diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 065646ad39..43b1ae04d5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -24,6 +24,7 @@ import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_OVERVIEW; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_FOR_BUBBLES; +import static com.android.launcher3.taskbar.TaskbarStashController.UNLOCK_TRANSITION_MEMOIZATION_MS; import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME; import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_IN_ANIM_ALPHA_DURATION_MS; import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_OUT_ANIM_POSITION_DURATION_MS; @@ -167,7 +168,12 @@ public class TaskbarLauncherStateController { private boolean mSkipNextRecentsAnimEnd; // Time when FLAG_TASKBAR_HIDDEN was last cleared, SystemClock.elapsedRealtime (milliseconds). - private long mLastUnlockTimeMs = 0; + private long mLastRemoveTaskbarHiddenTimeMs = 0; + /** + * Time when FLAG_DEVICE_LOCKED was last cleared, plus + * {@link TaskbarStashController#UNLOCK_TRANSITION_MEMOIZATION_MS} + */ + private long mLastUnlockTransitionTimeout; private @Nullable TaskBarRecentsAnimationListener mTaskBarRecentsAnimationListener; @@ -535,7 +541,7 @@ public class TaskbarLauncherStateController { if (hasAnyFlag(changedFlags, FLAG_TASKBAR_HIDDEN) && !hasAnyFlag(FLAG_TASKBAR_HIDDEN)) { // Take note of the current time, as the taskbar is made visible again. - mLastUnlockTimeMs = SystemClock.elapsedRealtime(); + mLastRemoveTaskbarHiddenTimeMs = SystemClock.elapsedRealtime(); } boolean isHidden = hasAnyFlag(FLAG_TASKBAR_HIDDEN); @@ -561,7 +567,8 @@ public class TaskbarLauncherStateController { // with a fingerprint reader. This should only be done when the device was woken // up via fingerprint reader, however since this information is currently not // available, opting to always delay the fade-in a bit. - long durationSinceLastUnlockMs = SystemClock.elapsedRealtime() - mLastUnlockTimeMs; + long durationSinceLastUnlockMs = SystemClock.elapsedRealtime() + - mLastRemoveTaskbarHiddenTimeMs; taskbarVisibility.setStartDelay( Math.max(0, TASKBAR_SHOW_DELAY_MS - durationSinceLastUnlockMs)); } @@ -631,6 +638,15 @@ public class TaskbarLauncherStateController { boolean isUnlockTransition = hasAnyFlag(changedFlags, FLAG_DEVICE_LOCKED) && !hasAnyFlag(FLAG_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; + } + boolean isInUnlockTimeout = SystemClock.elapsedRealtime() < mLastUnlockTransitionTimeout; + if (isUnlockTransition || isInUnlockTimeout) { // When transitioning to unlocked, ensure the hotseat is fully visible from the // beginning. The hotseat itself is animated by LauncherUnlockAnimationController. mIconAlignment.cancelAnimation(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 6222e53a5f..8991965f61 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -191,7 +191,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // Duration for which an unlock event is considered "current", as other events are received // asynchronously. - private static final long UNLOCK_TRANSITION_MEMOIZATION_MS = 200; + public static final long UNLOCK_TRANSITION_MEMOIZATION_MS = 200; /** * The default stash animation, morphing the taskbar into the navbar. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0fa9e60d06..05f84e29f0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -84,7 +84,6 @@ import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import java.io.PrintWriter; import java.util.Collections; import java.util.HashSet; -import java.util.List; import java.util.Set; import java.util.function.Predicate; @@ -330,7 +329,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar */ public void setRecentsButtonDisabled(boolean isDisabled) { // TODO: check TaskbarStashController#supportsStashing(), to stash instead of setting alpha. - mTaskbarIconAlpha.get(ALPHA_INDEX_RECENTS_DISABLED).setValue(isDisabled ? 0 : 1); + mTaskbarIconAlpha.get(ALPHA_INDEX_RECENTS_DISABLED).animateToValue(isDisabled ? 0 : 1) + .start(); } /**