Loading core/java/com/android/internal/os/OWNERS +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ per-file BatteryUsageStats* = file:/BATTERY_STATS_OWNERS per-file *ChargeCalculator* = file:/BATTERY_STATS_OWNERS per-file *PowerCalculator* = file:/BATTERY_STATS_OWNERS per-file *PowerEstimator* = file:/BATTERY_STATS_OWNERS per-file *PowerStats* = file:/BATTERY_STATS_OWNERS per-file *Kernel* = file:/BATTERY_STATS_OWNERS per-file *MultiState* = file:/BATTERY_STATS_OWNERS per-file *PowerProfile* = file:/BATTERY_STATS_OWNERS Loading core/java/com/android/internal/os/PowerStats.java 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.os; import android.os.BatteryConsumer; import android.util.IndentingPrintWriter; import android.util.SparseArray; import java.util.Arrays; /** * Container for power stats, acquired by various PowerStatsCollector classes. See subclasses for * details. */ public final class PowerStats { /** * Power component (e.g. CPU, WIFI etc) that this snapshot relates to. */ public @BatteryConsumer.PowerComponent int powerComponentId; /** * Duration, in milliseconds, covered by this snapshot. */ public long durationMs; /** * Device-wide stats. */ public long[] stats; /** * Per-UID CPU stats. */ public final SparseArray<long[]> uidStats = new SparseArray<>(); /** * Prints the contents of the stats snapshot. */ public void dump(IndentingPrintWriter pw) { pw.print("PowerStats: "); pw.println(BatteryConsumer.powerComponentIdToString(powerComponentId)); pw.increaseIndent(); pw.print("duration", durationMs).println(); for (int i = 0; i < uidStats.size(); i++) { pw.print("UID "); pw.print(uidStats.keyAt(i)); pw.print(": "); pw.print(Arrays.toString(uidStats.valueAt(i))); pw.println(); } pw.decreaseIndent(); } } core/res/res/values/config.xml +0 −5 Original line number Diff line number Diff line Loading @@ -6624,11 +6624,6 @@ <!-- Whether to show weather on the lock screen by default. --> <bool name="config_lockscreenWeatherEnabledByDefault">false</bool> <!-- Whether to reset Battery Stats on unplug when the battery level is high. --> <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- Whether we should persist the brightness value in nits for the default display even if the underlying display device changes. --> <bool name="config_persistBrightnessNitsForDefaultDisplay">false</bool> Loading core/res/res/values/config_battery_stats.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- These resources are around just to allow their values to be customized for different hardware and product builds. Do not translate. NOTE: The naming convention is "config_camelCaseValue". --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Whether to reset Battery Stats on unplug when the battery level is high. --> <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- CPU power stats collection throttle period in milliseconds. Since power stats collection is a relatively expensive operation, this throttle period may need to be adjusted for low-power devices--> <integer name="config_defaultPowerStatsThrottlePeriodCpu">60000</integer> </resources> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -5089,6 +5089,7 @@ <java-symbol type="bool" name="config_batteryStatsResetOnUnplugHighBatteryLevel" /> <java-symbol type="bool" name="config_batteryStatsResetOnUnplugAfterSignificantCharge" /> <java-symbol type="integer" name="config_defaultPowerStatsThrottlePeriodCpu" /> <java-symbol name="materialColorOnSecondaryFixedVariant" type="attr"/> <java-symbol name="materialColorOnTertiaryFixedVariant" type="attr"/> Loading Loading
core/java/com/android/internal/os/OWNERS +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ per-file BatteryUsageStats* = file:/BATTERY_STATS_OWNERS per-file *ChargeCalculator* = file:/BATTERY_STATS_OWNERS per-file *PowerCalculator* = file:/BATTERY_STATS_OWNERS per-file *PowerEstimator* = file:/BATTERY_STATS_OWNERS per-file *PowerStats* = file:/BATTERY_STATS_OWNERS per-file *Kernel* = file:/BATTERY_STATS_OWNERS per-file *MultiState* = file:/BATTERY_STATS_OWNERS per-file *PowerProfile* = file:/BATTERY_STATS_OWNERS Loading
core/java/com/android/internal/os/PowerStats.java 0 → 100644 +67 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.os; import android.os.BatteryConsumer; import android.util.IndentingPrintWriter; import android.util.SparseArray; import java.util.Arrays; /** * Container for power stats, acquired by various PowerStatsCollector classes. See subclasses for * details. */ public final class PowerStats { /** * Power component (e.g. CPU, WIFI etc) that this snapshot relates to. */ public @BatteryConsumer.PowerComponent int powerComponentId; /** * Duration, in milliseconds, covered by this snapshot. */ public long durationMs; /** * Device-wide stats. */ public long[] stats; /** * Per-UID CPU stats. */ public final SparseArray<long[]> uidStats = new SparseArray<>(); /** * Prints the contents of the stats snapshot. */ public void dump(IndentingPrintWriter pw) { pw.print("PowerStats: "); pw.println(BatteryConsumer.powerComponentIdToString(powerComponentId)); pw.increaseIndent(); pw.print("duration", durationMs).println(); for (int i = 0; i < uidStats.size(); i++) { pw.print("UID "); pw.print(uidStats.keyAt(i)); pw.print(": "); pw.print(Arrays.toString(uidStats.valueAt(i))); pw.println(); } pw.decreaseIndent(); } }
core/res/res/values/config.xml +0 −5 Original line number Diff line number Diff line Loading @@ -6624,11 +6624,6 @@ <!-- Whether to show weather on the lock screen by default. --> <bool name="config_lockscreenWeatherEnabledByDefault">false</bool> <!-- Whether to reset Battery Stats on unplug when the battery level is high. --> <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- Whether we should persist the brightness value in nits for the default display even if the underlying display device changes. --> <bool name="config_persistBrightnessNitsForDefaultDisplay">false</bool> Loading
core/res/res/values/config_battery_stats.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2023 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- These resources are around just to allow their values to be customized for different hardware and product builds. Do not translate. NOTE: The naming convention is "config_camelCaseValue". --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Whether to reset Battery Stats on unplug when the battery level is high. --> <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- CPU power stats collection throttle period in milliseconds. Since power stats collection is a relatively expensive operation, this throttle period may need to be adjusted for low-power devices--> <integer name="config_defaultPowerStatsThrottlePeriodCpu">60000</integer> </resources>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -5089,6 +5089,7 @@ <java-symbol type="bool" name="config_batteryStatsResetOnUnplugHighBatteryLevel" /> <java-symbol type="bool" name="config_batteryStatsResetOnUnplugAfterSignificantCharge" /> <java-symbol type="integer" name="config_defaultPowerStatsThrottlePeriodCpu" /> <java-symbol name="materialColorOnSecondaryFixedVariant" type="attr"/> <java-symbol name="materialColorOnTertiaryFixedVariant" type="attr"/> Loading