Merge "DO NOT MERGE Fix display freezing when screen size mismatches" into pi-dev
am: ab39f605b1
Change-Id: I949542f78ee47a2da613735498c3bf3f7d55e062
diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
index fa8a5c6..755a571 100644
--- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -37,6 +37,7 @@
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;
@@ -268,6 +269,12 @@
.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;