diff options
author | Deepak Kundra <deepakkundra@gmail.com> | 2016-08-26 11:13:09 -0700 |
---|---|---|
committer | Deepak Kundra <deepakkundra@gmail.com> | 2016-08-26 11:13:09 -0700 |
commit | 24b1797e46e4635b70650e7786056809d02ad00b (patch) | |
tree | fe16a1ed4a13c2e528791ea737e41441c71f23f8 | |
parent | a1a6b3fc335b289e21ed27ca6c2b0ea3c214b3d1 (diff) | |
download | android_frameworks_base-staging/caf/LA.BR.1.2.6.c1-01200-8x09.0_LLS.tar.gz android_frameworks_base-staging/caf/LA.BR.1.2.6.c1-01200-8x09.0_LLS.tar.bz2 android_frameworks_base-staging/caf/LA.BR.1.2.6.c1-01200-8x09.0_LLS.zip |
CAF based Demo for LLSstaging/caf/LA.BR.1.2.6.c1-01200-8x09.0_LLS
Change-Id: I503daded9243b29638787be389846d5dacb07a96
-rw-r--r-- | api/current.txt | 2 | ||||
-rw-r--r-- | api/system-current.txt | 2 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 9 | ||||
-rw-r--r-- | packages/SystemUI/Android.mk | 15 | ||||
-rw-r--r-- | packages/SystemUI/AndroidManifest_extra.xml | 32 | ||||
-rw-r--r-- | packages/SystemUI/libs/platform.sdk-5.0.1.jar | bin | 0 -> 414289 bytes | |||
-rw-r--r-- | packages/SystemUI/res/layout/unlock_fab.xml | 8 | ||||
-rw-r--r-- | packages/SystemUI/res/values/cm_dimens.xml | 22 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java | 45 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 19 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java | 67 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java | 11 | ||||
-rw-r--r-- | packages/SystemUI/tests/Android.mk | 2 | ||||
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 26 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/WindowAnimator.java | 3 |
15 files changed, 257 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt index d7fdb2db68e..4727e725fa7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -75,6 +75,7 @@ package android { field public static final java.lang.String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT"; field public static final java.lang.String INTERNET = "android.permission.INTERNET"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; + field public static final java.lang.String LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE = "cyanogenmod.permission.LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; field public static final java.lang.String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS"; field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; @@ -124,6 +125,7 @@ package android { field public static final java.lang.String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES"; field public static final java.lang.String STATUS_BAR = "android.permission.STATUS_BAR"; field public static final java.lang.String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW"; + field public static final java.lang.String THIRD_PARTY_KEYGUARD = "cyanogenmod.permission.THIRD_PARTY_KEYGUARD"; field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR"; field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT"; field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS"; diff --git a/api/system-current.txt b/api/system-current.txt index 3c88e5979c8..f7d24d21324 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -115,6 +115,7 @@ package android { field public static final java.lang.String INTERNET = "android.permission.INTERNET"; field public static final java.lang.String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; + field public static final java.lang.String LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE = "cyanogenmod.permission.LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE"; field public static final java.lang.String LOCAL_MAC_ADDRESS = "android.permission.LOCAL_MAC_ADDRESS"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; field public static final java.lang.String LOOP_RADIO = "android.permission.LOOP_RADIO"; @@ -209,6 +210,7 @@ package android { field public static final java.lang.String STATUS_BAR = "android.permission.STATUS_BAR"; field public static final java.lang.String STOP_APP_SWITCHES = "android.permission.STOP_APP_SWITCHES"; field public static final java.lang.String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW"; + field public static final java.lang.String THIRD_PARTY_KEYGUARD = "cyanogenmod.permission.THIRD_PARTY_KEYGUARD"; field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR"; field public static final java.lang.String TV_INPUT_HARDWARE = "android.permission.TV_INPUT_HARDWARE"; field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT"; diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 45bc1df3346..b07b486aa57 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -186,6 +186,7 @@ public interface WindowManager extends ViewManager { * @see #TYPE_SYSTEM_ERROR * @see #TYPE_INPUT_METHOD * @see #TYPE_INPUT_METHOD_DIALOG + * @see #TYPE_KEYGUARD_PANEL */ @ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"), @@ -226,6 +227,7 @@ public interface WindowManager extends ViewManager { @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"), @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"), @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"), + @ViewDebug.IntToString(from = TYPE_KEYGUARD_PANEL, to = "TYPE_KEYGUARD_PANEL"), }) public int type; @@ -565,6 +567,13 @@ public interface WindowManager extends ViewManager { public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33; /** + * Window type: Windows that are layered within the keyguard + * This type is LAST_SYSTEM_WINDOW-1 to avoid future conflicts with AOSP + * @hide + */ + public static final int TYPE_KEYGUARD_PANEL = FIRST_SYSTEM_WINDOW+998; + + /** * End of types of system windows. */ public static final int LAST_SYSTEM_WINDOW = 2999; diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk index 51fea2a124e..7760cbdd325 100644 --- a/packages/SystemUI/Android.mk +++ b/packages/SystemUI/Android.mk @@ -25,10 +25,25 @@ ifneq ($(SYSTEM_UI_INCREMENTAL_BUILDS),) LOCAL_JACK_ENABLED := incremental endif +LOCAL_PROGUARD_FLAGS += -dontwarn + +LOCAL_STATIC_JAVA_LIBRARIES += cmsdk +LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest_extra.xml + include frameworks/base/packages/SettingsLib/common.mk include $(BUILD_PACKAGE) + +# CMSDK +include $(CLEAR_VARS) + +LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \ + cmsdk:libs/platform.sdk-5.0.1.jar + +include $(BUILD_MULTI_PREBUILT) + + ifeq ($(EXCLUDE_SYSTEMUI_TESTS),) include $(call all-makefiles-under,$(LOCAL_PATH)) endif diff --git a/packages/SystemUI/AndroidManifest_extra.xml b/packages/SystemUI/AndroidManifest_extra.xml new file mode 100644 index 00000000000..40181942a3f --- /dev/null +++ b/packages/SystemUI/AndroidManifest_extra.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* //device/apps/common/AndroidManifest.xml +** +** Copyright 2006, The Android Open Source 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="android"> + + <!-- Allows an application to be used as a third party keyguard --> + <permission android:name="cyanogenmod.permission.THIRD_PARTY_KEYGUARD" + android:protectionLevel="normal" /> + + <permission android:name="cyanogenmod.permission.LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE" + android:protectionLevel="signature|privileged" /> + + <uses-permission android:name="cyanogenmod.permission.LIVE_LOCK_SCREEN_MANAGER_ACCESS_PRIVATE"/> + +</manifest> diff --git a/packages/SystemUI/libs/platform.sdk-5.0.1.jar b/packages/SystemUI/libs/platform.sdk-5.0.1.jar Binary files differnew file mode 100644 index 00000000000..a38e9961076 --- /dev/null +++ b/packages/SystemUI/libs/platform.sdk-5.0.1.jar diff --git a/packages/SystemUI/res/layout/unlock_fab.xml b/packages/SystemUI/res/layout/unlock_fab.xml new file mode 100644 index 00000000000..c80bc19d83e --- /dev/null +++ b/packages/SystemUI/res/layout/unlock_fab.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<ImageView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/show_bouncer" + android:layout_width="@dimen/unlock_fab_size" + android:layout_height="@dimen/unlock_fab_size" + android:layout_gravity="bottom|center_horizontal" + android:alpha="0.5" + android:src="@drawable/ic_lock_open_24dp" /> diff --git a/packages/SystemUI/res/values/cm_dimens.xml b/packages/SystemUI/res/values/cm_dimens.xml new file mode 100644 index 00000000000..f759cc3c675 --- /dev/null +++ b/packages/SystemUI/res/values/cm_dimens.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + 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. +--> +<resources> + + <!-- Size of unlock FAB used when showing external keyguard views --> + <dimen name="unlock_fab_size">48dp</dimen> + +</resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index bdd2c73bd67..bedabb3027f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -23,6 +23,7 @@ import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.app.ActivityManager; import android.app.StatusBarManager; +import android.content.ComponentName; import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Configuration; @@ -35,6 +36,7 @@ import android.util.MathUtils; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; +import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; @@ -66,6 +68,8 @@ import com.android.systemui.statusbar.stack.StackStateAnimator; import java.util.List; +import cyanogenmod.externalviews.KeyguardExternalView; + public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, @@ -90,6 +94,12 @@ public class NotificationPanelView extends PanelView implements public static final long DOZE_ANIMATION_DURATION = 700; + + // Layout params for external keyguard view + private static final FrameLayout.LayoutParams EXTERNAL_KEYGUARD_VIEW_PARAMS = + new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); + private KeyguardAffordanceHelper mAfforanceHelper; private StatusBarHeaderView mHeader; private KeyguardUserSwitcher mKeyguardUserSwitcher; @@ -205,6 +215,9 @@ public class NotificationPanelView extends PanelView implements private boolean mLaunchingAffordance; private String mLastCameraLaunchSource = KeyguardBottomAreaView.CAMERA_LAUNCH_SOURCE_AFFORDANCE; + private ComponentName mThirdPartyKeyguardViewComponent; + private KeyguardExternalView mKeyguardExternalView; + private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() { @Override public void run() { @@ -271,6 +284,12 @@ public class NotificationPanelView extends PanelView implements } } }); + +// CmLockPatternUtils lockPatternUtils = new CmLockPatternUtils(getContext()); +// if (lockPatternUtils.isThirdPartyKeyguardEnabled()) { +// mThirdPartyKeyguardViewComponent = lockPatternUtils.getThirdPartyKeyguardComponent(); +// } + mThirdPartyKeyguardViewComponent = new ComponentName("org.cyanogenmod.samples.keyguardextview", "org.cyanogenmod.samples.keyguardextview.SampleKeyguardProviderService"); } @Override @@ -1014,6 +1033,19 @@ public class NotificationPanelView extends PanelView implements } if (keyguardShowing) { updateDozingVisibilities(false /* animate */); + if (mThirdPartyKeyguardViewComponent != null) { + if (mKeyguardExternalView == null) { + mKeyguardExternalView = + getExternalKeyguardView(mThirdPartyKeyguardViewComponent); + } + if (mKeyguardExternalView != null && !mKeyguardExternalView.isAttachedToWindow()) { + addView(mKeyguardExternalView, 0, EXTERNAL_KEYGUARD_VIEW_PARAMS); + } + } + } else { + if (mKeyguardExternalView != null && mKeyguardExternalView.isAttachedToWindow()) { + removeView(mKeyguardExternalView); + } } resetVerticalPanelPosition(); updateQsState(); @@ -2451,4 +2483,17 @@ public class NotificationPanelView extends PanelView implements List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1); return !tasks.isEmpty() && pkgName.equals(tasks.get(0).topActivity.getPackageName()); } + + public boolean hasExternalKeyguardView() { + return mKeyguardExternalView != null && mKeyguardExternalView.isAttachedToWindow(); + } + + private KeyguardExternalView getExternalKeyguardView(ComponentName componentName) { + try { + return new KeyguardExternalView(getContext(), null, componentName); + } catch (Exception e) { + // just return null below and move on + } + return null; + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index d0bc8021646..feae16a5335 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3866,9 +3866,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void onTrackingStopped(boolean expand) { if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { - if (!expand && !mUnlockMethodCache.canSkipBouncer()) { - showBouncer(); + if (!expand && (!mUnlockMethodCache.canSkipBouncer() || + mNotificationPanel.hasExternalKeyguardView())) { + showBouncerOrFocusKeyguardExternalView(); } + } else if (expand && mStatusBarWindowManager.keyguardExternalViewHasFocus()) { + mStatusBarKeyguardViewManager.setKeyguardExternalViewFocus(false); + setBarState(StatusBarState.KEYGUARD); } } @@ -4382,4 +4386,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } } + + private void showBouncerOrFocusKeyguardExternalView() { + if (mNotificationPanel.hasExternalKeyguardView()) { + mStatusBarView.collapseAllPanels(/*animate=*/ false, false /* delayed*/, + 1.0f /* speedUpFactor */); + mStatusBarKeyguardViewManager.setKeyguardExternalViewFocus(true); + setBarState(StatusBarState.SHADE); + } else { + showBouncer(); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 05f6e57d919..284a187e5b9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -18,17 +18,21 @@ package com.android.systemui.statusbar.phone; import android.content.ComponentCallbacks2; import android.content.Context; +import android.graphics.PixelFormat; import android.os.Bundle; import android.os.SystemClock; import android.os.Trace; +import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; +import android.view.WindowManager; import android.view.WindowManagerGlobal; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; +import com.android.keyguard.R; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.statusbar.CommandQueue; @@ -79,6 +83,8 @@ public class StatusBarKeyguardViewManager { private boolean mDeviceWillWakeUp; private boolean mDeferScrimFadeOut; + private View mUnlockFab; + public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils) { mContext = context; @@ -232,6 +238,9 @@ public class StatusBarKeyguardViewManager { } mOccluded = occluded; mStatusBarWindowManager.setKeyguardOccluded(occluded); + if (mUnlockFab != null && mUnlockFab.isAttachedToWindow() && !occluded) { + hideUnlockFab(); + } reset(); } @@ -368,8 +377,16 @@ public class StatusBarKeyguardViewManager { * Dismisses the keyguard by going to the next screen or making it gone. */ public void dismiss() { - if (mDeviceInteractive || mDeviceWillWakeUp) { + dismiss(false); + } + + public void dismiss(boolean focusKeyguardExternalView) { + if ((mDeviceInteractive || mDeviceWillWakeUp) && !focusKeyguardExternalView) { showBouncer(); + hideUnlockFab(); + } else if (focusKeyguardExternalView) { + showUnlockFab(); + mStatusBarWindowManager.setKeyguardExternalViewFocus(true); } } @@ -542,4 +559,52 @@ public class StatusBarKeyguardViewManager { public ViewRootImpl getViewRootImpl() { return mPhoneStatusBar.getStatusBarView().getViewRootImpl(); } + + public void setKeyguardExternalViewFocus(boolean hasFocus) { + if (hasFocus) { + showUnlockFab(); + } else { + hideUnlockFab(); + } + mStatusBarWindowManager.setKeyguardExternalViewFocus(hasFocus); + } + + private void showUnlockFab() { + if (mUnlockFab == null) { + mUnlockFab = View.inflate(mContext, R.layout.unlock_fab, null); + } + if (!mUnlockFab.isAttachedToWindow()) { + WindowManager.LayoutParams lp = new WindowManager.LayoutParams( + WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, + WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH + | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS + | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, + PixelFormat.TRANSLUCENT); + lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; + lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; + lp.setTitle("UnlockFab"); + lp.packageName = mContext.getPackageName(); + lp.width = lp.height = + mContext.getResources().getDimensionPixelSize(R.dimen.unlock_fab_size); + WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); + wm.addView(mUnlockFab, lp); + mUnlockFab.setOnClickListener(mUnlockFabClickListener); + } + } + + private void hideUnlockFab() { + if (mUnlockFab != null && mUnlockFab.isAttachedToWindow()) { + WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); + wm.removeViewImmediate(mUnlockFab); + } + } + + private View.OnClickListener mUnlockFabClickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + mStatusBarWindowManager.setKeyguardExternalViewFocus(false); + dismiss(false); + } + }; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java index ccfa0dd058d..e6c95af8b62 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java @@ -305,6 +305,10 @@ public class StatusBarWindowManager { pw.println(mCurrentState); } + public boolean keyguardExternalViewHasFocus() { + return mCurrentState.keyguardExternalViewHasFocus; + } + private static class State { boolean keyguardShowing; boolean keyguardOccluded; @@ -319,6 +323,7 @@ public class StatusBarWindowManager { boolean forceStatusBarVisible; boolean forceCollapsed; boolean forceDozeBrightness; + boolean keyguardExternalViewHasFocus; /** * The {@link BaseStatusBar} state from the status bar. @@ -355,4 +360,10 @@ public class StatusBarWindowManager { return result.toString(); } } + + public void setKeyguardExternalViewFocus(boolean hasFocus) { + mCurrentState.keyguardExternalViewHasFocus = hasFocus; + // make the keyguard occluded so the external view gets full focus + setKeyguardOccluded(hasFocus); + } } diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk index 6a7201c26a4..666d3bec74f 100644 --- a/packages/SystemUI/tests/Android.mk +++ b/packages/SystemUI/tests/Android.mk @@ -30,7 +30,7 @@ LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common LOCAL_PACKAGE_NAME := SystemUITests -LOCAL_STATIC_JAVA_LIBRARIES := mockito-target Keyguard +LOCAL_STATIC_JAVA_LIBRARIES := mockito-target Keyguard cmsdk # sign this with platform cert, so this test is allowed to inject key events into # UI it doesn't own. This is necessary to allow screenshots to be taken diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 0bcd3ac864b..992310bb4ee 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1,3 +1,4 @@ + /* * Copyright (C) 2006 The Android Open Source Project * @@ -234,6 +235,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // app shows again. If that doesn't happen for 30s we drop the gesture. private static final long PANIC_GESTURE_EXPIRATION = 30000; + private static final String THIRD_PARTY_KEYGUARD_PERMISSION = + "cyanogenmod.permission.THIRD_PARTY_KEYGUARD"; + /** * Keyguard stuff */ @@ -330,6 +334,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { int[] mNavigationBarWidthForRotation = new int[4]; boolean mBootMessageNeedsHiding; + WindowState mKeyguardPanel; + KeyguardServiceDelegate mKeyguardDelegate; final Runnable mWindowManagerDrawCallback = new Runnable() { @Override @@ -1920,6 +1926,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { permission = android.Manifest.permission.SYSTEM_ALERT_WINDOW; outAppOp[0] = AppOpsManager.OP_SYSTEM_ALERT_WINDOW; break; + case TYPE_KEYGUARD_PANEL: + permission = THIRD_PARTY_KEYGUARD_PERMISSION; + break; default: permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; } @@ -2001,6 +2010,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { case TYPE_SYSTEM_DIALOG: case TYPE_VOLUME_OVERLAY: case TYPE_PRIVATE_PRESENTATION: + case TYPE_KEYGUARD_PANEL: break; } @@ -2136,6 +2146,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // the safety window that shows behind keyguard while keyguard is starting return 14; case TYPE_STATUS_BAR_SUB_PANEL: + case TYPE_KEYGUARD_PANEL: return 15; case TYPE_STATUS_BAR: return 16; @@ -2476,6 +2487,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { android.Manifest.permission.STATUS_BAR_SERVICE, "PhoneWindowManager"); break; + case TYPE_KEYGUARD_PANEL: + mContext.enforceCallingOrSelfPermission(THIRD_PARTY_KEYGUARD_PERMISSION, + "PhoneWindowManager"); + if (mKeyguardPanel != null) { + return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON; + } + mKeyguardPanel = win; + break; case TYPE_KEYGUARD_SCRIM: if (mKeyguardScrim != null) { return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON; @@ -2496,9 +2515,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else if (mKeyguardScrim == win) { Log.v(TAG, "Removing keyguard scrim"); mKeyguardScrim = null; - } if (mNavigationBar == win) { + } else if (mNavigationBar == win) { mNavigationBar = null; mNavigationBarController.setWindow(null); + } else if (mKeyguardPanel == win) { + mKeyguardPanel = null; } } @@ -4129,7 +4150,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // gets everything, period. if (attrs.type == TYPE_STATUS_BAR_PANEL || attrs.type == TYPE_STATUS_BAR_SUB_PANEL - || attrs.type == TYPE_VOLUME_OVERLAY) { + || attrs.type == TYPE_VOLUME_OVERLAY + || attrs.type == TYPE_KEYGUARD_PANEL) { pf.left = df.left = of.left = cf.left = hasNavBar ? mDockLeft : mUnrestrictedScreenLeft; pf.top = df.top = of.top = cf.top = mUnrestrictedScreenTop; diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java index 85a96247165..d62bae6785d 100644 --- a/services/core/java/com/android/server/wm/WindowAnimator.java +++ b/services/core/java/com/android/server/wm/WindowAnimator.java @@ -36,6 +36,7 @@ import android.util.SparseArray; import android.util.TimeUtils; import android.view.Display; import android.view.SurfaceControl; +import android.view.WindowManager; import android.view.WindowManagerPolicy; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -203,6 +204,8 @@ public class WindowAnimator { allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard; // Show SHOW_WHEN_LOCKED windows that turn on the screen allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen; + // Show windows that use TYPE_STATUS_BAR_SUB_PANEL when locked + allowWhenLocked |= win.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL; if (appShowWhenLocked != null) { allowWhenLocked |= appShowWhenLocked == win.mAppToken |