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
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 31aa8d5..acf63a1 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -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
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index d150b5c..1891146 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -327,7 +327,7 @@
     RecentApplicationsDialog mRecentAppsDialog;
     int mRecentAppsDialogHeldModifiers;
 
-    int mLidOpen = LID_ABSENT;
+    int mLidState = LID_ABSENT;
 
     boolean mSystemReady;
     boolean mSystemBooted;
@@ -1225,16 +1225,16 @@
     }
     
     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 @@
         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 @@
             }
 
             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 @@
     }
 
     private void updateKeyboardVisibility() {
-        mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
+        mPowerManager.setKeyboardVisibility(mLidState == LID_OPEN);
     }
 
     void updateRotation(boolean alwaysSendConfiguration) {
@@ -4132,7 +4132,7 @@
         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