Merge "Accounts: Fix TokenCache maps access" am: b06de7892a

am: c311914042

Change-Id: I5ca61d48c103c33cd790698c097f581e76e354fc
This commit is contained in:
Andreas Gampe
2018-03-06 20:29:24 +00:00
committed by android-build-merger

View File

@@ -125,7 +125,7 @@ import java.util.Objects;
* This is recursive, but it won't spiral out of control because LruCache is
* thread safe and the Evictor can only be removed once.
*/
Evictor evictor = mTokenEvictors.remove(oldVal.token);
Evictor evictor = mTokenEvictors.remove(new Pair<>(k.account.type, oldVal.token));
if (evictor != null) {
evictor.evict();
}
@@ -134,12 +134,13 @@ import java.util.Objects;
public void putToken(Key k, Value v) {
// Prepare for removal by token string.
Evictor tokenEvictor = mTokenEvictors.get(v.token);
Pair<String, String> mapKey = new Pair<>(k.account.type, v.token);
Evictor tokenEvictor = mTokenEvictors.get(mapKey);
if (tokenEvictor == null) {
tokenEvictor = new Evictor();
}
tokenEvictor.add(k);
mTokenEvictors.put(new Pair<>(k.account.type, v.token), tokenEvictor);
mTokenEvictors.put(mapKey, tokenEvictor);
// Prepare for removal by associated account.
Evictor accountEvictor = mAccountEvictors.get(k.account);