diff options
8 files changed, 84 insertions, 272 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 88bd1c113704..778ebb056c8f 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1810,7 +1810,7 @@ public final class ViewRootImpl implements ViewParent, .setParent(getRenderSurfaceControl()) .setCallsite("ViewRootImpl.getBoundsLayer") .build(); - setBoundsLayerCrop(); + setBoundsLayerCrop(mTransaction); mTransaction.show(mBoundsLayer).apply(); } return mBoundsLayer; @@ -1838,25 +1838,41 @@ public final class ViewRootImpl implements ViewParent, return ret; } - private void setBoundsLayerCrop() { + private void setBoundsLayerCrop(Transaction t) { // mWinFrame is already adjusted for surface insets. So offset it and use it as // the cropping bounds. mTempBoundsRect.set(mWinFrame); mTempBoundsRect.offsetTo(mWindowAttributes.surfaceInsets.left, mWindowAttributes.surfaceInsets.top); - mTransaction.setWindowCrop(mBoundsLayer, mTempBoundsRect); + t.setWindowCrop(mBoundsLayer, mTempBoundsRect); } /** * Called after window layout to update the bounds surface. If the surface insets have changed * or the surface has resized, update the bounds surface. */ - private void updateBoundsLayer() { + private boolean updateBoundsLayer(SurfaceControl.Transaction t) { if (mBoundsLayer != null) { - setBoundsLayerCrop(); - mTransaction.deferTransactionUntil(mBoundsLayer, - getRenderSurfaceControl(), mSurface.getNextFrameNumber()) - .apply(); + setBoundsLayerCrop(t); + t.deferTransactionUntil(mBoundsLayer, getRenderSurfaceControl(), + mSurface.getNextFrameNumber()); + return true; + } + return false; + } + + private void prepareSurfaces(boolean sizeChanged) { + final SurfaceControl.Transaction t = mTransaction; + final SurfaceControl sc = getRenderSurfaceControl(); + if (!sc.isValid()) return; + + boolean applyTransaction = updateBoundsLayer(t); + if (sizeChanged) { + applyTransaction = true; + t.setBufferSize(sc, mSurfaceSize.x, mSurfaceSize.y); + } + if (applyTransaction) { + t.apply(); } } @@ -2947,7 +2963,16 @@ public final class ViewRootImpl implements ViewParent, } if (surfaceSizeChanged || surfaceReplaced || surfaceCreated || windowAttributesChanged) { - updateBoundsLayer(); + // If the surface has been replaced, there's a chance the bounds layer is not parented + // to the new layer. When updating bounds layer, also reparent to the main VRI + // SurfaceControl to ensure it's correctly placed in the hierarchy. + // + // This needs to be done on the client side since WMS won't reparent the children to the + // new surface if it thinks the app is closing. WMS gets the signal that the app is + // stopping, but on the client side it doesn't get stopped since it's restarted quick + // enough. WMS doesn't want to keep around old children since they will leak when the + // client creates new children. + prepareSurfaces(surfaceSizeChanged); } final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw); diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 42fb13389b04..1cb610fc7604 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -7867,7 +7867,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A InsetUtils.addInsets(insets, getLetterboxInsets()); return new RemoteAnimationTarget(task.mTaskId, record.getMode(), record.mAdapter.mCapturedLeash, !fillsParent(), - mainWindow.mWinAnimator.mLastClipRect, insets, + new Rect(), insets, getPrefixOrderIndex(), record.mAdapter.mPosition, record.mAdapter.mLocalBounds, record.mAdapter.mStackBounds, task.getWindowConfiguration(), false /*isNotInRecents*/, diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index b50cb4c34398..42a20ff7ed7b 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -929,7 +929,7 @@ public class RecentsAnimationController implements DeathRecipient { ? MODE_OPENING : MODE_CLOSING; mTarget = new RemoteAnimationTarget(mTask.mTaskId, mode, mCapturedLeash, - !topApp.fillsParent(), mainWindow.mWinAnimator.mLastClipRect, + !topApp.fillsParent(), new Rect(), insets, mTask.getPrefixOrderIndex(), new Point(mBounds.left, mBounds.top), mLocalBounds, mBounds, mTask.getWindowConfiguration(), mIsRecentTaskInvisible, null, null); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fa640367e1fe..d434bf9d3816 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2423,8 +2423,8 @@ public class WindowManagerService extends IWindowManager.Stub Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } if (winAnimator.mSurfaceController != null) { - outSurfaceSize.set(winAnimator.mSurfaceController.getWidth(), - winAnimator.mSurfaceController.getHeight()); + win.calculateSurfaceBounds(win.getAttrs(), mTmpRect); + outSurfaceSize.set(mTmpRect.width(), mTmpRect.height()); } getInsetsSourceControls(win, outActiveControls); } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 45a3162f2a28..ad2817720387 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4950,93 +4950,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } /** - * Calculate the window crop according to system decor policy. In general this is - * the system decor rect (see #calculateSystemDecorRect), but we also have some - * special cases. This rectangle is in screen space. - */ - void calculatePolicyCrop(Rect policyCrop) { - final DisplayContent displayContent = getDisplayContent(); - - if (!displayContent.isDefaultDisplay && !displayContent.supportsSystemDecorations()) { - // On a different display there is no system decor. Crop the window - // by the screen boundaries. - final DisplayInfo displayInfo = getDisplayInfo(); - policyCrop.set(0, 0, mWindowFrames.mCompatFrame.width(), - mWindowFrames.mCompatFrame.height()); - policyCrop.intersect(-mWindowFrames.mCompatFrame.left, -mWindowFrames.mCompatFrame.top, - displayInfo.logicalWidth - mWindowFrames.mCompatFrame.left, - displayInfo.logicalHeight - mWindowFrames.mCompatFrame.top); - } else if (skipDecorCrop()) { - // Windows without policy decor aren't cropped. - policyCrop.set(0, 0, mWindowFrames.mCompatFrame.width(), - mWindowFrames.mCompatFrame.height()); - } else { - // Crop to the system decor specified by policy. - calculateSystemDecorRect(policyCrop); - } - } - - /** - * The system decor rect is the region of the window which is not covered - * by system decorations. - */ - private void calculateSystemDecorRect(Rect systemDecorRect) { - final Rect decorRect = mWindowFrames.mDecorFrame; - final int width = mWindowFrames.mFrame.width(); - final int height = mWindowFrames.mFrame.height(); - - final int left = mWindowFrames.mFrame.left; - final int top = mWindowFrames.mFrame.top; - - // Initialize the decor rect to the entire frame. - if (isDockedResizing()) { - // If we are resizing with the divider, the task bounds might be smaller than the - // stack bounds. The system decor is used to clip to the task bounds, which we don't - // want in this case in order to avoid holes. - // - // We take care to not shrink the width, for surfaces which are larger than - // the display region. Of course this area will not eventually be visible - // but if we truncate the width now, we will calculate incorrectly - // when adjusting to the stack bounds. - final DisplayInfo displayInfo = getDisplayContent().getDisplayInfo(); - systemDecorRect.set(0, 0, - Math.max(width, displayInfo.logicalWidth), - Math.max(height, displayInfo.logicalHeight)); - } else { - systemDecorRect.set(0, 0, width, height); - } - - // If a freeform window is animating from a position where it would be cutoff, it would be - // cutoff during the animation. We don't want that, so for the duration of the animation - // we ignore the decor cropping and depend on layering to position windows correctly. - - // We also ignore cropping when the window is currently being drag resized in split screen - // to prevent issues with the crop for screenshot. - final boolean cropToDecor = - !(inFreeformWindowingMode() && isAnimatingLw()) && !isDockedResizing(); - if (cropToDecor) { - // Intersect with the decor rect, offsetted by window position. - systemDecorRect.intersect(decorRect.left - left, decorRect.top - top, - decorRect.right - left, decorRect.bottom - top); - } - - // If size compatibility is being applied to the window, the - // surface is scaled relative to the screen. Also apply this - // scaling to the crop rect. We aren't using the standard rect - // scale function because we want to round things to make the crop - // always round to a larger rect to ensure we don't crop too - // much and hide part of the window that should be seen. - if (mInvGlobalScale != 1.0f && inSizeCompatMode()) { - final float scale = mInvGlobalScale; - systemDecorRect.left = (int) (systemDecorRect.left * scale - 0.5f); - systemDecorRect.top = (int) (systemDecorRect.top * scale - 0.5f); - systemDecorRect.right = (int) ((systemDecorRect.right + 1) * scale - 0.5f); - systemDecorRect.bottom = (int) ((systemDecorRect.bottom + 1) * scale - 0.5f); - } - - } - - /** * Expand the given rectangle by this windows surface insets. This * takes you from the 'window size' to the 'surface size'. * The surface insets are positive in each direction, so we inset by @@ -5093,9 +5006,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // on the new one. This prevents blinking when we change elevation of freeform and // pinned windows. if (!mWinAnimator.tryChangeFormatInPlaceLocked()) { - mWinAnimator.preserveSurfaceLocked(); + mWinAnimator.preserveSurfaceLocked(getPendingTransaction()); result |= RELAYOUT_RES_SURFACE_CHANGED | RELAYOUT_RES_FIRST_TIME; + scheduleAnimation(); } } @@ -5111,9 +5025,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // to preserve and destroy windows which are attached to another, they // will keep their surface and its size may change over time. if (mHasSurface && !isChildWindow()) { - mWinAnimator.preserveSurfaceLocked(); + mWinAnimator.preserveSurfaceLocked(getPendingTransaction()); result |= RELAYOUT_RES_SURFACE_CHANGED | RELAYOUT_RES_FIRST_TIME; + scheduleAnimation(); } } final boolean freeformResizing = isDragResizing() @@ -5937,4 +5852,37 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void requestRedrawForSync() { mRedrawForSyncReported = false; } + + void calculateSurfaceBounds(WindowManager.LayoutParams attrs, Rect outSize) { + outSize.setEmpty(); + if ((attrs.flags & FLAG_SCALED) != 0) { + // For a scaled surface, we always want the requested size. + outSize.right = mRequestedWidth; + outSize.bottom = mRequestedHeight; + } else { + // When we're doing a drag-resizing, request a surface that's fullscreen size, + // so that we don't need to reallocate during the process. This also prevents + // buffer drops due to size mismatch. + if (isDragResizing()) { + final DisplayInfo displayInfo = getDisplayInfo(); + outSize.right = displayInfo.logicalWidth; + outSize.bottom = displayInfo.logicalHeight; + } else { + getCompatFrameSize(outSize); + } + } + + // This doesn't necessarily mean that there is an error in the system. The sizes might be + // incorrect, because it is before the first layout or draw. + if (outSize.width() < 1) { + outSize.right = 1; + } + if (outSize.height() < 1) { + outSize.bottom = 1; + } + + // Adjust for surface insets. + outSize.inset(-attrs.surfaceInsets.left, -attrs.surfaceInsets.top, + -attrs.surfaceInsets.right, -attrs.surfaceInsets.bottom); + } } diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 7bb79555c52c..2ace23f24788 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -135,9 +135,6 @@ class WindowStateAnimator { float mAlpha = 0; float mLastAlpha = 0; - Rect mTmpClipRect = new Rect(); - Rect mLastClipRect = new Rect(); - Rect mLastFinalClipRect = new Rect(); Rect mTmpStackBounds = new Rect(); private Rect mTmpAnimatingBounds = new Rect(); private Rect mTmpSourceBounds = new Rect(); @@ -352,7 +349,7 @@ class WindowStateAnimator { return result; } - void preserveSurfaceLocked() { + void preserveSurfaceLocked(SurfaceControl.Transaction t) { if (mDestroyPreservedSurfaceUponRedraw) { // This could happen when switching the surface mode very fast. For example, // we preserved a surface when dragResizing changed to true. Then before the @@ -379,7 +376,7 @@ class WindowStateAnimator { // Our SurfaceControl is always at layer 0 within the parent Surface managed by // window-state. We want this old Surface to stay on top of the new one // until we do the swap, so we place it at a positive layer. - mSurfaceController.mSurfaceControl.setLayer(PRESERVED_SURFACE_LAYER); + t.setLayer(mSurfaceController.getClientViewRootSurface(), PRESERVED_SURFACE_LAYER); } mDestroyPreservedSurfaceUponRedraw = true; mSurfaceDestroyDeferred = true; @@ -456,7 +453,8 @@ class WindowStateAnimator { flags |= SurfaceControl.SKIP_SCREENSHOT; } - calculateSurfaceBounds(w, attrs, mTmpSize); + w.calculateSurfaceBounds(attrs, mTmpSize); + final int width = mTmpSize.width(); final int height = mTmpSize.height(); @@ -468,9 +466,6 @@ class WindowStateAnimator { + " format=" + attrs.format + " flags=" + flags); } - // We may abort, so initialize to defaults. - mLastClipRect.set(0, 0, 0, 0); - // Set up surface control with initial size. try { @@ -532,40 +527,6 @@ class WindowStateAnimator { return mSurfaceController; } - private void calculateSurfaceBounds(WindowState w, LayoutParams attrs, Rect outSize) { - outSize.setEmpty(); - if ((attrs.flags & FLAG_SCALED) != 0) { - // For a scaled surface, we always want the requested size. - outSize.right = w.mRequestedWidth; - outSize.bottom = w.mRequestedHeight; - } else { - // When we're doing a drag-resizing, request a surface that's fullscreen size, - // so that we don't need to reallocate during the process. This also prevents - // buffer drops due to size mismatch. - if (w.isDragResizing()) { - final DisplayInfo displayInfo = w.getDisplayInfo(); - outSize.right = displayInfo.logicalWidth; - outSize.bottom = displayInfo.logicalHeight; - } else { - w.getCompatFrameSize(outSize); - } - } - - // Something is wrong and SurfaceFlinger will not like this, try to revert to reasonable - // values. This doesn't necessarily mean that there is an error in the system. The sizes - // might be incorrect, because it is before the first layout or draw. - if (outSize.width() < 1) { - outSize.right = 1; - } - if (outSize.height() < 1) { - outSize.bottom = 1; - } - - // Adjust for surface insets. - outSize.inset(-attrs.surfaceInsets.left, -attrs.surfaceInsets.top, - -attrs.surfaceInsets.right, -attrs.surfaceInsets.bottom); - } - boolean hasSurface() { return mSurfaceController != null && mSurfaceController.hasSurface(); } @@ -674,77 +635,6 @@ class WindowStateAnimator { mDsDy = mWin.mGlobalScale; } - /** - * Calculate the window-space crop rect and fill clipRect. - * @return true if clipRect has been filled otherwise, no window space crop should be applied. - */ - private boolean calculateCrop(Rect clipRect) { - final WindowState w = mWin; - final DisplayContent displayContent = w.getDisplayContent(); - clipRect.setEmpty(); - - if (displayContent == null) { - return false; - } - - if (w.getWindowConfiguration().tasksAreFloating() - || WindowConfiguration.isSplitScreenWindowingMode(w.getWindowingMode())) { - return false; - } - - // During forced seamless rotation, the surface bounds get updated with the crop in the - // new rotation, which is not compatible with showing the surface in the old rotation. - // To work around that we disable cropping for such windows, as it is not necessary anyways. - if (w.mForceSeamlesslyRotate) { - return false; - } - - // If we're animating, the wallpaper should only - // be updated at the end of the animation. - if (w.mAttrs.type == TYPE_WALLPAPER) { - return false; - } - - if (DEBUG_WINDOW_CROP) Slog.d(TAG, - "Updating crop win=" + w + " mLastCrop=" + mLastClipRect); - - w.calculatePolicyCrop(mSystemDecorRect); - - if (DEBUG_WINDOW_CROP) Slog.d(TAG, "Applying decor to crop win=" + w + " mDecorFrame=" - + w.getDecorFrame() + " mSystemDecorRect=" + mSystemDecorRect); - - // We use the clip rect as provided by the tranformation for non-fullscreen windows to - // avoid premature clipping with the system decor rect. - clipRect.set(mSystemDecorRect); - if (DEBUG_WINDOW_CROP) Slog.d(TAG, "win=" + w + " Initial clip rect: " + clipRect); - - w.expandForSurfaceInsets(clipRect); - - // The clip rect was generated assuming (0,0) as the window origin, - // so we need to translate to match the actual surface coordinates. - clipRect.offset(w.mAttrs.surfaceInsets.left, w.mAttrs.surfaceInsets.top); - - if (DEBUG_WINDOW_CROP) Slog.d(TAG, - "win=" + w + " Clip rect after stack adjustment=" + clipRect); - - w.transformClipRectFromScreenToSurfaceSpace(clipRect); - - return true; - } - - private void applyCrop(Rect clipRect, boolean recoveringMemory) { - if (DEBUG_WINDOW_CROP) Slog.d(TAG, "applyCrop: win=" + mWin - + " clipRect=" + clipRect); - if (clipRect != null) { - if (!clipRect.equals(mLastClipRect)) { - mLastClipRect.set(clipRect); - mSurfaceController.setCropInTransaction(clipRect, recoveringMemory); - } - } else { - mSurfaceController.clearCropInTransaction(recoveringMemory); - } - } - private boolean shouldConsumeMainWindowSizeTransaction() { // We only consume the transaction when the client is calling relayout // because this is the only time we know the frameNumber will be valid @@ -771,29 +661,6 @@ class WindowStateAnimator { final LayoutParams attrs = mWin.getAttrs(); final Task task = w.getTask(); - calculateSurfaceBounds(w, attrs, mTmpSize); - - // Once relayout has been called at least once, we need to make sure - // we only resize the client surface during calls to relayout. For - // clients which use indeterminate measure specs (MATCH_PARENT), - // we may try and change their window size without a call to relayout. - // However, this would be unsafe, as the client may be in the middle - // of producing a frame at the old size, having just completed layout - // to find the surface size changed underneath it. - final boolean relayout = !w.mRelayoutCalled || w.mInRelayout; - if (relayout) { - mSurfaceController.setBufferSizeInTransaction( - mTmpSize.width(), mTmpSize.height(), recoveringMemory); - } - // If we are undergoing seamless rotation, the surface has already - // been set up to persist at it's old location. We need to freeze - // updates until a resize occurs. - - Rect clipRect = null; - if (calculateCrop(mTmpClipRect)) { - clipRect = mTmpClipRect; - } - if (shouldConsumeMainWindowSizeTransaction()) { task.getMainWindowSizeChangeTask().getSurfaceControl().deferTransactionUntil( mWin.getClientViewRootSurface(), mWin.getFrameNumber()); @@ -808,6 +675,11 @@ class WindowStateAnimator { final Rect insets = attrs.surfaceInsets; + // getFrameNumber is only valid in the call-stack of relayoutWindow + // as this is the only-time we know the client renderer + // is paused. + final boolean relayout = !w.mRelayoutCalled || w.mInRelayout; + if (!w.mSeamlesslyRotated) { // Used to offset the WSA when stack position changes before a resize. int xOffset = mXOffset; @@ -830,12 +702,6 @@ class WindowStateAnimator { } xOffset = -mTmpPos.x; yOffset = -mTmpPos.y; - // Crop also needs to be extended so the bottom isn't cut off when the WSA - // position is moved. - if (clipRect != null) { - clipRect.right += mTmpPos.x; - clipRect.bottom += mTmpPos.y; - } } } if (!mIsWallpaper) { @@ -850,7 +716,6 @@ class WindowStateAnimator { // Wallpaper is already updated above when calling setWallpaperPositionAndScale so // we only need to consider the non-wallpaper case here. if (!mIsWallpaper) { - applyCrop(clipRect, recoveringMemory); mSurfaceController.setMatrixInTransaction( mDsDx * w.mHScale, mDtDx * w.mVScale, @@ -1052,7 +917,6 @@ class WindowStateAnimator { mDtDy * mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale, mDsDy * mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale, recoveringMemory); - applyCrop(null, recoveringMemory); } /** @@ -1243,7 +1107,6 @@ class WindowStateAnimator { void dumpDebug(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); - mLastClipRect.dumpDebug(proto, LAST_CLIP_RECT); if (mSurfaceController != null) { mSurfaceController.dumpDebug(proto, SURFACE); } @@ -1264,11 +1127,7 @@ class WindowStateAnimator { pw.print(prefix); pw.print(" mLastHidden="); pw.println(mLastHidden); pw.print(prefix); pw.print("mEnterAnimationPending=" + mEnterAnimationPending); pw.print(prefix); pw.print("mSystemDecorRect="); mSystemDecorRect.printShortString(pw); - pw.print(" mLastClipRect="); mLastClipRect.printShortString(pw); - if (!mLastFinalClipRect.isEmpty()) { - pw.print(" mLastFinalClipRect="); mLastFinalClipRect.printShortString(pw); - } pw.println(); } diff --git a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java index 13f04d23ccd3..2efd4b53efcc 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -117,7 +117,6 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { assertEquals(win.mActivityRecord.getPrefixOrderIndex(), app.prefixOrderIndex); assertEquals(win.mActivityRecord.getTask().mTaskId, app.taskId); assertEquals(mMockLeash, app.leash); - assertEquals(win.mWinAnimator.mLastClipRect, app.clipRect); assertEquals(false, app.isTranslucent); verify(mMockTransaction).setPosition(mMockLeash, app.position.x, app.position.y); verify(mMockTransaction).setWindowCrop(mMockLeash, 100, 50); @@ -274,7 +273,6 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { assertEquals(new Rect(0, 0, 200, 200), app.startBounds); assertEquals(mMockLeash, app.leash); assertEquals(mMockThumbnailLeash, app.startLeash); - assertEquals(win.mWinAnimator.mLastClipRect, app.clipRect); assertEquals(false, app.isTranslucent); verify(mMockTransaction).setPosition( mMockLeash, app.startBounds.left, app.startBounds.top); @@ -325,7 +323,6 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { assertEquals(new Rect(50, 100, 150, 150), app.startBounds); assertEquals(mMockLeash, app.leash); assertEquals(mMockThumbnailLeash, app.startLeash); - assertEquals(win.mWinAnimator.mLastClipRect, app.clipRect); assertEquals(false, app.isTranslucent); verify(mMockTransaction).setPosition( mMockLeash, app.startBounds.left, app.startBounds.top); diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java index ca3626d09062..0cf63f4ff21d 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java @@ -115,12 +115,6 @@ public class WindowFrameTests extends WindowTestsBase { expectedRect.bottom); } - private void assertPolicyCrop(WindowState w, int left, int top, int right, int bottom) { - Rect policyCrop = new Rect(); - w.calculatePolicyCrop(policyCrop); - assertRect(policyCrop, left, top, right, bottom); - } - @Test public void testLayoutInFullscreenTaskInsets() { // fullscreen task doesn't use bounds for computeFrame @@ -335,12 +329,10 @@ public class WindowFrameTests extends WindowTestsBase { final WindowFrames windowFrames = w.getWindowFrames(); windowFrames.setFrames(pf, df, cf, vf, dcf, sf); w.computeFrame(); - assertPolicyCrop(w, 0, cf.top, logicalWidth, cf.bottom); windowFrames.mDecorFrame.setEmpty(); // Likewise with no decor frame we would get no crop w.computeFrame(); - assertPolicyCrop(w, 0, 0, logicalWidth, logicalHeight); // Now we set up a window which doesn't fill the entire decor frame. // Normally it would be cropped to it's frame but in the case of docked resizing @@ -355,16 +347,7 @@ public class WindowFrameTests extends WindowTestsBase { w.mRequestedHeight = logicalHeight / 2; w.computeFrame(); - // Normally the crop is shrunk from the decor frame - // to the computed window frame. - assertPolicyCrop(w, 0, 0, logicalWidth / 2, logicalHeight / 2); - doReturn(true).when(w).isDockedResizing(); - // But if we are docked resizing it won't be, however we will still be - // shrunk to the decor frame and the display. - assertPolicyCrop(w, 0, 0, - Math.min(pf.width(), displayInfo.logicalWidth), - Math.min(pf.height(), displayInfo.logicalHeight)); } @Test |