diff options
author | 2025-02-19 18:13:46 -0800 | |
---|---|---|
committer | 2025-02-19 18:13:46 -0800 | |
commit | 4ca581ca05feb4f8aabe9739e461113490eec7b9 (patch) | |
tree | 34dbff01d28f293e35fca1c6a9185c63c7ad1c30 /services | |
parent | 1be4df1376b354024cb723de8b6bc9cb26568293 (diff) |
Fix initialization timing for CPU energy consumer config
Bug: 397780139
Flag: EXEMPT bugfix
Test: atest PowerStatsTests;atest PowerStatsTestsRavenwood
Change-Id: I5df9760211310a8f4d21b7a2938838f86fce9843
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/power/stats/processor/CpuPowerStatsProcessor.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/power/stats/processor/CpuPowerStatsProcessor.java b/services/core/java/com/android/server/power/stats/processor/CpuPowerStatsProcessor.java index 6ce2cf738192..ab2489c81449 100644 --- a/services/core/java/com/android/server/power/stats/processor/CpuPowerStatsProcessor.java +++ b/services/core/java/com/android/server/power/stats/processor/CpuPowerStatsProcessor.java @@ -119,6 +119,8 @@ class CpuPowerStatsProcessor extends PowerStatsProcessor { mTmpUidStatsArray = new long[descriptor.uidStatsArrayLength]; mWakelockDescriptor = null; + + initEnergyConsumerToPowerBracketMaps(); } /** @@ -157,9 +159,6 @@ class CpuPowerStatsProcessor extends PowerStatsProcessor { if (mPlan == null) { mPlan = new PowerEstimationPlan(stats.getConfig()); - if (mStatsLayout.getEnergyConsumerCount() != 0) { - initEnergyConsumerToPowerBracketMaps(); - } } Intermediates intermediates = new Intermediates(); @@ -255,6 +254,10 @@ class CpuPowerStatsProcessor extends PowerStatsProcessor { */ private void initEnergyConsumerToPowerBracketMaps() { int energyConsumerCount = mStatsLayout.getEnergyConsumerCount(); + if (energyConsumerCount == 0) { + return; + } + int powerBracketCount = mStatsLayout.getCpuPowerBracketCount(); mEnergyConsumerToCombinedEnergyConsumerMap = new int[energyConsumerCount]; |