diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 5b0d950e3bd8f..0847a179c5535 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -739,7 +739,7 @@ public class Surface implements Parcelable { * Set the scaling mode to be used for this surfaces buffers * @hide */ - void setScalingMode(@ScalingMode int scalingMode) { + public void setScalingMode(@ScalingMode int scalingMode) { synchronized (mLock) { checkNotReleasedLocked(); int err = nativeSetScalingMode(mNativeObject, scalingMode); diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 25732e7f0d995..7ed22a1f7777e 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -203,16 +203,14 @@ class ScreenRotationAnimation { .setCallsite("ScreenRotationAnimation") .build(); - // In case display bounds change, screenshot buffer and surface may mismatch so set a - // scaling mode. - SurfaceControl.Transaction t2 = mService.mTransactionFactory.get(); - t2.setOverrideScalingMode(mScreenshotLayer, Surface.SCALING_MODE_SCALE_TO_WINDOW); - t2.apply(true /* sync */); - // Capture a screenshot into the surface we just created. final int displayId = displayContent.getDisplayId(); final Surface surface = mService.mSurfaceFactory.get(); + // In case display bounds change, screenshot buffer and surface may mismatch so set a + // scaling mode. surface.copyFrom(mScreenshotLayer); + surface.setScalingMode(Surface.SCALING_MODE_SCALE_TO_WINDOW); + SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer = mService.mDisplayManagerInternal.systemScreenshot(displayId); if (screenshotBuffer != null) {