ExtViews: Add action and meta-data

Services that extend KeyguardExternalViewProviderService should also
include this newly defined action in an intent-filter within the
<service> tag in their AndroidManifest.xml.  These services can also
include meta-data that defines a configuration xml which will be used
to define a settings activity that can be launched within a yet to
be defined settings/configuration UI.

Change-Id: I0a5ca09cf6f63413d067f89a9757137102dd09f6
TICKET: CYNGNOS-1687
This commit is contained in:
d34d 2016-01-21 16:57:42 -08:00
parent d994fe130a
commit fc50f7cef8
4 changed files with 58 additions and 0 deletions

View File

@ -27,6 +27,13 @@
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<service android:name=".SampleKeyguardProviderService"
android:exported="true">
<intent-filter>
<action android:name="cyanogenmod.externalviews.KeyguardExternalViewProviderService" />
</intent-filter>
<meta-data
android:name="cyanogenmod.externalviews.keyguard"
android:resource="@xml/mylockscreen" />
</service>
<activity android:name=".Settings" />
</application>
</manifest>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lockscreen xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="org.cyanogenmod.samples.keyguardextview.Settings"/>

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2016 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cyanogenmod.samples.keyguardextview;
import android.app.Activity;
import android.os.Bundle;
public class Settings extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

View File

@ -57,6 +57,26 @@ public abstract class KeyguardExternalViewProviderService extends Service {
private static final String TAG = KeyguardExternalViewProviderService.class.getSimpleName();
private static final boolean DEBUG = false;
/**
* The action that must be declared as handled by this service.
*
* <p>{@code
* <intent-filter>
* <action android:name="cyanogenmod.externalviews.KeyguardExternalViewProviderService"/>
* </intent-filter>
*}</p>
*/
public static final String SERVICE_INTERFACE =
"cyanogenmod.externalviews.KeyguardExternalViewProviderService";
/**
* Name under which an external keyguard view publishes information about itself.
* This meta-data must reference an XML resource containing
* a <code>&lt;lockscreen&gt;</code>
* tag.
*/
public static final String META_DATA = "cyanogenmod.externalviews.keyguard";
private WindowManager mWindowManager;
private final Handler mHandler = new Handler();