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

Commit f441fd67 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

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
parent 4266fa49
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -86,4 +86,8 @@ public class TaskbarSharedState {
    public void setTaskbarWasPinned(boolean taskbarWasPinned) {
        mTaskbarWasPinned = taskbarWasPinned;
    }

    // To track if taskbar was stashed / unstashed between configuration changes (which recreates
    // the task bar).
    public Boolean taskbarWasStashedAuto = true;
}
+10 −3
Original line number Diff line number Diff line
@@ -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();
        }