kevin760515 / android-x86

Automatically exported from code.google.com/p/android-x86
0 stars 0 forks source link

SoftKeyBoard Enable setting not persistant #226

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Uncheck SoftKeyBoard Enable
2. Reboot
3. SoftKeyBoard Enable is selected

What is the expected output? What do you see instead?
SoftKeyBoard Enable to retain choice

What version of the product are you using? On what operating system?
Froyo 2.2.1 (latest git)

Please provide any additional information below.

It appears that in adjustConfigurationLw(), mlidOpen is not set correctly so 
when setting lidOpen = !KEYBOARD_ALWAYS_HIDDEN && mLidOpen

Settings.System.putInt(mContext.getContentResolver(),
      Settings.System.SOFTKEYBOARD, lidOpen ? 0 : 1);

will always set the preference to 1 (selected).

While I would prefer to find the error with mLidOpen, (the correct setting of 
lidOpen should be:

final boolean lidOpen = !KEYBOARD_ALWAYS_HIDDEN && ((!isSoftKeyBoardEnable()) 
&& mLidOpen;

Could also get rid of the "NOT" by changing it to SoftKeyBoard Disable in the 
settings.

For now it is possible to get the proper behavior with the following modified 
"frameworks/policies/base//phone/com/android/internal/policy/impl/PhoneWindowMan
ager.java"

Here is the diff to fix:

project frameworks/policies/base/
diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java 
b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
index 95a461b..4407a3b 100755
--- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -272,8 +272,6 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
     // Nothing to see here, move along...
     int mFancyRotationAnimation;

-    static boolean mFirstAdjustSoftkeyboard = true;
-
     ShortcutManager mShortcutManager;
     PowerManager.WakeLock mBroadcastWakeLock;

@@ -729,25 +727,18 @@ public class PhoneWindowManager implements 
WindowManagerPolicy {
     /** {@inheritDoc} */
     public void adjustConfigurationLw(Configuration config) {
         readLidState();
-        final boolean lidOpen = !KEYBOARD_ALWAYS_HIDDEN && mLidOpen;
+        final boolean lidOpen = !(isSoftKeyBoardEnable());
         mPowerManager.setKeyboardVisibility(lidOpen);
-        if (mFirstAdjustSoftkeyboard) {
-            Settings.System.putInt(mContext.getContentResolver(),
-                    Settings.System.SOFTKEYBOARD, lidOpen ? 0 : 1);
-        } else {
-            config.hardKeyboardHidden = 
determineHiddenState(isSoftKeyBoardEnable(),
-                    mLidKeyboardAccessibility, 
Configuration.HARDKEYBOARDHIDDEN_NO,
-                    Configuration.HARDKEYBOARDHIDDEN_YES);
-            config.navigationHidden = 
determineHiddenState(isSoftKeyBoardEnable(),
-                    mLidNavigationAccessibility, 
Configuration.NAVIGATIONHIDDEN_NO,
-                    Configuration.NAVIGATIONHIDDEN_YES);
-            config.keyboardHidden = (config.hardKeyboardHidden ==
-                    Configuration.HARDKEYBOARDHIDDEN_NO || mHasSoftInput)
-                    ? Configuration.KEYBOARDHIDDEN_NO
-                    : Configuration.KEYBOARDHIDDEN_YES;
-        }
-
-   mFirstAdjustSoftkeyboard = false;
+        config.hardKeyboardHidden = determineHiddenState(lidOpen,
+                mLidKeyboardAccessibility, 
Configuration.HARDKEYBOARDHIDDEN_YES,
+                Configuration.HARDKEYBOARDHIDDEN_NO);
+        config.navigationHidden = determineHiddenState(lidOpen,
+                mLidNavigationAccessibility, 
Configuration.NAVIGATIONHIDDEN_YES,
+                Configuration.NAVIGATIONHIDDEN_NO);
+        config.keyboardHidden = (config.hardKeyboardHidden
+                        == Configuration.HARDKEYBOARDHIDDEN_NO || 
mHasSoftInput)
+                ? Configuration.KEYBOARDHIDDEN_NO
+                : Configuration.KEYBOARDHIDDEN_YES;
     }

     public boolean isCheekPressedAgainstScreen(MotionEvent ev) {

Original issue reported on code.google.com by padraig...@gmail.com on 25 Jan 2011 at 6:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Forgot my closing paren

final boolean lidOpen = !KEYBOARD_ALWAYS_HIDDEN && (!(isSoftKeyBoardEnable()) 
&& mLidOpen);

Original comment by padraig...@gmail.com on 25 Jan 2011 at 7:02

GoogleCodeExporter commented 9 years ago
This is what I was looking for, but dont know how to use your fix. Hope it will 
be implemented in future update for froyo.

Original comment by oluj...@gmail.com on 25 Jan 2011 at 10:59