Loading quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten private static final String TAG = "BaseSwipeUpHandler"; protected static final Rect TEMP_RECT = new Rect(); public static final float MIN_PROGRESS_FOR_OVERVIEW = 0.7f; private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL; // The distance needed to drag to reach the task size in recents. Loading quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +35 −14 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static com.android.quickstep.GestureState.GestureEndTarget.HOME; import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.LauncherSwipeHandler.MIN_PROGRESS_FOR_OVERVIEW; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.RecentsActivity.EXTRA_TASK_ID; import static com.android.quickstep.RecentsActivity.EXTRA_THUMBNAIL; Loading Loading @@ -97,7 +96,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa private final AnimatedFloat mLauncherAlpha = new AnimatedFloat(this::onLauncherAlphaChanged); private boolean mIsMotionPaused = false; private boolean mOverviewThresholdPassed = false; private final boolean mInQuickSwitchMode; private final boolean mContinuingLastGesture; Loading Loading @@ -222,10 +221,16 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa @Override public void onMotionPauseChanged(boolean isPaused) { if (!mInQuickSwitchMode) { mIsMotionPaused = isPaused; if (!mInQuickSwitchMode && mDeviceState.isFullyGesturalNavMode()) { updateOverviewThresholdPassed(isPaused); } } private void updateOverviewThresholdPassed(boolean passed) { if (passed != mOverviewThresholdPassed) { mOverviewThresholdPassed = passed; if (mSwipeUpOverHome) { mLauncherAlpha.animateToValue(mLauncherAlpha.value, isPaused ? 0 : 1) mLauncherAlpha.animateToValue(mLauncherAlpha.value, passed ? 0 : 1) .setDuration(150).start(); } performHapticFeedback(); Loading @@ -234,7 +239,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa @Override public Intent getLaunchIntent() { if (mInQuickSwitchMode || mSwipeUpOverHome) { if (mInQuickSwitchMode || mSwipeUpOverHome || !mDeviceState.isFullyGesturalNavMode()) { return mGestureState.getOverviewIntent(); } else { return mGestureState.getHomeIntent(); Loading @@ -248,6 +253,11 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa mRecentsAnimationController.setWindowThresholdCrossed(!mInQuickSwitchMode && (mCurrentShift.value > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD)); } if (!mInQuickSwitchMode && !mDeviceState.isFullyGesturalNavMode()) { updateOverviewThresholdPassed(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW); } if (mRecentsAnimationTargets != null) { applyTransformUnchecked(); } Loading @@ -271,15 +281,26 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa .getDimension(R.dimen.quickstep_fling_threshold_velocity); boolean isFling = Math.abs(endVelocity) > flingThreshold; if (mDeviceState.isFullyGesturalNavMode()) { if (isFling) { mGestureState.setEndTarget(endVelocity < 0 ? HOME : LAST_TASK); } else if (mIsMotionPaused) { } else if (mOverviewThresholdPassed) { mGestureState.setEndTarget(RECENTS); } else { mGestureState.setEndTarget(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? HOME : LAST_TASK); } } else { GestureEndTarget startState = mSwipeUpOverHome ? HOME : LAST_TASK; if (isFling) { mGestureState.setEndTarget(endVelocity < 0 ? RECENTS : startState); } else { mGestureState.setEndTarget(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? RECENTS : startState); } } } mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED); } Loading Loading @@ -353,7 +374,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa mRecentsAnimationController.finish(false, null, false); break; case RECENTS: { if (mSwipeUpOverHome) { if (mSwipeUpOverHome || !mDeviceState.isFullyGesturalNavMode()) { mRecentsAnimationController.finish(true, null, true); break; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +1 −22 Original line number Diff line number Diff line Loading @@ -616,11 +616,7 @@ public class TouchInteractionService extends Service implements PluginListener<O if (!mOverviewComponentObserver.isHomeAndOverviewSame()) { shouldDefer = previousGestureState.getFinishingRecentsAnimationTaskId() < 0; if (mDeviceState.isFullyGesturalNavMode()) { factory = mFallbackSwipeHandlerFactory; } else { factory = this::determineFallbackTwoButtonSwipeHandler; } } else { shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); Loading @@ -633,23 +629,6 @@ 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, Loading Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten private static final String TAG = "BaseSwipeUpHandler"; protected static final Rect TEMP_RECT = new Rect(); public static final float MIN_PROGRESS_FOR_OVERVIEW = 0.7f; private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL; // The distance needed to drag to reach the task size in recents. Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +35 −14 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static com.android.quickstep.GestureState.GestureEndTarget.HOME; import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.LauncherSwipeHandler.MIN_PROGRESS_FOR_OVERVIEW; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.RecentsActivity.EXTRA_TASK_ID; import static com.android.quickstep.RecentsActivity.EXTRA_THUMBNAIL; Loading Loading @@ -97,7 +96,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa private final AnimatedFloat mLauncherAlpha = new AnimatedFloat(this::onLauncherAlphaChanged); private boolean mIsMotionPaused = false; private boolean mOverviewThresholdPassed = false; private final boolean mInQuickSwitchMode; private final boolean mContinuingLastGesture; Loading Loading @@ -222,10 +221,16 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa @Override public void onMotionPauseChanged(boolean isPaused) { if (!mInQuickSwitchMode) { mIsMotionPaused = isPaused; if (!mInQuickSwitchMode && mDeviceState.isFullyGesturalNavMode()) { updateOverviewThresholdPassed(isPaused); } } private void updateOverviewThresholdPassed(boolean passed) { if (passed != mOverviewThresholdPassed) { mOverviewThresholdPassed = passed; if (mSwipeUpOverHome) { mLauncherAlpha.animateToValue(mLauncherAlpha.value, isPaused ? 0 : 1) mLauncherAlpha.animateToValue(mLauncherAlpha.value, passed ? 0 : 1) .setDuration(150).start(); } performHapticFeedback(); Loading @@ -234,7 +239,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa @Override public Intent getLaunchIntent() { if (mInQuickSwitchMode || mSwipeUpOverHome) { if (mInQuickSwitchMode || mSwipeUpOverHome || !mDeviceState.isFullyGesturalNavMode()) { return mGestureState.getOverviewIntent(); } else { return mGestureState.getHomeIntent(); Loading @@ -248,6 +253,11 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa mRecentsAnimationController.setWindowThresholdCrossed(!mInQuickSwitchMode && (mCurrentShift.value > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD)); } if (!mInQuickSwitchMode && !mDeviceState.isFullyGesturalNavMode()) { updateOverviewThresholdPassed(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW); } if (mRecentsAnimationTargets != null) { applyTransformUnchecked(); } Loading @@ -271,15 +281,26 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa .getDimension(R.dimen.quickstep_fling_threshold_velocity); boolean isFling = Math.abs(endVelocity) > flingThreshold; if (mDeviceState.isFullyGesturalNavMode()) { if (isFling) { mGestureState.setEndTarget(endVelocity < 0 ? HOME : LAST_TASK); } else if (mIsMotionPaused) { } else if (mOverviewThresholdPassed) { mGestureState.setEndTarget(RECENTS); } else { mGestureState.setEndTarget(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? HOME : LAST_TASK); } } else { GestureEndTarget startState = mSwipeUpOverHome ? HOME : LAST_TASK; if (isFling) { mGestureState.setEndTarget(endVelocity < 0 ? RECENTS : startState); } else { mGestureState.setEndTarget(mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? RECENTS : startState); } } } mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED); } Loading Loading @@ -353,7 +374,7 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler<RecentsActivity, Fa mRecentsAnimationController.finish(false, null, false); break; case RECENTS: { if (mSwipeUpOverHome) { if (mSwipeUpOverHome || !mDeviceState.isFullyGesturalNavMode()) { mRecentsAnimationController.finish(true, null, true); break; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +1 −22 Original line number Diff line number Diff line Loading @@ -616,11 +616,7 @@ public class TouchInteractionService extends Service implements PluginListener<O if (!mOverviewComponentObserver.isHomeAndOverviewSame()) { shouldDefer = previousGestureState.getFinishingRecentsAnimationTaskId() < 0; if (mDeviceState.isFullyGesturalNavMode()) { factory = mFallbackSwipeHandlerFactory; } else { factory = this::determineFallbackTwoButtonSwipeHandler; } } else { shouldDefer = gestureState.getActivityInterface().deferStartingActivity(mDeviceState, event); Loading @@ -633,23 +629,6 @@ 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, Loading