From 1893a6118ce09f60dc6ff91b5977da467bddb00e Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Thu, 4 May 2017 14:45:09 -0700 Subject: [PATCH] Fix app bounds for pinned stack Floating tasks can be positioned partly beyond the parent bounds, so we shouldn't intersect app bounds rect with its parent for freeform stack and intersect with offset of pinned stack. Bug: 37722714 Test: android.server.cts.ActivityManagerPinnedStackTests Test: #testDisplayMetricsPinUnpin Change-Id: I0f2c2c1583e9ad85dde24023517c350be0697254 --- .../java/com/android/server/wm/StackWindowController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/StackWindowController.java b/services/core/java/com/android/server/wm/StackWindowController.java index b927e670bc285..9c44c14d78660 100644 --- a/services/core/java/com/android/server/wm/StackWindowController.java +++ b/services/core/java/com/android/server/wm/StackWindowController.java @@ -17,6 +17,7 @@ package com.android.server.wm; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; +import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import android.app.ActivityManager.StackId; import android.app.RemoteAction; @@ -285,13 +286,16 @@ public class StackWindowController if (StackId.tasksAreFloating(mStackId)) { // Floating tasks should not be resized to the screen's bounds. - if (bounds.width() == mTmpDisplayBounds.width() && + if (mStackId == PINNED_STACK_ID && bounds.width() == mTmpDisplayBounds.width() && bounds.height() == mTmpDisplayBounds.height()) { // If the bounds we are animating is the same as the fullscreen stack // dimensions, then apply the same inset calculations that we normally do for // the fullscreen stack, without intersecting it with the display bounds stableBounds.inset(mTmpStableInsets); nonDecorBounds.inset(mTmpNonDecorInsets); + // Move app bounds to zero to apply intersection with parent correctly. They are + // used only for evaluating width and height, so it's OK to move them around. + config.appBounds.offsetTo(0, 0); intersectParentBounds = true; } width = (int) (stableBounds.width() / density);