Disable non-permitted accessibility services and IMEs
Bug: 14469005 Change-Id: I4986f035318854c27ecb92bbe2f0c977d53b6361
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user