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

Commit 2e7760eb authored by Jeff Brown's avatar Jeff Brown
Browse files

Don't do anything on lid state change by default.

Because a lid switch can be used to do many things, it's best
if the framework does not do anything by default when the lid is
opened or closed.  The behavior of the lid switch should be
configured on a per-product basis in a config.xml resource overlay.

Bug: 6320088
Change-Id: I9f768dd11d76c3c17c49f46c92f993ee2ff1409f
parent 4d6a82d7
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -323,8 +323,9 @@
         true here reverses that logic. -->
    <bool name="config_reverseDefaultRotation">false</bool>

    <!-- The number of degrees to rotate the display when the keyboard is open. -->
    <integer name="config_lidOpenRotation">90</integer>
    <!-- The number of degrees to rotate the display when the keyboard is open.
         A value of -1 means no change in orientation by default. -->
    <integer name="config_lidOpenRotation">-1</integer>

    <!-- The number of degrees to rotate the display when the device is in a desk dock.
         A value of -1 means no change in orientation by default. -->
@@ -370,8 +371,8 @@
    <!-- Indicate whether the lid state impacts the accessibility of
         the physical keyboard.  0 means it doesn't, 1 means it is accessible
         when the lid is open, 2 means it is accessible when the lid is
         closed.  The default is 1. -->
    <integer name="config_lidKeyboardAccessibility">1</integer>
         closed.  The default is 0. -->
    <integer name="config_lidKeyboardAccessibility">0</integer>

    <!-- Indicate whether the lid state impacts the accessibility of
         the physical keyboard.  0 means it doesn't, 1 means it is accessible
+9 −9
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    RecentApplicationsDialog mRecentAppsDialog;
    int mRecentAppsDialogHeldModifiers;

    int mLidOpen = LID_ABSENT;
    int mLidState = LID_ABSENT;

    boolean mSystemReady;
    boolean mSystemBooted;
@@ -1225,16 +1225,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    
    void readLidState() {
        mLidOpen = mWindowManagerFuncs.getLidState();
        mLidState = mWindowManagerFuncs.getLidState();
    }
    
    private int determineHiddenState(int mode, int hiddenValue, int visibleValue) {
        if (mLidOpen != LID_ABSENT) {
        if (mLidState != LID_ABSENT) {
            switch (mode) {
                case 1:
                    return mLidOpen == LID_OPEN ? visibleValue : hiddenValue;
                    return mLidState == LID_OPEN ? visibleValue : hiddenValue;
                case 2:
                    return mLidOpen == LID_OPEN ? hiddenValue : visibleValue;
                    return mLidState == LID_OPEN ? hiddenValue : visibleValue;
            }
        }
        return visibleValue;
@@ -2797,7 +2797,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (mHeadless) return;

        // lid changed state
        mLidOpen = lidOpen ? LID_OPEN : LID_CLOSED;
        mLidState = lidOpen ? LID_OPEN : LID_CLOSED;
        updateKeyboardVisibility();

        boolean awakeNow = mKeyguardMediator.doLidChangeTq(lidOpen);
@@ -3486,7 +3486,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }

            final int preferredRotation;
            if (mLidOpen == LID_OPEN && mLidOpenRotation >= 0) {
            if (mLidState == LID_OPEN && mLidOpenRotation >= 0) {
                // Ignore sensor when lid switch is open and rotation is forced.
                preferredRotation = mLidOpenRotation;
            } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR
@@ -3878,7 +3878,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void updateKeyboardVisibility() {
        mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
        mPowerManager.setKeyboardVisibility(mLidState == LID_OPEN);
    }

    void updateRotation(boolean alwaysSendConfiguration) {
@@ -4132,7 +4132,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode);
                pw.print(" mSystemReady="); pw.print(mSystemReady);
                pw.print(" mSystemBooted="); pw.println(mSystemBooted);
        pw.print(prefix); pw.print("mLidOpen="); pw.print(mLidOpen);
        pw.print(prefix); pw.print("mLidState="); pw.print(mLidState);
                pw.print(" mLidOpenRotation="); pw.print(mLidOpenRotation);
                pw.print(" mHdmiPlugged="); pw.println(mHdmiPlugged);
        if (mLastSystemUiFlags != 0 || mResettingSystemUiFlags != 0