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

Commit 32461dcb authored by Alexander Hofbauer's avatar Alexander Hofbauer Committed by Steve Kondik
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: I1051278a45875b2139b75db28467f9b8de2936d6
parent e81caed1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -936,4 +936,9 @@
         config to 7. -->
    <integer name="config_deviceHardwareKeys">15</integer>

    <!-- 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
@@ -3681,6 +3681,7 @@
  <java-symbol type="bool" name="config_noDelayInATwoDP" />
  <java-symbol type="bool" name="config_smsSamsungCdmaAlternateMessageIDEncoding" />
  <java-symbol type="integer" name="config_deviceHardwareKeys" />
  <java-symbol type="bool" name="config_hasRemovableLid" />

  <!-- Notification and battery light -->
  <java-symbol type="bool" name="config_intrusiveBatteryLed" />
+8 −2
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mUiMode;
    int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
    int mLidOpenRotation;
    boolean mHasRemovableLid;
    int mCarDockRotation;
    int mDeskDockRotation;
    int mHdmiRotation;
@@ -1179,6 +1180,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.integer.config_lidNavigationAccessibility);
        mLidControlsSleep = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_lidControlsSleep);
        mHasRemovableLid = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_hasRemovableLid);
        mBackKillTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_backKillTimeout);
        mDeviceHardwareKeys = mContext.getResources().getInteger(
@@ -4245,8 +4248,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)) {