diff options
author | Tracy Zhou <tracyzhou@google.com> | 2019-02-20 13:18:24 -0800 |
---|---|---|
committer | Tracy Zhou <tracyzhou@google.com> | 2019-04-09 21:11:19 +0000 |
commit | d64fe113f5f636fe55fefabf5255a56c2478c0ce (patch) | |
tree | 3d519278f2e0c4825e7542e179cb4eaf6bcb41b0 | |
parent | 9edc8eb756835c507226947c040845c356357283 (diff) | |
download | android_packages_apps_Trebuchet-d64fe113f5f636fe55fefabf5255a56c2478c0ce.tar.gz android_packages_apps_Trebuchet-d64fe113f5f636fe55fefabf5255a56c2478c0ce.tar.bz2 android_packages_apps_Trebuchet-d64fe113f5f636fe55fefabf5255a56c2478c0ce.zip |
Put pippable apps to pip mode upon swipe up to home gesture
Fixes: 122609330
Test: manual
Change-Id: I6cd0110b17fba9be6de1b3e6ba5750018d6f0514
(cherry picked from commit b091ed9098c32ac6fd7ffa211e1a3e9e2ec6b049)
3 files changed, 20 insertions, 9 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java index 0924f38dc..ced9afab7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java @@ -85,15 +85,24 @@ public class RecentsAnimationWrapper { } } + /** See {@link #finish(boolean, Runnable, boolean)} */ + @UiThread + public void finish(boolean toRecents, Runnable onFinishComplete) { + finish(toRecents, onFinishComplete, false /* sendUserLeaveHint */); + } + /** * @param onFinishComplete A callback that runs on the main thread after the animation * controller has finished on the background thread. + * @param sendUserLeaveHint Determines whether userLeaveHint flag will be set on the pausing + * activity. If userLeaveHint is true, the activity will enter into + * picture-in-picture mode upon being paused. */ @UiThread - public void finish(boolean toRecents, Runnable onFinishComplete) { + public void finish(boolean toRecents, Runnable onFinishComplete, boolean sendUserLeaveHint) { Preconditions.assertUIThread(); if (!toRecents) { - finishAndClear(false, onFinishComplete); + finishAndClear(false, onFinishComplete, sendUserLeaveHint); } else { if (mTouchInProgress) { mFinishPending = true; @@ -102,16 +111,17 @@ public class RecentsAnimationWrapper { onFinishComplete.run(); } } else { - finishAndClear(true, onFinishComplete); + finishAndClear(true, onFinishComplete, sendUserLeaveHint); } } } - private void finishAndClear(boolean toRecents, Runnable onFinishComplete) { + private void finishAndClear(boolean toRecents, Runnable onFinishComplete, + boolean sendUserLeaveHint) { SwipeAnimationTargetSet controller = targetSet; targetSet = null; if (controller != null) { - controller.finishController(toRecents, onFinishComplete); + controller.finishController(toRecents, onFinishComplete, sendUserLeaveHint); } } @@ -163,7 +173,7 @@ public class RecentsAnimationWrapper { mTouchInProgress = false; if (mFinishPending) { mFinishPending = false; - finishAndClear(true /* toRecents */, null); + finishAndClear(true /* toRecents */, null, false /* sendUserLeaveHint */); } } if (mInputConsumer != null) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index a974135be..5a1d3877a 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1130,7 +1130,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> private void finishCurrentTransitionToHome() { synchronized (mRecentsAnimationWrapper) { mRecentsAnimationWrapper.finish(true /* toRecents */, - () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); + () -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED), + true /* sendUserLeaveHint */); } TOUCH_INTERACTION_LOG.addLog("finishRecentsAnimation", true); doLogGesture(HOME); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java index b6824813f..5a1a10320 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/SwipeAnimationTargetSet.java @@ -53,11 +53,11 @@ public class SwipeAnimationTargetSet extends RemoteAnimationTargetSet { this.mOnFinishListener = onFinishListener; } - public void finishController(boolean toRecents, Runnable callback) { + public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) { mOnFinishListener.accept(this); BACKGROUND_EXECUTOR.execute(() -> { controller.setInputConsumerEnabled(false); - controller.finish(toRecents); + controller.finish(toRecents, sendUserLeaveHint); if (callback != null) { MAIN_THREAD_EXECUTOR.execute(callback); |