• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂596c1da03801a3ffe8d6a5adc78b450f0914e7bb (tree)
時間2016-10-11 09:11:23
作者d34d <clark@cyng...>
CommiterSM

Log Message

Lockscreen: Introduce window type TYPE_KEYGUARD_PANEL

This window type will be used by third party keyguard components
so that they can be layered within the keyguard while running in
their own process. This window type will use the same Z ordering
as TYPE_STATUS_BAR_SUB_PANEL, which is currently unused.

Note from SHM:

  • This also fixes the following errors while compiling for the emulator:

ERROR: vendor/cmsdk/tests/src/org/cyanogenmod/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java:199: TYPE_KEYGUARD_PANEL cannot be resolved or is not a field
ERROR: vendor/cmsdk/tests/src/org/cyanogenmod/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java:200: TYPE_KEYGUARD_PANEL cannot be resolved or is not a field

Change-Id: Ie18caf12a55ba79a5c56a36ca79b3a6e377d7529

Change Summary

差異

--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -239,6 +239,7 @@ public interface WindowManager extends ViewManager {
239239 * @see #TYPE_SYSTEM_ERROR
240240 * @see #TYPE_INPUT_METHOD
241241 * @see #TYPE_INPUT_METHOD_DIALOG
242+ * @see #TYPE_KEYGUARD_PANEL
242243 */
243244 @ViewDebug.ExportedProperty(mapping = {
244245 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
@@ -281,7 +282,8 @@ public interface WindowManager extends ViewManager {
281282 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
282283 @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"),
283284 @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"),
284- @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT")
285+ @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT"),
286+ @ViewDebug.IntToString(from = TYPE_KEYGUARD_PANEL, to = "TYPE_KEYGUARD_PANEL"),
285287 })
286288 public int type;
287289
@@ -642,6 +644,13 @@ public interface WindowManager extends ViewManager {
642644 public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;
643645
644646 /**
647+ * Window type: Windows that are layered within the keyguard
648+ * This type is LAST_SYSTEM_WINDOW-1 to avoid future conflicts with AOSP
649+ * @hide
650+ */
651+ public static final int TYPE_KEYGUARD_PANEL = FIRST_SYSTEM_WINDOW+998;
652+
653+ /**
645654 * End of types of system windows.
646655 */
647656 public static final int LAST_SYSTEM_WINDOW = 2999;
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -425,6 +425,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
425425 boolean mNavigationBarLeftInLandscape = false; // Navigation bar left handed?
426426
427427 boolean mBootMessageNeedsHiding;
428+
429+ WindowState mKeyguardPanel;
430+
431+
428432 KeyguardServiceDelegate mKeyguardDelegate;
429433 final Runnable mWindowManagerDrawCallback = new Runnable() {
430434 @Override
@@ -2479,6 +2483,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
24792483 permission = android.Manifest.permission.SYSTEM_ALERT_WINDOW;
24802484 outAppOp[0] = AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
24812485 break;
2486+ case TYPE_KEYGUARD_PANEL:
2487+ permission =
2488+ org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD;
2489+ break;
24822490 default:
24832491 permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
24842492 }
@@ -2572,6 +2580,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
25722580 case TYPE_VOLUME_OVERLAY:
25732581 case TYPE_PRIVATE_PRESENTATION:
25742582 case TYPE_DOCK_DIVIDER:
2583+ case TYPE_KEYGUARD_PANEL:
25752584 break;
25762585 }
25772586
@@ -2761,6 +2770,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
27612770 // the safety window that shows behind keyguard while keyguard is starting
27622771 return 14;
27632772 case TYPE_STATUS_BAR_SUB_PANEL:
2773+ case TYPE_KEYGUARD_PANEL:
27642774 return 15;
27652775 case TYPE_STATUS_BAR:
27662776 return 16;
@@ -3128,6 +3138,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
31283138 android.Manifest.permission.STATUS_BAR_SERVICE,
31293139 "PhoneWindowManager");
31303140 break;
3141+ case TYPE_KEYGUARD_PANEL:
3142+ mContext.enforceCallingOrSelfPermission(
3143+ org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD,
3144+ "PhoneWindowManager");
3145+ if (mKeyguardPanel != null) {
3146+ return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
3147+ }
3148+ mKeyguardPanel = win;
3149+ break;
31313150 case TYPE_KEYGUARD_SCRIM:
31323151 if (mKeyguardScrim != null) {
31333152 return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
@@ -3148,9 +3167,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
31483167 } else if (mKeyguardScrim == win) {
31493168 Log.v(TAG, "Removing keyguard scrim");
31503169 mKeyguardScrim = null;
3151- } if (mNavigationBar == win) {
3170+ } else if (mNavigationBar == win) {
31523171 mNavigationBar = null;
31533172 mNavigationBarController.setWindow(null);
3173+ } else if (mKeyguardPanel == win) {
3174+ mKeyguardPanel = null;
31543175 }
31553176 }
31563177
@@ -5117,7 +5138,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
51175138 // gets everything, period.
51185139 if (attrs.type == TYPE_STATUS_BAR_PANEL
51195140 || attrs.type == TYPE_STATUS_BAR_SUB_PANEL
5120- || attrs.type == TYPE_VOLUME_OVERLAY) {
5141+ || attrs.type == TYPE_VOLUME_OVERLAY
5142+ || attrs.type == TYPE_KEYGUARD_PANEL) {
51215143 pf.left = df.left = of.left = cf.left = hasNavBar
51225144 ? mDockLeft : mUnrestrictedScreenLeft;
51235145 pf.top = df.top = of.top = cf.top = mUnrestrictedScreenTop;
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -52,6 +52,7 @@ import android.util.TimeUtils;
5252 import android.view.Choreographer;
5353 import android.view.Display;
5454 import android.view.SurfaceControl;
55+import android.view.WindowManager;
5556 import android.view.WindowManagerPolicy;
5657 import android.view.animation.AlphaAnimation;
5758 import android.view.animation.Animation;
@@ -224,6 +225,8 @@ public class WindowAnimator {
224225 allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard;
225226 // Show SHOW_WHEN_LOCKED windows that turn on the screen
226227 allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen;
228+ // Show windows that use TYPE_STATUS_BAR_SUB_PANEL when locked
229+ allowWhenLocked |= win.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL;
227230
228231 if (appShowWhenLocked != null) {
229232 allowWhenLocked |= appShowWhenLocked == win.mAppToken