Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +15 −3 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED; import static com.android.quickstep.GestureState.STATE_END_TARGET_SET; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_CANCELED; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; Loading Loading @@ -378,6 +379,17 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, activity.runOnceOnStart(this::onLauncherStart); } // Set up a entire animation lifecycle callback to notify the current recents view when // the animation is canceled mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> { ThumbnailData snapshot = mGestureState.getRecentsAnimationCanceledSnapshot(); if (snapshot != null) { RecentsModel.INSTANCE.get(mContext).onTaskSnapshotChanged( mRecentsView.getRunningTaskId(), snapshot); mRecentsView.onRecentsAnimationComplete(); } }); setupRecentsViewUi(); linkRecentsViewScroll(); Loading Loading @@ -671,6 +683,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsAnimationController.setUseLauncherSystemBarFlags(swipeUpThresholdPassed || (quickswitchThresholdPassed && centermostTaskFlags != 0)); mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); // Provide a hint to WM the direction that we will be settling in case the animation // needs to be canceled mRecentsAnimationController.setWillFinishToHome(swipeUpThresholdPassed); if (swipeUpThresholdPassed) { mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); Loading Loading @@ -1467,9 +1482,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, final boolean refreshView = !LIVE_TILE.get() /* refreshView */; boolean finishTransitionPosted = false; if (mRecentsAnimationController != null) { if (LIVE_TILE.get()) { mRecentsAnimationController.getController().setWillFinishToHome(true); } // Update the screenshot of the task if (mTaskSnapshot == null) { UI_HELPER_EXECUTOR.execute(() -> { Loading quickstep/src/com/android/quickstep/GestureState.java +17 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL private RemoteAnimationTargetCompat mLastAppearedTaskTarget; private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>(); private int mLastStartedTaskId = -1; private RecentsAnimationController mRecentsAnimationController; private ThumbnailData mRecentsAnimationCanceledSnapshot; /** The time when the swipe up gesture is triggered. */ private long mSwipeUpStartTimeMs; Loading Loading @@ -351,13 +353,20 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL @Override public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) { mRecentsAnimationController = controller; mStateCallback.setState(STATE_RECENTS_ANIMATION_STARTED); } @Override public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) { mRecentsAnimationCanceledSnapshot = thumbnailData; mStateCallback.setState(STATE_RECENTS_ANIMATION_CANCELED); mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED); if (mRecentsAnimationCanceledSnapshot != null) { // Clean up the screenshot to finalize the recents animation cancel mRecentsAnimationController.cleanupScreenshot(); mRecentsAnimationCanceledSnapshot = null; } } @Override Loading @@ -366,6 +375,14 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED); } /** * Returns the canceled animation thumbnail data. This call only returns a value while * STATE_RECENTS_ANIMATION_CANCELED state is being set. */ ThumbnailData getRecentsAnimationCanceledSnapshot() { return mRecentsAnimationCanceledSnapshot; } void setSwipeUpStartTimeMs(long uptimeMs) { mSwipeUpStartTimeMs = uptimeMs; } Loading quickstep/src/com/android/quickstep/RecentsAnimationController.java +16 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,14 @@ public class RecentsAnimationController { }); } /** * @see IRecentsAnimationController#cleanupScreenshot() */ @UiThread public void cleanupScreenshot() { UI_HELPER_EXECUTOR.execute(() -> mController.cleanupScreenshot()); } /** * @see RecentsAnimationControllerCompat#detachNavigationBarFromApp */ Loading @@ -171,6 +179,14 @@ public class RecentsAnimationController { UI_HELPER_EXECUTOR.execute(() -> mController.animateNavigationBarToApp(duration)); } /** * @see IRecentsAnimationController#setWillFinishToHome(boolean) */ @UiThread public void setWillFinishToHome(boolean willFinishToHome) { UI_HELPER_EXECUTOR.execute(() -> mController.setWillFinishToHome(willFinishToHome)); } /** * Sets the final surface transaction on a Task. This is used by Launcher to notify the system * that animating Activity to PiP has completed and the associated task surface should be Loading quickstep/src/com/android/quickstep/views/RecentsView.java +18 −19 Original line number Diff line number Diff line Loading @@ -394,8 +394,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T private final TaskOverlayFactory mTaskOverlayFactory; private int mOrientation; protected boolean mDisallowScrollToClearAll; private boolean mOverlayEnabled; protected boolean mFreezeViewVisibility; Loading Loading @@ -590,7 +588,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T .getDimensionPixelSize(R.dimen.recents_fast_fling_velocity); mModel = RecentsModel.INSTANCE.get(context); mIdp = InvariantDeviceProfile.INSTANCE.get(context); mOrientation = getResources().getConfiguration().orientation; mClearAllButton = (ClearAllButton) LayoutInflater.from(context) .inflate(R.layout.overview_clear_all_button, this, false); Loading Loading @@ -2649,16 +2646,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (LIVE_TILE.get() && mEnableDrawingLiveTile && newConfig.orientation != mOrientation) { switchToScreenshot( () -> finishRecentsAnimation(true /* toRecents */, false /* showPip */, this::updateRecentsRotation)); mEnableDrawingLiveTile = false; } else { updateRecentsRotation(); } mOrientation = newConfig.orientation; } /** * Updates {@link RecentsOrientedState}'s cached RecentsView rotation. Loading Loading @@ -3413,6 +3402,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T if (onFinishComplete != null) { onFinishComplete.run(); } onRecentsAnimationComplete(); }, sendUserLeaveHint); } /** * Called when a running recents animation has finished or canceled. */ public void onRecentsAnimationComplete() { // At this point, the recents animation is not running and if the animation was canceled // by a display rotation then reset this state to show the screenshot setRunningTaskViewShowScreenshot(true); // After we finish the recents animation, the current task id should be correctly // reset so that when the task is launched from Overview later, it goes through the // flow of starting a new task instead of finishing recents animation to app. A Loading @@ -3420,7 +3420,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T // taps on QSB (3) user goes back to Overview and launch the most recent task. setCurrentTask(-1); mRecentsAnimationController = null; }, sendUserLeaveHint); } public void setDisallowScrollToClearAll(boolean disallowScrollToClearAll) { Loading Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +15 −3 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED; import static com.android.quickstep.GestureState.STATE_END_TARGET_SET; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_CANCELED; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; Loading Loading @@ -378,6 +379,17 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, activity.runOnceOnStart(this::onLauncherStart); } // Set up a entire animation lifecycle callback to notify the current recents view when // the animation is canceled mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> { ThumbnailData snapshot = mGestureState.getRecentsAnimationCanceledSnapshot(); if (snapshot != null) { RecentsModel.INSTANCE.get(mContext).onTaskSnapshotChanged( mRecentsView.getRunningTaskId(), snapshot); mRecentsView.onRecentsAnimationComplete(); } }); setupRecentsViewUi(); linkRecentsViewScroll(); Loading Loading @@ -671,6 +683,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsAnimationController.setUseLauncherSystemBarFlags(swipeUpThresholdPassed || (quickswitchThresholdPassed && centermostTaskFlags != 0)); mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); // Provide a hint to WM the direction that we will be settling in case the animation // needs to be canceled mRecentsAnimationController.setWillFinishToHome(swipeUpThresholdPassed); if (swipeUpThresholdPassed) { mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); Loading Loading @@ -1467,9 +1482,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, final boolean refreshView = !LIVE_TILE.get() /* refreshView */; boolean finishTransitionPosted = false; if (mRecentsAnimationController != null) { if (LIVE_TILE.get()) { mRecentsAnimationController.getController().setWillFinishToHome(true); } // Update the screenshot of the task if (mTaskSnapshot == null) { UI_HELPER_EXECUTOR.execute(() -> { Loading
quickstep/src/com/android/quickstep/GestureState.java +17 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL private RemoteAnimationTargetCompat mLastAppearedTaskTarget; private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>(); private int mLastStartedTaskId = -1; private RecentsAnimationController mRecentsAnimationController; private ThumbnailData mRecentsAnimationCanceledSnapshot; /** The time when the swipe up gesture is triggered. */ private long mSwipeUpStartTimeMs; Loading Loading @@ -351,13 +353,20 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL @Override public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) { mRecentsAnimationController = controller; mStateCallback.setState(STATE_RECENTS_ANIMATION_STARTED); } @Override public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) { mRecentsAnimationCanceledSnapshot = thumbnailData; mStateCallback.setState(STATE_RECENTS_ANIMATION_CANCELED); mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED); if (mRecentsAnimationCanceledSnapshot != null) { // Clean up the screenshot to finalize the recents animation cancel mRecentsAnimationController.cleanupScreenshot(); mRecentsAnimationCanceledSnapshot = null; } } @Override Loading @@ -366,6 +375,14 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED); } /** * Returns the canceled animation thumbnail data. This call only returns a value while * STATE_RECENTS_ANIMATION_CANCELED state is being set. */ ThumbnailData getRecentsAnimationCanceledSnapshot() { return mRecentsAnimationCanceledSnapshot; } void setSwipeUpStartTimeMs(long uptimeMs) { mSwipeUpStartTimeMs = uptimeMs; } Loading
quickstep/src/com/android/quickstep/RecentsAnimationController.java +16 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,14 @@ public class RecentsAnimationController { }); } /** * @see IRecentsAnimationController#cleanupScreenshot() */ @UiThread public void cleanupScreenshot() { UI_HELPER_EXECUTOR.execute(() -> mController.cleanupScreenshot()); } /** * @see RecentsAnimationControllerCompat#detachNavigationBarFromApp */ Loading @@ -171,6 +179,14 @@ public class RecentsAnimationController { UI_HELPER_EXECUTOR.execute(() -> mController.animateNavigationBarToApp(duration)); } /** * @see IRecentsAnimationController#setWillFinishToHome(boolean) */ @UiThread public void setWillFinishToHome(boolean willFinishToHome) { UI_HELPER_EXECUTOR.execute(() -> mController.setWillFinishToHome(willFinishToHome)); } /** * Sets the final surface transaction on a Task. This is used by Launcher to notify the system * that animating Activity to PiP has completed and the associated task surface should be Loading
quickstep/src/com/android/quickstep/views/RecentsView.java +18 −19 Original line number Diff line number Diff line Loading @@ -394,8 +394,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T private final TaskOverlayFactory mTaskOverlayFactory; private int mOrientation; protected boolean mDisallowScrollToClearAll; private boolean mOverlayEnabled; protected boolean mFreezeViewVisibility; Loading Loading @@ -590,7 +588,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T .getDimensionPixelSize(R.dimen.recents_fast_fling_velocity); mModel = RecentsModel.INSTANCE.get(context); mIdp = InvariantDeviceProfile.INSTANCE.get(context); mOrientation = getResources().getConfiguration().orientation; mClearAllButton = (ClearAllButton) LayoutInflater.from(context) .inflate(R.layout.overview_clear_all_button, this, false); Loading Loading @@ -2649,16 +2646,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (LIVE_TILE.get() && mEnableDrawingLiveTile && newConfig.orientation != mOrientation) { switchToScreenshot( () -> finishRecentsAnimation(true /* toRecents */, false /* showPip */, this::updateRecentsRotation)); mEnableDrawingLiveTile = false; } else { updateRecentsRotation(); } mOrientation = newConfig.orientation; } /** * Updates {@link RecentsOrientedState}'s cached RecentsView rotation. Loading Loading @@ -3413,6 +3402,17 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T if (onFinishComplete != null) { onFinishComplete.run(); } onRecentsAnimationComplete(); }, sendUserLeaveHint); } /** * Called when a running recents animation has finished or canceled. */ public void onRecentsAnimationComplete() { // At this point, the recents animation is not running and if the animation was canceled // by a display rotation then reset this state to show the screenshot setRunningTaskViewShowScreenshot(true); // After we finish the recents animation, the current task id should be correctly // reset so that when the task is launched from Overview later, it goes through the // flow of starting a new task instead of finishing recents animation to app. A Loading @@ -3420,7 +3420,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T // taps on QSB (3) user goes back to Overview and launch the most recent task. setCurrentTask(-1); mRecentsAnimationController = null; }, sendUserLeaveHint); } public void setDisallowScrollToClearAll(boolean disallowScrollToClearAll) { Loading