summaryrefslogtreecommitdiffstats
path: root/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
diff options
context:
space:
mode:
authorTracy Zhou <tracyzhou@google.com>2019-03-12 23:36:47 -0700
committerTracy Zhou <tracyzhou@google.com>2019-03-21 18:06:36 +0000
commite790b217e122ed7e5b3cf300a4ef8285097c6665 (patch)
treec7c86e689bec3bedfedd2734c8715eaff2d55cfd /quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
parent16675c566a15059f56d2a788590a559137636d6f (diff)
downloadandroid_packages_apps_Trebuchet-e790b217e122ed7e5b3cf300a4ef8285097c6665.tar.gz
android_packages_apps_Trebuchet-e790b217e122ed7e5b3cf300a4ef8285097c6665.tar.bz2
android_packages_apps_Trebuchet-e790b217e122ed7e5b3cf300a4ef8285097c6665.zip
Properly clean up screenshot of recents animation upon cancelation
Bug: 122593881 Test: Manual Change-Id: Ia9ce1ede08309a0898c622bcd07a9e076443d98a (cherry picked from commit 2bd3a0225b373c21774e7f0806ff49853d410042)
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
index 62f2183b5..94e704a71 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java
@@ -38,9 +38,16 @@ import androidx.annotation.UiThread;
*/
public class RecentsAnimationListenerSet implements RecentsAnimationListener {
+ // The actual app surface is replaced by a screenshot upon recents animation cancelation when
+ // deferredWithScreenshot is true. Launcher takes the responsibility to clean up this screenshot
+ // after app transition is finished. This delay is introduced to cover the app transition
+ // period of time.
+ private final int TRANSITION_DELAY = 100;
+
private final Set<SwipeAnimationListener> mListeners = new ArraySet<>();
private final boolean mShouldMinimizeSplitScreen;
private final Consumer<SwipeAnimationTargetSet> mOnFinishListener;
+ private RecentsAnimationControllerCompat mController;
public RecentsAnimationListenerSet(boolean shouldMinimizeSplitScreen,
Consumer<SwipeAnimationTargetSet> onFinishListener) {
@@ -64,6 +71,7 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener {
public final void onAnimationStart(RecentsAnimationControllerCompat controller,
RemoteAnimationTargetCompat[] targets, Rect homeContentInsets,
Rect minimizedHomeBounds) {
+ mController = controller;
SwipeAnimationTargetSet targetSet = new SwipeAnimationTargetSet(controller, targets,
homeContentInsets, minimizedHomeBounds, mShouldMinimizeSplitScreen,
mOnFinishListener);
@@ -75,12 +83,17 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener {
}
@Override
- public final void onAnimationCanceled() {
+ public final void onAnimationCanceled(boolean deferredWithScreenshot) {
Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
for (SwipeAnimationListener listener : getListeners()) {
listener.onRecentsAnimationCanceled();
}
});
+ // TODO: handle the transition better instead of simply using a transition delay.
+ if (deferredWithScreenshot) {
+ MAIN_THREAD_EXECUTOR.getHandler().postDelayed(() -> mController.cleanupScreenshot(),
+ TRANSITION_DELAY);
+ }
}
private SwipeAnimationListener[] getListeners() {