diff options
| author | 2022-06-24 17:30:40 +0000 | |
|---|---|---|
| committer | 2022-07-01 18:02:50 +0000 | |
| commit | 3171dbf96c53a68745dd09c44b94ffd51aaef9a6 (patch) | |
| tree | 22f4bf6477fc05ab570dace1d39cb80dd69257ba /libs/androidfw/StringPool.cpp | |
| parent | 3329ea3de30fc9535626a49629e553a7629e48be (diff) | |
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
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions