summaryrefslogtreecommitdiff
path: root/libs/androidfw/StringPool.cpp
diff options
context:
space:
mode:
author Alejandro Nijamkin <nijamkin@google.com> 2022-10-31 09:04:09 -0700
committer Alejandro Nijamkin <nijamkin@google.com> 2022-10-31 09:12:16 -0700
commit8d6a7a10e6b64c6b84fdf560f2840d1c43a49870 (patch)
tree9469762bbc8ee1a797eb540a123e4f9c8cd79590 /libs/androidfw/StringPool.cpp
parent08dbdfc508c33f39b14fec498416697bdd0e1a19 (diff)
Blind fix for user switcher instant crash.
There is an instant crash stemming from a premature optimization done in the newly refactored code for the user switcher system. I am unable to reproduce this locally, so this is a blind fix. What follows is the rationale behind it. It appears to be a race condition. UserRepositoryImpl#isSimpleUserSwitcher asserts that we have loaded the settings but the settings are only loaded in a background coroutine job that's kicked off when the repository class is instantiated. From the looks of it, the former path is triggered before the latter is. The fix, therefore, is to always make sure that there is a non-null value for user settings. This is achieved in this CL using an expensive runBlocking call at class instantiation time. Delaying that was an optimization that attempted to do better than the original pre-refactor code, where the same approach is taken (settings are accessed on the main thread in a blocking fashion). Fix: 255916597, 254764031 Test: unable to reproduce locally but made sure that, with the new changes, there is no instant crash nor a crash when entering the full-screen user switcher on one of the affected device models - used adb reboot to trigger restarts. Change-Id: I970a416ae7eaf2d2a366b12b3d7c6b98ebc52011
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions