Settings crashing if there are no installed accessibility services.

If there is no installed accessibility services and the user goes into
the accessibility settings section, the app crashes. This is due to a
lacking null pointer check against the list of installed services
returned by the accessibility manager. We should not have returned
null, rather an empty list - too late now, sigh...

bug:8871034

Change-Id: Id3800d398af83868862847fa7ed861a9dee61c8f
This commit is contained in:
Svetoslav
2013-05-08 12:14:15 -07:00
parent c6adece066
commit 084fbc8107

View File

@@ -570,11 +570,16 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
}
private void loadInstalledServices() {
Set<ComponentName> installedServices = sInstalledServices;
installedServices.clear();
List<AccessibilityServiceInfo> installedServiceInfos =
AccessibilityManager.getInstance(getActivity())
.getInstalledAccessibilityServiceList();
Set<ComponentName> installedServices = sInstalledServices;
installedServices.clear();
if (installedServiceInfos == null) {
return;
}
final int installedServiceInfoCount = installedServiceInfos.size();
for (int i = 0; i < installedServiceInfoCount; i++) {
ResolveInfo resolveInfo = installedServiceInfos.get(i).getResolveInfo();