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

Commit 333bf1c2 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by JP Sugarbroad
Browse files

DO NOT MERGE Fix display freezing when screen size mismatches

If we have a display size change, make sure to set different
scaling mode such that we can show the buffer even if there is
a size mismatch.

Test: Rotate screen
Test: Change cutout type
Bug: 112876936
Change-Id: Iedc7774d69730a95b98ba46d4f274bc3b7e66bd1
(cherry picked from commit da499731)
parent e258e0a5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.view.DisplayInfo;
import android.view.Surface;
import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.SurfaceSession;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
@@ -269,6 +270,12 @@ class ScreenRotationAnimation {
                    .setSecure(isSecure)
                    .build();

            // In case display bounds change, screenshot buffer and surface may mismatch so set a
            // scaling mode.
            Transaction t2 = new Transaction();
            t2.setOverrideScalingMode(mSurfaceControl, Surface.SCALING_MODE_SCALE_TO_WINDOW);
            t2.apply(true /* sync */);

            // capture a screenshot into the surface we just created
            // TODO(multidisplay): we should use the proper display
            final int displayId = SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN;