Use the background thread instead ActivityManager to update CPU stats.

Updating the CPU stats can be quite slow and blocks the ActivityManager
handler thread.

Bug: 115506775
Change-Id: I9f67acfe2724c11d117703b2c4ccdbcc1f61c5ab
Test: manual - dumpsys batterystats | grep CPU
This commit is contained in:
Olivier Gaillard
2018-09-20 13:53:18 +01:00
parent ab4bbc038e
commit c2d02b522c
2 changed files with 5 additions and 1 deletions

View File

@@ -337,6 +337,9 @@ public class BatteryStatsImpl extends BatteryStats {
private final PlatformIdleStateCallback mPlatformIdleStateCallback;
/**
* This handler is running on {@link BackgroundThread}.
*/
final class MyHandler extends Handler {
public MyHandler(Looper looper) {
super(looper, null, true);