summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-05 22:55:34 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-05 22:55:34 +0000
commitddbc48cdee409d882b8bbb2bf626843c378b4925 (patch)
tree74fc146749ee393517e2065431ce77d02ddf737d /services
parent38d909a57d95d29e6c47f40d360bc10325d7b228 (diff)
parent0fcfae88f2737b004cae83a77d590046e2b08ef3 (diff)
downloadframeworks_base-ddbc48cdee409d882b8bbb2bf626843c378b4925.zip
frameworks_base-ddbc48cdee409d882b8bbb2bf626843c378b4925.tar.gz
frameworks_base-ddbc48cdee409d882b8bbb2bf626843c378b4925.tar.bz2
am 0fcfae88: am ecc20aaf: am 63ab6eb2: Merge "Frameworks/base: Use ArraySet more explicitly"
* commit '0fcfae88f2737b004cae83a77d590046e2b08ef3': Frameworks/base: Use ArraySet more explicitly
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/pm/KeySetManagerService.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/KeySetManagerService.java b/services/core/java/com/android/server/pm/KeySetManagerService.java
index 773b164..aa63932 100644
--- a/services/core/java/com/android/server/pm/KeySetManagerService.java
+++ b/services/core/java/com/android/server/pm/KeySetManagerService.java
@@ -414,9 +414,9 @@ public class KeySetManagerService {
// Get the package's known keys and KeySets
ArraySet<Long> deletableKeySets = getOriginalKeySetsByPackageNameLPr(packageName);
ArraySet<Long> deletableKeys = new ArraySet<Long>();
- ArraySet<Long> knownKeys = null;
- for (Long ks : deletableKeySets) {
- knownKeys = mKeySetMapping.get(ks);
+ final int origDksSize = deletableKeySets.size();
+ for (int i = 0; i < origDksSize; i++) {
+ ArraySet<Long> knownKeys = mKeySetMapping.get(deletableKeySets.valueAt(i));
if (knownKeys != null) {
deletableKeys.addAll(knownKeys);
}
@@ -429,9 +429,9 @@ public class KeySetManagerService {
}
ArraySet<Long> knownKeySets = getOriginalKeySetsByPackageNameLPr(pkgName);
deletableKeySets.removeAll(knownKeySets);
- knownKeys = new ArraySet<Long>();
- for (Long ks : knownKeySets) {
- knownKeys = mKeySetMapping.get(ks);
+ final int kksSize = knownKeySets.size();
+ for (int i = 0; i < kksSize; i++) {
+ ArraySet<Long> knownKeys = mKeySetMapping.get(knownKeySets.valueAt(i));
if (knownKeys != null) {
deletableKeys.removeAll(knownKeys);
}
@@ -440,18 +440,22 @@ public class KeySetManagerService {
// The remaining keys and KeySets are not relied on by any other
// application and so can be safely deleted.
- for (Long ks : deletableKeySets) {
+ final int dksSize = deletableKeySets.size();
+ for (int i = 0; i < dksSize; i++) {
+ Long ks = deletableKeySets.valueAt(i);
mKeySets.delete(ks);
mKeySetMapping.delete(ks);
}
- for (Long keyId : deletableKeys) {
- mPublicKeys.delete(keyId);
+ final int dkSize = deletableKeys.size();
+ for (int i = 0; i < dkSize; i++) {
+ mPublicKeys.delete(deletableKeys.valueAt(i));
}
// Now remove the deleted KeySets from each package's signingKeySets
for (String pkgName : mPackages.keySet()) {
PackageSetting p = mPackages.get(pkgName);
- for (Long ks : deletableKeySets) {
+ for (int i = 0; i < dksSize; i++) {
+ Long ks = deletableKeySets.valueAt(i);
p.keySetData.removeSigningKeySet(ks);
}
}