Fix black keyguard / missing status bar
The status bar window was stuck in the READY_TO_SHOW state
because it was not policy visible, whereas the policy
was waiting for the window to become HAS_DRAWN.
Now BarController also updates states if the window
is READY_TO_SHOW, which in turn allows the window to
become visible and HAS_DRAWN.
Bug: 22072099
Change-Id: I1836c276723ee2205d7d5759be079f02aaa23e2e
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 64210ea..be564f8 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -342,6 +342,14 @@
boolean isGoneForLayoutLw();
/**
+ * Returns true if the window has a surface that it has drawn a
+ * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
+ * in that it also returns true if the window is READY_TO_SHOW, but was not yet
+ * promoted to HAS_DRAWN.
+ */
+ boolean isDrawnLw();
+
+ /**
* Returns true if this window has been shown on screen at some time in
* the past. Must be called with the window manager lock held.
*/
diff --git a/services/core/java/com/android/server/policy/BarController.java b/services/core/java/com/android/server/policy/BarController.java
index 5877b3e..9095f57 100644
--- a/services/core/java/com/android/server/policy/BarController.java
+++ b/services/core/java/com/android/server/policy/BarController.java
@@ -155,7 +155,7 @@
}
private int computeStateLw(boolean wasVis, boolean wasAnim, WindowState win, boolean change) {
- if (win.hasDrawnLw()) {
+ if (win.isDrawnLw()) {
final boolean vis = win.isVisibleLw();
final boolean anim = win.isAnimatingLw();
if (mState == StatusBarManager.WINDOW_STATE_HIDING && !change && !vis) {
@@ -198,7 +198,7 @@
}
public boolean checkHiddenLw() {
- if (mWin != null && mWin.hasDrawnLw()) {
+ if (mWin != null && mWin.isDrawnLw()) {
if (!mWin.isVisibleLw() && !mWin.isAnimatingLw()) {
updateStateLw(StatusBarManager.WINDOW_STATE_HIDDEN);
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index b918a25..c2548de 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1104,6 +1104,7 @@
* Returns true if the window has a surface that it has drawn a
* complete UI in to.
*/
+ @Override
public boolean isDrawnLw() {
return mHasSurface && !mDestroying &&
(mWinAnimator.mDrawState == WindowStateAnimator.READY_TO_SHOW