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

Commit 77263a6a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Add config_hasRemovableLid

If a device features a dock with a removable lid, lidOpenRotation
overrides the rotation even if it was undocked (technically the lid is
still open).

This setting tells the framework whether to apply lidOpenRotation to
undocked devices.

Change-Id: I614dcf5430859e4c52e56e9757eb8b3f2d4ef279
parent 10b792bb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2112,4 +2112,9 @@
    <string-array name="config_auto_perf_activities" translatable="false">
    </string-array>

    <!-- If a dock provides a lid switch, that lid can be removed. This
         setting is used to determine, whether lidOpenRotation has to be
         applied. -->
    <bool name="config_hasRemovableLid">false</bool>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -2219,6 +2219,7 @@
  <java-symbol type="integer" name="config_backKillTimeout" />
  <java-symbol type="bool" name="config_show_cmIMESwitcher"/>
  <java-symbol type="bool" name="config_samsung_stk" />
  <java-symbol type="bool" name="config_hasRemovableLid" />

  <!-- Notification and battery light -->
  <java-symbol type="bool" name="config_intrusiveNotificationLed" />
+8 −2
Original line number Diff line number Diff line
@@ -357,6 +357,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mUiMode;
    int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
    int mLidOpenRotation;
    boolean mHasRemovableLid;
    int mCarDockRotation;
    int mDeskDockRotation;
    int mUndockedHdmiRotation;
@@ -1310,6 +1311,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.bool.config_enableTranslucentDecor);
        mDeviceHardwareKeys = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_deviceHardwareKeys);
        mHasRemovableLid = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_hasRemovableLid);
        mBackKillTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_backKillTimeout);

@@ -5849,8 +5852,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }

            final int preferredRotation;
            if (mLidState == LID_OPEN && mLidOpenRotation >= 0) {
                // Ignore sensor when lid switch is open and rotation is forced.
            if ((mLidState == LID_OPEN && mLidOpenRotation >= 0)
                    && !(mHasRemovableLid
                            && mDockMode == Intent.EXTRA_DOCK_STATE_UNDOCKED)) {
                // Ignore sensor when lid switch is open and rotation is forced
                // and a removable lid was not undocked.
                preferredRotation = mLidOpenRotation;
            } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR
                    && (mCarDockEnablesAccelerometer || mCarDockRotation >= 0)) {