Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76758096 authored by Robert Carr's avatar Robert Carr
Browse files

ScreenRotationAnimation: Use Surface#setScalingMode

We are the last user of SurfaceControl#setOverrideScalingMode
in ScreenRotationAnimation we have no need to call it since we
are the BufferProducer and we can just use Surface#setScalingMode

Bug: 161937501
Test: Existing tests pass
Change-Id: I049145a91fedbbca5f009648f1537b0380c5e771
parent f09bdfc4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+4 −6
Original line number Diff line number Diff line
@@ -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) {