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

Commit 975fa692 authored by Mike Schneider's avatar Mike Schneider
Browse files

Fade out navbar on lockscreen -> homescreen transition

Introduces a new SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY QuickStepContract flag, to get an early signal when the keyguard is going away

Bug: 275319714
Test: transitions manual (http://shortn/_ySNBaPFHRZ), existing tapl tests
Change-Id: Ie0044ea8e934afa793ca56a4eacc2b776edbdf0e
parent 65ac592f
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_I
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -43,6 +44,7 @@ import android.animation.AnimatorSet;
import android.app.RemoteAction;
import android.content.SharedPreferences;
import android.graphics.drawable.Icon;
import android.os.SystemClock;
import android.util.Log;
import android.view.InsetsController;
import android.view.View;
@@ -187,6 +189,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    // Auto stashes when user has not interacted with the Taskbar after X ms.
    private static final long NO_TOUCH_TIMEOUT_TO_STASH_MS = 5000;

    // Duration for which an unlock event is considered "current", as other events are received
    // asynchronously.
    private static final long UNLOCK_TRANSITION_MEMOIZATION_MS = 200;

    /**
     * The default stash animation, morphing the taskbar into the navbar.
     */
@@ -951,7 +957,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        updateStateForFlag(FLAG_STASHED_SYSUI,
                hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING));

        boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
        boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED)
                && !hasAnyFlag(systemUiStateFlags, SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY);
        updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED, isLocked);

        // Only update FLAG_STASHED_IN_APP_IME when system gesture is not in progress.
@@ -1169,6 +1176,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        private @StashAnimation int mLastStartedTransitionType = TRANSITION_DEFAULT;
        private int mPrevFlags;

        private long mLastUnlockTransitionTimeout = 0;

        StatePropertyHolder(IntPredicate stashCondition) {
            mStashCondition = stashCondition;
        }
@@ -1199,6 +1208,17 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
                mPrevFlags = flags;
            }

            boolean isUnlockTransition = hasAnyFlag(changedFlags, FLAG_STASHED_DEVICE_LOCKED)
                    && !hasAnyFlag(FLAG_STASHED_DEVICE_LOCKED);
            if (isUnlockTransition) {
                // the launcher might not be resumed at the time the device is considered
                // unlocked (when the keyguard goes away), but possibly shortly afterwards.
                // To play the unlock transition at the time the unstash animation actually happens,
                // this memoizes the state transition for UNLOCK_TRANSITION_MEMOIZATION_MS.
                mLastUnlockTransitionTimeout =
                        SystemClock.elapsedRealtime() + UNLOCK_TRANSITION_MEMOIZATION_MS;
            }

            @StashAnimation int animationType = computeTransitionType(changedFlags);

            // Allow re-starting animation if upgrading from default animation type, otherwise
@@ -1229,6 +1249,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        }

        private @StashAnimation int computeTransitionType(int changedFlags) {

            boolean hotseatHiddenDuringAppLaunch =
                    !mControllers.uiController.isHotseatIconOnTopWhenAligned()
                            && hasAnyFlag(changedFlags, FLAG_IN_APP);
@@ -1240,8 +1261,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
                return TRANSITION_HANDLE_FADE;
            }

            boolean isUnlockTransition = hasAnyFlag(changedFlags, FLAG_STASHED_DEVICE_LOCKED)
                    && !hasAnyFlag(FLAG_STASHED_DEVICE_LOCKED);
            boolean isUnlockTransition =
                    SystemClock.elapsedRealtime() < mLastUnlockTransitionTimeout;
            if (isUnlockTransition) {
                // When transitioning to unlocked device, the  hotseat will already be visible on
                // the homescreen, thus do not play an un-stash animation.