Create copy of op list, return empty if indicators disabled

When assembling the op list, create a copy, do not use the existing
camera op list, as that list is final. Also return an empty list when
indicators are disabled, not null.

Fixes: 177005228
Test: Manual
Change-Id: I281085c12f0706836098fc2f16d196887596170e
This commit is contained in:
Nate Myren
2021-01-07 13:12:19 -08:00
parent f88fbe5128
commit 0767818077

View File

@@ -153,11 +153,13 @@ public class PermissionUsageHelper {
* @see PermissionManager.getIndicatorAppOpUsageData
*/
public List<PermGroupUsage> getOpUsageData(boolean isMicMuted) {
List<PermGroupUsage> usages = new ArrayList<>();
if (!shouldShowIndicators()) {
return null;
return usages;
}
List<String> ops = CAMERA_OPS;
List<String> ops = new ArrayList<>(CAMERA_OPS);
if (shouldShowLocationIndicator()) {
ops.addAll(LOCATION_OPS);
}
@@ -169,7 +171,6 @@ public class PermissionUsageHelper {
Map<PackageAttribution, CharSequence> packagesWithAttributionLabels =
getTrustedAttributions(rawUsages.get(MICROPHONE));
List<PermGroupUsage> usages = new ArrayList<>();
List<String> usedPermGroups = new ArrayList<>(rawUsages.keySet());
for (int permGroupNum = 0; permGroupNum < usedPermGroups.size(); permGroupNum++) {
boolean isPhone = false;