Loading quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java +3 −3 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private VelocityTracker mVelocityTracker; private MotionEventQueue mEventQueue; private boolean mIsGoingToHome; private boolean mIsGoingToLauncher; public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo, RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl, Loading Loading @@ -333,7 +333,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC if (mInteractionHandler != null) { final WindowTransformSwipeHandler handler = mInteractionHandler; mInteractionHandler = null; mIsGoingToHome = handler.mIsGoingToHome; mIsGoingToLauncher = handler.mIsGoingToRecents; mMainThreadExecutor.execute(handler::reset); } } Loading Loading @@ -417,7 +417,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC @Override public boolean forceToLauncherConsumer() { return mIsGoingToHome; return mIsGoingToLauncher; } @Override Loading quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java +6 −5 Original line number Diff line number Diff line Loading @@ -100,8 +100,8 @@ public class RecentsAnimationWrapper { * @param onFinishComplete A callback that runs on the main thread after the animation * controller has finished on the background thread. */ public void finish(boolean toHome, Runnable onFinishComplete) { if (!toHome) { public void finish(boolean toRecents, Runnable onFinishComplete) { if (!toRecents) { mExecutorService.submit(() -> finishBg(false, onFinishComplete)); return; } Loading @@ -119,13 +119,14 @@ public class RecentsAnimationWrapper { }); } protected void finishBg(boolean toHome, Runnable onFinishComplete) { protected void finishBg(boolean toRecents, Runnable onFinishComplete) { RecentsAnimationControllerCompat controller = mController; mController = null; TraceHelper.endSection("RecentsController", "Finish " + controller + ", toHome=" + toHome); TraceHelper.endSection("RecentsController", "Finish " + controller + ", toRecents=" + toRecents); if (controller != null) { controller.setInputConsumerEnabled(false); controller.finish(toHome); controller.finish(toRecents); if (onFinishComplete != null) { mMainThreadExecutor.execute(onFinishComplete); Loading quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +24 −24 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private final ClipAnimationHelper.TransformParams mTransformParams; protected Runnable mGestureEndCallback; protected boolean mIsGoingToHome; protected boolean mIsGoingToRecents; private DeviceProfile mDp; private int mTransitionDragLength; Loading Loading @@ -319,7 +319,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { mStateCallback.addCallback(STATE_SCREENSHOT_CAPTURED | STATE_GESTURE_COMPLETED | STATE_SCALED_CONTROLLER_RECENTS, this::finishCurrentTransitionToHome); this::finishCurrentTransitionToRecents); mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_APP_CONTROLLER_RECEIVED | STATE_ACTIVITY_MULTIPLIER_COMPLETE | STATE_SCALED_CONTROLLER_RECENTS Loading Loading @@ -812,7 +812,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { float velocityXPxPerMs = velocityX / 1000; long duration = MAX_SWIPE_DURATION; float currentShift = mCurrentShift.value; final boolean goingToHome; final boolean goingToRecents; float endShift; final float startShift; Interpolator interpolator = DEACCEL; Loading @@ -821,24 +821,24 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { boolean goingToNewTask = mRecentsView != null && nextPage != runningTaskIndex; final boolean reachedOverviewThreshold = currentShift >= MIN_PROGRESS_FOR_OVERVIEW; if (!isFling) { goingToHome = reachedOverviewThreshold && mGestureStarted; endShift = goingToHome ? 1 : 0; goingToRecents = reachedOverviewThreshold && mGestureStarted; endShift = goingToRecents ? 1 : 0; long expectedDuration = Math.abs(Math.round((endShift - currentShift) * MAX_SWIPE_DURATION * SWIPE_DURATION_MULTIPLIER)); duration = Math.min(MAX_SWIPE_DURATION, expectedDuration); startShift = currentShift; interpolator = goingToHome ? OVERSHOOT_1_2 : DEACCEL; interpolator = goingToRecents ? OVERSHOOT_1_2 : DEACCEL; } else { // If user scrolled to a new task, only go to home (overview) if they already passed // If user scrolled to a new task, only go to recents if they already passed // the overview threshold. Otherwise, we'll snap to the new task and launch it. goingToHome = endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold); endShift = goingToHome ? 1 : 0; goingToRecents = endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold); endShift = goingToRecents ? 1 : 0; startShift = Utilities.boundToRange(currentShift - velocityPxPerMs * SINGLE_FRAME_MS / mTransitionDragLength, 0, 1); float minFlingVelocity = mContext.getResources() .getDimension(R.dimen.quickstep_fling_min_velocity); if (Math.abs(endVelocity) > minFlingVelocity && mTransitionDragLength > 0) { if (goingToHome) { if (goingToRecents) { Interpolators.OvershootParams overshoot = new Interpolators.OvershootParams( startShift, endShift, endShift, velocityPxPerMs, mTransitionDragLength); endShift = overshoot.end; Loading @@ -856,10 +856,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } } if (goingToHome) { if (goingToRecents) { mRecentsAnimationWrapper.enableTouchProxy(); } else if (goingToNewTask) { // We aren't goingToHome, and user scrolled/flung to a new task; snap to the closest // We aren't goingToRecents, and user scrolled/flung to a new task; snap to the closest // task in that direction and launch it (in startNewTask()). int taskToLaunch = runningTaskIndex + (nextPage > runningTaskIndex ? 1 : - 1); if (taskToLaunch >= mRecentsView.getTaskViewCount()) { Loading @@ -879,7 +879,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } animateToProgress(startShift, endShift, duration, interpolator, goingToHome, animateToProgress(startShift, endShift, duration, interpolator, goingToRecents, goingToNewTask, velocityPxPerMs); } Loading @@ -906,15 +906,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { /** Animates to the given progress, where 0 is the current app and 1 is overview. */ private void animateToProgress(float start, float end, long duration, Interpolator interpolator, boolean goingToHome, boolean goingToNewTask, float velocityPxPerMs) { boolean goingToRecents, boolean goingToNewTask, float velocityPxPerMs) { mRecentsAnimationWrapper.runOnInit(() -> animateToProgressInternal(start, end, duration, interpolator, goingToHome, goingToNewTask, velocityPxPerMs)); interpolator, goingToRecents, goingToNewTask, velocityPxPerMs)); } private void animateToProgressInternal(float start, float end, long duration, Interpolator interpolator, boolean goingToHome, boolean goingToNewTask, Interpolator interpolator, boolean goingToRecents, boolean goingToNewTask, float velocityPxPerMs) { mIsGoingToHome = goingToHome; mIsGoingToRecents = goingToRecents; ObjectAnimator anim = mCurrentShift.animateToValue(start, end).setDuration(duration); anim.setInterpolator(interpolator); anim.addListener(new AnimationSuccessListener() { Loading @@ -922,7 +922,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { public void onAnimationSuccess(Animator animator) { int recentsState = STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT | STATE_SCREENSHOT_VIEW_SHOWN; setStateOnUiThread(mIsGoingToHome setStateOnUiThread(mIsGoingToRecents ? recentsState : goingToNewTask ? STATE_START_NEW_TASK Loading Loading @@ -970,14 +970,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { @UiThread private void resumeLastTask() { mRecentsAnimationWrapper.finish(false /* toHome */, null); mRecentsAnimationWrapper.finish(false /* toRecents */, null); mTouchInteractionLog.finishRecentsAnimation(false); } @UiThread private void startNewTask() { // Launch the task user scrolled to (mRecentsView.getNextPage()). mRecentsAnimationWrapper.finish(true /* toHome */, () -> { mRecentsAnimationWrapper.finish(true /* toRecents */, () -> { mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).launchTask(false, result -> setStateOnUiThread(STATE_HANDLER_INVALIDATED), mMainThreadHandler); Loading Loading @@ -1083,12 +1083,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } private void finishCurrentTransitionToHome() { private void finishCurrentTransitionToRecents() { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); } else { synchronized (mRecentsAnimationWrapper) { mRecentsAnimationWrapper.finish(true /* toHome */, mRecentsAnimationWrapper.finish(true /* toRecents */, () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); } } Loading Loading @@ -1126,7 +1126,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { long duration = FeatureFlags.QUICK_SWITCH.get() ? QUICK_SWITCH_FROM_APP_START_DURATION : QUICK_SCRUB_FROM_APP_START_DURATION; animateToProgress(mCurrentShift.value, 1f, duration, LINEAR, true /* goingToHome */, animateToProgress(mCurrentShift.value, 1f, duration, LINEAR, true /* goingToRecents */, false /* goingToNewTask */, 1f); } Loading Loading @@ -1289,7 +1289,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { return; } mUiLongSwipeMode = false; finishCurrentTransitionToHome(); finishCurrentTransitionToRecents(); mLongSwipeController.end(velocity, isFling, () -> setStateOnUiThread(STATE_HANDLER_INVALIDATED)); Loading Loading
quickstep/src/com/android/quickstep/OtherActivityTouchConsumer.java +3 −3 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC private VelocityTracker mVelocityTracker; private MotionEventQueue mEventQueue; private boolean mIsGoingToHome; private boolean mIsGoingToLauncher; public OtherActivityTouchConsumer(Context base, RunningTaskInfo runningTaskInfo, RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl, Loading Loading @@ -333,7 +333,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC if (mInteractionHandler != null) { final WindowTransformSwipeHandler handler = mInteractionHandler; mInteractionHandler = null; mIsGoingToHome = handler.mIsGoingToHome; mIsGoingToLauncher = handler.mIsGoingToRecents; mMainThreadExecutor.execute(handler::reset); } } Loading Loading @@ -417,7 +417,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC @Override public boolean forceToLauncherConsumer() { return mIsGoingToHome; return mIsGoingToLauncher; } @Override Loading
quickstep/src/com/android/quickstep/RecentsAnimationWrapper.java +6 −5 Original line number Diff line number Diff line Loading @@ -100,8 +100,8 @@ public class RecentsAnimationWrapper { * @param onFinishComplete A callback that runs on the main thread after the animation * controller has finished on the background thread. */ public void finish(boolean toHome, Runnable onFinishComplete) { if (!toHome) { public void finish(boolean toRecents, Runnable onFinishComplete) { if (!toRecents) { mExecutorService.submit(() -> finishBg(false, onFinishComplete)); return; } Loading @@ -119,13 +119,14 @@ public class RecentsAnimationWrapper { }); } protected void finishBg(boolean toHome, Runnable onFinishComplete) { protected void finishBg(boolean toRecents, Runnable onFinishComplete) { RecentsAnimationControllerCompat controller = mController; mController = null; TraceHelper.endSection("RecentsController", "Finish " + controller + ", toHome=" + toHome); TraceHelper.endSection("RecentsController", "Finish " + controller + ", toRecents=" + toRecents); if (controller != null) { controller.setInputConsumerEnabled(false); controller.finish(toHome); controller.finish(toRecents); if (onFinishComplete != null) { mMainThreadExecutor.execute(onFinishComplete); Loading
quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +24 −24 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { private final ClipAnimationHelper.TransformParams mTransformParams; protected Runnable mGestureEndCallback; protected boolean mIsGoingToHome; protected boolean mIsGoingToRecents; private DeviceProfile mDp; private int mTransitionDragLength; Loading Loading @@ -319,7 +319,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { mStateCallback.addCallback(STATE_SCREENSHOT_CAPTURED | STATE_GESTURE_COMPLETED | STATE_SCALED_CONTROLLER_RECENTS, this::finishCurrentTransitionToHome); this::finishCurrentTransitionToRecents); mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_APP_CONTROLLER_RECEIVED | STATE_ACTIVITY_MULTIPLIER_COMPLETE | STATE_SCALED_CONTROLLER_RECENTS Loading Loading @@ -812,7 +812,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { float velocityXPxPerMs = velocityX / 1000; long duration = MAX_SWIPE_DURATION; float currentShift = mCurrentShift.value; final boolean goingToHome; final boolean goingToRecents; float endShift; final float startShift; Interpolator interpolator = DEACCEL; Loading @@ -821,24 +821,24 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { boolean goingToNewTask = mRecentsView != null && nextPage != runningTaskIndex; final boolean reachedOverviewThreshold = currentShift >= MIN_PROGRESS_FOR_OVERVIEW; if (!isFling) { goingToHome = reachedOverviewThreshold && mGestureStarted; endShift = goingToHome ? 1 : 0; goingToRecents = reachedOverviewThreshold && mGestureStarted; endShift = goingToRecents ? 1 : 0; long expectedDuration = Math.abs(Math.round((endShift - currentShift) * MAX_SWIPE_DURATION * SWIPE_DURATION_MULTIPLIER)); duration = Math.min(MAX_SWIPE_DURATION, expectedDuration); startShift = currentShift; interpolator = goingToHome ? OVERSHOOT_1_2 : DEACCEL; interpolator = goingToRecents ? OVERSHOOT_1_2 : DEACCEL; } else { // If user scrolled to a new task, only go to home (overview) if they already passed // If user scrolled to a new task, only go to recents if they already passed // the overview threshold. Otherwise, we'll snap to the new task and launch it. goingToHome = endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold); endShift = goingToHome ? 1 : 0; goingToRecents = endVelocity < 0 && (!goingToNewTask || reachedOverviewThreshold); endShift = goingToRecents ? 1 : 0; startShift = Utilities.boundToRange(currentShift - velocityPxPerMs * SINGLE_FRAME_MS / mTransitionDragLength, 0, 1); float minFlingVelocity = mContext.getResources() .getDimension(R.dimen.quickstep_fling_min_velocity); if (Math.abs(endVelocity) > minFlingVelocity && mTransitionDragLength > 0) { if (goingToHome) { if (goingToRecents) { Interpolators.OvershootParams overshoot = new Interpolators.OvershootParams( startShift, endShift, endShift, velocityPxPerMs, mTransitionDragLength); endShift = overshoot.end; Loading @@ -856,10 +856,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } } if (goingToHome) { if (goingToRecents) { mRecentsAnimationWrapper.enableTouchProxy(); } else if (goingToNewTask) { // We aren't goingToHome, and user scrolled/flung to a new task; snap to the closest // We aren't goingToRecents, and user scrolled/flung to a new task; snap to the closest // task in that direction and launch it (in startNewTask()). int taskToLaunch = runningTaskIndex + (nextPage > runningTaskIndex ? 1 : - 1); if (taskToLaunch >= mRecentsView.getTaskViewCount()) { Loading @@ -879,7 +879,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } animateToProgress(startShift, endShift, duration, interpolator, goingToHome, animateToProgress(startShift, endShift, duration, interpolator, goingToRecents, goingToNewTask, velocityPxPerMs); } Loading @@ -906,15 +906,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { /** Animates to the given progress, where 0 is the current app and 1 is overview. */ private void animateToProgress(float start, float end, long duration, Interpolator interpolator, boolean goingToHome, boolean goingToNewTask, float velocityPxPerMs) { boolean goingToRecents, boolean goingToNewTask, float velocityPxPerMs) { mRecentsAnimationWrapper.runOnInit(() -> animateToProgressInternal(start, end, duration, interpolator, goingToHome, goingToNewTask, velocityPxPerMs)); interpolator, goingToRecents, goingToNewTask, velocityPxPerMs)); } private void animateToProgressInternal(float start, float end, long duration, Interpolator interpolator, boolean goingToHome, boolean goingToNewTask, Interpolator interpolator, boolean goingToRecents, boolean goingToNewTask, float velocityPxPerMs) { mIsGoingToHome = goingToHome; mIsGoingToRecents = goingToRecents; ObjectAnimator anim = mCurrentShift.animateToValue(start, end).setDuration(duration); anim.setInterpolator(interpolator); anim.addListener(new AnimationSuccessListener() { Loading @@ -922,7 +922,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { public void onAnimationSuccess(Animator animator) { int recentsState = STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT | STATE_SCREENSHOT_VIEW_SHOWN; setStateOnUiThread(mIsGoingToHome setStateOnUiThread(mIsGoingToRecents ? recentsState : goingToNewTask ? STATE_START_NEW_TASK Loading Loading @@ -970,14 +970,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { @UiThread private void resumeLastTask() { mRecentsAnimationWrapper.finish(false /* toHome */, null); mRecentsAnimationWrapper.finish(false /* toRecents */, null); mTouchInteractionLog.finishRecentsAnimation(false); } @UiThread private void startNewTask() { // Launch the task user scrolled to (mRecentsView.getNextPage()). mRecentsAnimationWrapper.finish(true /* toHome */, () -> { mRecentsAnimationWrapper.finish(true /* toRecents */, () -> { mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).launchTask(false, result -> setStateOnUiThread(STATE_HANDLER_INVALIDATED), mMainThreadHandler); Loading Loading @@ -1083,12 +1083,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } } private void finishCurrentTransitionToHome() { private void finishCurrentTransitionToRecents() { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); } else { synchronized (mRecentsAnimationWrapper) { mRecentsAnimationWrapper.finish(true /* toHome */, mRecentsAnimationWrapper.finish(true /* toRecents */, () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); } } Loading Loading @@ -1126,7 +1126,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { long duration = FeatureFlags.QUICK_SWITCH.get() ? QUICK_SWITCH_FROM_APP_START_DURATION : QUICK_SCRUB_FROM_APP_START_DURATION; animateToProgress(mCurrentShift.value, 1f, duration, LINEAR, true /* goingToHome */, animateToProgress(mCurrentShift.value, 1f, duration, LINEAR, true /* goingToRecents */, false /* goingToNewTask */, 1f); } Loading Loading @@ -1289,7 +1289,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { return; } mUiLongSwipeMode = false; finishCurrentTransitionToHome(); finishCurrentTransitionToRecents(); mLongSwipeController.end(velocity, isFling, () -> setStateOnUiThread(STATE_HANDLER_INVALIDATED)); Loading