OSDN Git Service

Fix issue when starting FLAG_DISMISS_KEYGUARD while occluded
authorJorim Jaggi <jjaggi@google.com>
Wed, 23 Nov 2016 16:37:49 +0000 (17:37 +0100)
committerJorim Jaggi <jjaggi@google.com>
Fri, 2 Dec 2016 12:44:03 +0000 (12:44 +0000)
Since KS.dismiss comes in before KG.setOccluded, we didn't defer
Keyguard going away until the shade was closed, which lead to
an ugly switch to the normal shade during the dismissal animation.

Test: Start FLAG_DISMISS_KEYGUARD while occluded to show bouncer,
make sure unlock animation is clean.

Test: Open settings from shade while Keyguard is occluded, make
sure animation is clean.

Change-Id: I31bdeb8077570ef2c50759321178f03601f1fa0d

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java

index 2b74c84..2c61358 100644 (file)
@@ -3572,10 +3572,18 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
             final boolean dismissShade,
             final boolean afterKeyguardGone,
             final boolean deferred) {
-        dismissKeyguardThenExecute(() -> {
+        final Runnable dismissAction = () -> {
             if (runnable != null) {
                 AsyncTask.execute(runnable);
             }
+        };
+        dismissKeyguardThenExecute(() -> {
+            if (mStatusBarKeyguardViewManager.isShowing()
+                    && mStatusBarKeyguardViewManager.isOccluded()) {
+                mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable);
+            } else {
+                dismissAction.run();
+            }
             if (dismissShade) {
                 if (mExpandedVisible) {
                     animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
@@ -3664,8 +3672,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
 
     private void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
             boolean afterKeyguardGone) {
-        afterKeyguardGone |= mStatusBarKeyguardViewManager.isShowing()
-                && mStatusBarKeyguardViewManager.isOccluded();
         if (mStatusBarKeyguardViewManager.isShowing()) {
             mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction,
                     afterKeyguardGone);
index 4263670..2e279b2 100644 (file)
@@ -40,6 +40,8 @@ import com.android.systemui.statusbar.RemoteInputController;
 import static com.android.keyguard.KeyguardHostView.OnDismissAction;
 import static com.android.systemui.statusbar.phone.FingerprintUnlockController.*;
 
+import java.util.ArrayList;
+
 /**
  * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back
  * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done,
@@ -90,6 +92,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
     protected boolean mLastRemoteInputActive;
 
     private OnDismissAction mAfterKeyguardGoneAction;
+    private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
     private boolean mDeviceWillWakeUp;
     private boolean mDeferScrimFadeOut;
 
@@ -165,6 +168,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
     }
 
     /**
+     * Adds a {@param runnable} to be executed after Keyguard is gone.
+     */
+    public void addAfterKeyguardGoneRunnable(Runnable runnable) {
+        mAfterKeyguardGoneRunnables.add(runnable);
+    }
+
+    /**
      * Reset the state of the view.
      */
     public void reset(boolean hideBouncerWhenShowing) {
@@ -418,6 +428,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
             mAfterKeyguardGoneAction.onDismiss();
             mAfterKeyguardGoneAction = null;
         }
+        for (int i = 0; i < mAfterKeyguardGoneRunnables.size(); i++) {
+            mAfterKeyguardGoneRunnables.get(i).run();
+        }
+        mAfterKeyguardGoneRunnables.clear();
     }
 
     /**