Make stack crop be aware of the big surface during resizing.
When resizing we are using big surface, so we can't depend on the
window frame to determine how to crop it to its surface.
Change-Id: I6aaa32433c5db59dfe7ccb930a0485688e6e2503
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index ee7c88a..ecc1f2c 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1431,8 +1431,14 @@
if (appToken != null && appToken.mCropWindowsToStack && !appToken.mReplacingWindow) {
TaskStack stack = w.getTask().mStack;
stack.getBounds(mTmpStackBounds);
- final int frameX = w.mFrame.left + mWin.mXOffset - w.getAttrs().surfaceInsets.left;
- final int frameY = w.mFrame.top + mWin.mYOffset - w.getAttrs().surfaceInsets.top;
+ // When we resize we use the big surface approach, which means we can't trust the
+ // window frame bounds anymore. Instead, the window will be placed at 0, 0, but to avoid
+ // hardcoding it, we use surface coordinates.
+ final boolean isResizing = w.isDragResizing();
+ final int frameX = isResizing ? (int) mSurfaceX :
+ w.mFrame.left + mWin.mXOffset - w.getAttrs().surfaceInsets.left;
+ final int frameY = isResizing ? (int) mSurfaceY :
+ w.mFrame.top + mWin.mYOffset - w.getAttrs().surfaceInsets.top;
// We need to do some acrobatics with surface position, because their clip region is
// relative to the inside of the surface, but the stack bounds aren't.
clipRect.left = Math.max(0,