Loading core/java/android/os/BatteryUsageStats.java +10 −0 Original line number Diff line number Diff line Loading @@ -869,6 +869,16 @@ public final class BatteryUsageStats implements Parcelable, Closeable { return mIncludesProcessStateData; } /** * Returns true if this Builder is configured to hold data for the specified * custom power component ID. */ public boolean isSupportedCustomPowerComponent(int componentId) { return componentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID && componentId < BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID + mBatteryConsumerDataLayout.customPowerComponentCount; } /** * Constructs a read-only object using the Builder values. */ Loading services/core/java/com/android/server/power/stats/PowerStatsExporter.java +5 −2 Original line number Diff line number Diff line Loading @@ -154,8 +154,11 @@ public class PowerStatsExporter { batteryUsageStatsBuilder.getAggregateBatteryConsumerBuilder( BatteryUsageStats.AGGREGATE_BATTERY_CONSUMER_SCOPE_DEVICE); if (descriptor.powerComponentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID) { if (batteryUsageStatsBuilder.isSupportedCustomPowerComponent( descriptor.powerComponentId)) { deviceScope.addConsumedPowerForCustomComponent(descriptor.powerComponentId, totalPower[0]); } } else { deviceScope.addConsumedPower(descriptor.powerComponentId, totalPower[0], BatteryConsumer.POWER_MODEL_UNDEFINED); Loading Loading
core/java/android/os/BatteryUsageStats.java +10 −0 Original line number Diff line number Diff line Loading @@ -869,6 +869,16 @@ public final class BatteryUsageStats implements Parcelable, Closeable { return mIncludesProcessStateData; } /** * Returns true if this Builder is configured to hold data for the specified * custom power component ID. */ public boolean isSupportedCustomPowerComponent(int componentId) { return componentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID && componentId < BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID + mBatteryConsumerDataLayout.customPowerComponentCount; } /** * Constructs a read-only object using the Builder values. */ Loading
services/core/java/com/android/server/power/stats/PowerStatsExporter.java +5 −2 Original line number Diff line number Diff line Loading @@ -154,8 +154,11 @@ public class PowerStatsExporter { batteryUsageStatsBuilder.getAggregateBatteryConsumerBuilder( BatteryUsageStats.AGGREGATE_BATTERY_CONSUMER_SCOPE_DEVICE); if (descriptor.powerComponentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID) { if (batteryUsageStatsBuilder.isSupportedCustomPowerComponent( descriptor.powerComponentId)) { deviceScope.addConsumedPowerForCustomComponent(descriptor.powerComponentId, totalPower[0]); } } else { deviceScope.addConsumedPower(descriptor.powerComponentId, totalPower[0], BatteryConsumer.POWER_MODEL_UNDEFINED); Loading