summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-05 22:46:49 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-05 22:46:49 +0000
commit0fcfae88f2737b004cae83a77d590046e2b08ef3 (patch)
tree596461f91961ff918d381c979fd660b7f6add6fa /services
parentf02b1abc2726692dd69f10c1c9e7fa69ccc4ab63 (diff)
parentecc20aafa6f3d272292e7b3577c99f2c127e590f (diff)
downloadframeworks_base-0fcfae88f2737b004cae83a77d590046e2b08ef3.zip
frameworks_base-0fcfae88f2737b004cae83a77d590046e2b08ef3.tar.gz
frameworks_base-0fcfae88f2737b004cae83a77d590046e2b08ef3.tar.bz2
am ecc20aaf: am 63ab6eb2: Merge "Frameworks/base: Use ArraySet more explicitly"
* commit 'ecc20aafa6f3d272292e7b3577c99f2c127e590f': 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 4a8e318..1772856 100644
--- a/services/core/java/com/android/server/pm/KeySetManagerService.java
+++ b/services/core/java/com/android/server/pm/KeySetManagerService.java
@@ -415,9 +415,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);
}
@@ -430,9 +430,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);
}
@@ -441,18 +441,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);
}
}