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

Commit 305b0fb4 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Fix 2242164 Soft keyboard keeps getting enabled even if I disable it

On keyboardful devices, it is possible to disable the system soft input
method. Something changed in eclair that caused the ime to be re-enabled
on every package manager update (packages added/deleted).

Now keep track of disabled system imes in the settings db and search
in that list before enabling a system IME on package changes.

Every time the user goes to settings to enable/disable imes, the list
is re-created.

Any new system IMEs that may be added via an OTA will get enabled if
they have a different package name.
parent 3d503e35
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ public class LanguageSettings extends PreferenceActivity {
        super.onPause();

        StringBuilder builder = new StringBuilder(256);
        StringBuilder disabledSysImes = new StringBuilder(256);

        int firstEnabled = -1;
        int N = mInputMethodProperties.size();
@@ -199,6 +200,12 @@ public class LanguageSettings extends PreferenceActivity {
            } else if (hasIt) {
                mLastInputMethodId = mLastTickedInputMethodId;
            }
            // If it's a disabled system ime, add it to the disabled list so that it
            // doesn't get enabled automatically on any changes to the package list
            if (pref != null && !pref.isChecked() && systemIme && mHaveHardKeyboard) {
                if (disabledSysImes.length() > 0) disabledSysImes.append(":");
                disabledSysImes.append(id);
            }
        }

        // If the last input method is unset, set it as the first enabled one.
@@ -212,6 +219,8 @@ public class LanguageSettings extends PreferenceActivity {
        
        Settings.Secure.putString(getContentResolver(),
            Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());
        Settings.Secure.putString(getContentResolver(),
                Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS, disabledSysImes.toString());
        Settings.Secure.putString(getContentResolver(),
            Settings.Secure.DEFAULT_INPUT_METHOD,
            mLastInputMethodId != null ? mLastInputMethodId : "");