Show default description only if description and html description are empty

* AccessibilitySettings only get the description to pass to the
ToggleFeaturePreferenceFragment
* ToggleFeaturePreferenceFragment handle the default description logic

Bug: 154092127
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.accessibility.AccessibilitySettingsTest"
Change-Id: I516a393aeef1472ca5d185d477a2b0b108fc5342
This commit is contained in:
jasonwshsu
2020-04-17 02:29:56 +08:00
committed by Jason Hsu
parent 9674276bb5
commit f74c0a72b6
3 changed files with 17 additions and 24 deletions

View File

@@ -307,11 +307,7 @@ public class AccessibilitySettings extends DashboardFragment {
return context.getText(R.string.accessibility_description_state_stopped);
}
final String description = info.loadDescription(context.getPackageManager());
return TextUtils.isEmpty(description)
? context.getText(R.string.accessibility_service_default_description)
: description;
return info.loadDescription(context.getPackageManager());
}
static boolean isRampingRingerEnabled(final Context context) {
@@ -460,7 +456,7 @@ public class AccessibilitySettings extends DashboardFragment {
}
/**
* Update the order of perferences in the category by matching their preference
* Update the order of preferences in the category by matching their preference
* key with the string array of preference order which is defined in the xml.
*
* @param categoryKey The key of the category need to update the order
@@ -708,10 +704,9 @@ public class AccessibilitySettings extends DashboardFragment {
CharSequence title, CharSequence summary, int imageRes, String htmlDescription,
ComponentName componentName) {
final Bundle extras = preference.getExtras();
extras.putString(EXTRA_PREFERENCE_KEY, prefKey);
extras.putString(EXTRA_TITLE, title.toString());
extras.putString(EXTRA_SUMMARY, summary.toString());
extras.putCharSequence(EXTRA_TITLE, title);
extras.putCharSequence(EXTRA_SUMMARY, summary);
extras.putParcelable(EXTRA_COMPONENT_NAME, componentName);
extras.putInt(EXTRA_ANIMATED_IMAGE_RES, imageRes);
extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);