Merge "Add util method to get battery stats" into oc-dr1-dev

This commit is contained in:
TreeHugger Robot
2017-07-06 21:58:33 +00:00
committed by Android (Google) Code Review
4 changed files with 30 additions and 72 deletions

View File

@@ -18,7 +18,9 @@ package com.android.settings.fuelgauge;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.BatteryStats;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserManager;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
@@ -328,6 +330,12 @@ public class BatteryUtils {
return timeMs * 1000;
}
public void initBatteryStatsHelper(BatteryStatsHelper statsHelper, Bundle bundle,
UserManager userManager) {
statsHelper.create(bundle);
statsHelper.refreshStats(BatteryStats.STATS_SINCE_CHARGED, userManager.getUserProfiles());
}
private boolean isDataCorrupted() {
return mPackageManager == null;
}