Make Keyguard a library and make StatusBar the new Keyguard.
This change achieves a couple of things:
- Let Keyguard be a library, so we can use it in SystemUI.
- Introduce FLAG_KEYGUARD for windows and deprecate TYPE_KEYGUARD. Make
all the TYPE_KEYGUARD behaviour dependant on the flag.
- Implement a new KeyguardService in SystemUI, and bind that service
from PhoneWindowManager.
- Introduce BaseStatusBar.setKeyguardState and inflate
KeyguardSimpleHostView there and use FLAG_KEYGUARD for the window, such
that the status bar window essentially gets the Keyguard.
Bug: 13635952
Change-Id: I059d80d8b9b9818a778ab685f4672ea2694def63
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 35f873e..a72965d 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -2972,7 +2972,6 @@
return AccessibilityWindowInfo.TYPE_INPUT_METHOD;
}
- case WindowManager.LayoutParams.TYPE_KEYGUARD:
case WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG:
case WindowManager.LayoutParams.TYPE_NAVIGATION_BAR:
case WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL:
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index 4aae5c1..a1b82c4 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -284,7 +284,7 @@
final boolean hasFocus = (child == mInputFocus);
final boolean isVisible = child.isVisibleLw();
final boolean hasWallpaper = (child == mService.mWallpaperTarget)
- && (type != WindowManager.LayoutParams.TYPE_KEYGUARD);
+ && (privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD) == 0;
final boolean onDefaultDisplay = (child.getDisplayId() == Display.DEFAULT_DISPLAY);
// If there's a drag in progress and 'child' is a potential drop target,
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index dcf5880..c6e997e 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1885,7 +1885,9 @@
int insertionIndex = 0;
if (visible && foundW != null) {
final int type = foundW.mAttrs.type;
- if (type == TYPE_KEYGUARD || type == TYPE_KEYGUARD_SCRIM) {
+ final int privateFlags = foundW.mAttrs.privateFlags;
+ if ((privateFlags & PRIVATE_FLAG_KEYGUARD) != 0
+ || type == TYPE_KEYGUARD_SCRIM) {
insertionIndex = windows.indexOf(foundW);
}
}
@@ -5347,7 +5349,7 @@
final int N = windows.size();
for (int i=0; i<N; i++) {
WindowState w = windows.get(i);
- if (w.mAttrs.type == TYPE_KEYGUARD) {
+ if ((w.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
// Only if there is a keyguard attached to the window manager
// will we consider ourselves as having a keyguard. If it
// isn't attached, we don't know if it wants to be shown or
@@ -5369,7 +5371,7 @@
haveApp = true;
} else if (w.mAttrs.type == TYPE_WALLPAPER) {
haveWallpaper = true;
- } else if (w.mAttrs.type == TYPE_KEYGUARD) {
+ } else if ((w.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
haveKeyguard = true;
}
}
@@ -8307,7 +8309,7 @@
// just don't display").
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
|| ((win.isConfigChanged() || win.setInsetsChanged()) &&
- (win.mAttrs.type == TYPE_KEYGUARD ||
+ ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 ||
win.mAppToken != null && win.mAppToken.layoutConfigChanges))
|| win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
if (!win.mLayoutAttached) {
@@ -8847,8 +8849,8 @@
if (canBeSeen
&& (type == TYPE_SYSTEM_DIALOG
|| type == TYPE_RECENTS_OVERLAY
- || type == TYPE_KEYGUARD
- || type == TYPE_SYSTEM_ERROR)) {
+ || type == TYPE_SYSTEM_ERROR
+ || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0)) {
mInnerFields.mSyswin = true;
}
@@ -8861,7 +8863,7 @@
// content on secondary displays (by forcibly enabling mirroring unless
// there is other content we want to show) but still allow opaque
// keyguard dialogs to be shown.
- if (type == TYPE_DREAM || type == TYPE_KEYGUARD) {
+ if (type == TYPE_DREAM || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
mInnerFields.mObscureApplicationContentOnSecondaryDisplays = true;
}
mInnerFields.mDisplayHasContent = true;
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 2c0e99e..2ff4830 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -23,12 +23,12 @@
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
-import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import android.app.AppOpsManager;
@@ -1010,7 +1010,7 @@
&& (mConfiguration == null
|| (mConfiguration.diff(mService.mCurConfiguration) != 0));
- if (mAttrs.type == TYPE_KEYGUARD) {
+ if ((mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
// Retain configuration changed status until resetConfiguration called.
mConfigHasChanged |= configChanged;
configChanged = mConfigHasChanged;