From 73b6e26d8c3e388995da6b72a9fda764883aaef9 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Thu, 8 Aug 2019 17:48:46 +0800 Subject: Freezing screen when dismiss pip if orientation is going to change. When skip pip animation to fullscreen, the stack will move to another fullscreen stack then resume top activity, if one of activity is not paused, the remaining resume steps will be skip till all activities paused. In that case the fullscreen stack will shows up before rotation animation. To let the animation smooth, freeze screen once we know the orientation is going to change when dismiss pip. Fix: 138820136 Test: atest ActivityLifecyclePipTests Change-Id: I808b1a797a322ffce039de4bcad316973e732672 --- .../java/com/android/server/wm/ActivityStack.java | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index b33f23cfdf4e..c5c53d8ba4ca 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -5651,13 +5651,20 @@ class ActivityStack extends ConfigurationContainer { void animateResizePinnedStack(Rect sourceHintBounds, Rect toBounds, int animationDuration, boolean fromFullscreen) { if (!inPinnedWindowingMode()) return; - if (skipResizeAnimation(toBounds == null /* toFullscreen */)) { - mService.moveTasksToFullscreenStack(mStackId, true /* onTop */); - } else { - if (getTaskStack() == null) return; - getTaskStack().animateResizePinnedStack(toBounds, sourceHintBounds, - animationDuration, fromFullscreen); + if (toBounds == null /* toFullscreen */) { + final Configuration parentConfig = getParent().getConfiguration(); + final ActivityRecord top = topRunningNonOverlayTaskActivity(); + if (top != null && !top.isConfigurationCompatible(parentConfig)) { + // The final orientation of this activity will change after moving to full screen. + // Start freezing screen here to prevent showing a temporary full screen window. + top.startFreezingScreenLocked(top.app, CONFIG_SCREEN_LAYOUT); + mService.moveTasksToFullscreenStack(mStackId, true /* onTop */); + return; + } } + if (getTaskStack() == null) return; + getTaskStack().animateResizePinnedStack(toBounds, sourceHintBounds, + animationDuration, fromFullscreen); } /** @@ -5673,15 +5680,6 @@ class ActivityStack extends ConfigurationContainer { stack.getAnimationOrCurrentBounds(outBounds); } - private boolean skipResizeAnimation(boolean toFullscreen) { - if (!toFullscreen) { - return false; - } - final Configuration parentConfig = getParent().getConfiguration(); - final ActivityRecord top = topRunningNonOverlayTaskActivity(); - return top != null && !top.isConfigurationCompatible(parentConfig); - } - void setPictureInPictureAspectRatio(float aspectRatio) { if (getTaskStack() == null) return; getTaskStack().setPictureInPictureAspectRatio(aspectRatio); -- cgit v1.2.3-59-g8ed1b