aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Mortimer <sam@mortimer.me.uk>2017-10-11 22:56:48 -0700
committerSam Mortimer <sam@mortimer.me.uk>2017-10-12 21:53:42 +0000
commit68d668ef53f7171294a55d0a3b64b5444ce1275c (patch)
tree7fe69cdd0282e304486c0950e7abb3e278f6ee47
parentae2d7e15ce8aef4f1b9caee7cf3ab692b0a4f20c (diff)
downloadlineage-sdk-68d668ef53f7171294a55d0a3b64b5444ce1275c.tar.gz
lineage-sdk-68d668ef53f7171294a55d0a3b64b5444ce1275c.tar.bz2
lineage-sdk-68d668ef53f7171294a55d0a3b64b5444ce1275c.zip
Remove KeyguardExternal
Change-Id: I58156b2cd17aac706d1567cbaf650f5c0bad5860
-rw-r--r--CleanSpec.mk1
-rw-r--r--api/lineage_current.txt31
-rw-r--r--samples/externalviews/keyguardviewprovider/Android.mk27
-rw-r--r--samples/externalviews/keyguardviewprovider/AndroidManifest.xml39
-rw-r--r--samples/externalviews/keyguardviewprovider/res/anim/pulsing_anim.xml15
-rw-r--r--samples/externalviews/keyguardviewprovider/res/drawable-hdpi/ic_launcher.pngbin9397 -> 0 bytes
-rw-r--r--samples/externalviews/keyguardviewprovider/res/drawable-ldpi/ic_launcher.pngbin2729 -> 0 bytes
-rw-r--r--samples/externalviews/keyguardviewprovider/res/drawable-mdpi/ic_launcher.pngbin5237 -> 0 bytes
-rw-r--r--samples/externalviews/keyguardviewprovider/res/drawable-nodpi/platlogo_lineage.xml55
-rw-r--r--samples/externalviews/keyguardviewprovider/res/drawable-xhdpi/ic_launcher.pngbin14383 -> 0 bytes
-rw-r--r--samples/externalviews/keyguardviewprovider/res/layout/main.xml29
-rw-r--r--samples/externalviews/keyguardviewprovider/res/values/strings.xml22
-rw-r--r--samples/externalviews/keyguardviewprovider/res/xml/mylockscreen.xml3
-rw-r--r--samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/SampleKeyguardProviderService.java124
-rw-r--r--samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/Settings.java28
-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.pngbin9397 -> 0 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.pngbin2729 -> 0 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.pngbin5237 -> 0 bytes
-rw-r--r--samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.pngbin14383 -> 0 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/lineageos/samples/keyguardextview/SetKeyguardComponentActivity.java73
-rw-r--r--sdk/src/java/lineageos/externalviews/IKeyguardExternalViewCallbacks.aidl30
-rw-r--r--sdk/src/java/lineageos/externalviews/IKeyguardExternalViewProvider.aidl42
-rw-r--r--sdk/src/java/lineageos/externalviews/KeyguardExternalView.java490
-rw-r--r--sdk/src/java/lineageos/externalviews/KeyguardExternalViewProviderService.java640
-rw-r--r--tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java351
-rw-r--r--tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalViewTest.java254
-rw-r--r--tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/ViewProviderService.java132
-rw-r--r--tests/src/org/lineageos/tests/versioning/unit/apiv4/ApiV4PriorReleaseInterfaces.java28
-rw-r--r--tests/src/org/lineageos/tests/versioning/unit/apiv5/ApiV5PriorReleaseInterfaces.java20
34 files changed, 0 insertions, 2547 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk
index aed1ca68..424784b3 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -42,7 +42,6 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/org.li
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/org.lineageos.platform.sdk_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/org.lineageos.platform.internal_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/lineage-sdk_stubs_current_intermediates)
-# KeyguardExternalView uses a new interface which requires cleaning to avoid a runtime exception
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/org.lineageos.platform_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/org.lineageos.platform.sdk_intermediates)
# Purge out the api stubs timestamp files (they're used as a dependency for checkapi-lineage)
diff --git a/api/lineage_current.txt b/api/lineage_current.txt
index 568aa9e3..d1e55a59 100644
--- a/api/lineage_current.txt
+++ b/api/lineage_current.txt
@@ -363,37 +363,6 @@ package lineageos.content {
}
-package lineageos.externalviews {
-
- public abstract class KeyguardExternalViewProviderService extends android.app.Service {
- ctor public KeyguardExternalViewProviderService();
- method protected abstract lineageos.externalviews.KeyguardExternalViewProviderService.Provider createExternalView(android.os.Bundle);
- method public final android.os.IBinder onBind(android.content.Intent);
- field public static final java.lang.String META_DATA = "lineageos.externalviews.keyguard";
- field public static final java.lang.String SERVICE_INTERFACE = "lineageos.externalviews.KeyguardExternalViewProviderService";
- }
-
- protected abstract class KeyguardExternalViewProviderService.Provider {
- ctor protected KeyguardExternalViewProviderService.Provider(android.os.Bundle);
- method protected final deprecated void collapseNotificationPanel();
- method protected android.os.Bundle getOptions();
- method protected void onAttach();
- method protected abstract void onBouncerShowing(boolean);
- method protected abstract android.view.View onCreateView();
- method protected void onDetach();
- method protected abstract void onKeyguardDismissed();
- method protected abstract void onKeyguardShowing(boolean);
- method protected void onLockscreenSlideOffsetChanged(float);
- method protected abstract void onScreenTurnedOff();
- method protected abstract void onScreenTurnedOn();
- method protected final boolean requestDismiss();
- method protected final boolean requestDismissAndStartActivity(android.content.Intent);
- method protected final void setInteractivity(boolean);
- method protected final void slideLockscreenIn();
- }
-
-}
-
package lineageos.hardware {
public final class LineageHardwareManager {
diff --git a/samples/externalviews/keyguardviewprovider/Android.mk b/samples/externalviews/keyguardviewprovider/Android.mk
deleted file mode 100644
index 017f09c2..00000000
--- a/samples/externalviews/keyguardviewprovider/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.lineageos.platform.sdk
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src/)
-
-LOCAL_PACKAGE_NAME := LineageKeyguardExternalViewProvider
-
-# Need a permission that is signature|privileged
-LOCAL_PRIVILEGED_MODULE := true
-
-include $(BUILD_PACKAGE) \ No newline at end of file
diff --git a/samples/externalviews/keyguardviewprovider/AndroidManifest.xml b/samples/externalviews/keyguardviewprovider/AndroidManifest.xml
deleted file mode 100644
index 390ec766..00000000
--- a/samples/externalviews/keyguardviewprovider/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.lineageos.samples.keyguardextview"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
-
- <!-- Required permission for third party keyguard components -->
- <uses-permission android:name="lineageos.permission.THIRD_PARTY_KEYGUARD" />
-
- <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
- <service android:name=".SampleKeyguardProviderService"
- android:exported="true">
- <intent-filter>
- <action android:name="lineageos.externalviews.KeyguardExternalViewProviderService" />
- </intent-filter>
- <meta-data
- android:name="lineageos.externalviews.keyguard"
- android:resource="@xml/mylockscreen" />
- </service>
- <activity android:name=".Settings" />
- </application>
-</manifest>
diff --git a/samples/externalviews/keyguardviewprovider/res/anim/pulsing_anim.xml b/samples/externalviews/keyguardviewprovider/res/anim/pulsing_anim.xml
deleted file mode 100644
index b43c3d05..00000000
--- a/samples/externalviews/keyguardviewprovider/res/anim/pulsing_anim.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <scale
- android:duration="1000"
- android:fromXScale="1"
- android:fromYScale="1"
- android:toXScale="1.5"
- android:toYScale="1.5"
- android:pivotX="50%"
- android:pivotY="50%"
- android:repeatMode="reverse"
- android:repeatCount="infinite"/>
-
-</set> \ No newline at end of file
diff --git a/samples/externalviews/keyguardviewprovider/res/drawable-hdpi/ic_launcher.png b/samples/externalviews/keyguardviewprovider/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e5..00000000
--- a/samples/externalviews/keyguardviewprovider/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/externalviews/keyguardviewprovider/res/drawable-ldpi/ic_launcher.png b/samples/externalviews/keyguardviewprovider/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 99238729..00000000
--- a/samples/externalviews/keyguardviewprovider/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/externalviews/keyguardviewprovider/res/drawable-mdpi/ic_launcher.png b/samples/externalviews/keyguardviewprovider/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047df..00000000
--- a/samples/externalviews/keyguardviewprovider/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/externalviews/keyguardviewprovider/res/drawable-nodpi/platlogo_lineage.xml b/samples/externalviews/keyguardviewprovider/res/drawable-nodpi/platlogo_lineage.xml
deleted file mode 100644
index b863c271..00000000
--- a/samples/externalviews/keyguardviewprovider/res/drawable-nodpi/platlogo_lineage.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
- android:viewportWidth="48.0"
- android:viewportHeight="48.0">
-
- <path
- android:name="body"
- android:fillColor="#FFFFFF"
- android:pathData="M24,12L24,12L24,12L24,12L24,12c7.7,0,14,1.2,14.9,2.6c0,0,0,0,0,0c1,1.5,1.1,6.5,1.1,9.4s-0.1,7.8-1.1,9.4
-c0,0,0,0,0,0C38,34.8,31.7,36,24,36l0,0l0,0l0,0l0,0l0,0l0,0l0,0l0,0c-7.7,0-14-1.2-14.9-2.6c0,0,0,0,0,0C8.1,31.8,8,26.9,8,24
-s0.1-7.8,1.1-9.4c0,0,0,0,0,0C10,13.2,16.3,12,24,12L24,12L24,12L24,12L24,12z" />
- <path
- android:name="top"
- android:fillColor="#EBEBEB"
- android:pathData="M39,15c0,1.7-6.7,3-15,3S9,16.7,9,15s6.7-3,15-3S39,13.3,39,15z" />
- <path
- android:name="r_ant"
- android:fillColor="#FFFFFF"
- android:pathData="M35,15c-0.1,0-0.3,0-0.4-0.1c-0.5-0.2-0.8-0.8-0.5-1.3l2-5c0.2-0.5,0.8-0.8,1.3-0.5
-c0.5,0.2,0.8,0.8,0.5,1.3l-2,5C35.7,14.8,35.3,15,35,15z" />
- <path
- android:name="l_ant"
- android:fillColor="#FFFFFF"
- android:pathData="M13,15c0.1,0,0.3,0,0.4-0.1c0.5-0.2,0.8-0.8,0.5-1.3l-2-5c-0.2-0.5-0.8-0.8-1.3-0.5
-c-0.5,0.2-0.8,0.8-0.5,1.3l2,5C12.3,14.8,12.7,15,13,15z" />
- <path
- android:name="smile"
- android:fillColor="#EBEBEB"
- android:pathData="M22,32C22,32,22,32.1,22,32c0,0.9,0.6,1.5,1.4,1.5h1.1c0.8,0,1.5-0.7,1.5-1.5c0,0,0-0.1,0-0.1H22z" />
- <path
- android:name="l_eye"
- android:fillColor="#EBEBEB"
- android:pathData="M16,20c-2.8,0-5,2.2-5,5c0,2.8,2.2,5,5,5c2.8,0,5-2.2,5-5C21,22.2,18.8,20,16,20z" />
- <path
- android:name="r_eye"
- android:fillColor="#EBEBEB"
- android:pathData="M32,20c-2.8,0-5,2.2-5,5c0,2.8,2.2,5,5,5c2.8,0,5-2.2,5-5C37,22.2,34.8,20,32,20z" />
-</vector>
diff --git a/samples/externalviews/keyguardviewprovider/res/drawable-xhdpi/ic_launcher.png b/samples/externalviews/keyguardviewprovider/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d760..00000000
--- a/samples/externalviews/keyguardviewprovider/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/externalviews/keyguardviewprovider/res/layout/main.xml b/samples/externalviews/keyguardviewprovider/res/layout/main.xml
deleted file mode 100644
index 0160e85e..00000000
--- a/samples/externalviews/keyguardviewprovider/res/layout/main.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ImageView
- android:id="@+id/cid"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:src="@drawable/platlogo_lineage"
- android:scaleType="fitCenter"
- />
-</FrameLayout>
-
diff --git a/samples/externalviews/keyguardviewprovider/res/values/strings.xml b/samples/externalviews/keyguardviewprovider/res/values/strings.xml
deleted file mode 100644
index 480dfe3e..00000000
--- a/samples/externalviews/keyguardviewprovider/res/values/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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 Sample</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/keyguardviewprovider/res/xml/mylockscreen.xml b/samples/externalviews/keyguardviewprovider/res/xml/mylockscreen.xml
deleted file mode 100644
index 12f56939..00000000
--- a/samples/externalviews/keyguardviewprovider/res/xml/mylockscreen.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<lockscreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:settingsActivity="org.lineageos.samples.keyguardextview.Settings"/> \ No newline at end of file
diff --git a/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/SampleKeyguardProviderService.java b/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/SampleKeyguardProviderService.java
deleted file mode 100644
index ff15f0ba..00000000
--- a/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/SampleKeyguardProviderService.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.lineageos.samples.keyguardextview;
-
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.ImageView;
-import lineageos.externalviews.KeyguardExternalViewProviderService;
-
-public class SampleKeyguardProviderService extends KeyguardExternalViewProviderService {
-
- @Override
- protected KeyguardExternalViewProviderService.Provider createExternalView(Bundle options) {
- return new ProviderImpl(options);
- }
-
- private class ProviderImpl extends Provider {
- ImageView mImageView;
- Animation mPulseAnimation;
-
- protected ProviderImpl(Bundle options) {
- super(options);
- }
-
- /**
- * Create a view that will be displayed within the system's lock screen (aka keyguard)
- * @return The view to be displayed
- */
- @Override
- protected View onCreateView() {
- View view = LayoutInflater.from(SampleKeyguardProviderService.this)
- .inflate(R.layout.main, null);
- mImageView = (ImageView) view.findViewById(R.id.cid);
- return view;
- }
-
- /**
- * Called when the keyguard is being shown
- * @param screenOn True if the screen is currently on
- */
- @Override
- protected void onKeyguardShowing(boolean screenOn) {
-
- }
-
- /**
- * Called when the user has unlocked their device and the keyguard is dismissed
- */
- @Override
- protected void onKeyguardDismissed() {
-
- }
-
- /**
- * Called when the state of the bouncer being shown changes
- * @param showing True if the bouncer is showing
- */
- @Override
- protected void onBouncerShowing(boolean showing) {
-
- }
-
- /**
- * Called when the screen has been turned on
- */
- @Override
- protected void onScreenTurnedOn() {
- mImageView.startAnimation(mPulseAnimation);
- }
-
- /**
- * Called when the screen has been turned off
- */
- @Override
- protected void onScreenTurnedOff() {
- mImageView.clearAnimation();
- }
-
- @Override
- protected void onLockscreenSlideOffsetChanged(float slideProgress) {
-
- }
-
- /**
- * Called when the view has been attached to a window
- */
- @Override
- protected void onAttach() {
- super.onAttach();
- // If this is an interactive component, now is a good time to
- // call setInteractivity(true);
- setInteractivity(false);
- mPulseAnimation = AnimationUtils.loadAnimation(SampleKeyguardProviderService.this,
- R.anim.pulsing_anim);
- mImageView.startAnimation(mPulseAnimation);
- }
-
- /**
- * Called when the view has been detached from the window
- */
- @Override
- protected void onDetach() {
- super.onDetach();
- }
- }
-}
diff --git a/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/Settings.java b/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/Settings.java
deleted file mode 100644
index bb9e0a85..00000000
--- a/samples/externalviews/keyguardviewprovider/src/org/lineageos/samples/keyguardextview/Settings.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.lineageos.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);
- }
-} \ No newline at end of file
diff --git a/samples/externalviews/setkeyguardviewprovider/Android.mk b/samples/externalviews/setkeyguardviewprovider/Android.mk
deleted file mode 100644
index 068382c2..00000000
--- a/samples/externalviews/setkeyguardviewprovider/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.lineageos.platform.internal
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src/)
-
-LOCAL_PACKAGE_NAME := LineageSetKeyguardExternalViewProvider
-
-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
deleted file mode 100644
index 9977b08b..00000000
--- a/samples/externalviews/setkeyguardviewprovider/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.lineageos.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
deleted file mode 100644
index bfb82692..00000000
--- a/samples/externalviews/setkeyguardviewprovider/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# 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 LineageOS build system.
diff --git a/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png b/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e5..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
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
deleted file mode 100644
index 99238729..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
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
deleted file mode 100644
index 359047df..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
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
deleted file mode 100644
index 71c6d760..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml b/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml
deleted file mode 100644
index 5d4f8ba8..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/layout/set_keyguard.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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
deleted file mode 100644
index 4ac04c4a..00000000
--- a/samples/externalviews/setkeyguardviewprovider/res/values/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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/lineageos/samples/keyguardextview/SetKeyguardComponentActivity.java b/samples/externalviews/setkeyguardviewprovider/src/org/lineageos/samples/keyguardextview/SetKeyguardComponentActivity.java
deleted file mode 100644
index bc606f96..00000000
--- a/samples/externalviews/setkeyguardviewprovider/src/org/lineageos/samples/keyguardextview/SetKeyguardComponentActivity.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.lineageos.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.lineageos.internal.util.LineageLockPatternUtils;
-
-public class SetKeyguardComponentActivity extends Activity {
- private static final String TAG = SetKeyguardComponentActivity.class.getSimpleName();
- private static final String KEYGUARD_PACKAGE = "org.lineageos.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) {
- LineageLockPatternUtils lockPatternUtils =
- new LineageLockPatternUtils(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
diff --git a/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewCallbacks.aidl b/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewCallbacks.aidl
deleted file mode 100644
index c33a2ee3..00000000
--- a/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewCallbacks.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 lineageos.externalviews;
-
-import android.content.Intent;
-
-/** @hide */
-interface IKeyguardExternalViewCallbacks {
- boolean requestDismiss();
- boolean requestDismissAndStartActivity(in Intent intent);
- oneway void collapseNotificationPanel();
- oneway void setInteractivity(boolean isInteractive);
- oneway void onAttachedToWindow();
- oneway void onDetachedFromWindow();
- oneway void slideLockscreenIn();
-}
diff --git a/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewProvider.aidl b/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewProvider.aidl
deleted file mode 100644
index 052453de..00000000
--- a/sdk/src/java/lineageos/externalviews/IKeyguardExternalViewProvider.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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 lineageos.externalviews;
-
-import android.graphics.Rect;
-
-import lineageos.externalviews.IKeyguardExternalViewCallbacks;
-
-/** @hide */
-interface IKeyguardExternalViewProvider
-{
- oneway void onAttach(in IBinder windowToken);
- oneway void onDetach();
-
- // Keyguard specific interface
- oneway void onKeyguardShowing(boolean screenOn);
- oneway void onKeyguardDismissed();
- oneway void onBouncerShowing(boolean showing);
- oneway void onScreenTurnedOn();
- oneway void onScreenTurnedOff();
-
- oneway void registerCallback(in IKeyguardExternalViewCallbacks callback);
- oneway void unregisterCallback(in IKeyguardExternalViewCallbacks callback);
-
- void alterWindow(in int x, in int y, in int width, in int height, in boolean visible,
- in Rect clipRect);
- oneway void onLockscreenSlideOffsetChanged(float swipeProgress);
-}
diff --git a/sdk/src/java/lineageos/externalviews/KeyguardExternalView.java b/sdk/src/java/lineageos/externalviews/KeyguardExternalView.java
deleted file mode 100644
index e8ce7072..00000000
--- a/sdk/src/java/lineageos/externalviews/KeyguardExternalView.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * 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 lineageos.externalviews;
-
-import android.app.Activity;
-import android.app.Application;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewTreeObserver;
-import android.view.WindowManager;
-
-import java.util.LinkedList;
-
-/**
- * This class provides a placeholder view for hosting an external view, provided by a
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService}, within the lock screen.
- *
- * <p>This class is intended to only be used within the SystemUi process.</p>
- * @hide
- */
-public class KeyguardExternalView extends View implements ViewTreeObserver.OnPreDrawListener,
- IBinder.DeathRecipient {
- private static final String TAG = KeyguardExternalView.class.getSimpleName();
-
- /**
- * An extra passed via an intent that provides a list of permissions that should be requested
- * from the user.
- */
- public static final String EXTRA_PERMISSION_LIST = "permissions_list";
-
- /**
- * Category defining an activity to call to request permissions that a
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService} will need. Apps that
- * provide a {@link lineageos.externalviews.KeyguardExternalViewProviderService} should
- * check that they have the required permission before making any method calls that would
- * require a dangerous permission to be granted.
- */
- public static final String CATEGORY_KEYGUARD_GRANT_PERMISSION
- = "org.lineageos.intent.category.KEYGUARD_GRANT_PERMISSION";
-
- private LinkedList<Runnable> mQueue = new LinkedList<Runnable>();
-
- private Context mContext;
- private final ExternalViewProperties mExternalViewProperties;
- private volatile IKeyguardExternalViewProvider mExternalViewProvider;
- private IBinder mService;
- private final Point mDisplaySize;
- private boolean mIsInteractive;
-
- private KeyguardExternalViewCallbacks mCallback;
-
- private OnWindowAttachmentChangedListener mWindowAttachmentListener;
-
- public KeyguardExternalView(Context context, AttributeSet attrs) {
- this(context, attrs, null);
- }
-
- public KeyguardExternalView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs);
- }
-
- public KeyguardExternalView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- this(context, attrs);
- }
-
- /**
- * @param context
- * @param attributeSet
- * @param componentName The component name for the
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * that will be bound to create the external view.
- */
- public KeyguardExternalView(Context context, AttributeSet attributeSet, ComponentName componentName) {
- super(context, attributeSet);
- mContext = getContext();
- mExternalViewProperties = new ExternalViewProperties(this, mContext);
- if (componentName != null) {
- mContext.bindService(new Intent().setComponent(componentName),
- mServiceConnection, Context.BIND_AUTO_CREATE);
- }
- mDisplaySize = new Point();
- WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- wm.getDefaultDisplay().getRealSize(mDisplaySize);
- }
-
- private ServiceConnection mServiceConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- try {
- IExternalViewProviderFactory factory = IExternalViewProviderFactory.Stub.asInterface(service);
- if (factory != null) {
- mExternalViewProvider = IKeyguardExternalViewProvider.Stub.asInterface(
- factory.createExternalView(null));
- if (mExternalViewProvider != null) {
- mExternalViewProvider.registerCallback(
- KeyguardExternalView.this.mKeyguardExternalViewCallbacks);
- mService = service;
- mService.linkToDeath(KeyguardExternalView.this, 0);
- executeQueue();
- } else {
- Log.e(TAG, "Unable to get external view provider");
- }
- } else {
- Log.e(TAG, "Unable to get external view provider factory");
- }
- } catch (RemoteException | SecurityException e) {
- Log.e(TAG, "Unable to connect to service", e);
- }
- // We should unbind the service if we failed to connect to the provider
- if (mService != service && service != null) {
- mContext.unbindService(mServiceConnection);
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- if (mExternalViewProvider != null) {
- try {
- mExternalViewProvider.unregisterCallback(
- KeyguardExternalView.this.mKeyguardExternalViewCallbacks);
- } catch (RemoteException e) {
- }
- mExternalViewProvider = null;
- }
- if (mService != null) {
- mService.unlinkToDeath(KeyguardExternalView.this, 0);
- mService = null;
- }
- }
- };
-
- private final IKeyguardExternalViewCallbacks mKeyguardExternalViewCallbacks =
- new IKeyguardExternalViewCallbacks.Stub() {
- @Override
- public boolean requestDismiss() throws RemoteException {
- if (mCallback != null) {
- return mCallback.requestDismiss();
- }
-
- return false;
- }
-
- @Override
- public boolean requestDismissAndStartActivity(Intent intent) throws RemoteException {
- if (mCallback != null) {
- return mCallback.requestDismissAndStartActivity(intent);
- }
-
- return false;
- }
-
- @Override
- public void collapseNotificationPanel() throws RemoteException {
- /* collapseNotificationPanel is deprecated so do nothing */
- }
-
- @Override
- public void setInteractivity(boolean isInteractive) {
- mIsInteractive = isInteractive;
- }
-
- @Override
- public void onAttachedToWindow() {
- if (mWindowAttachmentListener != null) {
- mWindowAttachmentListener.onAttachedToWindow();
- }
- }
-
- @Override
- public void onDetachedFromWindow() {
- if (mWindowAttachmentListener != null) {
- mWindowAttachmentListener.onDetachedFromWindow();
- }
- }
-
- @Override
- public void slideLockscreenIn() {
- if (mCallback != null) {
- mCallback.slideLockscreenIn();
- }
- }
- };
-
- private void executeQueue() {
- while (!mQueue.isEmpty()) {
- Runnable r = mQueue.pop();
- r.run();
- }
- }
-
- protected void performAction(Runnable r) {
- if (mExternalViewProvider != null) {
- r.run();
- } else {
- mQueue.add(r);
- }
- }
-
- // view overrides, for positioning
-
- @Override
- public boolean onPreDraw() {
- if (!mExternalViewProperties.hasChanged()) {
- return true;
- }
- // keyguard views always take up the full screen when visible
- final int x = mExternalViewProperties.getX();
- final int y = mExternalViewProperties.getY();
- final int width = mDisplaySize.x - x;
- final int height = mDisplaySize.y - y;
- final boolean visible = mExternalViewProperties.isVisible();
- final Rect clipRect = new Rect(x, y, width + x, height + y);
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.alterWindow(x, y, width, height, visible,
- clipRect);
- } catch (RemoteException e) {
- }
- }
- });
- return true;
- }
-
- // Placeholder callbacks
-
- @Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onDetach();
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- @Override
- public void onAttachedToWindow() {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onAttach(null);
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- @Override
- public void binderDied() {
- if (mCallback != null) {
- mCallback.providerDied();
- }
- }
-
- /**
- * Sets the component of the {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * to be used for this ExternalView. If a provider is already connected to this view, it is
- * first unbound before binding to the new provider.
- * @param componentName The {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * to bind to.
- */
- public void setProviderComponent(ComponentName componentName) {
- // unbind any existing external view provider
- if (mExternalViewProvider != null) {
- mContext.unbindService(mServiceConnection);
- }
- if (componentName != null) {
- mContext.bindService(new Intent().setComponent(componentName),
- mServiceConnection, Context.BIND_AUTO_CREATE);
- }
- }
-
- /**
- * Called from the host when the keyguard is being shown to the user.
- * @param screenOn True if the screen is currently on.
- */
- public void onKeyguardShowing(final boolean screenOn) {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onKeyguardShowing(screenOn);
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * Called from the host when the user has unlocked the device. Once this is called the lock
- * lock screen should no longer displayed.
- */
- public void onKeyguardDismissed() {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onKeyguardDismissed();
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * Called from the host when the keyguard is displaying the security screen for the user to
- * enter their pin, password, or pattern.
- * @param showing True if the bouncer is being show or false when it is dismissed without the
- * device being unlocked.
- */
- public void onBouncerShowing(final boolean showing) {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onBouncerShowing(showing);
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * Called from the host when the screen is turned on.
- */
- public void onScreenTurnedOn() {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onScreenTurnedOn();
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * Called from the host when the screen is turned off.
- */
- public void onScreenTurnedOff() {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onScreenTurnedOff();
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * Called from the host when the user is swiping the lockscreen
- * to transition into the live lock screen
- *
- * @param swipeProgress [0-1] represents the progress of the swipe
- */
- public void onLockscreenSlideOffsetChanged(final float swipeProgress) {
- performAction(new Runnable() {
- @Override
- public void run() {
- try {
- mExternalViewProvider.onLockscreenSlideOffsetChanged(swipeProgress);
- } catch (RemoteException e) {
- }
- }
- });
- }
-
- /**
- * External views provided by a
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService} can be either
- * interactive or non-interactive.
- *
- * <p>A non-interactive component does not receive any input events and functions similar to a
- * live wallpaper.</p>
- *
- * <p>An interactive component can receive input events and allows the user to interact with it
- * when the notification panel is not being displayed on top of the external view.</p>
- *
- * @return True if the current external view is interactive.
- */
- public boolean isInteractive() {
- return mIsInteractive;
- }
-
- /**
- * Registers a {@link lineageos.externalviews.KeyguardExternalView.KeyguardExternalViewCallbacks}
- * for receiving events from the
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * @param callback The callback to register
- */
- public void registerKeyguardExternalViewCallback(KeyguardExternalViewCallbacks callback) {
- mCallback = callback;
- }
-
- /**
- * Unregister a previously registered
- * {@link lineageos.externalviews.KeyguardExternalView.KeyguardExternalViewCallbacks}
- * @param callback The callback to unregister
- */
- public void unregisterKeyguardExternalViewCallback(KeyguardExternalViewCallbacks callback) {
- if (mCallback != callback) {
- throw new IllegalArgumentException("Callback not registered");
- }
- mCallback = null;
- }
-
- /**
- * Registers a {@link lineageos.externalviews.KeyguardExternalView.OnWindowAttachmentChangedListener}
- * for receiving events from the
- * {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * @param listener The callback to register
- *
- * @hide
- */
- public void registerOnWindowAttachmentChangedListener(
- OnWindowAttachmentChangedListener listener) {
- mWindowAttachmentListener = listener;
- }
-
- /**
- * Unregister a previously registered
- * {@link lineageos.externalviews.KeyguardExternalView.OnWindowAttachmentChangedListener}
- * @param listener The callback to unregister
- *
- * @hide
- */
- public void unregisterOnWindowAttachmentChangedListener(
- OnWindowAttachmentChangedListener listener) {
- if (mWindowAttachmentListener != listener) {
- throw new IllegalArgumentException("Callback not registered");
- }
- mWindowAttachmentListener = null;
- }
-
- /**
- * Callback interface for a {@link lineageos.externalviews.KeyguardExternalViewProviderService}
- * to send events to the host's registered
- * {@link lineageos.externalviews.KeyguardExternalView.KeyguardExternalViewCallbacks}
- */
- public interface KeyguardExternalViewCallbacks {
- boolean requestDismiss();
- boolean requestDismissAndStartActivity(Intent intent);
- void providerDied();
- void slideLockscreenIn();
- }
-
- /**
- * Callback interface for changes to the containing window being attached and detached from the
- * window manager.
- * @hide
- */
- public interface OnWindowAttachmentChangedListener {
- void onAttachedToWindow();
- void onDetachedFromWindow();
- }
-}
diff --git a/sdk/src/java/lineageos/externalviews/KeyguardExternalViewProviderService.java b/sdk/src/java/lineageos/externalviews/KeyguardExternalViewProviderService.java
deleted file mode 100644
index 9b435995..00000000
--- a/sdk/src/java/lineageos/externalviews/KeyguardExternalViewProviderService.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * 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 lineageos.externalviews;
-
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.ActionMode;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.SearchEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.accessibility.AccessibilityEvent;
-import com.android.internal.policy.PhoneWindow;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-
-/**
- * A class for providing a view that can be displayed within the lock screen. Applications that
- * wish to provide a view to be displayed within the lock screen should extend this service.
- *
- * <p>Applications extending this class should include the
- * {@link lineageos.platform.Manifest.permission#THIRD_PARTY_KEYGUARD} permission in their
- * manifest</p>
-
- * <p>Applications extending this class should also extend
- * {@link KeyguardExternalViewProviderService.Provider} and return a new instance of
- * {@link KeyguardExternalViewProviderService.Provider} in
- * {@link KeyguardExternalViewProviderService#createExternalView(Bundle)}.</p>
- */
-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="lineageos.externalviews.KeyguardExternalViewProviderService"/>
- * </intent-filter>
- *}</p>
- */
- public static final String SERVICE_INTERFACE =
- "lineageos.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 = "lineageos.externalviews.keyguard";
-
- private WindowManager mWindowManager;
- private final Handler mHandler = new Handler();
-
- @Override
- public void onCreate() {
- super.onCreate();
-
- mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- super.onStartCommand(intent, flags, startId);
- return START_NOT_STICKY;
- }
-
- @Override
- public final IBinder onBind(Intent intent) {
- return new IExternalViewProviderFactory.Stub() {
- @Override public IBinder createExternalView(final Bundle options) {
- FutureTask<IBinder> c = new FutureTask<IBinder>(new Callable<IBinder>() {
- @Override
- public IBinder call() throws Exception {
- return KeyguardExternalViewProviderService.this
- .createExternalView(options).mImpl;
- }
- });
- mHandler.post(c);
- try {
- return c.get();
- } catch (InterruptedException | ExecutionException e) {
- Log.e(TAG, "error: ", e);
- return null;
- }
- }
- };
- }
-
- /**
- * Called when the host has bound to this service.
- * @param options Optional bundle. This param is currently not used.
- * @return The newly created provider.
- */
- protected abstract Provider createExternalView(Bundle options);
-
- /**
- * This class provides an interface for the host and service to communicate to each other.
- */
- protected abstract class Provider {
- private final class ProviderImpl extends IKeyguardExternalViewProvider.Stub
- implements Window.Callback {
- private final Window mWindow;
- private final WindowManager.LayoutParams mParams;
-
- private boolean mShouldShow = true;
- private boolean mAskedShow = false;
-
- private final RemoteCallbackList<IKeyguardExternalViewCallbacks> mCallbacks =
- new RemoteCallbackList<IKeyguardExternalViewCallbacks>();
-
- public ProviderImpl(Provider provider) {
- mWindow = new PhoneWindow(KeyguardExternalViewProviderService.this);
- mWindow.setCallback(this);
- ((ViewGroup) mWindow.getDecorView()).addView(onCreateView());
-
- mParams = new WindowManager.LayoutParams();
- mParams.type = provider.getWindowType();
- mParams.flags = provider.getWindowFlags();
- mParams.gravity = Gravity.LEFT | Gravity.TOP;
- mParams.format = PixelFormat.TRANSPARENT;
- }
-
- @Override
- public void onAttach(IBinder windowToken) throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mWindowManager.addView(mWindow.getDecorView(), mParams);
- Provider.this.onAttach();
- }
- });
- }
-
- @Override
- public void onDetach() throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mWindowManager.removeView(mWindow.getDecorView());
- Provider.this.onDetach();
- }
- });
- }
-
- @Override
- public void onKeyguardShowing(final boolean screenOn) throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onKeyguardShowing(screenOn);
- }
- });
- }
-
- @Override
- public void onKeyguardDismissed() throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onKeyguardDismissed();
- }
- });
- }
-
- @Override
- public void onBouncerShowing(final boolean showing) throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onBouncerShowing(showing);
- }
- });
- }
-
- @Override
- public void onScreenTurnedOn() throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onScreenTurnedOn();
- }
- });
- }
-
- @Override
- public void onScreenTurnedOff() throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onScreenTurnedOff();
- }
- });
- }
-
- @Override
- public void onLockscreenSlideOffsetChanged(final float swipeProgress)
- throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- Provider.this.onLockscreenSlideOffsetChanged(swipeProgress);
- }
- });
- }
-
- @Override
- public void alterWindow(final int x, final int y, final int width, final int height,
- final boolean visible, final Rect clipRect) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mParams.x = x;
- mParams.y = y;
- mParams.width = width;
- mParams.height = height;
-
- if (DEBUG) Log.d(TAG, mParams.toString());
-
- mAskedShow = visible;
-
- updateVisibility();
-
- View decorView = mWindow.getDecorView();
- if (decorView.getVisibility() == View.VISIBLE) {
- decorView.setClipBounds(clipRect);
- }
-
- if (mWindow.getDecorView().getVisibility() != View.GONE)
- mWindowManager.updateViewLayout(mWindow.getDecorView(), mParams);
- }
- });
- }
-
- @Override
- public void registerCallback(IKeyguardExternalViewCallbacks callback) {
- mCallbacks.register(callback);
- }
-
- @Override
- public void unregisterCallback(IKeyguardExternalViewCallbacks callback) {
- mCallbacks.unregister(callback);
- }
-
- private void updateVisibility() {
- if (DEBUG) Log.d(TAG, "shouldShow = " + mShouldShow + " askedShow = " + mAskedShow);
- mWindow.getDecorView().setVisibility(mShouldShow && mAskedShow ?
- View.VISIBLE : View.GONE);
- }
-
- // callbacks from provider to host
- protected final boolean requestDismiss() {
- boolean ret = true;
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- ret &= callback.requestDismiss();
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- return ret;
- }
-
- protected final boolean requestDismissAndStartActivity(final Intent intent) {
- boolean ret = true;
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- ret &= callback.requestDismissAndStartActivity(intent);
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- return ret;
- }
-
- protected final void collapseNotificationPanel() {
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- callback.collapseNotificationPanel();
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- }
-
- protected final void setInteractivity(final boolean isInteractive) {
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- callback.setInteractivity(isInteractive);
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- }
-
- public void slideLockscreenIn() {
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- callback.slideLockscreenIn();
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- }
-
- // region Window callbacks
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- return mWindow.superDispatchKeyEvent(event);
- }
-
- @Override
- public boolean dispatchKeyShortcutEvent(KeyEvent event) {
- return mWindow.superDispatchKeyShortcutEvent(event);
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent event) {
- return mWindow.superDispatchTouchEvent(event);
- }
-
- @Override
- public boolean dispatchTrackballEvent(MotionEvent event) {
- return mWindow.superDispatchTrackballEvent(event);
- }
-
- @Override
- public boolean dispatchGenericMotionEvent(MotionEvent event) {
- return mWindow.superDispatchGenericMotionEvent(event);
- }
-
- @Override
- public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
- return false;
- }
-
- @Override
- public View onCreatePanelView(int featureId) {
- return null;
- }
-
- @Override
- public boolean onCreatePanelMenu(int featureId, Menu menu) {
- return false;
- }
-
- @Override
- public boolean onPreparePanel(int featureId, View view, Menu menu) {
- return false;
- }
-
- @Override
- public boolean onMenuOpened(int featureId, Menu menu) {
- return false;
- }
-
- @Override
- public boolean onMenuItemSelected(int featureId, MenuItem item) {
- return false;
- }
-
- @Override
- public void onWindowAttributesChanged(WindowManager.LayoutParams attrs) {}
-
- @Override
- public void onContentChanged() {}
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {}
-
- @Override
- public void onAttachedToWindow() {
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- callback.onAttachedToWindow();
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- }
-
- @Override
- public void onDetachedFromWindow() {
- int N = mCallbacks.beginBroadcast();
- for(int i=0; i < N; i++) {
- IKeyguardExternalViewCallbacks callback = mCallbacks.getBroadcastItem(0);
- try {
- callback.onDetachedFromWindow();
- } catch(RemoteException e) {
- }
- }
- mCallbacks.finishBroadcast();
- }
-
- @Override
- public void onPanelClosed(int featureId, Menu menu) {}
-
- @Override
- public boolean onSearchRequested() {
- return false;
- }
-
- @Override
- public boolean onSearchRequested(SearchEvent searchEvent) {
- return false;
- }
-
- @Override
- public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
- return null;
- }
-
- @Override
- public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int type) {
- return null;
- }
-
- @Override
- public void onActionModeStarted(ActionMode mode) {}
-
- @Override
- public void onActionModeFinished(ActionMode mode) {}
- }
-
- private final ProviderImpl mImpl = new ProviderImpl(this);
- private final Bundle mOptions;
-
- protected Provider(Bundle options) {
- mOptions = options;
- }
-
- protected Bundle getOptions() {
- return mOptions;
- }
-
- /**
- * Called when the host view is attached to a window.
- */
- protected void onAttach() {}
-
- /**
- * Called when the host view is detached from a window.
- */
- protected void onDetach() {}
-
- /**
- * Callback used for getting the view to be displayed within the host's content.
- * @return The view to be displayed within the host's content. If null is returned no
- * content will be displayed.
- */
- protected abstract View onCreateView();
-
- // keyguard events
-
- /**
- * Called from the host when the keyguard is being shown to the user.
- * @param screenOn True if the screen is currently on.
- */
- protected abstract void onKeyguardShowing(boolean screenOn);
-
- /**
- * Called from the host when the user has unlocked the device. Once this is called the lock
- * lock screen is no longer being displayed.
- *
- * <p>The view component should enter a paused state when this is called, and save any state
- * information that may be needed once the lock screen is displayed again. For example, a
- * non-interactive component that provides animated visuals should pause playback of those
- * animations and save the state, if necessary, of that animation.</p>
- */
- protected abstract void onKeyguardDismissed();
-
- /**
- * Called from the host when the keyguard is displaying the security screen for the user to
- * enter their pin, password, or pattern.
- *
- * <p>Interactive components will no longer have focus when the bouncer is displayed and
- * should enter a paused or idle state while the bouncer is being shown.</p>
- * @param showing True if the bouncer is being show or false when it is dismissed without the
- * device being unlocked.
- */
- protected abstract void onBouncerShowing(boolean showing);
-
- /**
- * Called from the host when the screen is turned on.
- *
- * <p>The provided view should return to a running state when this is called. For example,
- * a non-interactive component that provides animated visuals should resume playback of
- * those animations.</p>
- */
- protected abstract void onScreenTurnedOn();
-
- /**
- * Called from the host when the screen is turned off.
- *
- * <p>The provided view should provided view should pause its activity, if not currently
- * in a paused state, and do any work necessary to be ready when the screen is turned
- * back on. This will allow for a seamless user experience once the screen is turned on.
- * </p>
- */
- protected abstract void onScreenTurnedOff();
-
- /**
- * Called from the host when the user is swiping the lockscreen
- * to transition into the live lock screen
- *
- * @param swipeProgress [0-1] represents the progress of the swipe
- */
- protected void onLockscreenSlideOffsetChanged(float swipeProgress) {}
-
- // callbacks from provider to host
-
- /**
- * Request that the keyguard be dismissed. Calling this method will dismiss the lock
- * screen, if it is a not secure, or present the user with the security screen for the user
- * to enter their security code to finish dismissing the lock screen.
- *
- * <p>If the user has a secure lock screen and dismisses the bouncer without entering their
- * secure code, the lock screen will not be dismissed and
- * {@link KeyguardExternalViewProviderService.Provider#onBouncerShowing(boolean)} will be
- * called with {@code onShowing} being set to false, indicating that the lock screen was not
- * dismissed as requested.</p>
- * @return True if the call succeeded.
- */
- protected final boolean requestDismiss() {
- return mImpl.requestDismiss();
- }
-
- /**
- * Request that the keyguard be dismissed and the activity provided by the given intent be
- * started once the keyguard is dismissed. If a secure lock screen is being used the user
- * will need to enter their correct security code to finish dismissing the lock screen.
- *
- * <p>If the user has a secure lock screen and dismisses the bouncer without entering their
- * secure code, the lock screen will not be dismissed and
- * {@link KeyguardExternalViewProviderService.Provider#onBouncerShowing(boolean)} will be
- * called with onShowing being set to false, indicating that the lock screen was not
- * dismissed as requested.</p>
- * @param intent An intent specifying an activity to launch.
- * @return True if the call succeeded.
- */
- protected final boolean requestDismissAndStartActivity(final Intent intent) {
- return mImpl.requestDismissAndStartActivity(intent);
- }
-
- /**
- * Call this method when you would like to take focus and hide the notification panel.
- *
- * <p>You should call this method if your component requires focus and the users's
- * attention. The user will still be able to bring the notifications back into view by
- * sliding down from the status bar.
- * Calling this method has no effect for non-interactive components.</p>
- * @deprecated As of SDK version {@link lineageos.os.Build.LINEAGE_VERSION_CODES#ELDERBERRY}
- * this does nothing.
- */
- @Deprecated
- protected final void collapseNotificationPanel() {
- /* do nothing */
- }
-
- /**
- * This method should be called when the provided view needs to change from interactive to
- * non-interactive and vice versa.
- *
- * <p>Interactive components can receive input focus and receive user interaction while
- * non-interactive components never receive focus and are purely visual.</p>
- * @param isInteractive
- */
- protected final void setInteractivity(final boolean isInteractive) {
- mImpl.setInteractivity(isInteractive);
- }
-
- /**
- * Call this method when you like to slide in the lockscreen on top of
- * your live lockscreen. Only relevant if you use
- * {@link KeyguardExternalViewProviderService.Provider#setInteractivity(boolean)}
- */
- protected final void slideLockscreenIn() {
- mImpl.slideLockscreenIn();
- }
-
- /*package*/ final int getWindowType() {
- //return WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL;
- return 0;
- }
-
- /*package*/ final int getWindowFlags() {
- return WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
- WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
- WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
- WindowManager.LayoutParams.FLAG_FULLSCREEN;
- }
- }
-}
diff --git a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java b/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java
deleted file mode 100644
index e9e663c8..00000000
--- a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * Copyright (c) 2015-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.lineageos.tests.externalviews.keyguardexternalviews;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.os.*;
-import android.test.ServiceTestCase;
-import android.view.*;
-import android.widget.Space;
-import android.widget.TextView;
-import lineageos.externalviews.IExternalViewProviderFactory;
-import lineageos.externalviews.IKeyguardExternalViewCallbacks;
-import lineageos.externalviews.IKeyguardExternalViewProvider;
-import lineageos.externalviews.KeyguardExternalViewProviderService;
-import org.lineageos.tests.common.MockIBinderStubForInterface;
-import org.lineageos.tests.common.ThreadServiceTestCase;
-import org.junit.Assert;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.lang.reflect.Field;
-
-public class KeyguardExternalProviderTest extends ThreadServiceTestCase<ViewProviderService> {
- private WindowManager mWindowManagerMock;
- private IExternalViewProviderFactory mProvider;
- private IKeyguardExternalViewProvider mView;
-
- public KeyguardExternalProviderTest() {
- super(ViewProviderService.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- IBinder bind = bindService((ServiceRunnable) null);
- assertNotNull (bind);
-
- mProvider = IExternalViewProviderFactory.Stub.asInterface(bind);
- assertNotNull (mProvider);
-
- final Bundle bundle = new Bundle();
- IBinder bindView = mProvider.createExternalView(bundle);
- mView = IKeyguardExternalViewProvider.Stub.asInterface(bindView);
- assertNotNull (mView);
-
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService(), Mockito.times(1))
- .createExternalView(Mockito.eq(bundle));
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onCreateView();
-
- // Ensure the bundle we constructed with is intact
- Bundle b = getService().getProvider().getOptionsImpl();
- assertEquals (b, bundle);
- }
- });
- }
-
- @Override
- protected void setupService() {
- super.setupService();
-
- // Update the service instance with our spy so we can track it
- try {
- Field f = ServiceTestCase.class.getDeclaredField("mService");
- f.setAccessible(true);
- ViewProviderService woot = ViewProviderService.class.newInstance();
- ViewProviderService spy = Mockito.spy(woot);
- f.set(this, spy);
- } catch (Exception e) {
- Assert.fail(e.getMessage());
- }
-
- // Setup mock context
- Context context = Mockito.mock(Context.class, Mockito.CALLS_REAL_METHODS);
- Mockito.doReturn(getContext().getApplicationInfo()).when(context).getApplicationInfo();
- Mockito.doReturn(getContext().getResources()).when(context).getResources();
- Mockito.doReturn(getContext().getTheme()).when(context).getTheme();
- Mockito.doReturn(getContext().getPackageManager()).when(context).getPackageManager();
- Mockito.doReturn(1).when(context).checkCallingOrSelfPermission(Mockito.anyString());
- Mockito.doReturn(getContext().getMainLooper()).when(context).getMainLooper();
-
- // Setup mock window manager
- mWindowManagerMock = Mockito.mock(WindowManager.class);
- WindowManager actualWindowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
- Mockito.doReturn(mWindowManagerMock).when(context).getSystemService(Mockito.eq(Context.WINDOW_SERVICE));
- Mockito.doReturn(actualWindowManager.getDefaultDisplay()).when(mWindowManagerMock).getDefaultDisplay();
- Mockito.doReturn(getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
- .when(context).getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // Attach our mock context to service
- getService().attach(
- context,
- null, // ActivityThread not actually used in Service
- ViewProviderService.class.getName(),
- null, // token not needed when not talking with the activity manager
- getApplication(),
- null // mocked services don't talk with the activity manager
- );
- }
-
- public void testCallbacks() throws Exception {
- Mockito.reset(getService().getProvider().getTracker());
- mView.onScreenTurnedOff();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onScreenTurnedOff();
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onKeyguardDismissed();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onKeyguardDismissed();
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onBouncerShowing(true);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onBouncerShowing(Mockito.eq(true));
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onKeyguardShowing(true);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onKeyguardShowing(Mockito.eq(true));
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onLockscreenSlideOffsetChanged(1f);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .onLockscreenSlideOffsetChanged(Mockito.eq(1f));
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onAttach(null);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1)).onAttach();
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
-
- ArgumentCaptor<WindowManager.LayoutParams> params = ArgumentCaptor
- .forClass(WindowManager.LayoutParams.class);
- ArgumentCaptor<ViewGroup> viewGroup = ArgumentCaptor
- .forClass(ViewGroup.class);
- Mockito.verify(mWindowManagerMock, Mockito.times(1))
- .addView(viewGroup.capture(), params.capture());
-
- ViewGroup decorView = viewGroup.getAllValues().get(0);
- assertEquals (decorView.getChildCount(), 2);
- assertEquals (decorView.getChildAt(1), getService().getProvider().getView());
-
- WindowManager.LayoutParams param = params.getAllValues().get(0);
- assertEquals ((param.type & WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL),
- WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL);
-
- int flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
- WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
- WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
- WindowManager.LayoutParams.FLAG_FULLSCREEN;
- assertEquals(param.flags & flags, flags);
-
- assertEquals ((param.gravity & Gravity.LEFT | Gravity.TOP),
- Gravity.LEFT | Gravity.TOP);
- assertEquals ((param.format & PixelFormat.TRANSPARENT),
- PixelFormat.TRANSPARENT);
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- mView.onDetach();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1)).onDetach();
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
-
- ArgumentCaptor<ViewGroup> viewGroup = ArgumentCaptor
- .forClass(ViewGroup.class);
- Mockito.verify(mWindowManagerMock, Mockito.times(1))
- .removeView(viewGroup.capture());
-
- ViewGroup decorView = viewGroup.getAllValues().get(0);
- assertEquals (decorView.getChildCount(), 2);
- assertEquals (decorView.getChildAt(1), getService().getProvider().getView());
- }
- });
- }
-
- public void testCallbackRegistration() throws Exception {
- final IKeyguardExternalViewCallbacks.Stub callback = MockIBinderStubForInterface
- .getMockInterface(IKeyguardExternalViewCallbacks.Stub.class);
- mView.registerCallback(callback);
- getService().getProvider().requestDismissImpl();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- try {
- Mockito.verify(callback, Mockito.times(1)).requestDismiss();
- Mockito.verify(callback, Mockito.times(1)).asBinder();
- } catch (RemoteException e) {
- Assert.fail(e.getMessage());
- }
- Mockito.verifyNoMoreInteractions(callback);
- }
- });
-
- Mockito.reset(callback);
- final Intent i = new Intent();
- getService().getProvider().requestDismissAndStartActivityImpl(i);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- try {
- Mockito.verify(callback, Mockito.times(1)).requestDismissAndStartActivity(Mockito.eq(i));
- } catch (RemoteException e) {
- Assert.fail(e.getMessage());
- }
- Mockito.verifyNoMoreInteractions(callback);
- }
- });
-
- Mockito.reset(callback);
- getService().getProvider().setInteractivityImpl(true);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- try {
- Mockito.verify(callback, Mockito.times(1)).setInteractivity(Mockito.eq(true));
- } catch (RemoteException e) {
- Assert.fail(e.getMessage());
- }
- Mockito.verifyNoMoreInteractions(callback);
- }
- });
-
- Mockito.reset(callback);
- getService().getProvider().slideLockscreenInImpl();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- try {
- Mockito.verify(callback, Mockito.times(1)).slideLockscreenIn();
- } catch (RemoteException e) {
- Assert.fail(e.getMessage());
- }
- Mockito.verifyNoMoreInteractions(callback);
- }
- });
-
- Mockito.reset(getService().getProvider().getTracker());
- getService().getProvider().collapseNotificationPanelImpl();
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verify(getService().getProvider().getTracker(), Mockito.times(1))
- .collapseNotificationPanelImpl();
- Mockito.verifyNoMoreInteractions(getService().getProvider().getTracker());
- }
- });
- }
-
- public void testAlterWindow() throws Exception {
- // Test visible false
- Mockito.reset(mWindowManagerMock);
- final Rect rect = new Rect(0, 0, 100, 100);
- mView.alterWindow(0, 0, 100, 100, false, rect);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- Mockito.verifyNoMoreInteractions(mWindowManagerMock);
- }
- });
-
- // Test visible true
- Mockito.reset(mWindowManagerMock);
- mView.alterWindow(10, 20, 30, 40, true, rect);
- runOnServiceThread(new Runnable() {
- @Override
- public void run() {
- ArgumentCaptor<WindowManager.LayoutParams> params = ArgumentCaptor
- .forClass(WindowManager.LayoutParams.class);
- ArgumentCaptor<ViewGroup> viewGroup = ArgumentCaptor
- .forClass(ViewGroup.class);
- Mockito.verify(mWindowManagerMock, Mockito.times(1))
- .updateViewLayout(viewGroup.capture(), params.capture());
-
- ViewGroup decorView = viewGroup.getAllValues().get(0);
- // First view is actionbar
- View child = decorView.getChildAt(1);
- assertEquals (decorView.getChildCount(), 2);
- assertEquals (child, getService().getProvider().getView());
- assertEquals (decorView.getVisibility(), View.VISIBLE);
- assertEquals (decorView.getClipBounds(), rect);
-
- WindowManager.LayoutParams param = params.getAllValues().get(0);
- assertEquals (param.x, 10);
- assertEquals (param.y, 20);
- assertEquals (param.width, 30);
- assertEquals (param.height, 40);
- Mockito.verifyNoMoreInteractions(mWindowManagerMock);
- }
- });
- }
-}
diff --git a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalViewTest.java b/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalViewTest.java
deleted file mode 100644
index 4c8896ab..00000000
--- a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/KeyguardExternalViewTest.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/**
- * 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.lineageos.tests.externalviews.keyguardexternalviews;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.test.AndroidTestCase;
-import android.view.WindowManager;
-import lineageos.externalviews.IExternalViewProviderFactory;
-import lineageos.externalviews.IKeyguardExternalViewCallbacks;
-import lineageos.externalviews.IKeyguardExternalViewProvider;
-import lineageos.externalviews.KeyguardExternalView;
-import org.lineageos.tests.common.MockIBinderStubForInterface;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-public class KeyguardExternalViewTest extends AndroidTestCase {
- private IKeyguardExternalViewProvider.Stub mIKeyguardExternalViewProvider;
- private IExternalViewProviderFactory.Stub mExternalViewProviderFactory;
- private WindowManager mWindowManagerMock;
- private Context mContextMock;
- private ServiceConnection mServiceConnection;
- private IKeyguardExternalViewCallbacks mKeyguardCallback;
- private KeyguardExternalView mExternalView;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- WindowManager windowManager = (WindowManager) getContext()
- .getSystemService(Context.WINDOW_SERVICE);
-
- // Ensure we mock context but invoke non intercepted calls to impl
- mContextMock = Mockito.mock(Context.class, Mockito.CALLS_REAL_METHODS);
-
- // Needed since ExternalView's base class instantiates things off this.
- // We can't use a spy here since ContextImpl is hidden (PowerMock ?)
- // For now just redirect these to the test context
- Mockito.doReturn(getContext().getApplicationInfo()).when(mContextMock).getApplicationInfo();
- Mockito.doReturn(getContext().getResources()).when(mContextMock).getResources();
- Mockito.doReturn(getContext().getTheme()).when(mContextMock).getTheme();
-
- // Mock window manager to ensure we don't try to add the windows
- mWindowManagerMock = Mockito.mock(WindowManager.class);
- Mockito.doReturn(mWindowManagerMock).when(mContextMock).getSystemService(Context.WINDOW_SERVICE);
- Mockito.doReturn(windowManager.getDefaultDisplay()).when(mWindowManagerMock).getDefaultDisplay();
-
- // Mock the viewProvider/KeyguardView to keep track of callback invocations
- mIKeyguardExternalViewProvider = MockIBinderStubForInterface
- .getMockInterface(IKeyguardExternalViewProvider.Stub.class);
- mExternalViewProviderFactory = MockIBinderStubForInterface
- .getMockInterface(IExternalViewProviderFactory.Stub.class);
-
- // Ensure we return our view provider when the factory is asked to create external view
- Mockito.doReturn(mIKeyguardExternalViewProvider)
- .when(mExternalViewProviderFactory)
- .createExternalView(Mockito.any(Bundle.class));
-
- // Store the callback object registered by the view
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- mKeyguardCallback = (IKeyguardExternalViewCallbacks) invocation.getArguments()[0];
- return null;
- }
- }).when(mIKeyguardExternalViewProvider)
- .registerCallback(Mockito.notNull(IKeyguardExternalViewCallbacks.class));
-
- // Simulate bound service connection when bindService is invoked
- Mockito.doAnswer(new Answer() {
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- ServiceConnection connection = (ServiceConnection) invocation.getArguments()[1];
- connection.onServiceConnected(null, mExternalViewProviderFactory);
- mServiceConnection = connection;
- return true;
- }
- }).when(mContextMock).bindService(Mockito.any(Intent.class),
- Mockito.any(ServiceConnection.class), Mockito.anyInt());
- }
-
- public void testValidServiceBind() {
- mExternalView = new KeyguardExternalView(mContextMock, null, new ComponentName("", ""));
-
- // Ensure we attempted to bind to the service
- Mockito.verify(mContextMock, Mockito.times(1)).bindService(Mockito.any(Intent.class),
- Mockito.any(ServiceConnection.class), Mockito.anyInt());
- }
-
- public void testInvalidServiceBind() {
- mExternalView = new KeyguardExternalView(mContextMock, null, null);
- // Ensure we did not attempt to bind to the service
- Mockito.verify(mContextMock, Mockito.never()).bindService(Mockito.any(Intent.class),
- Mockito.any(ServiceConnection.class), Mockito.anyInt());
- }
-
- public void testServiceAndCallbacksRegistered() throws RemoteException {
- testValidServiceBind();
-
- // Ensure a view was asked to be created
- Mockito.verify(mExternalViewProviderFactory, Mockito.times(1))
- .createExternalView(Mockito.any(Bundle.class));
-
- // Ensure callbacks were registered
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1))
- .registerCallback(Mockito.notNull(IKeyguardExternalViewCallbacks.class));
-
- assertNotNull(mKeyguardCallback);
- }
-
- public void testServiceUnbindAndCallbacksUnRegistered() throws RemoteException {
- testServiceAndCallbacksRegistered();
-
- assertNotNull(mServiceConnection);
- mServiceConnection.onServiceDisconnected(null);
-
- // Ensure callbacks were registered
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1))
- .unregisterCallback(Mockito.notNull(IKeyguardExternalViewCallbacks.class));
- }
-
- // Ensure provider is alerted view callbacks
- public void testViewProviderCallbacks() throws RemoteException {
- testServiceAndCallbacksRegistered();
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onKeyguardShowing(true);
- Mockito.verify(mIKeyguardExternalViewProvider,
- Mockito.times(1)).onKeyguardShowing(Mockito.anyBoolean());
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onAttachedToWindow();
- Mockito.verify(mIKeyguardExternalViewProvider,
- Mockito.times(1)).onAttach(Mockito.any(IBinder.class));
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onDetachedFromWindow();
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1)).onDetach();
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onBouncerShowing(true);
- Mockito.verify(mIKeyguardExternalViewProvider,
- Mockito.times(1)).onBouncerShowing(Mockito.anyBoolean());
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onKeyguardDismissed();
- Mockito.verify(mIKeyguardExternalViewProvider,
- Mockito.times(1)).onKeyguardDismissed();
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onLockscreenSlideOffsetChanged(1f);
- Mockito.verify(mIKeyguardExternalViewProvider,
- Mockito.times(1)).onLockscreenSlideOffsetChanged(Mockito.eq(1f));
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onScreenTurnedOff();
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1)).onScreenTurnedOff();
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
-
- Mockito.reset(mIKeyguardExternalViewProvider);
- mExternalView.onScreenTurnedOn();
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1)).onScreenTurnedOn();
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
- }
-
- public void testWindowMovement() throws RemoteException {
- testServiceAndCallbacksRegistered();
- Mockito.reset(mIKeyguardExternalViewProvider);
-
- mExternalView.setLeft(0);
- mExternalView.setTop(0);
- mExternalView.setRight(100);
- mExternalView.setBottom(100);
-
- mExternalView.onPreDraw();
- Mockito.verify(mIKeyguardExternalViewProvider, Mockito.times(1))
- .alterWindow(Mockito.eq(0), Mockito.eq(0), Mockito.anyInt(),
- Mockito.anyInt(), Mockito.eq(true), Mockito.any(Rect.class));
- Mockito.verifyNoMoreInteractions(mIKeyguardExternalViewProvider);
- }
-
- public void testWindowAttachmentCallbacks() throws RemoteException {
- testServiceAndCallbacksRegistered();
-
- KeyguardExternalView.OnWindowAttachmentChangedListener callback =
- Mockito.mock(KeyguardExternalView.OnWindowAttachmentChangedListener.class);
- mExternalView.registerOnWindowAttachmentChangedListener(callback);
-
- mKeyguardCallback.onAttachedToWindow();
- Mockito.verify(callback, Mockito.times(1)).onAttachedToWindow();
- Mockito.verifyNoMoreInteractions(callback);
-
- mKeyguardCallback.onDetachedFromWindow();
- Mockito.verify(callback, Mockito.times(1)).onDetachedFromWindow();
- Mockito.verifyNoMoreInteractions(callback);
- }
-
- public void testKeyguardViewCallbacks() throws RemoteException {
- testServiceAndCallbacksRegistered();
-
- KeyguardExternalView.KeyguardExternalViewCallbacks callback = Mockito.mock(
- KeyguardExternalView.KeyguardExternalViewCallbacks.class);
- mExternalView.registerKeyguardExternalViewCallback(callback);
-
- mKeyguardCallback.requestDismiss();
- Mockito.verify(callback, Mockito.times(1)).requestDismiss();
- Mockito.verifyNoMoreInteractions(callback);
-
- Intent i = new Intent();
- mKeyguardCallback.requestDismissAndStartActivity(i);
- Mockito.verify(callback, Mockito.times(1))
- .requestDismissAndStartActivity(Mockito.eq(i));
- Mockito.verifyNoMoreInteractions(callback);
-
- mKeyguardCallback.setInteractivity(true);
- assertEquals(mExternalView.isInteractive(), true);
- Mockito.verifyNoMoreInteractions(callback);
-
- mKeyguardCallback.slideLockscreenIn();
- Mockito.verify(callback, Mockito.times(1)).slideLockscreenIn();
- Mockito.verifyNoMoreInteractions(callback);
-
- mExternalView.binderDied();
- Mockito.verify(callback, Mockito.times(1)).providerDied();
- Mockito.verifyNoMoreInteractions(callback);
- }
-}
diff --git a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/ViewProviderService.java b/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/ViewProviderService.java
deleted file mode 100644
index 6d669025..00000000
--- a/tests/src/org/lineageos/tests/externalviews/keyguardexternalviews/ViewProviderService.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * 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.lineageos.tests.externalviews.keyguardexternalviews;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Space;
-import lineageos.externalviews.KeyguardExternalViewProviderService;
-import org.mockito.Mockito;
-
-public class ViewProviderService extends KeyguardExternalViewProviderService {
- private ViewProvider mProvider;
-
- public ViewProviderService() {}
-
- @Override
- public KeyguardExternalViewProviderService.Provider createExternalView(Bundle options) {
- if (mProvider == null) {
- mProvider = Mockito.spy(new ViewProvider(options));
- }
- return mProvider;
- }
-
- public ViewProvider getProvider() {
- return mProvider;
- }
-
- public class ViewProvider extends KeyguardExternalViewProviderService.Provider {
- private ViewProvider mTracker;
- private View mView;
-
- public ViewProvider(Bundle options) {
- super(options);
- }
-
- public View getView() {
- return mView;
- }
-
- public ViewProvider getTracker() {
- return mTracker;
- }
-
- @Override
- public View onCreateView() {
- if (mTracker == null) {
- mTracker = Mockito.mock(ViewProvider.class);
- }
- mTracker.onCreateView();
- if (mView == null) {
- mView = new Space(getBaseContext());
- }
- return mView;
- }
- @Override
- public void onKeyguardShowing(boolean screenOn) {
- mTracker.onKeyguardShowing(screenOn);
- }
- @Override
- public void onKeyguardDismissed() {
- mTracker.onKeyguardDismissed();
- }
- @Override
- public void onBouncerShowing(boolean showing) {
- mTracker.onBouncerShowing(showing);
- }
- @Override
- public void onScreenTurnedOn() {
- mTracker.onScreenTurnedOn();
- }
- @Override
- public void onScreenTurnedOff() {
- mTracker.onScreenTurnedOff();
- }
-
- @Override
- protected void onAttach() {
- mTracker.onAttach();
- }
-
- @Override
- protected void onDetach() {
- mTracker.onDetach();
- }
-
- @Override
- protected void onLockscreenSlideOffsetChanged(float swipeProgress) {
- mTracker.onLockscreenSlideOffsetChanged(swipeProgress);
- }
-
- public boolean requestDismissImpl() {
- return requestDismiss();
- }
-
- public boolean requestDismissAndStartActivityImpl(Intent intent) {
- return requestDismissAndStartActivity(intent);
- }
-
- public void setInteractivityImpl(boolean interactive) {
- setInteractivity(interactive);
- }
-
- public void slideLockscreenInImpl() {
- slideLockscreenIn();
- }
-
- public Bundle getOptionsImpl() {
- return getOptions();
- }
-
- public void collapseNotificationPanelImpl() {
- mTracker.collapseNotificationPanelImpl();
- collapseNotificationPanel();
- }
- }
-}; \ No newline at end of file
diff --git a/tests/src/org/lineageos/tests/versioning/unit/apiv4/ApiV4PriorReleaseInterfaces.java b/tests/src/org/lineageos/tests/versioning/unit/apiv4/ApiV4PriorReleaseInterfaces.java
index 8321dd22..3e29d58b 100644
--- a/tests/src/org/lineageos/tests/versioning/unit/apiv4/ApiV4PriorReleaseInterfaces.java
+++ b/tests/src/org/lineageos/tests/versioning/unit/apiv4/ApiV4PriorReleaseInterfaces.java
@@ -91,34 +91,6 @@ public class ApiV4PriorReleaseInterfaces {
extViewProviderMap.put("alterWindow", 7);
}
- //KeyguardExternalViewCallbacks Aidl (IKeyguardExternalViewCallbacks)
- static {
- Map<String, Integer> kgExtViewCbMap =
- getInternalInterfaceMap("IKeyguardExternalViewCallbacks");
- // DRAGONFRUIT BEGIN
- kgExtViewCbMap.put("requestDismiss", 1);
- kgExtViewCbMap.put("requestDismissAndStartActivity", 2);
- kgExtViewCbMap.put("collapseNotificationPanel", 3);
- kgExtViewCbMap.put("setInteractivity", 4);
- }
-
- //KeyguardExternalViewProvider Aidl (IKeyguardExternalViewProvider)
- static {
- Map<String, Integer> kgExtViewProviderMap =
- getInternalInterfaceMap("IKeyguardExternalViewProvider");
- // DRAGONFRUIT BEGIN
- kgExtViewProviderMap.put("onAttach", 1);
- kgExtViewProviderMap.put("onDetach", 2);
- kgExtViewProviderMap.put("onKeyguardShowing", 3);
- kgExtViewProviderMap.put("onKeyguardDismissed" , 4);
- kgExtViewProviderMap.put("onBouncerShowing", 5);
- kgExtViewProviderMap.put("onScreenTurnedOn", 6);
- kgExtViewProviderMap.put("onScreenTurnedOff", 7);
- kgExtViewProviderMap.put("registerCallback", 8);
- kgExtViewProviderMap.put("unregisterCallback", 9);
- kgExtViewProviderMap.put("alterWindow", 10);
- }
-
protected static Map<String, Integer> getInternalInterfaceMap(String targetInterface) {
Map<String, Integer> internalMap = mApiMethodsAndValues.get(targetInterface);
if (internalMap == null) {
diff --git a/tests/src/org/lineageos/tests/versioning/unit/apiv5/ApiV5PriorReleaseInterfaces.java b/tests/src/org/lineageos/tests/versioning/unit/apiv5/ApiV5PriorReleaseInterfaces.java
index 74cbaea1..898dbfad 100644
--- a/tests/src/org/lineageos/tests/versioning/unit/apiv5/ApiV5PriorReleaseInterfaces.java
+++ b/tests/src/org/lineageos/tests/versioning/unit/apiv5/ApiV5PriorReleaseInterfaces.java
@@ -39,26 +39,6 @@ public class ApiV5PriorReleaseInterfaces {
// ELDERBERRY BEGIN
}
- //KeyguardExternalViewCallbacks Aidl (IKeyguardExternalViewCallbacks)
- static {
- Map<String, Integer> kgExtViewCbMap =
- getInternalInterfaceMap("IKeyguardExternalViewCallbacks");
- // DRAGONFRUIT TO 4
- // ELDERBERRY BEGIN
- kgExtViewCbMap.put("onAttachedToWindow", 5);
- kgExtViewCbMap.put("onDetachedFromWindow", 6);
- kgExtViewCbMap.put("slideLockscreenIn", 7);
- }
-
- //KeyguardExternalViewProvider Aidl (IKeyguardExternalViewProvider)
- static {
- Map<String, Integer> kgExtViewProviderMap =
- getInternalInterfaceMap("IKeyguardExternalViewProvider");
- // DRAGONFRUIT TO 10
- // ELDERBERRY BEGIN
- kgExtViewProviderMap.put("onLockscreenSlideOffsetChanged", 11);
- }
-
//LineageAudioManager Aidl (ILineageAudioService)
static {
Map<String, Integer> lineageAudioService =