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

Commit cbef1151 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira 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: I614dcf5430859e4c52e56e9757eb8b3f2d4ef279
parent 4619dc3a
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -2308,4 +2308,9 @@
    <string-array name="config_auto_perf_activities" translatable="false">
    <string-array name="config_auto_perf_activities" translatable="false">
    </string-array>
    </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>
</resources>
+1 −0
Original line number Original line Diff line number Diff line
@@ -2343,6 +2343,7 @@
  <java-symbol type="integer" name="config_backKillTimeout" />
  <java-symbol type="integer" name="config_backKillTimeout" />
  <java-symbol type="bool" name="config_show_cmIMESwitcher"/>
  <java-symbol type="bool" name="config_show_cmIMESwitcher"/>
  <java-symbol type="bool" name="config_samsung_stk" />
  <java-symbol type="bool" name="config_samsung_stk" />
  <java-symbol type="bool" name="config_hasRemovableLid" />


  <!-- Notification and battery light -->
  <!-- Notification and battery light -->
  <java-symbol type="bool" name="config_intrusiveNotificationLed" />
  <java-symbol type="bool" name="config_intrusiveNotificationLed" />
+8 −2
Original line number Original line Diff line number Diff line
@@ -385,6 +385,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mUiMode;
    int mUiMode;
    int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
    int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
    int mLidOpenRotation;
    int mLidOpenRotation;
    boolean mHasRemovableLid;
    int mCarDockRotation;
    int mCarDockRotation;
    int mDeskDockRotation;
    int mDeskDockRotation;
    int mUndockedHdmiRotation;
    int mUndockedHdmiRotation;
@@ -1572,6 +1573,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {


        mDeviceHardwareKeys = mContext.getResources().getInteger(
        mDeviceHardwareKeys = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_deviceHardwareKeys);
                com.android.internal.R.integer.config_deviceHardwareKeys);
        mHasRemovableLid = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_hasRemovableLid);
        mBackKillTimeout = mContext.getResources().getInteger(
        mBackKillTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_backKillTimeout);
                com.android.internal.R.integer.config_backKillTimeout);


@@ -6165,8 +6168,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
            }


            final int preferredRotation;
            final int preferredRotation;
            if (mLidState == LID_OPEN && mLidOpenRotation >= 0) {
            if ((mLidState == LID_OPEN && mLidOpenRotation >= 0)
                // Ignore sensor when lid switch is open and rotation is forced.
                    && !(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;
                preferredRotation = mLidOpenRotation;
            } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR
            } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR
                    && (mCarDockEnablesAccelerometer || mCarDockRotation >= 0)) {
                    && (mCarDockEnablesAccelerometer || mCarDockRotation >= 0)) {