Make sure the task bar stays unstashed upon configuration change

So we recreate task bars when configuration is changed, if ENABLE_TASKBAR_NAVBAR_UNIFICATION = true. In order for unstashed state to propagate, we need to save STASHED_IN_APP_AUTO in TaskbarSharedState.

Fixes: 311429718
Test: Unstash the task bar in app, rotate, make sure the task bar stays unstashed
Change-Id: I7db773725ea89976612e9e91af5b6911d0ec5fc0
This commit is contained in:
Tracy Zhou
2023-12-04 20:17:14 -08:00
parent 4266fa49e2
commit f441fd67d3
2 changed files with 14 additions and 3 deletions
@@ -21,6 +21,7 @@ import static com.android.app.animation.Interpolators.EMPHASIZED;
import static com.android.app.animation.Interpolators.FINAL_FRAME;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW;
import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED;
@@ -306,8 +307,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity);
boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible;
updateStateForFlag(FLAG_STASHED_IN_APP_AUTO,
isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned());
boolean isStashedInAppAuto =
isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned();
if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
isStashedInAppAuto = isStashedInAppAuto && mTaskbarSharedState.taskbarWasStashedAuto;
}
updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, isStashedInAppAuto);
updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup);
updateStateForFlag(FLAG_IN_SETUP, isInSetup);
updateStateForFlag(FLAG_STASHED_SMALL_SCREEN, isPhoneMode()
@@ -316,7 +321,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
// us that we're paused until a bit later. This avoids flickering upon recreating taskbar.
updateStateForFlag(FLAG_IN_APP, true);
applyState(/* duration = */ 0);
if (mTaskbarSharedState.getTaskbarWasPinned()) {
if (mTaskbarSharedState.getTaskbarWasPinned()
|| !mTaskbarSharedState.taskbarWasStashedAuto) {
tryStartTaskbarTimeout();
}
notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp());
@@ -491,6 +497,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
}
if (hasAnyFlag(FLAG_STASHED_IN_APP_AUTO) != stash) {
mTaskbarSharedState.taskbarWasStashedAuto = stash;
updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, stash);
applyState();
}