Replace uses of SystemBatteryConsumer with aggregate BatteryConsumers
Bug: 186006876 Test: make RunSettingsRoboTests Test: make RunSettingsGoogleRoboTests Change-Id: I2e240aa15c87b4b9dcbe993b4b0b1111285ec3ff
This commit is contained in:
@@ -15,10 +15,8 @@ package com.android.settings.fuelgauge;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.util.Log;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/** A container class to carry data from {@link ContentValues}. */
|
||||
public class BatteryHistEntry {
|
||||
@@ -61,7 +59,7 @@ public class BatteryHistEntry {
|
||||
public final double mPercentOfTotal;
|
||||
public final long mForegroundUsageTimeInMs;
|
||||
public final long mBackgroundUsageTimeInMs;
|
||||
public final int mDrainType;
|
||||
public final int mPowerComponentId;
|
||||
public final int mConsumerType;
|
||||
// Records the battery intent relative information.
|
||||
public final int mBatteryLevel;
|
||||
@@ -85,7 +83,7 @@ public class BatteryHistEntry {
|
||||
mPercentOfTotal = getDouble(values, KEY_PERCENT_OF_TOTAL);
|
||||
mForegroundUsageTimeInMs = getLong(values, KEY_FOREGROUND_USAGE_TIME);
|
||||
mBackgroundUsageTimeInMs = getLong(values, KEY_BACKGROUND_USAGE_TIME);
|
||||
mDrainType = getInteger(values, KEY_DRAIN_TYPE);
|
||||
mPowerComponentId = getInteger(values, KEY_DRAIN_TYPE);
|
||||
mConsumerType = getInteger(values, KEY_CONSUMER_TYPE);
|
||||
mBatteryLevel = getInteger(values, KEY_BATTERY_LEVEL);
|
||||
mBatteryStatus = getInteger(values, KEY_BATTERY_STATUS);
|
||||
@@ -106,7 +104,7 @@ public class BatteryHistEntry {
|
||||
mPercentOfTotal = getDouble(cursor, KEY_PERCENT_OF_TOTAL);
|
||||
mForegroundUsageTimeInMs = getLong(cursor, KEY_FOREGROUND_USAGE_TIME);
|
||||
mBackgroundUsageTimeInMs = getLong(cursor, KEY_BACKGROUND_USAGE_TIME);
|
||||
mDrainType = getInteger(cursor, KEY_DRAIN_TYPE);
|
||||
mPowerComponentId = getInteger(cursor, KEY_DRAIN_TYPE);
|
||||
mConsumerType = getInteger(cursor, KEY_CONSUMER_TYPE);
|
||||
mBatteryLevel = getInteger(cursor, KEY_BATTERY_LEVEL);
|
||||
mBatteryStatus = getInteger(cursor, KEY_BATTERY_STATUS);
|
||||
@@ -141,7 +139,7 @@ public class BatteryHistEntry {
|
||||
mKey = Long.toString(mUid);
|
||||
break;
|
||||
case ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY:
|
||||
mKey = "S|" + mDrainType;
|
||||
mKey = "S|" + mPowerComponentId;
|
||||
break;
|
||||
case ConvertUtils.CONSUMER_TYPE_USER_BATTERY:
|
||||
mKey = "U|" + mUserId;
|
||||
@@ -164,7 +162,7 @@ public class BatteryHistEntry {
|
||||
mPercentOfTotal, mTotalPower, mConsumePower,
|
||||
Duration.ofMillis(mForegroundUsageTimeInMs).getSeconds(),
|
||||
Duration.ofMillis(mBackgroundUsageTimeInMs).getSeconds()))
|
||||
.append(String.format("\n\tdrain=%d|consumer=%d", mDrainType, mConsumerType))
|
||||
.append(String.format("\n\tdrain=%d|consumer=%d", mPowerComponentId, mConsumerType))
|
||||
.append(String.format("\n\tbattery=%d|status=%d|health=%d\n}",
|
||||
mBatteryLevel, mBatteryStatus, mBatteryHealth));
|
||||
return builder.toString();
|
||||
|
Reference in New Issue
Block a user