diff options
| author | Jing Ji <jji@google.com> | 2021-08-31 06:12:23 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-08-31 06:12:23 +0000 |
| commit | 8e99ff57e9eb73b54687ecf6282c7f0a896c2dd4 (patch) | |
| tree | e875e2743533bf586c87b46b5a2fa85474c4f68f /core/java/android | |
| parent | 9285cc273cc4d2ebbf76aa6c88175d2138f111b1 (diff) | |
| parent | 655a7f52f976f2e3f90722663753a446d1e02d74 (diff) | |
Merge "Use ArrayMap instead of SparseArray to manage the ProviderKey" into sc-dev am: d5ea86eaf0 am: 655a7f52f9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15664720
Change-Id: I61aa6119af0a47aa02b83cde48fd22070192e5fb
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index bff1e57c9f22..61da4a7fecc0 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -466,11 +466,7 @@ public final class ActivityThread extends ClientTransactionHandler @Override public int hashCode() { - return hashCode(authority, userId); - } - - public static int hashCode(final String auth, final int userIdent) { - return ((auth != null) ? auth.hashCode() : 0) ^ userIdent; + return ((authority != null) ? authority.hashCode() : 0) ^ userId; } } @@ -492,7 +488,7 @@ public final class ActivityThread extends ClientTransactionHandler // Note we never removes items from this map but that's okay because there are only so many // users and so many authorities. @GuardedBy("mGetProviderKeys") - final SparseArray<ProviderKey> mGetProviderKeys = new SparseArray<>(); + final ArrayMap<ProviderKey, ProviderKey> mGetProviderKeys = new ArrayMap<>(); final ArrayMap<Activity, ArrayList<OnActivityPausedListener>> mOnPauseListeners = new ArrayMap<Activity, ArrayList<OnActivityPausedListener>>(); @@ -6991,11 +6987,11 @@ public final class ActivityThread extends ClientTransactionHandler } private ProviderKey getGetProviderKey(String auth, int userId) { - final int key = ProviderKey.hashCode(auth, userId); + final ProviderKey key = new ProviderKey(auth, userId); synchronized (mGetProviderKeys) { ProviderKey lock = mGetProviderKeys.get(key); if (lock == null) { - lock = new ProviderKey(auth, userId); + lock = key; mGetProviderKeys.put(key, lock); } return lock; |
