frameworks/base
修訂 | 596c1da03801a3ffe8d6a5adc78b450f0914e7bb (tree) |
---|---|
時間 | 2016-10-11 09:11:23 |
作者 | d34d <clark@cyng...> |
Commiter | SM |
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:
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
@@ -239,6 +239,7 @@ public interface WindowManager extends ViewManager { | ||
239 | 239 | * @see #TYPE_SYSTEM_ERROR |
240 | 240 | * @see #TYPE_INPUT_METHOD |
241 | 241 | * @see #TYPE_INPUT_METHOD_DIALOG |
242 | + * @see #TYPE_KEYGUARD_PANEL | |
242 | 243 | */ |
243 | 244 | @ViewDebug.ExportedProperty(mapping = { |
244 | 245 | @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"), |
@@ -281,7 +282,8 @@ public interface WindowManager extends ViewManager { | ||
281 | 282 | @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"), |
282 | 283 | @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"), |
283 | 284 | @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"), | |
285 | 287 | }) |
286 | 288 | public int type; |
287 | 289 |
@@ -642,6 +644,13 @@ public interface WindowManager extends ViewManager { | ||
642 | 644 | public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36; |
643 | 645 | |
644 | 646 | /** |
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 | + /** | |
645 | 654 | * End of types of system windows. |
646 | 655 | */ |
647 | 656 | public static final int LAST_SYSTEM_WINDOW = 2999; |
@@ -425,6 +425,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
425 | 425 | boolean mNavigationBarLeftInLandscape = false; // Navigation bar left handed? |
426 | 426 | |
427 | 427 | boolean mBootMessageNeedsHiding; |
428 | + | |
429 | + WindowState mKeyguardPanel; | |
430 | + | |
431 | + | |
428 | 432 | KeyguardServiceDelegate mKeyguardDelegate; |
429 | 433 | final Runnable mWindowManagerDrawCallback = new Runnable() { |
430 | 434 | @Override |
@@ -2479,6 +2483,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
2479 | 2483 | permission = android.Manifest.permission.SYSTEM_ALERT_WINDOW; |
2480 | 2484 | outAppOp[0] = AppOpsManager.OP_SYSTEM_ALERT_WINDOW; |
2481 | 2485 | break; |
2486 | + case TYPE_KEYGUARD_PANEL: | |
2487 | + permission = | |
2488 | + org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD; | |
2489 | + break; | |
2482 | 2490 | default: |
2483 | 2491 | permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; |
2484 | 2492 | } |
@@ -2572,6 +2580,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
2572 | 2580 | case TYPE_VOLUME_OVERLAY: |
2573 | 2581 | case TYPE_PRIVATE_PRESENTATION: |
2574 | 2582 | case TYPE_DOCK_DIVIDER: |
2583 | + case TYPE_KEYGUARD_PANEL: | |
2575 | 2584 | break; |
2576 | 2585 | } |
2577 | 2586 |
@@ -2761,6 +2770,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
2761 | 2770 | // the safety window that shows behind keyguard while keyguard is starting |
2762 | 2771 | return 14; |
2763 | 2772 | case TYPE_STATUS_BAR_SUB_PANEL: |
2773 | + case TYPE_KEYGUARD_PANEL: | |
2764 | 2774 | return 15; |
2765 | 2775 | case TYPE_STATUS_BAR: |
2766 | 2776 | return 16; |
@@ -3128,6 +3138,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
3128 | 3138 | android.Manifest.permission.STATUS_BAR_SERVICE, |
3129 | 3139 | "PhoneWindowManager"); |
3130 | 3140 | 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; | |
3131 | 3150 | case TYPE_KEYGUARD_SCRIM: |
3132 | 3151 | if (mKeyguardScrim != null) { |
3133 | 3152 | return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON; |
@@ -3148,9 +3167,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
3148 | 3167 | } else if (mKeyguardScrim == win) { |
3149 | 3168 | Log.v(TAG, "Removing keyguard scrim"); |
3150 | 3169 | mKeyguardScrim = null; |
3151 | - } if (mNavigationBar == win) { | |
3170 | + } else if (mNavigationBar == win) { | |
3152 | 3171 | mNavigationBar = null; |
3153 | 3172 | mNavigationBarController.setWindow(null); |
3173 | + } else if (mKeyguardPanel == win) { | |
3174 | + mKeyguardPanel = null; | |
3154 | 3175 | } |
3155 | 3176 | } |
3156 | 3177 |
@@ -5117,7 +5138,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { | ||
5117 | 5138 | // gets everything, period. |
5118 | 5139 | if (attrs.type == TYPE_STATUS_BAR_PANEL |
5119 | 5140 | || 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) { | |
5121 | 5143 | pf.left = df.left = of.left = cf.left = hasNavBar |
5122 | 5144 | ? mDockLeft : mUnrestrictedScreenLeft; |
5123 | 5145 | pf.top = df.top = of.top = cf.top = mUnrestrictedScreenTop; |
@@ -52,6 +52,7 @@ import android.util.TimeUtils; | ||
52 | 52 | import android.view.Choreographer; |
53 | 53 | import android.view.Display; |
54 | 54 | import android.view.SurfaceControl; |
55 | +import android.view.WindowManager; | |
55 | 56 | import android.view.WindowManagerPolicy; |
56 | 57 | import android.view.animation.AlphaAnimation; |
57 | 58 | import android.view.animation.Animation; |
@@ -224,6 +225,8 @@ public class WindowAnimator { | ||
224 | 225 | allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard; |
225 | 226 | // Show SHOW_WHEN_LOCKED windows that turn on the screen |
226 | 227 | 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; | |
227 | 230 | |
228 | 231 | if (appShowWhenLocked != null) { |
229 | 232 | allowWhenLocked |= appShowWhenLocked == win.mAppToken |