Only use PROCESS_STATE_TOP as foreground time.

There are some miscalculations in state FOREGROUND_SERVICE and
FOREGROUND, so we move them out of the foreground time for now.

We will fix it after O and may add them back later.

Bug: 37000096
Test: RunSettingsRoboTests
Change-Id: Ic3f2f7fa69e8a213895c601630d1cca94fd32220
This commit is contained in:
jackqdyulei
2017-05-04 12:38:08 -07:00
parent e5fa4cd4b5
commit 01e690e377
3 changed files with 4 additions and 6 deletions

View File

@@ -100,9 +100,7 @@ public class BatteryUtils {
private long getProcessForegroundTimeMs(BatteryStats.Uid uid, int which) {
final long rawRealTimeUs = convertMsToUs(SystemClock.elapsedRealtime());
final int foregroundTypes[] = {BatteryStats.Uid.PROCESS_STATE_TOP,
BatteryStats.Uid.PROCESS_STATE_FOREGROUND_SERVICE,
BatteryStats.Uid.PROCESS_STATE_FOREGROUND};
final int foregroundTypes[] = {BatteryStats.Uid.PROCESS_STATE_TOP};
Log.v(TAG, "package: " + mPackageManager.getNameForUid(uid.getUid()));
long timeUs = 0;