Execute getting battery info on the parallel executor

Getting battery info is time consuming and may block other tasks in the
same background thread.

Executing it on the parallel executor can improve app launch performance.

Bug: 141694556
Test: robotest
Change-Id: I55517e03961929c2b288e230ed474d45915d63fd
This commit is contained in:
Jason Chiu
2019-09-27 17:33:08 +08:00
parent 6472d299e9
commit 86e98bf448

View File

@@ -160,7 +160,7 @@ public class BatteryInfo {
callback.onBatteryInfoLoaded(batteryInfo);
BatteryUtils.logRuntime(LOG_TAG, "time for callback", startTime);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static BatteryInfo getBatteryInfo(final Context context,