summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
diff options
context:
space:
mode:
authorKenny Guy <kennyguy@google.com>2014-08-21 13:20:21 +0100
committerKenny Guy <kennyguy@google.com>2014-08-21 17:15:49 +0100
commit333f2bc71a0866053f8e2fce8efbfb0bcec68811 (patch)
tree81db561524dbe7c980ce1a4c4adbe5f62109f482 /src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
parent10673f1a1e330cf20ddab04fbc09cce3f18d111d (diff)
downloadpackages_apps_Settings-333f2bc71a0866053f8e2fce8efbfb0bcec68811.tar.gz
packages_apps_Settings-333f2bc71a0866053f8e2fce8efbfb0bcec68811.tar.bz2
packages_apps_Settings-333f2bc71a0866053f8e2fce8efbfb0bcec68811.zip
Disable non-permitted accessibility services and IMEs
Bug: 14469005 Change-Id: I4986f035318854c27ecb92bbe2f0c977d53b6361
Diffstat (limited to 'src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index f18694c56..d0bc0cc0c 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -18,6 +18,7 @@ package com.android.settings.inputmethod;
import android.app.Activity;
import android.app.Fragment;
+import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -34,6 +35,7 @@ import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.os.Handler;
+import android.os.UserHandle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -102,6 +104,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
private SettingsObserver mSettingsObserver;
private Intent mIntentWaitingForResult;
private InputMethodSettingValuesWrapper mInputMethodSettingValues;
+ private DevicePolicyManager mDpm;
@Override
public void onCreate(Bundle icicle) {
@@ -175,6 +178,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
mHandler = new Handler();
mSettingsObserver = new SettingsObserver(mHandler, activity);
+ mDpm = (DevicePolicyManager) (getActivity().
+ getSystemService(Context.DEVICE_POLICY_SERVICE));
}
private void updateInputMethodSelectorSummary(int value) {
@@ -403,6 +408,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
mKeyboardSettingsCategory.removePreference(pref);
}
mInputMethodPreferenceList.clear();
+ List<String> permittedList = mDpm.getPermittedInputMethodsForCurrentUser();
final Context context = getActivity();
final List<InputMethodInfo> imis = mShowsOnlyFullImeAndKeyboardList
? mInputMethodSettingValues.getInputMethodList()
@@ -410,8 +416,11 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
final int N = (imis == null ? 0 : imis.size());
for (int i = 0; i < N; ++i) {
final InputMethodInfo imi = imis.get(i);
+ final boolean isAllowedByOrganization = permittedList == null
+ || permittedList.contains(imi.getPackageName());
final InputMethodPreference pref = new InputMethodPreference(
- context, imi, mShowsOnlyFullImeAndKeyboardList /* hasSwitch */, this);
+ context, imi, mShowsOnlyFullImeAndKeyboardList /* hasSwitch */,
+ isAllowedByOrganization, this);
mInputMethodPreferenceList.add(pref);
}
final Collator collator = Collator.getInstance();