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

Skip to content
Commit 8d6a7a10 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

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
parent 08dbdfc5
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