From e93e6f9deb8d3c044d673ffb771b73b2346486a3 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 4 Aug 2016 13:55:39 +0200 Subject: [PATCH] Fix flickering issues with FLAG_SHOW_WHEN_LOCKED and fingerprint wake The whole sequence is different as Keyguard is occluded. Thus, we are not doing the normal keyguard exit sequence, but jump directly to dismissing the Keyguard. Normally the sequence is: - keyguardDone - notifyScreenTurningOn - startKeyguardExitAnim In the occluded case, it is: - keyguardDone - startKeyguardExitAnim - notifyScreenTurningOn Now, the following issues cause the flickering in the occluded case, which are normally not causing any breakage: - There was an issued with the draw callback not being reset and reused at the wrong time. - mWakeAndUnlocking was not cleared soon enough. This caused a timeout if notifyScreenTurningOn happens after starKeyguardExitAnim - We always need to wait for the Keyguard host window, as isForceHiding isn't set in this case Change-Id: Id8d0f9fec79ec63b36659513f97c724147c7521f Fixes: 30483392 --- .../com/android/systemui/keyguard/KeyguardViewMediator.java | 3 +++ .../core/java/com/android/server/wm/WindowManagerService.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index cfa4661d7a06d..5f2e3d1d66051 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1728,6 +1728,7 @@ public class KeyguardViewMediator extends SystemUI { // this to our ViewRootImpl. mStatusBarKeyguardViewManager.getViewRootImpl().setReportNextDraw(); notifyDrawn(mDrawnCallback); + mDrawnCallback = null; } // only play "unlock" noises if not on a call (since the incall UI @@ -1736,6 +1737,7 @@ public class KeyguardViewMediator extends SystemUI { playSounds(false); } + mWakeAndUnlocking = false; setShowingLocked(false); mStatusBarKeyguardViewManager.hide(startTime, fadeoutDuration); resetKeyguardDonePendingLocked(); @@ -1862,6 +1864,7 @@ public class KeyguardViewMediator extends SystemUI { synchronized (this) { if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOff"); mStatusBarKeyguardViewManager.onScreenTurnedOff(); + mDrawnCallback = null; mWakeAndUnlocking = false; } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 6451c7492fa82..b4085f5177b43 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -11445,8 +11445,9 @@ public class WindowManagerService extends IWindowManager.Stub for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { final WindowState win = windows.get(winNdx); final boolean isForceHiding = mPolicy.isForceHiding(win.mAttrs); + final boolean keyguard = mPolicy.isKeyguardHostWindow(win.mAttrs); if (win.isVisibleLw() - && (win.mAppToken != null || isForceHiding)) { + && (win.mAppToken != null || isForceHiding || keyguard)) { win.mWinAnimator.mDrawState = DRAW_PENDING; // Force add to mResizingWindows. win.mLastContentInsets.set(-1, -1, -1, -1);