Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3171dbf9 authored by Eric Biggers's avatar Eric Biggers
Browse files

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
parent 3329ea3d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment