Clean up a flag for respecting nosensor and locked when docked.
Removing config that was originally added in Ibb017523d7c99174cf5f20e8fbb89a726aa18e15 enabling the corresponding behavior by default. Fix: 274763533 Test: atest WmTests:DisplayRotationTests Change-Id: Ie9cef1971b377eaf34eb2a3ec32d1f473533b56a
This commit is contained in:
@@ -774,11 +774,6 @@
|
||||
we rely on gravity to determine the effective orientation. -->
|
||||
<bool name="config_deskDockEnablesAccelerometer">true</bool>
|
||||
|
||||
<!-- Control whether nosensor and locked orientation requests are respected from the app when
|
||||
config_deskDockEnablesAccelerometer is set to false.
|
||||
TODO(b/274763533): Consider making true by default and removing this. -->
|
||||
<bool name="config_deskRespectsNoSensorAndLockedWithoutAccelerometer">false</bool>
|
||||
|
||||
<!-- Car dock behavior -->
|
||||
|
||||
<!-- The number of degrees to rotate the display when the device is in a car dock.
|
||||
|
||||
@@ -1698,7 +1698,6 @@
|
||||
<java-symbol type="bool" name="config_carDockEnablesAccelerometer" />
|
||||
<java-symbol type="bool" name="config_customUserSwitchUi" />
|
||||
<java-symbol type="bool" name="config_deskDockEnablesAccelerometer" />
|
||||
<java-symbol type="bool" name="config_deskRespectsNoSensorAndLockedWithoutAccelerometer" />
|
||||
<java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
|
||||
<java-symbol type="bool" name="config_enableCarDockHomeLaunch" />
|
||||
<java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
|
||||
|
||||
@@ -184,7 +184,6 @@ public class DisplayPolicy {
|
||||
|
||||
private final boolean mCarDockEnablesAccelerometer;
|
||||
private final boolean mDeskDockEnablesAccelerometer;
|
||||
private final boolean mDeskDockRespectsNoSensorAndLockedWithoutAccelerometer;
|
||||
private final AccessibilityManager mAccessibilityManager;
|
||||
private final ImmersiveModeConfirmation mImmersiveModeConfirmation;
|
||||
private final ScreenshotHelper mScreenshotHelper;
|
||||
@@ -394,8 +393,6 @@ public class DisplayPolicy {
|
||||
final Resources r = mContext.getResources();
|
||||
mCarDockEnablesAccelerometer = r.getBoolean(R.bool.config_carDockEnablesAccelerometer);
|
||||
mDeskDockEnablesAccelerometer = r.getBoolean(R.bool.config_deskDockEnablesAccelerometer);
|
||||
mDeskDockRespectsNoSensorAndLockedWithoutAccelerometer =
|
||||
r.getBoolean(R.bool.config_deskRespectsNoSensorAndLockedWithoutAccelerometer);
|
||||
mCanSystemBarsBeShownByUser = !r.getBoolean(
|
||||
R.bool.config_remoteInsetsControllerControlsSystemBars) || r.getBoolean(
|
||||
R.bool.config_remoteInsetsControllerSystemBarsCanBeShownByUserAction);
|
||||
@@ -707,10 +704,6 @@ public class DisplayPolicy {
|
||||
return mDeskDockEnablesAccelerometer;
|
||||
}
|
||||
|
||||
boolean isDeskDockRespectsNoSensorAndLockedWithoutAccelerometer() {
|
||||
return mDeskDockRespectsNoSensorAndLockedWithoutAccelerometer;
|
||||
}
|
||||
|
||||
public void setPersistentVrModeEnabled(boolean persistentVrModeEnabled) {
|
||||
mPersistentVrModeEnabled = persistentVrModeEnabled;
|
||||
}
|
||||
@@ -2514,8 +2507,6 @@ public class DisplayPolicy {
|
||||
pw.print("mCarDockEnablesAccelerometer="); pw.print(mCarDockEnablesAccelerometer);
|
||||
pw.print(" mDeskDockEnablesAccelerometer=");
|
||||
pw.println(mDeskDockEnablesAccelerometer);
|
||||
pw.print(" mDeskDockRespectsNoSensorAndLockedWithoutAccelerometer=");
|
||||
pw.println(mDeskDockRespectsNoSensorAndLockedWithoutAccelerometer);
|
||||
pw.print(prefix); pw.print("mDockMode="); pw.print(Intent.dockStateToString(mDockMode));
|
||||
pw.print(" mLidState="); pw.println(WindowManagerFuncs.lidStateToString(mLidState));
|
||||
pw.print(prefix); pw.print("mAwake="); pw.print(mAwake);
|
||||
|
||||
@@ -1239,10 +1239,6 @@ public class DisplayRotation {
|
||||
mDisplayPolicy.isCarDockEnablesAccelerometer();
|
||||
final boolean deskDockEnablesAccelerometer =
|
||||
mDisplayPolicy.isDeskDockEnablesAccelerometer();
|
||||
final boolean deskDockRespectsNoSensorAndLockedWithoutAccelerometer =
|
||||
mDisplayPolicy.isDeskDockRespectsNoSensorAndLockedWithoutAccelerometer()
|
||||
&& (orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED
|
||||
|| orientation == ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
|
||||
|
||||
@Surface.Rotation
|
||||
final int preferredRotation;
|
||||
@@ -1263,10 +1259,10 @@ public class DisplayRotation {
|
||||
|| dockMode == Intent.EXTRA_DOCK_STATE_LE_DESK
|
||||
|| dockMode == Intent.EXTRA_DOCK_STATE_HE_DESK)
|
||||
&& (deskDockEnablesAccelerometer || mDeskDockRotation >= 0)
|
||||
&& !deskDockRespectsNoSensorAndLockedWithoutAccelerometer) {
|
||||
&& !(orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED
|
||||
|| orientation == ActivityInfo.SCREEN_ORIENTATION_NOSENSOR)) {
|
||||
// Ignore sensor when in desk dock unless explicitly enabled.
|
||||
// This case can override the behavior of NOSENSOR, and can also
|
||||
// enable 180 degree rotation while docked.
|
||||
// This case can enable 180 degree rotation while docked.
|
||||
preferredRotation = deskDockEnablesAccelerometer ? sensorRotation : mDeskDockRotation;
|
||||
} else if (hdmiPlugged && mDemoHdmiRotationLock) {
|
||||
// Ignore sensor when plugged into HDMI when demo HDMI rotation lock enabled.
|
||||
|
||||
@@ -940,8 +940,6 @@ public class DisplayRotationTests {
|
||||
@Test
|
||||
public void testIgnoresDeskDockRotation_whenNoSensorAndLockedRespected() throws Exception {
|
||||
mBuilder.setDeskDockRotation(Surface.ROTATION_270).build();
|
||||
when(mMockDisplayPolicy.isDeskDockRespectsNoSensorAndLockedWithoutAccelerometer())
|
||||
.thenReturn(true);
|
||||
configureDisplayRotation(SCREEN_ORIENTATION_LANDSCAPE, false, false);
|
||||
|
||||
when(mMockDisplayPolicy.getDockMode()).thenReturn(Intent.EXTRA_DOCK_STATE_DESK);
|
||||
|
||||
Reference in New Issue
Block a user