Only use cacheLock when it's needed
When reading from cache, we can avoid synchronization on dbLock if we
only read from cache (no db access).
When doing updates to db and cache, we should hold cacheLock only when
updating the cache.
This change improves locking in the following methods:
- getAccountVisibilityFromCache
- saveAuthTokenToDatabase
- getAccountsFromCacheLocked no longer allows outside locking. The
method was renamed to getAccountsFromCache and now self-manages locks
- writeAuthTokenIntoCacheLocked
- readAuthTokenInternal
Test: AccountManagerServiceTest
Bug: 36485175
Bug: 35262596
Change-Id: I9aca45c31716c4f0e0fd9f07859e88a7f5ba6922
1 file changed