Improve the speed of AccessibilitySettings#containsTargetNameInList to
help reduce the a11y settings' cold start latency. Bug: 327052480 Flag: EXEMPT bugfix low risk Test: atest com.android.settings.accessibility Test: manual (a11y settings page still shows up with correct content) Change-Id: Ib9980756d88a218ebb10f17d6a3b0d9a406a0ddd
This commit is contained in:
@@ -50,6 +50,7 @@ public class AccessibilityActivityPreference extends RestrictedPreference {
|
||||
private final AccessibilityShortcutInfo mA11yShortcutInfo;
|
||||
private final PackageManager mPm;
|
||||
private final ComponentName mComponentName;
|
||||
private final CharSequence mLabel;
|
||||
private final ListenableFuture mExtraArgumentsFuture;
|
||||
|
||||
public AccessibilityActivityPreference(Context context, String packageName, int uid,
|
||||
@@ -58,9 +59,10 @@ public class AccessibilityActivityPreference extends RestrictedPreference {
|
||||
mPm = context.getPackageManager();
|
||||
mA11yShortcutInfo = a11yShortcutInfo;
|
||||
mComponentName = a11yShortcutInfo.getComponentName();
|
||||
mLabel = a11yShortcutInfo.getActivityInfo().loadLabel(mPm);
|
||||
// setup basic info for a preference
|
||||
setKey(mComponentName.flattenToString());
|
||||
setTitle(a11yShortcutInfo.getActivityInfo().loadLabel(mPm));
|
||||
setTitle(mLabel);
|
||||
setSummary(a11yShortcutInfo.loadSummary(mPm));
|
||||
setFragment(TARGET_FRAGMENT);
|
||||
setIconSize(ICON_SIZE_MEDIUM);
|
||||
@@ -92,6 +94,13 @@ public class AccessibilityActivityPreference extends RestrictedPreference {
|
||||
super.performClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label of the Accessibility Activity
|
||||
*/
|
||||
public CharSequence getLabel() {
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
private Drawable getA11yActivityIcon() {
|
||||
ActivityInfo activityInfo = mA11yShortcutInfo.getActivityInfo();
|
||||
Drawable serviceIcon;
|
||||
|
Reference in New Issue
Block a user