Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +29 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, private boolean mWasLauncherAlreadyVisible; private boolean mPassedOverviewThreshold; private boolean mGestureStarted; private boolean mLogDirectionUpOrLeft = true; private boolean mIsLikelyToStartNewTask; Loading Loading @@ -883,6 +884,14 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @UiThread @Override public void onCurrentShiftUpdated() { final boolean passed = hasReachedHomeOverviewThreshold(); if (passed != mPassedOverviewThreshold) { mPassedOverviewThreshold = passed; if (mDeviceState.isTwoButtonNavMode() && !mGestureState.isHandlingAtomicEvent()) { performHapticFeedback(); } } float threshold = LauncherPrefs.get(mContext).get(ALL_APPS_OVERVIEW_THRESHOLD) / 100f; setIsInAllAppsRegion(mCurrentShift.value >= threshold); updateSysUiFlags(mCurrentShift.value); Loading Loading @@ -981,6 +990,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED, this::startInterceptingTouchesForGesture); mStateCallback.setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED); mPassedOverviewThreshold = false; } @Override Loading Loading @@ -1260,11 +1271,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, 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 @@ -1308,6 +1327,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, 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/inputconsumers/OtherActivityInputConsumer.java +20 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.content.ContextWrapper; import android.content.Intent; import android.graphics.PointF; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; Loading Loading @@ -64,6 +66,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 @@ -125,6 +128,12 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // Might be displacement in X or Y, depending on the direction we are swiping from the nav bar. private float mStartDisplacement; 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 @@ -135,6 +144,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mNavBarPosition = mDeviceState.getNavBarPosition(); mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mMainThreadHandler = new Handler(Looper.getMainLooper()); mHandlerFactory = handlerFactory; mActivityInterface = mGestureState.getActivityInterface(); Loading Loading @@ -453,6 +463,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 @@ -474,6 +493,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 @@ -305,6 +305,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, private boolean mWasLauncherAlreadyVisible; private boolean mPassedOverviewThreshold; private boolean mGestureStarted; private boolean mLogDirectionUpOrLeft = true; private boolean mIsLikelyToStartNewTask; Loading Loading @@ -883,6 +884,14 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @UiThread @Override public void onCurrentShiftUpdated() { final boolean passed = hasReachedHomeOverviewThreshold(); if (passed != mPassedOverviewThreshold) { mPassedOverviewThreshold = passed; if (mDeviceState.isTwoButtonNavMode() && !mGestureState.isHandlingAtomicEvent()) { performHapticFeedback(); } } float threshold = LauncherPrefs.get(mContext).get(ALL_APPS_OVERVIEW_THRESHOLD) / 100f; setIsInAllAppsRegion(mCurrentShift.value >= threshold); updateSysUiFlags(mCurrentShift.value); Loading Loading @@ -981,6 +990,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mStateCallback.runOnceAtState(STATE_APP_CONTROLLER_RECEIVED | STATE_GESTURE_STARTED, this::startInterceptingTouchesForGesture); mStateCallback.setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED); mPassedOverviewThreshold = false; } @Override Loading Loading @@ -1260,11 +1271,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, 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 @@ -1308,6 +1327,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, 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/inputconsumers/OtherActivityInputConsumer.java +20 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.content.ContextWrapper; import android.content.Intent; import android.graphics.PointF; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; Loading Loading @@ -64,6 +66,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 @@ -125,6 +128,12 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // Might be displacement in X or Y, depending on the direction we are swiping from the nav bar. private float mStartDisplacement; 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 @@ -135,6 +144,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mNavBarPosition = mDeviceState.getNavBarPosition(); mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mMainThreadHandler = new Handler(Looper.getMainLooper()); mHandlerFactory = handlerFactory; mActivityInterface = mGestureState.getActivityInterface(); Loading Loading @@ -453,6 +463,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 @@ -474,6 +493,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