Loading core/java/com/android/internal/os/PowerProfile.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -126,6 +126,11 @@ public class PowerProfile { public static final String POWER_CPU_SPEEDS = "cpu.speeds"; public static final String POWER_CPU_SPEEDS = "cpu.speeds"; /** * Battery capacity in milliAmpHour (mAh). */ public static final String POWER_BATTERY_CAPACITY = "battery.capacity"; static final HashMap<String, Object> sPowerMap = new HashMap<String, Object>(); static final HashMap<String, Object> sPowerMap = new HashMap<String, Object>(); private static final String TAG_DEVICE = "device"; private static final String TAG_DEVICE = "device"; Loading Loading @@ -243,6 +248,19 @@ public class PowerProfile { } } } } /** * Returns the battery capacity, if available, in milli Amp Hours. If not available, * it returns zero. * @return the battery capacity in mAh */ public double getBatteryCapacity() { return getAveragePower(POWER_BATTERY_CAPACITY); } /** * Returns the number of speeds that the CPU can be run at. * @return */ public int getNumSpeedSteps() { public int getNumSpeedSteps() { Object value = sPowerMap.get(POWER_CPU_SPEEDS); Object value = sPowerMap.get(POWER_CPU_SPEEDS); if (value != null && value instanceof Double[]) { if (value != null && value instanceof Double[]) { Loading core/res/res/xml/power_profile.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ --> --> <device name="Android"> <device name="Android"> <!-- All values are in mAh except as noted -> <item name="none">0</item> <item name="none">0</item> <item name="screen.on">0.1</item> <item name="screen.on">0.1</item> <item name="bluetooth.active">0.1</item> <item name="bluetooth.active">0.1</item> Loading Loading @@ -48,4 +49,6 @@ <array name="cpu.active"> <array name="cpu.active"> <value>0.2</value> <value>0.2</value> </array> </array> <!-- This is the battery capacity in mAh --> <item name="battery.capacity">1000</item> </device> </device> Loading
core/java/com/android/internal/os/PowerProfile.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -126,6 +126,11 @@ public class PowerProfile { public static final String POWER_CPU_SPEEDS = "cpu.speeds"; public static final String POWER_CPU_SPEEDS = "cpu.speeds"; /** * Battery capacity in milliAmpHour (mAh). */ public static final String POWER_BATTERY_CAPACITY = "battery.capacity"; static final HashMap<String, Object> sPowerMap = new HashMap<String, Object>(); static final HashMap<String, Object> sPowerMap = new HashMap<String, Object>(); private static final String TAG_DEVICE = "device"; private static final String TAG_DEVICE = "device"; Loading Loading @@ -243,6 +248,19 @@ public class PowerProfile { } } } } /** * Returns the battery capacity, if available, in milli Amp Hours. If not available, * it returns zero. * @return the battery capacity in mAh */ public double getBatteryCapacity() { return getAveragePower(POWER_BATTERY_CAPACITY); } /** * Returns the number of speeds that the CPU can be run at. * @return */ public int getNumSpeedSteps() { public int getNumSpeedSteps() { Object value = sPowerMap.get(POWER_CPU_SPEEDS); Object value = sPowerMap.get(POWER_CPU_SPEEDS); if (value != null && value instanceof Double[]) { if (value != null && value instanceof Double[]) { Loading
core/res/res/xml/power_profile.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ --> --> <device name="Android"> <device name="Android"> <!-- All values are in mAh except as noted -> <item name="none">0</item> <item name="none">0</item> <item name="screen.on">0.1</item> <item name="screen.on">0.1</item> <item name="bluetooth.active">0.1</item> <item name="bluetooth.active">0.1</item> Loading Loading @@ -48,4 +49,6 @@ <array name="cpu.active"> <array name="cpu.active"> <value>0.2</value> <value>0.2</value> </array> </array> <!-- This is the battery capacity in mAh --> <item name="battery.capacity">1000</item> </device> </device>