Merge "[Battery usage U] For system comsumed power, use device comsumed power directly instead of removing app comsumed power from it."
This commit is contained in:
committed by
Android (Google) Code Review
commit
fe3250007b
@@ -200,16 +200,13 @@ public class BatteryEntry {
|
||||
|
||||
/** Battery entry for a power component of AggregateBatteryConsumer */
|
||||
public BatteryEntry(Context context, int powerComponentId, double devicePowerMah,
|
||||
double appsPowerMah, long usageDurationMs) {
|
||||
long usageDurationMs) {
|
||||
mContext = context;
|
||||
mBatteryConsumer = null;
|
||||
mUid = Process.INVALID_UID;
|
||||
mIsHidden = false;
|
||||
mPowerComponentId = powerComponentId;
|
||||
mConsumedPower =
|
||||
powerComponentId == BatteryConsumer.POWER_COMPONENT_SCREEN
|
||||
? devicePowerMah
|
||||
: devicePowerMah - appsPowerMah;
|
||||
mConsumedPower = devicePowerMah;
|
||||
mUsageDurationMs = usageDurationMs;
|
||||
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
|
||||
|
||||
@@ -224,7 +221,7 @@ public class BatteryEntry {
|
||||
|
||||
/** Battery entry for a custom power component of AggregateBatteryConsumer */
|
||||
public BatteryEntry(Context context, int powerComponentId, String powerComponentName,
|
||||
double devicePowerMah, double appsPowerMah) {
|
||||
double devicePowerMah) {
|
||||
mContext = context;
|
||||
mBatteryConsumer = null;
|
||||
mUid = Process.INVALID_UID;
|
||||
@@ -234,10 +231,7 @@ public class BatteryEntry {
|
||||
mIconId = R.drawable.ic_power_system;
|
||||
mIcon = context.getDrawable(mIconId);
|
||||
mName = powerComponentName;
|
||||
mConsumedPower =
|
||||
powerComponentId == BatteryConsumer.POWER_COMPONENT_SCREEN
|
||||
? devicePowerMah
|
||||
: devicePowerMah - appsPowerMah;
|
||||
mConsumedPower = devicePowerMah;
|
||||
mConsumerType = ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY;
|
||||
}
|
||||
|
||||
|
@@ -1243,14 +1243,11 @@ public final class DataProcessor {
|
||||
|
||||
final BatteryConsumer deviceConsumer = batteryUsageStats.getAggregateBatteryConsumer(
|
||||
BatteryUsageStats.AGGREGATE_BATTERY_CONSUMER_SCOPE_DEVICE);
|
||||
final BatteryConsumer appsConsumer = batteryUsageStats.getAggregateBatteryConsumer(
|
||||
BatteryUsageStats.AGGREGATE_BATTERY_CONSUMER_SCOPE_ALL_APPS);
|
||||
|
||||
for (int componentId = 0; componentId < BatteryConsumer.POWER_COMPONENT_COUNT;
|
||||
componentId++) {
|
||||
results.add(new BatteryEntry(context, componentId,
|
||||
deviceConsumer.getConsumedPower(componentId),
|
||||
appsConsumer.getConsumedPower(componentId),
|
||||
deviceConsumer.getUsageDurationMillis(componentId)));
|
||||
}
|
||||
|
||||
@@ -1260,8 +1257,7 @@ public final class DataProcessor {
|
||||
componentId++) {
|
||||
results.add(new BatteryEntry(context, componentId,
|
||||
deviceConsumer.getCustomPowerComponentName(componentId),
|
||||
deviceConsumer.getConsumedPowerForCustomComponent(componentId),
|
||||
appsConsumer.getConsumedPowerForCustomComponent(componentId)));
|
||||
deviceConsumer.getConsumedPowerForCustomComponent(componentId)));
|
||||
}
|
||||
|
||||
final List<UserBatteryConsumer> userBatteryConsumers =
|
||||
|
Reference in New Issue
Block a user