From 169741b70880607701d704262dd9b386fcfd083d Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 27 May 2010 10:37:54 -0700 Subject: [PATCH] DO NOT MERGE: Add a battery capacity value to the power profile. Can be accessed through PowerProfile.getBatteryCapacity() Individual device profiles need to be updated with their capacities. (merged from master) Change-Id: Ie76ab6de47c44807a46934331665e077a7226566 --- .../com/android/internal/os/PowerProfile.java | 18 ++++++++++++++++++ core/res/res/xml/power_profile.xml | 3 +++ 2 files changed, 21 insertions(+) diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java index 2369d25bd4728..127ed68dff98a 100644 --- a/core/java/com/android/internal/os/PowerProfile.java +++ b/core/java/com/android/internal/os/PowerProfile.java @@ -126,6 +126,11 @@ public class PowerProfile { 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 sPowerMap = new HashMap(); private static final String TAG_DEVICE = "device"; @@ -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() { Object value = sPowerMap.get(POWER_CPU_SPEEDS); if (value != null && value instanceof Double[]) { diff --git a/core/res/res/xml/power_profile.xml b/core/res/res/xml/power_profile.xml index ce623e8d4d359..30312b3694991 100644 --- a/core/res/res/xml/power_profile.xml +++ b/core/res/res/xml/power_profile.xml @@ -18,6 +18,7 @@ --> + 0 0.1 0.1 @@ -48,4 +49,6 @@ 0.2 + + 1000