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

Commit 3c3bef33 authored by Jagrut Desai's avatar Jagrut Desai
Browse files

Fixing taskbar being unstashed after opening to unfolded mode

Test: Manual,
Bug: 312723553
Flag: ACONFIG com.android.launcher3.enable_taskbar_pinning TRUNKFOOD
Change-Id: I91aa947a707e3fc918e617f207e823b2f1460466
parent e3e00c6e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -308,6 +308,9 @@ public class TaskbarManager {
                    }
                }
                mOldConfig = new Configuration(newConfig);
                // reset taskbar was pinned value, so we don't automatically unstash taskbar upon
                // user unfolding the device.
                mSharedState.setTaskbarWasPinned(false);
            }

            @Override
@@ -468,7 +471,7 @@ public class TaskbarManager {
     * In other case (folding/unfolding) we don't need to remove and add window.
     */
    @VisibleForTesting
    public void recreateTaskbar() {
    public synchronized void recreateTaskbar() {
        Trace.beginSection("recreateTaskbar");
        try {
            DeviceProfile dp = mUserUnlocked ?
+30 −27
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
     * by not scaling the height of the taskbar background.
     */
    private static final int TRANSITION_UNSTASH_SUW_MANUAL = 3;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef(value = {
            TRANSITION_DEFAULT,
@@ -205,7 +206,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
            TRANSITION_HANDLE_FADE,
            TRANSITION_UNSTASH_SUW_MANUAL,
    })
    private @interface StashAnimation {}
    private @interface StashAnimation {
    }

    private final TaskbarActivityContext mActivity;
    private final int mStashedHeight;
@@ -310,15 +312,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

        boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity);
        boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible;
        boolean taskbarWasPinned = mTaskbarSharedState.getTaskbarWasPinned();
        boolean isStashedInAppAuto = isTransientTaskbar && !taskbarWasPinned;

        // now that we know we need to keep transient taskbar unstashed after unpinning animation
        // we need to reset the shared state, so everytime user recreates taskbar we don't unstash
        // transient taskbar by default.
        if (mTaskbarSharedState.getTaskbarWasPinned()) {
            mTaskbarSharedState.setTaskbarWasPinned(false);
        }
        boolean isStashedInAppAuto =
                isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned();

        if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
            isStashedInAppAuto = isStashedInAppAuto && mTaskbarSharedState.taskbarWasStashedAuto;
@@ -332,7 +327,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 (taskbarWasPinned || !mTaskbarSharedState.taskbarWasStashedAuto) {
        if (mTaskbarSharedState.getTaskbarWasPinned()
                || !mTaskbarSharedState.taskbarWasStashedAuto) {
            tryStartTaskbarTimeout();
        }
        notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp());
@@ -426,6 +422,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Returns the height that taskbar will inset when inside apps.
     *
     * @see android.view.WindowInsets.Type#navigationBars()
     * @see android.view.WindowInsets.Type#systemBars()
     */
@@ -460,6 +457,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Returns the height that taskbar will inset when inside apps.
     *
     * @see android.view.WindowInsets.Type#tappableElement()
     */
    public int getTappableHeightToReportToApps() {
@@ -481,6 +479,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Stash or unstashes the transient taskbar.
     *
     * @param stash               whether transient taskbar should be stashed.
     * @param shouldBubblesFollow whether bubbles should match taskbars behavior.
     */
@@ -565,6 +564,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Create a stash animation and save to {@link #mAnimator}.
     *
     * @param isStashed     whether it's a stash animation or an unstash animation
     * @param duration      duration of the animation
     * @param animationType what transition type to play.
@@ -1018,6 +1018,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Called after updateStateForFlag() and applyState() have been called.
     *
     * @param changedFlags The flags that have changed.
     */
    private void onStateChangeApplied(int changedFlags) {
@@ -1091,6 +1092,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba

    /**
     * Updates the status of the taskbar timeout.
     *
     * @param isAutohideSuspended If true, cancels any existing timeout
     *                            If false, attempts to re/start the timeout
     */
@@ -1181,6 +1183,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        /**
         * Creates an animator (stored in mAnimator) which applies the latest state, potentially
         * creating a new animation (stored in mAnimator).
         *
         * @param flags    The latest flags to apply (see the top of this file).
         * @param duration The length of the animation.
         * @return mAnimator if mIsStashed changed, or {@code null} otherwise.