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

Commit 1f4108d3 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal Committed by Mohammed Althaf T
Browse files

LatinIME: Force disable ime key once again for old updating users

parent f14bc6f4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
        } else if (Intent.ACTION_BOOT_COMPLETED.equals(intentAction)) {
            Log.i(TAG, "Boot has been completed");
            toggleAppIcon(context);
            disableVoiceKey(context);
        } else if (Intent.ACTION_LOCALE_CHANGED.equals(intentAction)) {
            Log.i(TAG, "System locale changed");
            KeyboardLayoutSet.onSystemLocaleChanged();
@@ -156,4 +157,15 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                PackageManager.DONT_KILL_APP);
    }

    public static void disableVoiceKey(final Context context) {
        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        if (prefs.getBoolean(Settings.PREF_VOICE_INPUT_KEY, false) &&
                !prefs.getBoolean(Settings.PREF_FORCED_DISABLE_VOICE_INPUT_KEY, false)) {
            prefs.edit()
               .putBoolean(Settings.PREF_VOICE_INPUT_KEY, false)
               .putBoolean(Settings.PREF_FORCED_DISABLE_VOICE_INPUT_KEY, true)
               .apply();
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
    // PREF_VOICE_MODE_OBSOLETE is obsolete. Use PREF_VOICE_INPUT_KEY instead.
    public static final String PREF_VOICE_MODE_OBSOLETE = "voice_mode";
    public static final String PREF_VOICE_INPUT_KEY = "pref_voice_input_key";
    // Added by /e/ to disable old enabled voice key
    public static final String PREF_FORCED_DISABLE_VOICE_INPUT_KEY = "pref_forced_disable_voice_input_key";
    public static final String PREF_EDIT_PERSONAL_DICTIONARY = "edit_personal_dictionary";
    public static final String PREF_CONFIGURE_DICTIONARIES_KEY = "configure_dictionaries_key";
    // PREF_AUTO_CORRECTION_THRESHOLD_OBSOLETE is obsolete. Use PREF_AUTO_CORRECTION instead.