diff options
author | Yi Jiang <eejiang@google.com> | 2023-04-20 14:50:43 -0700 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-05-27 21:43:35 +0000 |
commit | 2539e724119f401973da60a0ab204e2e9b23c6b2 (patch) | |
tree | 54f59c3295bfda36d451b13e8dcff00239125c1f | |
parent | 3169dfcf37eb18a0089fba4ee465ad44885c6eca (diff) | |
download | base-2539e724119f401973da60a0ab204e2e9b23c6b2.tar.gz |
Gates RotationResolverService with a config flag
Bug: 266824653
Test: atest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8dd4fb802129344cd93314421552a72f37ab34ee)
Merged-In: I7bc69ddf1c1742bd800eea4068ce268dfd96d0e3
Change-Id: I7bc69ddf1c1742bd800eea4068ce268dfd96d0e3
-rw-r--r-- | core/res/res/values/config.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/DisplayRotation.java | 6 |
3 files changed, 9 insertions, 1 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 514083cefca9..9891409a08bb 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -572,6 +572,9 @@ docked if the dock is configured to enable the accelerometer. --> <bool name="config_supportAutoRotation">true</bool> + <!-- If true, allows rotation resolver service to help resolve screen rotation. --> + <bool name="config_allowRotationResolver">true</bool> + <!-- If true, the screen can be rotated via the accelerometer in all 4 rotations as the default behavior. --> <bool name="config_allowAllRotations">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 17a8a76bd590..01c6b5509cb7 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1754,6 +1754,7 @@ <java-symbol type="bool" name="config_perDisplayFocusEnabled" /> <java-symbol type="bool" name="config_showNavigationBar" /> <java-symbol type="bool" name="config_supportAutoRotation" /> + <java-symbol type="bool" name="config_allowRotationResolver" /> <java-symbol type="bool" name="config_dockedStackDividerFreeSnapMode" /> <java-symbol type="dimen" name="docked_stack_divider_thickness" /> <java-symbol type="dimen" name="docked_stack_divider_insets" /> diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index 0a1e29ace045..2cff3545cc1c 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -123,6 +123,7 @@ public class DisplayRotation { public final boolean isDefaultDisplay; private final boolean mSupportAutoRotation; + private final boolean mAllowRotationResolver; private final int mLidOpenRotation; private final int mCarDockRotation; private final int mDeskDockRotation; @@ -265,6 +266,8 @@ public class DisplayRotation { mSupportAutoRotation = mContext.getResources().getBoolean(R.bool.config_supportAutoRotation); + mAllowRotationResolver = + mContext.getResources().getBoolean(R.bool.config_allowRotationResolver); mLidOpenRotation = readRotation(R.integer.config_lidOpenRotation); mCarDockRotation = readRotation(R.integer.config_carDockRotation); mDeskDockRotation = readRotation(R.integer.config_deskDockRotation); @@ -1992,7 +1995,8 @@ public class DisplayRotation { @Override public boolean isRotationResolverEnabled() { - return mUserRotationMode == WindowManagerPolicy.USER_ROTATION_FREE + return mAllowRotationResolver + && mUserRotationMode == WindowManagerPolicy.USER_ROTATION_FREE && mCameraRotationMode == CAMERA_ROTATION_ENABLED && !mService.mPowerManager.isPowerSaveMode(); } |