From b091ed9098c32ac6fd7ffa211e1a3e9e2ec6b049 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 20 Feb 2019 13:18:24 -0800 Subject: [PATCH 1/2] Put pippable apps to pip mode upon swipe up to home gesture Fixes: 122609330 Test: manual Change-Id: I6cd0110b17fba9be6de1b3e6ba5750018d6f0514 --- .../quickstep/RecentsAnimationWrapper.java | 22 ++++++++++++++----- .../WindowTransformSwipeHandler.java | 3 ++- .../util/SwipeAnimationTargetSet.java | 4 ++-- 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 0924f38dcf..ced9afab78 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 a974135be3..5a1d3877a4 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 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 b6824813f4..5a1a103204 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); From d71693426658f0e2a5a735dff0d936dc6b1a0dc0 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Tue, 9 Apr 2019 11:07:28 +0800 Subject: [PATCH 2/2] Fix SecondaryLauncher crash when started. SecondaryLauncher crash after change material source. From the error log the style of this component should be Theme.MaterialComponents or as descendant. Change theme parent to fix it. Bug: 130151609 Bug: 130182878 Test: atest MultiDisplaySystemDecorationTests Change-Id: Iad2817864326b04fac00bfc57b8ab6eaf2bd9c13 --- SecondaryDisplayLauncher/res/values/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecondaryDisplayLauncher/res/values/styles.xml b/SecondaryDisplayLauncher/res/values/styles.xml index 4bfda6a2a5..4e41a98fc8 100644 --- a/SecondaryDisplayLauncher/res/values/styles.xml +++ b/SecondaryDisplayLauncher/res/values/styles.xml @@ -18,7 +18,7 @@ --> -