Add log for BatteryUtils
This cl add logs to get more data for app usage time. Also refactor BatteryUtils to singleton pattern because we need to extract package name from uid. Bug: 36909166 Test: RunSettingsRoboTests Change-Id: I6ede354035c46e46cb856b7cf57bd1b7ccbd6d4f
This commit is contained in:
@@ -110,6 +110,8 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
PowerGaugePreference mLastFullChargePref;
|
||||
@VisibleForTesting
|
||||
PowerUsageFeatureProvider mPowerFeatureProvider;
|
||||
@VisibleForTesting
|
||||
BatteryUtils mBatteryUtils;
|
||||
|
||||
private LayoutPreference mBatteryLayoutPref;
|
||||
private PreferenceGroup mAppListGroup;
|
||||
@@ -127,6 +129,8 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
KEY_TIME_SINCE_LAST_FULL_CHARGE);
|
||||
mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.battery_footer_summary);
|
||||
|
||||
mBatteryUtils = BatteryUtils.getInstance(getContext());
|
||||
|
||||
initFeatureProvider();
|
||||
}
|
||||
|
||||
@@ -494,7 +498,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
pref.setOrder(i + 1);
|
||||
pref.setPercent(percentOfTotal);
|
||||
if (sipper.usageTimeMs == 0 && sipper.drainType == DrainType.APP) {
|
||||
sipper.usageTimeMs = BatteryUtils.getProcessTimeMs(
|
||||
sipper.usageTimeMs = mBatteryUtils.getProcessTimeMs(
|
||||
BatteryUtils.StatusType.FOREGROUND, sipper.uidObj, mStatsType);
|
||||
}
|
||||
setUsageSummary(pref, usedTime, sipper.usageTimeMs);
|
||||
|
Reference in New Issue
Block a user