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:
@@ -101,13 +101,14 @@ public class RestrictedPreferenceHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the list of {@link RestrictedPreference} with the installedShortcuts arguments.
|
||||
* Creates the list of {@link AccessibilityActivityPreference} with the installedShortcuts
|
||||
* arguments.
|
||||
*
|
||||
* @param installedShortcuts The list of {@link AccessibilityShortcutInfo}s of the
|
||||
* installed accessibility shortcuts
|
||||
* @return The list of {@link RestrictedPreference}
|
||||
* @return The list of {@link AccessibilityActivityPreference}
|
||||
*/
|
||||
public List<RestrictedPreference> createAccessibilityActivityPreferenceList(
|
||||
public List<AccessibilityActivityPreference> createAccessibilityActivityPreferenceList(
|
||||
List<AccessibilityShortcutInfo> installedShortcuts) {
|
||||
final Set<ComponentName> enabledServices =
|
||||
AccessibilityUtils.getEnabledServicesFromSettings(mContext);
|
||||
@@ -115,7 +116,7 @@ public class RestrictedPreferenceHelper {
|
||||
UserHandle.myUserId());
|
||||
|
||||
final int installedShortcutsSize = installedShortcuts.size();
|
||||
final List<RestrictedPreference> preferenceList = new ArrayList<>(
|
||||
final List<AccessibilityActivityPreference> preferenceList = new ArrayList<>(
|
||||
installedShortcutsSize);
|
||||
|
||||
for (int i = 0; i < installedShortcutsSize; ++i) {
|
||||
@@ -124,7 +125,7 @@ public class RestrictedPreferenceHelper {
|
||||
final ComponentName componentName = info.getComponentName();
|
||||
|
||||
final boolean serviceEnabled = enabledServices.contains(componentName);
|
||||
RestrictedPreference preference = new AccessibilityActivityPreference(
|
||||
AccessibilityActivityPreference preference = new AccessibilityActivityPreference(
|
||||
mContext, componentName.getPackageName(), activityInfo.applicationInfo.uid,
|
||||
info);
|
||||
setRestrictedPreferenceEnabled(preference, permittedServices, serviceEnabled);
|
||||
|
||||
Reference in New Issue
Block a user