Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcbe9481 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix issue when starting FLAG_DISMISS_KEYGUARD while occluded

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
parent 24b7a7d7
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -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);
+14 −0
Original line number Diff line number Diff line
@@ -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;

@@ -164,6 +167,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        updateStates();
    }

    /**
     * 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.
     */
@@ -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();
    }

    /**