Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2871239 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Ignore attribution data for unsupported custom power components

Bug: 354482725
Test: atest PowerStatsTests
Flag: com.android.server.power.optimization.streamlined_misc_battery_stats
Change-Id: I45cd47fa280f154568a8a7e71c1a3d3e42e255bb
parent 04606353
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -307,7 +307,10 @@ public class PowerStatsExporter {
                }
            }
            if (powerComponentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID) {
                builder.addConsumedPowerForCustomComponent(powerComponentId, powerAllProcStates);
                if (batteryUsageStatsBuilder.isSupportedCustomPowerComponent(powerComponentId)) {
                    builder.addConsumedPowerForCustomComponent(powerComponentId,
                            powerAllProcStates);
                }
            } else {
                builder.addConsumedPower(powerComponentId, powerAllProcStates,
                        BatteryConsumer.POWER_MODEL_UNDEFINED);
@@ -319,7 +322,9 @@ public class PowerStatsExporter {
                batteryUsageStatsBuilder.getAggregateBatteryConsumerBuilder(
                        BatteryUsageStats.AGGREGATE_BATTERY_CONSUMER_SCOPE_ALL_APPS);
        if (powerComponentId >= BatteryConsumer.FIRST_CUSTOM_POWER_COMPONENT_ID) {
            if (batteryUsageStatsBuilder.isSupportedCustomPowerComponent(powerComponentId)) {
                allAppsScope.addConsumedPowerForCustomComponent(powerComponentId, powerAllApps);
            }
        } else {
            BatteryConsumer.Key key = allAppsScope.getKey(powerComponentId,
                    BatteryConsumer.PROCESS_STATE_ANY, screenState, powerState);