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
This commit is contained in:
Riddle Hsu
2021-11-04 15:33:52 +08:00
parent cc110e6aea
commit e290bd061d

View File

@@ -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;