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

Skip to content
Commit 83f8dbda authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato Committed by Nicolò Mazzucato
Browse files

Use separate locks for BatteryController estimation and callbacks

Initially mFetchCallbacks was used as a lock for everything going on in the class.
From droidfooders traces we noticed that getEstimatedTimeRemainingString was blocking the main thread because an estimate update was going on the in background, even if it was only waiting to add a callback to a list.

 This was causing priority inversion (ui thread depending on the background thread with less priority), ending up blocking the ui thread for 150ms.

 With this cl there are 2 locks: one just for the callbacks list, and one for the estimate computations

Bug: 272677942
Test: BatteryControllerTest
Change-Id: I31cc862161377678f60b70f5870a5295bb2625fa
parent 4626fa48
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