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

Commit 70f99847 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Allow quick switch from 3P launcher home in 2 button mode" into ub-launcher3-master

parents dfa1a205 a06ad834
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -283,7 +283,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,