From 8dd4fb802129344cd93314421552a72f37ab34ee Mon Sep 17 00:00:00 2001 From: Yi Jiang Date: Thu, 20 Apr 2023 14:50:43 -0700 Subject: [PATCH] Gates RotationResolverService with a config flag Bug: 266824653 Test: atest Change-Id: I7bc69ddf1c1742bd800eea4068ce268dfd96d0e3 --- core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + .../core/java/com/android/server/wm/DisplayRotation.java | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 514083cefca9b..9891409a08bbf 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. --> true + + true + false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 17a8a76bd5903..01c6b5509cb77 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1754,6 +1754,7 @@ + diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index 0a1e29ace045e..2cff3545cc1c9 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(); }