diff options
4 files changed, 29 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 95734a4ed782..0662a5ab1b6e 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2394,7 +2394,18 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mWindowManager.deferSurfaceLayout(); try { ActivityRecord r = stack.topRunningActivityLocked(); - stack.resize(pinnedBounds, tempPinnedTaskBounds, null); + Rect insetBounds = null; + if (tempPinnedTaskBounds != null) { + // We always use 0,0 as the position for the inset rect because + // if we are getting insets at all in the pinned stack it must mean + // we are headed for fullscreen. + insetBounds = tempRect; + insetBounds.top = 0; + insetBounds.left = 0; + insetBounds.right = tempPinnedTaskBounds.width(); + insetBounds.bottom = tempPinnedTaskBounds.height(); + } + stack.resize(pinnedBounds, tempPinnedTaskBounds, insetBounds); stack.ensureVisibleActivitiesConfigurationLocked(r, false); } finally { mWindowManager.continueSurfaceLayout(); diff --git a/services/core/java/com/android/server/wm/BoundsAnimationController.java b/services/core/java/com/android/server/wm/BoundsAnimationController.java index cf5cecdaf797..01bd86d4f326 100644 --- a/services/core/java/com/android/server/wm/BoundsAnimationController.java +++ b/services/core/java/com/android/server/wm/BoundsAnimationController.java @@ -176,7 +176,7 @@ public class BoundsAnimationController { // we trigger any size changes, so it can swap surfaces // in to appropriate modes, or do as it wishes otherwise. if (!mReplacement) { - mTarget.onAnimationStart(); + mTarget.onAnimationStart(mMoveToFullScreen); } // Immediately update the task bounds if they have to become larger, but preserve @@ -263,7 +263,7 @@ public class BoundsAnimationController { */ boolean setPinnedStackSize(Rect bounds, Rect taskBounds); - void onAnimationStart(); + void onAnimationStart(boolean toFullscreen); /** * Callback for the target to inform it that the animation has ended, so it can do some diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index ab9a378e7a5b..da5fcf301c98 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -592,8 +592,15 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU return mStack != null && mStack.mStackId == PINNED_STACK_ID; } + /** + * When we are in a floating stack (Freeform, Pinned, ...) we calculate + * insets differently. However if we are animating to the fullscreen stack + * we need to begin calculating insets as if we were fullscreen, otherwise + * we will have a jump at the end. + */ boolean isFloating() { - return StackId.tasksAreFloating(mStack.mStackId); + return StackId.tasksAreFloating(mStack.mStackId) + && !mStack.isBoundsAnimatingToFullscreen(); } WindowState getTopVisibleAppMainWindow() { diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index d81db1663f6f..bd0ec23c580f 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -125,6 +125,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye // perfectly fit the region it would have been cropped to. We may also avoid certain logic we // would otherwise apply while resizing, while resizing in the bounds animating mode. private boolean mBoundsAnimating = false; + private boolean mBoundsAnimatingToFullscreen = false; private Rect mBoundsAnimationTarget = new Rect(); // Temporary storage for the new bounds that should be used after the configuration change. @@ -1443,9 +1444,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } @Override // AnimatesBounds - public void onAnimationStart() { + public void onAnimationStart(boolean toFullscreen) { synchronized (mService.mWindowMap) { mBoundsAnimating = true; + mBoundsAnimatingToFullscreen = toFullscreen; } } @@ -1491,6 +1493,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye return mBoundsAnimating; } + public boolean isBoundsAnimatingToFullscreen() { + return mBoundsAnimating && mBoundsAnimatingToFullscreen; + } + /** Returns true if a removal action is still being deferred. */ boolean checkCompleteDeferredRemoval() { if (isAnimating()) { |