diff options
| author | 2021-06-08 17:51:02 +0000 | |
|---|---|---|
| committer | 2021-06-08 17:51:02 +0000 | |
| commit | 0d0d1ae6496d1fbc91dcfbb6cddef065b716d625 (patch) | |
| tree | 5d1a5831b02c7dfe3b287e7fcec2861825bb6359 | |
| parent | bf37dd716d2d6e52efc1dd360d4365bcfccd4f02 (diff) | |
| parent | 6d22064dcd921081d3b77e5085fe4bef5ce27a39 (diff) | |
Merge "Call KeyguardViewMediator#hideWithAnimation on the main thread" into sc-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 11 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | 7 |
2 files changed, 14 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index a159984ddcd3..56efafba4640 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1651,14 +1651,19 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, Trace.endSection(); } - /** Hide the keyguard and let {@code runner} handle the animation. */ + /** + * Hide the keyguard and let {@code runner} handle the animation. + * + * This method should typically be called after {@link ViewMediatorCallback#keyguardDonePending} + * was called, when we are ready to hide the keyguard. + */ public void hideWithAnimation(IRemoteAnimationRunner runner) { - if (!mShowing) { + if (!mKeyguardDonePending) { return; } mKeyguardExitAnimationRunner = runner; - hideLocked(); + mViewMediatorCallback.readyForKeyguardDone(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 06aedaa5d06e..09779d12f7b3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -2118,7 +2118,12 @@ public class StatusBar extends SystemUI implements DemoMode, return; } - mKeyguardViewMediator.hideWithAnimation(runner); + // We post to the main thread for 2 reasons: + // 1. KeyguardViewMediator is not thread-safe. + // 2. To ensure that ViewMediatorCallback#keyguardDonePending is called before + // ViewMediatorCallback#readyForKeyguardDone. The wrong order could occur when doing + // dismissKeyguardThenExecute { hideKeyguardWithAnimation(runner) }. + mMainThreadHandler.post(() -> mKeyguardViewMediator.hideWithAnimation(runner)); } @Override |