Only get apps with permission granted.

The subtitle gives the number of apps that can access location, but it
currently collects all apps that request location, including those
that are denied.  Ensure that we only count granted apps.

Bug: 129296799
Test: Open Settings, see the count is much lower.
Change-Id: I9a18bbb62be742731205dab9f5b8e9a703ea030c
This commit is contained in:
Joel Galenson
2019-04-17 11:10:48 -07:00
parent 634b56cb17
commit db516d98c5

View File

@@ -71,7 +71,8 @@ public class TopLevelLocationPreferenceController extends BasePreferenceControll
return;
}
mContext.getSystemService(PermissionControllerManager.class).countPermissionApps(
Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION), 0,
Arrays.asList(ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION),
PermissionControllerManager.COUNT_ONLY_WHEN_GRANTED,
(numApps) -> {
setLocationAppCount(numApps);
}, null);