+11
−8
Loading
Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more
Problem: notifications do not show until a few seconds after the shade opens, caused by a blocking call to load ic_brightness_full.xml for the brightness slider Call stack that blocks UI: - The UI (produceState in BrightnessSlider.kt) waits for the icon to load before it can finish drawing. - The ViewModel's loadImage function calls imageLoader.loadDrawable. - imageLoader switches to a background thread but then calls a synchronous loadDrawableSync that hangs while trying to load the xml. - Because the background thread is frozen, the UI thread, which is waiting for the result, is also frozen. Solution: The fix wraps the imageLoader call in a 500ms timeout. If loading the icon takes too long, we cancel and return null, so the UI remains responsive and renders notifications promptly on shade open. Fixes: 423364554 Test: BrightnessSliderViewModelTest.kt Test: open shade, notifs show with no delay, brightness slider has no regressions; screenrecord in bug Flag: EXEMPT bug fix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:56a930e723c4d896928e55d3fe3c31c768b21b38) Merged-In: I3674060e2925acb326f0b120c09b2663112e7cba Change-Id: I3674060e2925acb326f0b120c09b2663112e7cba