Loading core/java/android/provider/Settings.java +0 −28 Original line number Diff line number Diff line Loading @@ -5443,32 +5443,6 @@ public final class Settings { */ public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; private static final Validator ENABLED_INPUT_METHODS_VALIDATOR = new Validator() { @Override public boolean validate(String value) { if (value == null) { return false; } String[] inputMethods = value.split(":"); boolean valid = true; for (String inputMethod : inputMethods) { if (inputMethod.length() == 0) { return false; } String[] subparts = inputMethod.split(";"); for (String subpart : subparts) { // allow either a non negative integer or a ComponentName valid |= (NON_NEGATIVE_INTEGER_VALIDATOR.validate(subpart) || COMPONENT_NAME_VALIDATOR.validate(subpart)); } if (!valid) { return false; } } return valid; } }; /** * List of system input methods that are currently disabled. This is a string * containing the IDs of all disabled input methods, each ID separated Loading Loading @@ -7709,7 +7683,6 @@ public final class Settings { ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, ENABLED_ACCESSIBILITY_SERVICES, ENABLED_VR_LISTENERS, ENABLED_INPUT_METHODS, TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, TOUCH_EXPLORATION_ENABLED, ACCESSIBILITY_ENABLED, Loading Loading @@ -7815,7 +7788,6 @@ public final class Settings { VALIDATORS.put(ENABLED_ACCESSIBILITY_SERVICES, ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR); VALIDATORS.put(ENABLED_VR_LISTENERS, ENABLED_VR_LISTENERS_VALIDATOR); VALIDATORS.put(ENABLED_INPUT_METHODS, ENABLED_INPUT_METHODS_VALIDATOR); VALIDATORS.put(TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR); VALIDATORS.put(TOUCH_EXPLORATION_ENABLED, TOUCH_EXPLORATION_ENABLED_VALIDATOR); Loading core/tests/coretests/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ public class SettingsBackupTest { Settings.Secure.DOZE_ALWAYS_ON, Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, Settings.Secure.ENABLED_INPUT_METHODS, // Intentionally removed in P Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT, Settings.Secure.ENABLED_NOTIFICATION_LISTENERS, Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -76,11 +76,10 @@ public class SettingsHelper { */ private static final ArraySet<String> sBroadcastOnRestore; static { sBroadcastOnRestore = new ArraySet<String>(5); sBroadcastOnRestore = new ArraySet<String>(4); sBroadcastOnRestore.add(Settings.Secure.ENABLED_NOTIFICATION_LISTENERS); sBroadcastOnRestore.add(Settings.Secure.ENABLED_VR_LISTENERS); sBroadcastOnRestore.add(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); sBroadcastOnRestore.add(Settings.Secure.ENABLED_INPUT_METHODS); sBroadcastOnRestore.add(Settings.Global.BLUETOOTH_ON); } Loading services/core/java/com/android/server/InputMethodManagerService.java +0 −50 Original line number Diff line number Diff line Loading @@ -120,7 +120,6 @@ import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; import android.text.TextUtils; import android.text.style.SuggestionSpan; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; import android.util.EventLog; Loading Loading @@ -183,7 +182,6 @@ import java.util.concurrent.atomic.AtomicInteger; public class InputMethodManagerService extends IInputMethodManager.Stub implements ServiceConnection, Handler.Callback { static final boolean DEBUG = false; static final boolean DEBUG_RESTORE = DEBUG || false; static final String TAG = "InputMethodManagerService"; @Retention(SOURCE) Loading Loading @@ -911,15 +909,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub || Intent.ACTION_USER_REMOVED.equals(action)) { updateCurrentProfileIds(); return; } else if (Intent.ACTION_SETTING_RESTORED.equals(action)) { final String name = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); if (Settings.Secure.ENABLED_INPUT_METHODS.equals(name)) { final String prevValue = intent.getStringExtra( Intent.EXTRA_SETTING_PREVIOUS_VALUE); final String newValue = intent.getStringExtra( Intent.EXTRA_SETTING_NEW_VALUE); restoreEnabledInputMethods(mContext, prevValue, newValue); } } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) { onActionLocaleChanged(); } else if (ACTION_SHOW_INPUT_METHOD_PICKER.equals(action)) { Loading Loading @@ -984,44 +973,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } // Apply the results of a restore operation to the set of enabled IMEs. Note that this // does not attempt to validate on the fly with any installed device policy, so must only // be run in the context of initial device setup. // // TODO: Move this method to InputMethodUtils with adding unit tests. static void restoreEnabledInputMethods(Context context, String prevValue, String newValue) { if (DEBUG_RESTORE) { Slog.i(TAG, "Restoring enabled input methods:"); Slog.i(TAG, "prev=" + prevValue); Slog.i(TAG, " new=" + newValue); } // 'new' is the just-restored state, 'prev' is what was in settings prior to the restore ArrayMap<String, ArraySet<String>> prevMap = InputMethodUtils.parseInputMethodsAndSubtypesString(prevValue); ArrayMap<String, ArraySet<String>> newMap = InputMethodUtils.parseInputMethodsAndSubtypesString(newValue); // Merge the restored ime+subtype enabled states into the live state for (ArrayMap.Entry<String, ArraySet<String>> entry : newMap.entrySet()) { final String imeId = entry.getKey(); ArraySet<String> prevSubtypes = prevMap.get(imeId); if (prevSubtypes == null) { prevSubtypes = new ArraySet<>(2); prevMap.put(imeId, prevSubtypes); } prevSubtypes.addAll(entry.getValue()); } final String mergedImesAndSubtypesString = InputMethodUtils.buildInputMethodsAndSubtypesString(prevMap); if (DEBUG_RESTORE) { Slog.i(TAG, "Merged IME string:"); Slog.i(TAG, " " + mergedImesAndSubtypesString); } Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ENABLED_INPUT_METHODS, mergedImesAndSubtypesString); } final class MyPackageMonitor extends PackageMonitor { /** * Package names that are known to contain {@link InputMethodService}. Loading Loading @@ -1577,7 +1528,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub broadcastFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); broadcastFilter.addAction(Intent.ACTION_USER_ADDED); broadcastFilter.addAction(Intent.ACTION_USER_REMOVED); broadcastFilter.addAction(Intent.ACTION_SETTING_RESTORED); broadcastFilter.addAction(Intent.ACTION_LOCALE_CHANGED); broadcastFilter.addAction(ACTION_SHOW_INPUT_METHOD_PICKER); mContext.registerReceiver(new ImmsBroadcastReceiver(), broadcastFilter); Loading Loading
core/java/android/provider/Settings.java +0 −28 Original line number Diff line number Diff line Loading @@ -5443,32 +5443,6 @@ public final class Settings { */ public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; private static final Validator ENABLED_INPUT_METHODS_VALIDATOR = new Validator() { @Override public boolean validate(String value) { if (value == null) { return false; } String[] inputMethods = value.split(":"); boolean valid = true; for (String inputMethod : inputMethods) { if (inputMethod.length() == 0) { return false; } String[] subparts = inputMethod.split(";"); for (String subpart : subparts) { // allow either a non negative integer or a ComponentName valid |= (NON_NEGATIVE_INTEGER_VALIDATOR.validate(subpart) || COMPONENT_NAME_VALIDATOR.validate(subpart)); } if (!valid) { return false; } } return valid; } }; /** * List of system input methods that are currently disabled. This is a string * containing the IDs of all disabled input methods, each ID separated Loading Loading @@ -7709,7 +7683,6 @@ public final class Settings { ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, ENABLED_ACCESSIBILITY_SERVICES, ENABLED_VR_LISTENERS, ENABLED_INPUT_METHODS, TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, TOUCH_EXPLORATION_ENABLED, ACCESSIBILITY_ENABLED, Loading Loading @@ -7815,7 +7788,6 @@ public final class Settings { VALIDATORS.put(ENABLED_ACCESSIBILITY_SERVICES, ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR); VALIDATORS.put(ENABLED_VR_LISTENERS, ENABLED_VR_LISTENERS_VALIDATOR); VALIDATORS.put(ENABLED_INPUT_METHODS, ENABLED_INPUT_METHODS_VALIDATOR); VALIDATORS.put(TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES, TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR); VALIDATORS.put(TOUCH_EXPLORATION_ENABLED, TOUCH_EXPLORATION_ENABLED_VALIDATOR); Loading
core/tests/coretests/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ public class SettingsBackupTest { Settings.Secure.DOZE_ALWAYS_ON, Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, Settings.Secure.ENABLED_INPUT_METHODS, // Intentionally removed in P Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT, Settings.Secure.ENABLED_NOTIFICATION_LISTENERS, Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -76,11 +76,10 @@ public class SettingsHelper { */ private static final ArraySet<String> sBroadcastOnRestore; static { sBroadcastOnRestore = new ArraySet<String>(5); sBroadcastOnRestore = new ArraySet<String>(4); sBroadcastOnRestore.add(Settings.Secure.ENABLED_NOTIFICATION_LISTENERS); sBroadcastOnRestore.add(Settings.Secure.ENABLED_VR_LISTENERS); sBroadcastOnRestore.add(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); sBroadcastOnRestore.add(Settings.Secure.ENABLED_INPUT_METHODS); sBroadcastOnRestore.add(Settings.Global.BLUETOOTH_ON); } Loading
services/core/java/com/android/server/InputMethodManagerService.java +0 −50 Original line number Diff line number Diff line Loading @@ -120,7 +120,6 @@ import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; import android.text.TextUtils; import android.text.style.SuggestionSpan; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; import android.util.EventLog; Loading Loading @@ -183,7 +182,6 @@ import java.util.concurrent.atomic.AtomicInteger; public class InputMethodManagerService extends IInputMethodManager.Stub implements ServiceConnection, Handler.Callback { static final boolean DEBUG = false; static final boolean DEBUG_RESTORE = DEBUG || false; static final String TAG = "InputMethodManagerService"; @Retention(SOURCE) Loading Loading @@ -911,15 +909,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub || Intent.ACTION_USER_REMOVED.equals(action)) { updateCurrentProfileIds(); return; } else if (Intent.ACTION_SETTING_RESTORED.equals(action)) { final String name = intent.getStringExtra(Intent.EXTRA_SETTING_NAME); if (Settings.Secure.ENABLED_INPUT_METHODS.equals(name)) { final String prevValue = intent.getStringExtra( Intent.EXTRA_SETTING_PREVIOUS_VALUE); final String newValue = intent.getStringExtra( Intent.EXTRA_SETTING_NEW_VALUE); restoreEnabledInputMethods(mContext, prevValue, newValue); } } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) { onActionLocaleChanged(); } else if (ACTION_SHOW_INPUT_METHOD_PICKER.equals(action)) { Loading Loading @@ -984,44 +973,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } // Apply the results of a restore operation to the set of enabled IMEs. Note that this // does not attempt to validate on the fly with any installed device policy, so must only // be run in the context of initial device setup. // // TODO: Move this method to InputMethodUtils with adding unit tests. static void restoreEnabledInputMethods(Context context, String prevValue, String newValue) { if (DEBUG_RESTORE) { Slog.i(TAG, "Restoring enabled input methods:"); Slog.i(TAG, "prev=" + prevValue); Slog.i(TAG, " new=" + newValue); } // 'new' is the just-restored state, 'prev' is what was in settings prior to the restore ArrayMap<String, ArraySet<String>> prevMap = InputMethodUtils.parseInputMethodsAndSubtypesString(prevValue); ArrayMap<String, ArraySet<String>> newMap = InputMethodUtils.parseInputMethodsAndSubtypesString(newValue); // Merge the restored ime+subtype enabled states into the live state for (ArrayMap.Entry<String, ArraySet<String>> entry : newMap.entrySet()) { final String imeId = entry.getKey(); ArraySet<String> prevSubtypes = prevMap.get(imeId); if (prevSubtypes == null) { prevSubtypes = new ArraySet<>(2); prevMap.put(imeId, prevSubtypes); } prevSubtypes.addAll(entry.getValue()); } final String mergedImesAndSubtypesString = InputMethodUtils.buildInputMethodsAndSubtypesString(prevMap); if (DEBUG_RESTORE) { Slog.i(TAG, "Merged IME string:"); Slog.i(TAG, " " + mergedImesAndSubtypesString); } Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ENABLED_INPUT_METHODS, mergedImesAndSubtypesString); } final class MyPackageMonitor extends PackageMonitor { /** * Package names that are known to contain {@link InputMethodService}. Loading Loading @@ -1577,7 +1528,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub broadcastFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); broadcastFilter.addAction(Intent.ACTION_USER_ADDED); broadcastFilter.addAction(Intent.ACTION_USER_REMOVED); broadcastFilter.addAction(Intent.ACTION_SETTING_RESTORED); broadcastFilter.addAction(Intent.ACTION_LOCALE_CHANGED); broadcastFilter.addAction(ACTION_SHOW_INPUT_METHOD_PICKER); mContext.registerReceiver(new ImmsBroadcastReceiver(), broadcastFilter); Loading