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

Commit fbc9c2c2 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
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

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
parent 685678cd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1335,4 +1335,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
@@ -1762,6 +1762,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" />

  <!-- Notification and battery light -->
  <java-symbol type="bool" name="config_intrusiveBatteryLed" />
+8 −2
Original line number Diff line number Diff line
@@ -282,6 +282,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;
@@ -1024,6 +1025,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.bool.config_lidControlsSleep);
        mTranslucentDecorEnabled = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_enableTranslucentDecor);
        mHasRemovableLid = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_hasRemovableLid);
        mBackKillTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_backKillTimeout);
        readConfigurationDependentBehaviors();
@@ -4629,8 +4632,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)) {