Add preference summary when disabled by admin.
Change-Id: Iaa84e66b0abe0fccde50f116cbf6e68c6abbabc0
This commit is contained in:
@@ -44,11 +44,13 @@ public class DimmableIconPreference extends RestrictedPreference {
|
||||
public DimmableIconPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContentDescription = null;
|
||||
useAdminDisabledSummary(true);
|
||||
}
|
||||
|
||||
public DimmableIconPreference(Context context, @Nullable CharSequence contentDescription) {
|
||||
super(context);
|
||||
mContentDescription = contentDescription;
|
||||
useAdminDisabledSummary(true);
|
||||
}
|
||||
|
||||
private void dimIcon(boolean dimmed) {
|
||||
|
@@ -481,6 +481,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
AccessibilityServiceInfo info = installedServices.get(i);
|
||||
|
||||
RestrictedPreference preference = new RestrictedPreference(getActivity());
|
||||
preference.useAdminDisabledSummary(true);
|
||||
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString();
|
||||
|
||||
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
|
||||
@@ -515,13 +516,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
preference.setEnabled(true);
|
||||
}
|
||||
|
||||
String summaryString;
|
||||
if (serviceAllowed) {
|
||||
summaryString = serviceEnabledString;
|
||||
} else {
|
||||
summaryString = getString(R.string.accessibility_feature_or_input_method_not_allowed);
|
||||
preference.setSummary(serviceEnabledString);
|
||||
}
|
||||
preference.setSummary(summaryString);
|
||||
|
||||
preference.setOrder(i);
|
||||
preference.setFragment(ToggleAccessibilityServicePreferenceFragment.class.getName());
|
||||
|
@@ -39,6 +39,7 @@ public class ProviderPreference extends RestrictedPreference {
|
||||
setIcon(icon);
|
||||
setPersistent(false);
|
||||
setTitle(providerName);
|
||||
useAdminDisabledSummary(true);
|
||||
}
|
||||
|
||||
public String getAccountType() {
|
||||
|
@@ -119,6 +119,7 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
|
||||
&& mInputMethodSettingValues.isValidSystemNonAuxAsciiCapableIme(imi, context);
|
||||
setOnPreferenceClickListener(this);
|
||||
setOnPreferenceChangeListener(this);
|
||||
useAdminDisabledSummary(true);
|
||||
if (!isAllowedByOrganization) {
|
||||
EnforcedAdmin admin =
|
||||
RestrictedLockUtils.getProfileOrDeviceOwnerOnCallingUser(context);
|
||||
@@ -194,7 +195,9 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
|
||||
// this preference should be disabled to prevent accidentally disabling an input method.
|
||||
setEnabled(!((isAlwaysChecked && isImeEnabler()) || (!mIsAllowedByOrganization)));
|
||||
setChecked(mInputMethodSettingValues.isEnabledImi(mImi));
|
||||
setSummary(getSummaryString());
|
||||
if (mIsAllowedByOrganization) {
|
||||
setSummary(getSummaryString());
|
||||
}
|
||||
}
|
||||
|
||||
private InputMethodManager getInputMethodManager() {
|
||||
@@ -203,9 +206,6 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
|
||||
|
||||
private String getSummaryString() {
|
||||
final Context context = getContext();
|
||||
if (!mIsAllowedByOrganization) {
|
||||
return context.getString(R.string.accessibility_feature_or_input_method_not_allowed);
|
||||
}
|
||||
final InputMethodManager imm = getInputMethodManager();
|
||||
final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(mImi, true);
|
||||
final ArrayList<CharSequence> subtypeLabels = new ArrayList<>();
|
||||
|
@@ -76,6 +76,7 @@ public class UserPreference extends RestrictedPreference {
|
||||
mDeleteClickListener = deleteListener;
|
||||
mSettingsClickListener = settingsListener;
|
||||
mUserId = userId;
|
||||
useAdminDisabledSummary(true);
|
||||
}
|
||||
|
||||
private void dimIcon(boolean dimmed) {
|
||||
|
Reference in New Issue
Block a user