LockSettingsStorage: fix user prefetching
The user prefetching logic doesn't work as intended, for two reasons: - The key that Cache.setFetched() sets differs from the key that Cache.isFetched() looks for, so Cache.isFetched() always returns false. So, LockSettingsStorage.prefetchUser() always runs for a user when called, rather than just once per boot as intended. Fix this by making Cache.setFetched() use the same key as Cache.isFetched(). - Since Cache.putIfUnchanged() increments Cache.mVersion, only the first call to it within LockSettingsStorage.prefetchUser() has any effect. So only the first key-value pair for the user is prefetched, not all of them as intended. Fix this by making Cache.putIfUnchanged() *not* increment mVersion, as the backing storage isn't being modified. Found by code review; these bugs aren't known to have been causing any real-world problems. Test: atest --iterations 50 LockSettingsStorageTests Change-Id: Ife97ba855d014d8e291d46f6a702a41b28bd5707
Loading
Please register or sign in to comment