From e290bd061ddc892736cca4123a8a012abb53b448 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 4 Nov 2021 15:33:52 +0800 Subject: [PATCH] Use 180 degree as general upside down for rotation choice The "UpsideDown" field of DisplayRotation stands for reverse portrait. So the general up side down rotation should be ROTATION_180. Otherwise a landscape display will get 90 as invalid and 180 as valid. Portrait display (default h>w) mLandscapeRotation=ROTATION_90 mSeascapeRotation=ROTATION_270 mPortraitRotation=ROTATION_0 mUpsideDownRotation=ROTATION_180 Landscape display (default w>h) mLandscapeRotation=ROTATION_0 mSeascapeRotation=ROTATION_180 mPortraitRotation=ROTATION_270 mUpsideDownRotation=ROTATION_90 Bug: 204197290 Test: adb shell wm size 2000x1000 Disable auto-rotation. Rotate the device 90-degree counterclockwise. The rotation hint button should show. Change-Id: Iea6ae5d9ac1ffdf7333f7cc52e644f10ed5311a8 --- services/core/java/com/android/server/wm/DisplayRotation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index 34e81498b1c3d..b6552cb1b962f 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -1330,7 +1330,7 @@ public class DisplayRotation { case ActivityInfo.SCREEN_ORIENTATION_USER: case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: // Works with any rotation except upside down. - return (preferredRotation >= 0) && (preferredRotation != mUpsideDownRotation); + return (preferredRotation >= 0) && (preferredRotation != Surface.ROTATION_180); } return false;