Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd473a32 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix iterator misuse"

parents 407396e3 57eb705e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5968,9 +5968,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            // If set, remove exclusive scopes from all other delegates
            if (exclusiveScopes != null && !exclusiveScopes.isEmpty()) {
                for (Map.Entry<String, List<String>> entry : policy.mDelegationMap.entrySet()) {
                    final String currentPackage = entry.getKey();
                    final List<String> currentScopes = entry.getValue();
                for (int i = policy.mDelegationMap.size() - 1; i >= 0; --i) {
                    final String currentPackage = policy.mDelegationMap.keyAt(i);
                    final List<String> currentScopes = policy.mDelegationMap.valueAt(i);
                    if (!currentPackage.equals(delegatePackage)) {
                        // Iterate through all other delegates
@@ -5978,7 +5978,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                            // And if this delegate had some exclusive scopes which are now moved
                            // to the new delegate, notify about its delegation changes.
                            if (currentScopes.isEmpty()) {
                                policy.mDelegationMap.remove(currentPackage);
                                policy.mDelegationMap.removeAt(i);
                            }
                            sendDelegationChangedBroadcast(currentPackage,
                                    new ArrayList<>(currentScopes), userId);