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

Commit 20fdc7b5 authored by Jon Miranda's avatar Jon Miranda Committed by Jon @
Browse files

Move taskbar clean up so that it only gets called when user swipes up to go home.

This fixes the bug where the flag gets set when user taps on nav handle, which
results in the taskbar animation playing.

Flag: N/A
Test: open app
      wait for taskbar to finish stashing*
      tap on nav handle
      nothing happens (desired affect)
      * I will address tapping on taskbar while its animating in a separate change
Bug: 292108880
Change-Id: I75870050225bdd951c69224d272d0bd5a3d6d4ea
parent 4266fa49
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -203,6 +203,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation);
    }

    @Override
    public void onStateTransitionCompletedAfterSwipeToHome(LauncherState state) {
        mTaskbarLauncherStateController.onStateTransitionCompletedAfterSwipeToHome(state);
    }

    @Override
    public void refreshResumedState() {
        onLauncherVisibilityChanged(mLauncher.hasBeenResumed());
+15 −7
Original line number Diff line number Diff line
@@ -205,13 +205,6 @@ public class TaskbarLauncherStateController {
                public void onStateTransitionComplete(LauncherState finalState) {
                    mLauncherState = finalState;
                    updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false);
                    // TODO(b/279514548) Cleans up bad state that can occur when user interacts with
                    // taskbar on top of transparent activity.
                    if (!FeatureFlags.enableHomeTransitionListener()
                            && finalState == LauncherState.NORMAL
                            && mLauncher.hasBeenResumed()) {
                        updateStateForFlag(FLAG_VISIBLE, true);
                    }
                    applyState();
                    boolean disallowLongClick =
                            FeatureFlags.enableSplitContextually()
@@ -223,6 +216,21 @@ public class TaskbarLauncherStateController {
                }
            };

    /**
     * Callback for when launcher state transition completes after user swipes to home.
     * @param finalState The final state of the transition.
     */
    public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) {
        // TODO(b/279514548) Cleans up bad state that can occur when user interacts with
        // taskbar on top of transparent activity.
        if (!FeatureFlags.enableHomeTransitionListener()
                && (finalState == LauncherState.NORMAL)
                && mLauncher.hasBeenResumed()) {
            updateStateForFlag(FLAG_VISIBLE, true);
            applyState();
        }
    }

    /** Initializes the controller instance, and applies the initial state immediately. */
    public void init(TaskbarControllers controllers, QuickstepLauncher launcher,
            int sysuiStateFlags) {
+9 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
@@ -329,6 +330,14 @@ public class TaskbarUIController {
        return null;
    }

    /**
     * Callback for when launcher state transition completes after user swipes to home.
     * @param finalState The final state of the transition.
     */
    public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) {
        // Overridden
    }

    /**
     * Refreshes the resumed state of this ui controller.
     */
+7 −0
Original line number Diff line number Diff line
@@ -706,6 +706,13 @@ public class QuickstepLauncher extends Launcher {
        return mSplitSelectStateController.isSplitSelectActive();
    }

    @Override
    public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) {
        if (mTaskbarUIController != null) {
            mTaskbarUIController.onStateTransitionCompletedAfterSwipeToHome(finalState);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
+15 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.TouchController;
@@ -194,7 +195,20 @@ public class NavBarToHomeTouchController implements TouchController,
            recentsView.switchToScreenshot(null,
                    () -> recentsView.finishRecentsAnimation(true /* toRecents */, null));
            if (mStartState.overviewUi) {
                new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState),
                Runnable onReachedHome = () -> {
                    StateManager.StateListener<LauncherState> listener =
                            new StateManager.StateListener<>() {
                                @Override
                                public void onStateTransitionComplete(LauncherState finalState) {
                                    mLauncher.onStateTransitionCompletedAfterSwipeToHome(
                                            finalState);
                                    mLauncher.getStateManager().removeStateListener(this);
                                }
                            };
                    mLauncher.getStateManager().addStateListener(listener);
                    onSwipeInteractionCompleted(mEndState);
                };
                new OverviewToHomeAnim(mLauncher, onReachedHome,
                        FeatureFlags.enableSplitContextually()
                                ? mCancelSplitRunnable
                                : null)
Loading