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

Commit a06ad834 authored by Tony Wickham's avatar Tony Wickham
Browse files

Allow quick switch from 3P launcher home in 2 button mode

Only the FallbackSwipeHandler supports quickswitch mode on the
home screen, but we only used that handler for fully gestural
mode. Now we also use that handler for 2-button mode if both
of these conditions are met:
- User is on the home screen
- User swipes right on the nav region (instead of up)

Also fix issues with continuous quick switch gestures by setting
the appropriate end target NEW_TASK instead of HOME.

Bug: 140467002
Change-Id: I8f327638b48cf4c0acb1ebe265b7846afac6759b
parent 56c9c86f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa
    @Override
    public void onConsumerAboutToBeSwitched() {
        if (mInQuickSwitchMode && mGestureState.getEndTarget() != null) {
            mGestureState.setEndTarget(HOME);
            mGestureState.setEndTarget(NEW_TASK);

            mCanceled = true;
            mCurrentShift.cancelAnimation();
+23 −3
Original line number Diff line number Diff line
@@ -559,10 +559,13 @@ public class TouchInteractionService extends Service implements PluginListener<O
        final boolean shouldDefer;
        final BaseSwipeUpHandler.Factory factory;

        if (mDeviceState.isFullyGesturalNavMode()
                && !mOverviewComponentObserver.isHomeAndOverviewSame()) {
        if (!mOverviewComponentObserver.isHomeAndOverviewSame()) {
            shouldDefer = previousGestureState.getFinishingRecentsAnimationTaskId() < 0;
            if (mDeviceState.isFullyGesturalNavMode()) {
                factory = mFallbackSwipeHandlerFactory;
            } else {
                factory = this::determineFallbackTwoButtonSwipeHandler;
            }
        } else {
            shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState,
                    event);
@@ -575,6 +578,23 @@ public class TouchInteractionService extends Service implements PluginListener<O
                mInputMonitorCompat, disableHorizontalSwipe, factory);
    }

    /**
     * Determines whether to use the LauncherSwipeHandler or FallbackSwipeHandler at runtime.
     * We need to use the FallbackSwipeHandler to handle quick switch from home, otherwise the
     * normal LauncherSwipeHandler works.
     */
    private BaseSwipeUpHandler determineFallbackTwoButtonSwipeHandler(GestureState gestureState,
            long touchTimeMs, boolean continuingLastGesture, boolean isLikelyToStartNewTask) {
        boolean runningOverHome = gestureState.getRunningTask() == null
                || ActivityManagerWrapper.isHomeTask(gestureState.getRunningTask());
        boolean isQuickSwitchMode = isLikelyToStartNewTask || continuingLastGesture;
        BaseSwipeUpHandler.Factory factory = runningOverHome && isQuickSwitchMode
                ? mFallbackSwipeHandlerFactory
                : mLauncherSwipeHandlerFactory;
        return factory.newHandler(gestureState, touchTimeMs, continuingLastGesture,
                isLikelyToStartNewTask);
    }

    private InputConsumer createDeviceLockedInputConsumer(GestureState gestureState) {
        if (mDeviceState.isFullyGesturalNavMode() && gestureState.getRunningTask() != null) {
            return new DeviceLockedInputConsumer(this, mDeviceState, mTaskAnimationManager,