summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2018-08-22 15:43:17 +0200
committerJP Sugarbroad <jpsugar@google.com>2019-07-31 16:49:21 -0700
commit333bf1c2dddbf9435f688924a3efbbae5f8b5eaf (patch)
tree85cbcfd041779e2b00faeae222456aa33160b366
parente258e0a541eccde013c2cf662af1c250a8792983 (diff)
downloadbase-333bf1c2dddbf9435f688924a3efbbae5f8b5eaf.tar.gz
DO NOT MERGE Fix display freezing when screen size mismatchesandroid-9.0.0_r48
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 da4997312c79bfb5b5c6fb31833fc2ce401c4457)
-rw-r--r--services/core/java/com/android/server/wm/ScreenRotationAnimation.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
index 1ff8ab5d0c89..95051dea2e9a 100644
--- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -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;