Synchronize the app launch and taskbar stash animations.

Introduce FLAG_IGNORE_IN_APP to prevent taskbar from stashing
prematurely due to HomeTransitionListener signal.

Fixes leak by adding event callback to clear runnable when launcher is
destroyed.

Bug: 319162553
Test: Launch an app, note the two animations are synced
      Verified by locally introducing a startDelay (since otherwise it is hard to tell)
Flag: com.android.launcher3.sync_app_launch_with_taskbar_stash
Change-Id: I684c714bb84fb1717b0e26620f2aa938671eb19a
This commit is contained in:
Jon Miranda
2025-03-12 14:37:09 -07:00
parent 380da627e9
commit 0779b1fa1b
3 changed files with 66 additions and 0 deletions
@@ -23,6 +23,7 @@ import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.internal.jank.InteractionJankMonitor.Configuration;
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
import static com.android.launcher3.Flags.syncAppLaunchWithTaskbarStash;
import static com.android.launcher3.QuickstepTransitionManager.PINNED_TASKBAR_TRANSITION_DURATION;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE;
@@ -107,6 +108,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
// taskbar should always be stashed for bubble bar on phone
public static final int FLAG_STASHED_BUBBLE_BAR_ON_PHONE = 1 << 15;
public static final int FLAG_IGNORE_IN_APP = 1 << 16; // used to sync with app launch animation
// If any of these flags are enabled, isInApp should return true.
private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP;
@@ -1412,6 +1415,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
*/
@Nullable
public Animator createSetStateAnimator(long flags, long duration) {
// We do this when we want to synchronize the app launch and taskbar stash animations.
if (syncAppLaunchWithTaskbarStash()
&& hasAnyFlag(FLAG_IGNORE_IN_APP)
&& hasAnyFlag(flags, FLAG_IN_APP)) {
flags = flags & ~FLAG_IN_APP;
}
boolean isStashed = mStashCondition.test(flags);
if (DEBUG) {