From 744e6e3aef4d4b6cb3a75e8ecbbc1796da2388b2 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 20 Apr 2016 12:53:16 -0700 Subject: [PATCH] Prevent recents from closing while moving PiP to fullscreen. If we close recents when beginning the animation, we will trigger a resume of the previous fullscreen app, which will attempt to aniamte in at the same time we are animating the PiP to fullscreen. These conflict causing flicker and churn. Bug: 27793381 Change-Id: I520181dadab938bbf62b25891f5ba0e4e9783967 --- .../src/com/android/systemui/tv/pip/PipManager.java | 8 +++++--- .../com/android/server/wm/BoundsAnimationController.java | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java index 5febb9b52a31a..d7efca7cac50e 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/tv/pip/PipManager.java @@ -276,9 +276,6 @@ public class PipManager { void movePipToFullscreen() { mState = STATE_NO_PIP; mPipTaskId = TASK_ID_NO_PIP; - for (int i = mListeners.size() - 1; i >= 0; --i) { - mListeners.get(i).onMoveToFullscreen(); - } resizePinnedStack(mState); } @@ -638,6 +635,11 @@ public class PipManager { public void onPinnedStackAnimationEnded() { if (DEBUG) Log.d(TAG, "onPinnedStackAnimationEnded()"); switch (mState) { + case STATE_NO_PIP: + for (int i = mListeners.size() - 1; i >= 0; --i) { + mListeners.get(i).onMoveToFullscreen(); + } + break; case STATE_PIP_OVERLAY: if (!mPipRecentsOverlayManager.isRecentsShown()) { showPipOverlay(); diff --git a/services/core/java/com/android/server/wm/BoundsAnimationController.java b/services/core/java/com/android/server/wm/BoundsAnimationController.java index debb382578174..1f44b2971e24f 100644 --- a/services/core/java/com/android/server/wm/BoundsAnimationController.java +++ b/services/core/java/com/android/server/wm/BoundsAnimationController.java @@ -149,11 +149,15 @@ public class BoundsAnimationController { public void onAnimationEnd(Animator animation) { if (DEBUG) Slog.d(TAG, "onAnimationEnd: mTarget=" + mTarget + " mMoveToFullScreen=" + mMoveToFullScreen + " mWillReplace=" + mWillReplace); - - finishAnimation(); if (mMoveToFullScreen && !mWillReplace) { mTarget.moveToFullscreen(); } + + // If we finish the animation before we move the target to fullscreen, + // recents may close itself and we may try and resume the previous + // fullscreen app leading to churn and flicker after we then move + // our target to fullscreen. + finishAnimation(); } @Override