Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56675d07 authored by Mariia Sandrikova's avatar Mariia Sandrikova Committed by Android (Google) Code Review
Browse files

Merge "Clean up a flag for respecting nosensor and locked when docked." into udc-dev

parents 3a9a83da 7bcc1fe3
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -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.
+0 −1
Original line number Diff line number Diff line
@@ -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" />
+0 −9
Original line number Diff line number Diff line
@@ -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);
+3 −7
Original line number Diff line number Diff line
@@ -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.
+0 −2
Original line number Diff line number Diff line
@@ -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);