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

This commit is contained in:
Amith Yamasani
2010-03-24 22:26:10 -07:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 4 deletions

View File

@@ -2312,6 +2312,14 @@ public final class Settings {
*/
public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
/**
* List of system input methods that are currently disabled. This is a string
* containing the IDs of all disabled input methods, each ID separated
* by ':'.
* @hide
*/
public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
/**
* Host name and port for a user-selected proxy.
*/

View File

@@ -46,6 +46,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.ContentObserver;
@@ -60,6 +61,7 @@ import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Slog;
@@ -1418,6 +1420,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
map.clear();
PackageManager pm = mContext.getPackageManager();
final Configuration config = mContext.getResources().getConfiguration();
final boolean haveHardKeyboard = config.keyboard == Configuration.KEYBOARD_QWERTY;
String disabledSysImes = Settings.Secure.getString(mContext.getContentResolver(),
Secure.DISABLED_SYSTEM_INPUT_METHODS);
if (disabledSysImes == null) disabledSysImes = "";
List<ResolveInfo> services = pm.queryIntentServices(
new Intent(InputMethod.SERVICE_INTERFACE),
@@ -1440,11 +1447,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
try {
InputMethodInfo p = new InputMethodInfo(mContext, ri);
list.add(p);
map.put(p.getId(), p);
final String id = p.getId();
map.put(id, p);
// System IMEs are enabled by default
if (isSystemIme(p)) {
setInputMethodEnabledLocked(p.getId(), true);
// System IMEs are enabled by default, unless there's a hard keyboard
// and the system IME was explicitly disabled
if (isSystemIme(p) && (!haveHardKeyboard || disabledSysImes.indexOf(id) < 0)) {
setInputMethodEnabledLocked(id, true);
}
if (DEBUG) {