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

Commit 159ebefc authored by Alexander Hofbauer's avatar Alexander Hofbauer 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: I1051278a45875b2139b75db28467f9b8de2936d6
parent 8c5ef198
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1086,4 +1086,9 @@
         legacy USB manager should be started. -->
    <string name="config_legacyUmsLunFile">/sys/devices/platform/usb_mass_storage/lun0/file</string>

    <!-- 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
@@ -1839,6 +1839,7 @@
  <java-symbol type="bool" name="config_samsung_stk" />
  <java-symbol type="integer" name="config_wallpaperMaxWidth" />
  <java-symbol type="string" name="config_legacyUmsLunFile" />
  <java-symbol type="bool" name="config_hasRemovableLid" />

  <!-- Hardware Key ReMapping -->
  <java-symbol type="integer" name="config_deviceHardwareKeys" />
+8 −2
Original line number Diff line number Diff line
@@ -329,6 +329,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mWifiDisplayConnected;
    int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
    int mLidOpenRotation;
    boolean mHasRemovableLid;
    int mCarDockRotation;
    int mDeskDockRotation;
    int mHdmiRotation;
@@ -1132,6 +1133,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(
@@ -4413,8 +4416,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)) {