Loading services/core/java/com/android/server/wm/WallpaperController.java +10 −3 Original line number Diff line number Diff line Loading @@ -298,9 +298,9 @@ class WallpaperController { } boolean updateWallpaperOffset(WindowState wallpaperWin, boolean sync) { final Rect parentFrame = wallpaperWin.getParentFrame(); final int dw = parentFrame.width(); final int dh = parentFrame.height(); final Rect bounds = wallpaperWin.getLastReportedBounds(); final int dw = bounds.width(); final int dh = bounds.height(); int xOffset = 0; int yOffset = 0; Loading Loading @@ -448,6 +448,13 @@ class WallpaperController { private void updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) { WindowState target = mWallpaperTarget; if (target == null && changingTarget.mToken.isVisible() && changingTarget.mTransitionController.inTransition()) { // If the wallpaper target was cleared during transition, still allows the visible // window which may have been requested to be invisible to update the offset, e.g. // zoom effect from home. target = changingTarget; } if (target != null) { if (target.mWallpaperX >= 0) { mLastWallpaperX = target.mWallpaperX; Loading services/core/java/com/android/server/wm/WindowState.java +15 −4 Original line number Diff line number Diff line Loading @@ -2882,6 +2882,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mLastReportedConfiguration.getMergedConfiguration(); } /** Returns the last window configuration bounds reported to the client. */ Rect getLastReportedBounds() { final Rect bounds = getLastReportedConfiguration().windowConfiguration.getBounds(); return !bounds.isEmpty() ? bounds : getBounds(); } void adjustStartingWindowFlags() { if (mAttrs.type == TYPE_BASE_APPLICATION && mActivityRecord != null && mActivityRecord.mStartingWindow != null) { Loading Loading @@ -5230,6 +5236,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Child window follows parent's scale. return; } if (!isVisibleRequested() && !(mIsWallpaper && mToken.isVisible())) { // Skip if it is requested to be invisible, but if it is wallpaper, it may be in // transition that still needs to update the scale for zoom effect. return; } float newHScale = mHScale * mGlobalScale * mWallpaperScale; float newVScale = mVScale * mGlobalScale * mWallpaperScale; if (mLastHScale != newHScale || Loading @@ -5249,7 +5260,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP updateSurfacePositionNonOrganized(); // Send information to SurfaceFlinger about the priority of the current window. updateFrameRateSelectionPriorityIfNeeded(); if (isVisibleRequested()) updateScaleIfNeeded(); updateScaleIfNeeded(); mWinAnimator.prepareSurfaceLocked(getSyncTransaction()); super.prepareSurfaces(); Loading @@ -5275,11 +5286,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mSurfacePosition); if (mWallpaperScale != 1f) { DisplayInfo displayInfo = getDisplayInfo(); final Rect bounds = getLastReportedBounds(); Matrix matrix = mTmpMatrix; matrix.setTranslate(mXOffset, mYOffset); matrix.postScale(mWallpaperScale, mWallpaperScale, displayInfo.logicalWidth / 2f, displayInfo.logicalHeight / 2f); matrix.postScale(mWallpaperScale, mWallpaperScale, bounds.exactCenterX(), bounds.exactCenterY()); matrix.getValues(mTmpMatrixArray); mSurfacePosition.offset(Math.round(mTmpMatrixArray[Matrix.MTRANS_X]), Math.round(mTmpMatrixArray[Matrix.MTRANS_Y])); Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +3 −5 Original line number Diff line number Diff line Loading @@ -1422,18 +1422,16 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(config90.orientation, app.getConfiguration().orientation); assertEquals(config90.windowConfiguration.getBounds(), app.getBounds()); // Make wallaper laid out with the fixed rotation transform. // Associate wallpaper with the fixed rotation transform. final WindowToken wallpaperToken = mWallpaperWindow.mToken; wallpaperToken.linkFixedRotationTransform(app); mWallpaperWindow.mLayoutNeeded = true; performLayout(mDisplayContent); // Force the negative offset to verify it can be updated. mWallpaperWindow.mXOffset = mWallpaperWindow.mYOffset = -1; assertTrue(mDisplayContent.mWallpaperController.updateWallpaperOffset(mWallpaperWindow, false /* sync */)); assertThat(mWallpaperWindow.mXOffset).isGreaterThan(-1); assertThat(mWallpaperWindow.mYOffset).isGreaterThan(-1); assertThat(mWallpaperWindow.mXOffset).isNotEqualTo(-1); assertThat(mWallpaperWindow.mYOffset).isNotEqualTo(-1); // The wallpaper need to animate with transformed position, so its surface position should // not be reset. Loading Loading
services/core/java/com/android/server/wm/WallpaperController.java +10 −3 Original line number Diff line number Diff line Loading @@ -298,9 +298,9 @@ class WallpaperController { } boolean updateWallpaperOffset(WindowState wallpaperWin, boolean sync) { final Rect parentFrame = wallpaperWin.getParentFrame(); final int dw = parentFrame.width(); final int dh = parentFrame.height(); final Rect bounds = wallpaperWin.getLastReportedBounds(); final int dw = bounds.width(); final int dh = bounds.height(); int xOffset = 0; int yOffset = 0; Loading Loading @@ -448,6 +448,13 @@ class WallpaperController { private void updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) { WindowState target = mWallpaperTarget; if (target == null && changingTarget.mToken.isVisible() && changingTarget.mTransitionController.inTransition()) { // If the wallpaper target was cleared during transition, still allows the visible // window which may have been requested to be invisible to update the offset, e.g. // zoom effect from home. target = changingTarget; } if (target != null) { if (target.mWallpaperX >= 0) { mLastWallpaperX = target.mWallpaperX; Loading
services/core/java/com/android/server/wm/WindowState.java +15 −4 Original line number Diff line number Diff line Loading @@ -2882,6 +2882,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return mLastReportedConfiguration.getMergedConfiguration(); } /** Returns the last window configuration bounds reported to the client. */ Rect getLastReportedBounds() { final Rect bounds = getLastReportedConfiguration().windowConfiguration.getBounds(); return !bounds.isEmpty() ? bounds : getBounds(); } void adjustStartingWindowFlags() { if (mAttrs.type == TYPE_BASE_APPLICATION && mActivityRecord != null && mActivityRecord.mStartingWindow != null) { Loading Loading @@ -5230,6 +5236,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Child window follows parent's scale. return; } if (!isVisibleRequested() && !(mIsWallpaper && mToken.isVisible())) { // Skip if it is requested to be invisible, but if it is wallpaper, it may be in // transition that still needs to update the scale for zoom effect. return; } float newHScale = mHScale * mGlobalScale * mWallpaperScale; float newVScale = mVScale * mGlobalScale * mWallpaperScale; if (mLastHScale != newHScale || Loading @@ -5249,7 +5260,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP updateSurfacePositionNonOrganized(); // Send information to SurfaceFlinger about the priority of the current window. updateFrameRateSelectionPriorityIfNeeded(); if (isVisibleRequested()) updateScaleIfNeeded(); updateScaleIfNeeded(); mWinAnimator.prepareSurfaceLocked(getSyncTransaction()); super.prepareSurfaces(); Loading @@ -5275,11 +5286,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mSurfacePosition); if (mWallpaperScale != 1f) { DisplayInfo displayInfo = getDisplayInfo(); final Rect bounds = getLastReportedBounds(); Matrix matrix = mTmpMatrix; matrix.setTranslate(mXOffset, mYOffset); matrix.postScale(mWallpaperScale, mWallpaperScale, displayInfo.logicalWidth / 2f, displayInfo.logicalHeight / 2f); matrix.postScale(mWallpaperScale, mWallpaperScale, bounds.exactCenterX(), bounds.exactCenterY()); matrix.getValues(mTmpMatrixArray); mSurfacePosition.offset(Math.round(mTmpMatrixArray[Matrix.MTRANS_X]), Math.round(mTmpMatrixArray[Matrix.MTRANS_Y])); Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +3 −5 Original line number Diff line number Diff line Loading @@ -1422,18 +1422,16 @@ public class DisplayContentTests extends WindowTestsBase { assertEquals(config90.orientation, app.getConfiguration().orientation); assertEquals(config90.windowConfiguration.getBounds(), app.getBounds()); // Make wallaper laid out with the fixed rotation transform. // Associate wallpaper with the fixed rotation transform. final WindowToken wallpaperToken = mWallpaperWindow.mToken; wallpaperToken.linkFixedRotationTransform(app); mWallpaperWindow.mLayoutNeeded = true; performLayout(mDisplayContent); // Force the negative offset to verify it can be updated. mWallpaperWindow.mXOffset = mWallpaperWindow.mYOffset = -1; assertTrue(mDisplayContent.mWallpaperController.updateWallpaperOffset(mWallpaperWindow, false /* sync */)); assertThat(mWallpaperWindow.mXOffset).isGreaterThan(-1); assertThat(mWallpaperWindow.mYOffset).isGreaterThan(-1); assertThat(mWallpaperWindow.mXOffset).isNotEqualTo(-1); assertThat(mWallpaperWindow.mYOffset).isNotEqualTo(-1); // The wallpaper need to animate with transformed position, so its surface position should // not be reset. Loading