Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +29 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, private boolean mWasLauncherAlreadyVisible; private boolean mPassedOverviewThreshold; private boolean mGestureStarted; private boolean mLogDirectionUpOrLeft = true; private boolean mIsLikelyToStartNewTask; Loading Loading @@ -896,6 +897,14 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, @UiThread @Override public void onCurrentShiftUpdated() { final boolean passed = hasReachedHomeOverviewThreshold(); if (passed != mPassedOverviewThreshold) { mPassedOverviewThreshold = passed; if (mDeviceState.isTwoButtonNavMode() && !mGestureState.isHandlingAtomicEvent()) { performHapticFeedback(); } } float threshold = DeviceConfigWrapper.get().getAllAppsOverviewThreshold() / 100f; setIsInAllAppsRegion(mCurrentShift.value >= threshold); updateSysUiFlags(mCurrentShift.value); Loading Loading @@ -998,6 +1007,8 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED, this::startInterceptingTouchesForGesture); mStateCallback.setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED); mPassedOverviewThreshold = false; } @Override Loading Loading @@ -1285,11 +1296,19 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, return willGoToNewTask || isCenteredOnNewTask ? NEW_TASK : LAST_TASK; } if (!mDeviceState.isFullyGesturalNavMode()) { return (!hasReachedHomeOverviewThreshold() && willGoToNewTask) ? NEW_TASK : RECENTS; } return willGoToNewTask ? NEW_TASK : HOME; } private GestureEndTarget calculateEndTargetForNonFling(PointF velocity) { final boolean isScrollingToNewTask = isScrollingToNewTask(); if (!mDeviceState.isFullyGesturalNavMode()) { return hasReachedHomeOverviewThreshold() && mGestureStarted ? RECENTS : (isScrollingToNewTask ? NEW_TASK : LAST_TASK); } // Fully gestural mode. final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() Loading Loading @@ -1333,6 +1352,16 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, mCanSlowSwipeGoHome = canSlowSwipeGoHome; } /** * Returns true if swipe has reached the overview threshold. */ private boolean hasReachedHomeOverviewThreshold() { if (mIsTransientTaskbar) { return mCanSlowSwipeGoHome; } return mCurrentShift.value > MIN_PROGRESS_FOR_OVERVIEW; } @UiThread private void handleNormalGestureEnd( float endVelocityPxPerMs, boolean isFling, PointF velocityPxPerMs, boolean isCancel) { Loading quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +8 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MOD import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION; import static com.android.launcher3.util.NavigationMode.NO_BUTTON; import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS; import static com.android.launcher3.util.NavigationMode.TWO_BUTTONS; import static com.android.launcher3.util.SettingsCache.ONE_HANDED_ENABLED; import static com.android.launcher3.util.SettingsCache.ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; Loading Loading @@ -315,6 +316,13 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E return mMode.hasGestures; } /** * @return whether the current nav mode is 2-button-based. */ public boolean isTwoButtonNavMode() { return mMode == TWO_BUTTONS; } /** * @return whether the current nav mode is button-based. */ Loading quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +20 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.graphics.PointF; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; Loading @@ -60,6 +62,7 @@ import com.android.quickstep.TaskAnimationManager; import com.android.quickstep.util.CachedEventDispatcher; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.NavBarPosition; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver; import com.android.systemui.shared.system.InputMonitorCompat; Loading Loading @@ -121,6 +124,12 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // The callback called upon finishing the recents transition if it was force-canceled private Runnable mForceFinishRecentsTransitionCallback; private Handler mMainThreadHandler; private Runnable mCancelRecentsAnimationRunnable = () -> { ActivityManagerWrapper.getInstance().cancelRecentsAnimation( true /* restoreHomeStackPosition */); }; public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback, Loading @@ -131,6 +140,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mNavBarPosition = mDeviceState.getNavBarPosition(); mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mMainThreadHandler = new Handler(Looper.getMainLooper()); mHandlerFactory = handlerFactory; mMotionPauseDetector = new MotionPauseDetector(base, false, Loading Loading @@ -459,6 +469,15 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } onConsumerAboutToBeSwitched(); onInteractionGestureFinished(); // Cancel the recents animation if SysUI happens to handle UP before we have a chance // to start the recents animation. In addition, workaround for b/126336729 by delaying // the cancel of the animation for a period, in case SysUI is slow to handle UP and we // handle DOWN & UP and move the home stack before SysUI can start the activity mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable); if (!mDeviceState.isFullyGesturalNavMode()) { mMainThreadHandler.postDelayed(mCancelRecentsAnimationRunnable, 100); } } cleanupAfterGesture(); TraceHelper.INSTANCE.endSection(); Loading @@ -480,6 +499,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC @Override public void onConsumerAboutToBeSwitched() { Preconditions.assertUIThread(); mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable); if (mInteractionHandler != null) { // The consumer is being switched while we are active. Set up the shared state to be // used by the next animation Loading Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +29 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, private boolean mWasLauncherAlreadyVisible; private boolean mPassedOverviewThreshold; private boolean mGestureStarted; private boolean mLogDirectionUpOrLeft = true; private boolean mIsLikelyToStartNewTask; Loading Loading @@ -896,6 +897,14 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, @UiThread @Override public void onCurrentShiftUpdated() { final boolean passed = hasReachedHomeOverviewThreshold(); if (passed != mPassedOverviewThreshold) { mPassedOverviewThreshold = passed; if (mDeviceState.isTwoButtonNavMode() && !mGestureState.isHandlingAtomicEvent()) { performHapticFeedback(); } } float threshold = DeviceConfigWrapper.get().getAllAppsOverviewThreshold() / 100f; setIsInAllAppsRegion(mCurrentShift.value >= threshold); updateSysUiFlags(mCurrentShift.value); Loading Loading @@ -998,6 +1007,8 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED, this::startInterceptingTouchesForGesture); mStateCallback.setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED); mPassedOverviewThreshold = false; } @Override Loading Loading @@ -1285,11 +1296,19 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, return willGoToNewTask || isCenteredOnNewTask ? NEW_TASK : LAST_TASK; } if (!mDeviceState.isFullyGesturalNavMode()) { return (!hasReachedHomeOverviewThreshold() && willGoToNewTask) ? NEW_TASK : RECENTS; } return willGoToNewTask ? NEW_TASK : HOME; } private GestureEndTarget calculateEndTargetForNonFling(PointF velocity) { final boolean isScrollingToNewTask = isScrollingToNewTask(); if (!mDeviceState.isFullyGesturalNavMode()) { return hasReachedHomeOverviewThreshold() && mGestureStarted ? RECENTS : (isScrollingToNewTask ? NEW_TASK : LAST_TASK); } // Fully gestural mode. final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() Loading Loading @@ -1333,6 +1352,16 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer, mCanSlowSwipeGoHome = canSlowSwipeGoHome; } /** * Returns true if swipe has reached the overview threshold. */ private boolean hasReachedHomeOverviewThreshold() { if (mIsTransientTaskbar) { return mCanSlowSwipeGoHome; } return mCurrentShift.value > MIN_PROGRESS_FOR_OVERVIEW; } @UiThread private void handleNormalGestureEnd( float endVelocityPxPerMs, boolean isFling, PointF velocityPxPerMs, boolean isCancel) { Loading
quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +8 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MOD import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION; import static com.android.launcher3.util.NavigationMode.NO_BUTTON; import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS; import static com.android.launcher3.util.NavigationMode.TWO_BUTTONS; import static com.android.launcher3.util.SettingsCache.ONE_HANDED_ENABLED; import static com.android.launcher3.util.SettingsCache.ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; Loading Loading @@ -315,6 +316,13 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E return mMode.hasGestures; } /** * @return whether the current nav mode is 2-button-based. */ public boolean isTwoButtonNavMode() { return mMode == TWO_BUTTONS; } /** * @return whether the current nav mode is button-based. */ Loading
quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +20 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.graphics.PointF; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; Loading @@ -60,6 +62,7 @@ import com.android.quickstep.TaskAnimationManager; import com.android.quickstep.util.CachedEventDispatcher; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.NavBarPosition; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver; import com.android.systemui.shared.system.InputMonitorCompat; Loading Loading @@ -121,6 +124,12 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // The callback called upon finishing the recents transition if it was force-canceled private Runnable mForceFinishRecentsTransitionCallback; private Handler mMainThreadHandler; private Runnable mCancelRecentsAnimationRunnable = () -> { ActivityManagerWrapper.getInstance().cancelRecentsAnimation( true /* restoreHomeStackPosition */); }; public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback, Loading @@ -131,6 +140,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mNavBarPosition = mDeviceState.getNavBarPosition(); mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mMainThreadHandler = new Handler(Looper.getMainLooper()); mHandlerFactory = handlerFactory; mMotionPauseDetector = new MotionPauseDetector(base, false, Loading Loading @@ -459,6 +469,15 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } onConsumerAboutToBeSwitched(); onInteractionGestureFinished(); // Cancel the recents animation if SysUI happens to handle UP before we have a chance // to start the recents animation. In addition, workaround for b/126336729 by delaying // the cancel of the animation for a period, in case SysUI is slow to handle UP and we // handle DOWN & UP and move the home stack before SysUI can start the activity mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable); if (!mDeviceState.isFullyGesturalNavMode()) { mMainThreadHandler.postDelayed(mCancelRecentsAnimationRunnable, 100); } } cleanupAfterGesture(); TraceHelper.INSTANCE.endSection(); Loading @@ -480,6 +499,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC @Override public void onConsumerAboutToBeSwitched() { Preconditions.assertUIThread(); mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable); if (mInteractionHandler != null) { // The consumer is being switched while we are active. Set up the shared state to be // used by the next animation Loading