aboutsummaryrefslogtreecommitdiffstats
path: root/samples/externalviews/setkeyguardviewprovider
diff options
context:
space:
mode:
Diffstat (limited to 'samples/externalviews/setkeyguardviewprovider')
-rw-r--r--samples/externalviews/setkeyguardviewprovider/Android.mk27
-rw-r--r--samples/externalviews/setkeyguardviewprovider/AndroidManifest.xml39
-rw-r--r--samples/externalviews/setkeyguardviewprovider/README.md6
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.pngbin0 -> 2729 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml19
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/values/strings.xml22
-rw-r--r--samples/externalviews/setkeyguardviewprovider/src/org/cyanogenmod/samples/keyguardextview/SetKeyguardComponentActivity.java73
10 files changed, 186 insertions, 0 deletions
diff --git a/samples/externalviews/setkeyguardviewprovider/Android.mk b/samples/externalviews/setkeyguardviewprovider/Android.mk
new file mode 100644
index 0000000..8ed385a
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2015 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.
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ org.cyanogenmod.platform.internal
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src/)
+
+LOCAL_PACKAGE_NAME := CMSetKeyguardExternalViewProvider
+
+LOCAL_PRIVILEGED_MODULE := true
+LOCAL_CERTIFICATE := platform
+
+include $(BUILD_PACKAGE) \ No newline at end of file
diff --git a/samples/externalviews/setkeyguardviewprovider/AndroidManifest.xml b/samples/externalviews/setkeyguardviewprovider/AndroidManifest.xml
new file mode 100644
index 0000000..f5300fd
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.cyanogenmod.samples.setkeyguardextview"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
+
+ <!-- Permissions used for setting the third party keyguard component, this is for
+ testing purposes only and should not be used when implementing third party
+ keyguard components -->
+ <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
+
+ <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
+ <activity
+ android:name=".SetKeyguardComponentActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/externalviews/setkeyguardviewprovider/README.md b/samples/externalviews/setkeyguardviewprovider/README.md
new file mode 100644
index 0000000..f0edd44
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/README.md
@@ -0,0 +1,6 @@
+# Notice
+This sample is provided as a way to set and clear the setting that defines what
+KeyguardExternalViewProviderService the system should use. Changing this setting
+requires a permission that is only granted to system apps. As such, this sample
+is not intended to be built as a standalone application and must be built as part
+of the CyanogenMod build system. \ No newline at end of file
diff --git a/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png b/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.png b/samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..9923872
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.png b/samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.png b/samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml b/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml
new file mode 100644
index 0000000..5d4f8ba
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <Button
+ android:id="@+id/clear_keyguard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_clear_keyguard"/>
+
+ <Button
+ android:id="@+id/set_keyguard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/btn_set_keyguard"/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/externalviews/setkeyguardviewprovider/res/values/strings.xml b/samples/externalviews/setkeyguardviewprovider/res/values/strings.xml
new file mode 100644
index 0000000..4ac04c4
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<resources>
+ <string name="app_name">Keyguard Selector</string>
+
+ <string name="btn_set_keyguard">Set keyguard component</string>
+ <string name="btn_clear_keyguard">Clear keyguard component</string>
+</resources>
diff --git a/samples/externalviews/setkeyguardviewprovider/src/org/cyanogenmod/samples/keyguardextview/SetKeyguardComponentActivity.java b/samples/externalviews/setkeyguardviewprovider/src/org/cyanogenmod/samples/keyguardextview/SetKeyguardComponentActivity.java
new file mode 100644
index 0000000..961bcf0
--- /dev/null
+++ b/samples/externalviews/setkeyguardviewprovider/src/org/cyanogenmod/samples/keyguardextview/SetKeyguardComponentActivity.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2015 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.setkeyguardextview;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+
+import org.cyanogenmod.internal.util.CmLockPatternUtils;
+
+public class SetKeyguardComponentActivity extends Activity {
+ private static final String TAG = SetKeyguardComponentActivity.class.getSimpleName();
+ private static final String KEYGUARD_PACKAGE = "org.cyanogenmod.samples.keyguardextview";
+ private static final String KEYGUARD_COMPONENT =
+ KEYGUARD_PACKAGE + ".SampleKeyguardProviderService";
+
+ private Button mClearKeyguardButton;
+ private Button mSetKeyguardButton;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.set_keyguard);
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mClearKeyguardButton = (Button) findViewById(R.id.clear_keyguard);
+ mClearKeyguardButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setKeyguardComponent(null);
+ }
+ });
+
+ mSetKeyguardButton = (Button) findViewById(R.id.set_keyguard);
+ mSetKeyguardButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setKeyguardComponent(new ComponentName(KEYGUARD_PACKAGE, KEYGUARD_COMPONENT));
+ }
+ });
+ }
+
+ private void setKeyguardComponent(ComponentName cn) {
+ CmLockPatternUtils lockPatternUtils =
+ new CmLockPatternUtils(this);
+ try {
+ lockPatternUtils.setThirdPartyKeyguard(cn);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(TAG, "Unable to set third party keyguard component", e);
+ }
+ }
+} \ No newline at end of file