Loading core/java/com/android/internal/os/BatterySipper.java +10 −9 Original line number Diff line number Diff line Loading @@ -113,19 +113,20 @@ public class BatterySipper implements Comparable<BatterySipper> { public double bluetoothPowerMah; public enum DrainType { IDLE, CELL, PHONE, WIFI, AMBIENT_DISPLAY, APP, BLUETOOTH, CAMERA, CELL, FLASHLIGHT, IDLE, MEMORY, OVERCOUNTED, PHONE, SCREEN, APP, USER, UNACCOUNTED, OVERCOUNTED, CAMERA, MEMORY USER, WIFI, } public BatterySipper(DrainType drainType, Uid uid, double value) { Loading core/java/com/android/internal/os/BatteryStatsHelper.java +31 −13 Original line number Diff line number Diff line Loading @@ -643,6 +643,21 @@ public class BatteryStatsHelper { } } /** * Ambient display power is the additional power the screen takes while in ambient display/ * screen doze/ always-on display (interchangeable terms) mode. Ambient display power should * be hidden {@link #shouldHideSipper(BatterySipper)}, but should not be included in smearing * {@link #removeHiddenBatterySippers(List)}. */ private void addAmbientDisplayUsage() { long ambientDisplayMs = mStats.getScreenDozeTime(mRawRealtimeUs, mStatsType); double power = mPowerProfile.getAveragePower(PowerProfile.POWER_AMBIENT_DISPLAY) * ambientDisplayMs / (60 * 60 * 1000); if (power > 0) { addEntry(DrainType.AMBIENT_DISPLAY, ambientDisplayMs, power); } } private void addRadioUsage() { BatterySipper radio = new BatterySipper(BatterySipper.DrainType.CELL, null, 0); mMobileRadioPowerCalculator.calculateRemaining(radio, mStats, mRawRealtimeUs, mRawUptimeUs, Loading Loading @@ -741,6 +756,7 @@ public class BatteryStatsHelper { addUserUsage(); addPhoneUsage(); addScreenUsage(); addAmbientDisplayUsage(); addWiFiUsage(); addBluetoothUsage(); addMemoryUsage(); Loading Loading @@ -841,12 +857,13 @@ public class BatteryStatsHelper { final BatterySipper sipper = sippers.get(i); sipper.shouldHide = shouldHideSipper(sipper); if (sipper.shouldHide) { if (sipper.drainType != BatterySipper.DrainType.OVERCOUNTED && sipper.drainType != BatterySipper.DrainType.SCREEN && sipper.drainType != BatterySipper.DrainType.UNACCOUNTED && sipper.drainType != BatterySipper.DrainType.BLUETOOTH && sipper.drainType != BatterySipper.DrainType.WIFI && sipper.drainType != BatterySipper.DrainType.IDLE) { if (sipper.drainType != DrainType.OVERCOUNTED && sipper.drainType != DrainType.SCREEN && sipper.drainType != DrainType.AMBIENT_DISPLAY && sipper.drainType != DrainType.UNACCOUNTED && sipper.drainType != DrainType.BLUETOOTH && sipper.drainType != DrainType.WIFI && sipper.drainType != DrainType.IDLE) { // Don't add it if it is overcounted, unaccounted or screen proportionalSmearPowerMah += sipper.totalPowerMah; } Loading Loading @@ -893,13 +910,14 @@ public class BatteryStatsHelper { * Check whether we should hide the battery sipper. */ public boolean shouldHideSipper(BatterySipper sipper) { final BatterySipper.DrainType drainType = sipper.drainType; return drainType == BatterySipper.DrainType.IDLE || drainType == BatterySipper.DrainType.CELL || drainType == BatterySipper.DrainType.SCREEN || drainType == BatterySipper.DrainType.UNACCOUNTED || drainType == BatterySipper.DrainType.OVERCOUNTED final DrainType drainType = sipper.drainType; return drainType == DrainType.IDLE || drainType == DrainType.CELL || drainType == DrainType.SCREEN || drainType == DrainType.AMBIENT_DISPLAY || drainType == DrainType.UNACCOUNTED || drainType == DrainType.OVERCOUNTED || isTypeService(sipper) || isTypeSystem(sipper); } Loading core/java/com/android/internal/os/PowerProfile.java +5 −1 Original line number Diff line number Diff line Loading @@ -136,6 +136,10 @@ public class PowerProfile { @Deprecated public static final String POWER_BLUETOOTH_AT_CMD = "bluetooth.at"; /** * Power consumption when screen is in doze/ambient/always-on mode, including backlight power. */ public static final String POWER_AMBIENT_DISPLAY = "ambient.on"; /** * Power consumption when screen is on, not including the backlight power. Loading core/res/res/xml/power_profile.xml +3 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ significantly, so should be measured on the shipping platform with a power meter. --> <item name="none">0</item> <item name="screen.on">0.1</item> <!-- ~200mA --> <item name="screen.full">0.1</item> <!-- ~300mA --> <item name="ambient.on">0.1</item> <!-- ~100mA --> <item name="screen.on">0.1</item> <!-- ~100mA --> <item name="screen.full">0.1</item> <!-- ~100mA --> <item name="bluetooth.active">0.1</item> <!-- Bluetooth data transfer, ~10mA --> <item name="bluetooth.on">0.1</item> <!-- Bluetooth on & connectable, but not connected, ~0.1mA --> <item name="wifi.on">0.1</item> <!-- ~3mA --> Loading core/res/res/xml/power_profile_test.xml +2 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,8 @@ <value>60</value> <!-- 3000 MHz CPU speed --> </array> <!-- Power used by display unit in ambient display mode, including back lighting--> <item name="ambient.on">0.5</item> <!-- Additional power used when screen is turned on at minimum brightness --> <item name="screen.on">100</item> <!-- Additional power used when screen is at maximum brightness, compared to Loading Loading
core/java/com/android/internal/os/BatterySipper.java +10 −9 Original line number Diff line number Diff line Loading @@ -113,19 +113,20 @@ public class BatterySipper implements Comparable<BatterySipper> { public double bluetoothPowerMah; public enum DrainType { IDLE, CELL, PHONE, WIFI, AMBIENT_DISPLAY, APP, BLUETOOTH, CAMERA, CELL, FLASHLIGHT, IDLE, MEMORY, OVERCOUNTED, PHONE, SCREEN, APP, USER, UNACCOUNTED, OVERCOUNTED, CAMERA, MEMORY USER, WIFI, } public BatterySipper(DrainType drainType, Uid uid, double value) { Loading
core/java/com/android/internal/os/BatteryStatsHelper.java +31 −13 Original line number Diff line number Diff line Loading @@ -643,6 +643,21 @@ public class BatteryStatsHelper { } } /** * Ambient display power is the additional power the screen takes while in ambient display/ * screen doze/ always-on display (interchangeable terms) mode. Ambient display power should * be hidden {@link #shouldHideSipper(BatterySipper)}, but should not be included in smearing * {@link #removeHiddenBatterySippers(List)}. */ private void addAmbientDisplayUsage() { long ambientDisplayMs = mStats.getScreenDozeTime(mRawRealtimeUs, mStatsType); double power = mPowerProfile.getAveragePower(PowerProfile.POWER_AMBIENT_DISPLAY) * ambientDisplayMs / (60 * 60 * 1000); if (power > 0) { addEntry(DrainType.AMBIENT_DISPLAY, ambientDisplayMs, power); } } private void addRadioUsage() { BatterySipper radio = new BatterySipper(BatterySipper.DrainType.CELL, null, 0); mMobileRadioPowerCalculator.calculateRemaining(radio, mStats, mRawRealtimeUs, mRawUptimeUs, Loading Loading @@ -741,6 +756,7 @@ public class BatteryStatsHelper { addUserUsage(); addPhoneUsage(); addScreenUsage(); addAmbientDisplayUsage(); addWiFiUsage(); addBluetoothUsage(); addMemoryUsage(); Loading Loading @@ -841,12 +857,13 @@ public class BatteryStatsHelper { final BatterySipper sipper = sippers.get(i); sipper.shouldHide = shouldHideSipper(sipper); if (sipper.shouldHide) { if (sipper.drainType != BatterySipper.DrainType.OVERCOUNTED && sipper.drainType != BatterySipper.DrainType.SCREEN && sipper.drainType != BatterySipper.DrainType.UNACCOUNTED && sipper.drainType != BatterySipper.DrainType.BLUETOOTH && sipper.drainType != BatterySipper.DrainType.WIFI && sipper.drainType != BatterySipper.DrainType.IDLE) { if (sipper.drainType != DrainType.OVERCOUNTED && sipper.drainType != DrainType.SCREEN && sipper.drainType != DrainType.AMBIENT_DISPLAY && sipper.drainType != DrainType.UNACCOUNTED && sipper.drainType != DrainType.BLUETOOTH && sipper.drainType != DrainType.WIFI && sipper.drainType != DrainType.IDLE) { // Don't add it if it is overcounted, unaccounted or screen proportionalSmearPowerMah += sipper.totalPowerMah; } Loading Loading @@ -893,13 +910,14 @@ public class BatteryStatsHelper { * Check whether we should hide the battery sipper. */ public boolean shouldHideSipper(BatterySipper sipper) { final BatterySipper.DrainType drainType = sipper.drainType; return drainType == BatterySipper.DrainType.IDLE || drainType == BatterySipper.DrainType.CELL || drainType == BatterySipper.DrainType.SCREEN || drainType == BatterySipper.DrainType.UNACCOUNTED || drainType == BatterySipper.DrainType.OVERCOUNTED final DrainType drainType = sipper.drainType; return drainType == DrainType.IDLE || drainType == DrainType.CELL || drainType == DrainType.SCREEN || drainType == DrainType.AMBIENT_DISPLAY || drainType == DrainType.UNACCOUNTED || drainType == DrainType.OVERCOUNTED || isTypeService(sipper) || isTypeSystem(sipper); } Loading
core/java/com/android/internal/os/PowerProfile.java +5 −1 Original line number Diff line number Diff line Loading @@ -136,6 +136,10 @@ public class PowerProfile { @Deprecated public static final String POWER_BLUETOOTH_AT_CMD = "bluetooth.at"; /** * Power consumption when screen is in doze/ambient/always-on mode, including backlight power. */ public static final String POWER_AMBIENT_DISPLAY = "ambient.on"; /** * Power consumption when screen is on, not including the backlight power. Loading
core/res/res/xml/power_profile.xml +3 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ significantly, so should be measured on the shipping platform with a power meter. --> <item name="none">0</item> <item name="screen.on">0.1</item> <!-- ~200mA --> <item name="screen.full">0.1</item> <!-- ~300mA --> <item name="ambient.on">0.1</item> <!-- ~100mA --> <item name="screen.on">0.1</item> <!-- ~100mA --> <item name="screen.full">0.1</item> <!-- ~100mA --> <item name="bluetooth.active">0.1</item> <!-- Bluetooth data transfer, ~10mA --> <item name="bluetooth.on">0.1</item> <!-- Bluetooth on & connectable, but not connected, ~0.1mA --> <item name="wifi.on">0.1</item> <!-- ~3mA --> Loading
core/res/res/xml/power_profile_test.xml +2 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,8 @@ <value>60</value> <!-- 3000 MHz CPU speed --> </array> <!-- Power used by display unit in ambient display mode, including back lighting--> <item name="ambient.on">0.5</item> <!-- Additional power used when screen is turned on at minimum brightness --> <item name="screen.on">100</item> <!-- Additional power used when screen is at maximum brightness, compared to Loading