Merge "BUG 5457035 : Anti-spoofing : DO NOT MERGE" into jb-dev
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index d848503..bc8b458 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -407,8 +407,7 @@
                 InputDevice device = InputDevice.getDevice(devices[i]);
                 if (device != null
                         && !device.isVirtual()
-                        && (device.getSources() & InputDevice.SOURCE_KEYBOARD) != 0
-                        && device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
+                        && device.isFullKeyboard()) {
                     final String inputDeviceDescriptor = device.getDescriptor();
                     final String keyboardLayoutDescriptor =
                             mIm.getCurrentKeyboardLayoutForInputDevice(inputDeviceDescriptor);
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index c736b2f5..f555d21 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -53,6 +53,7 @@
     private final InputMethodManager mImm;
     private final Intent mSettingsIntent;
     private final boolean mAlwaysChecked;
+    private final boolean mIsSystemIme;
 
     private AlertDialog mDialog = null;
     private ImageView mInputMethodSettingsButton;
@@ -69,7 +70,7 @@
             if (isChecked()) {
                 setChecked(false, true /* save */);
             } else {
-                if (mAlwaysChecked) {
+                if (mIsSystemIme) {
                     setChecked(true, true /* save */);
                 } else {
                     showSecurityWarnDialog(mImi, InputMethodPreference.this);
@@ -90,6 +91,7 @@
         updateSummary();
         mAlwaysChecked = InputMethodAndSubtypeUtil.isAlwaysCheckedIme(
                 imi, fragment.getActivity(), imiCount);
+        mIsSystemIme = InputMethodAndSubtypeUtil.isSystemIme(imi);
         if (mAlwaysChecked) {
             setEnabled(false);
         }