Loading
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