1page.title=Power Profiles for Android
2@jd:body
3
4<!--
5    Copyright 2015 The Android Open Source Project
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18-->
19<div id="qv-wrapper">
20  <div id="qv">
21    <h2>In this document</h2>
22    <ol id="auto-toc"></ol>
23  </div>
24</div>
25
26<p>Battery usage information is derived from battery usage statistics and power profile values.</p>
27
28<h2 id="usage-statistics">Battery Usage Statistics</h2>
29
30<p>The framework automatically determines battery usage statistics by tracking how long device
31components spend in different states. As components (Wi-Fi chipset, cellular radio, Bluetooth, GPS,
32display, CPU) change states (OFF/ON, idle/full power, low/high brightness, etc.), the controlling
33service reports to the framework BatteryStats service. BatteryStats collects information over time and
34stores it for use across reboots. The service doesn’t track battery current draw directly,
35but instead collects timing information that can be used to approximate battery
36consumption by different components.</p>
37
38<p>The framework gathers statistics using the following methods:</p>
39
40<ul>
41<li><strong>Push</strong>. Services aware of component changes push state changes to the
42BatteryStats service.</li>
43<li><strong>Pull</strong>. For components such as the CPU usage by apps, the framework automatically
44pulls the data at transition points (such as starting or stopping an activity) to take a
45snapshot.</li>
46</ul>
47
48<p>Resource consumption is associated with the application using the resource. When multiple
49applications simultaneously use a resource (such as wakelocks that prevent the system from
50suspending), the framework spreads consumption across those applications, although not necessarily
51equally.</p>
52
53<p>To avoid losing usage statistics for a shutdown event, which may indicate battery power
54consumption problems (i.e. shutdown occurs because the battery reached zero remaining capacity), the
55framework flashes statistics approximately every 30 minutes.</p>
56
57<p>Battery usage statistics are handled entirely by the framework and do not require OEM
58modifications.</p>
59
60<h2 id="profile-values">Power Profile Values</h2>
61
62<p class="caution"><strong>Caution:</strong> Device manufacturers must
63provide a component power profile that defines the current consumption value
64for the component and the approximate battery drain caused by the component
65over time. This profile is defined in <a
66href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/power_profile.xml">platform/frameworks/base/core/res/res/xml/power_profile.xml</a>.
67See the <a href="#power-values">Power Values</a> table for guidance on these
68settings.</p>
69
70<p>Within a power profile, power consumption is specified in milliamps (mA) of
71current draw at a nominal voltage and can be a fractional value specified in microamps (uA). The
72value should be the mA consumed at the battery and not a value applicable to a power rail that does
73not correspond to current consumed from the battery.</p>
74
75<p>For example, a display power profile specifies the mA of current required to keep the display on
76at minimum brightness and at maximum brightness. To determine the power cost (i.e the battery
77drained by the display component) of keeping the display on, the framework tracks the time spent at
78each brightness level, then multiplies those time intervals by an interpolated display brightness
79cost.</p>
80
81<p>The framework also multiplies the CPU time for each application by the mA required to run the CPU
82at a specific speed. This calculation establishes a comparative ranking of how much battery an
83application consumes by executing CPU code (time as the foreground app and total time including
84background activity are reported separately).</p>
85
86<h2 id="component-power">Measuring Component Power</h2>
87
88<p>You can determine individual component power consumption by comparing the current drawn by the
89device when the component is in the desired state (on, active, scanning, etc.) and when the
90component is off. Measure the average instantaneous current drawn on the device at a
91nominal voltage using an external power monitor, such as a bench power supply or specialized
92battery-monitoring tools (such as Monsoon Solution Inc. Power Monitor and Power Tool software).</p>
93
94<p class="note">
95<strong>Note:</strong> Manufacturers often supply information about the current consumed by an
96individual component. Use this information if it accurately represents the current drawn from the
97device battery in practice. However, validate manufacturer-provided values before
98using those values in your device power profile.</p>
99
100<p>When measuring, ensure the device does not have a connection to an external charge source, such
101as a USB connection to a development host used when running Android Debug Bridge (adb). The device
102under test might draw current from the host, thus lowering measurements at the battery. Avoid USB
103On-The-Go (OTG) connections, as the OTG device might draw current from the device under test.</p>
104
105<p>Excluding the component being measured, the system should run at a constant level of power
106consumption to avoid inaccurate measurements caused by changes in other components. System
107activities that can introduce unwanted changes to power measurements include:</p>
108
109<ul>
110<li><strong>Cellular, Wi-Fi, and Bluetooth receive, transmit, or scanning activity</strong>. When
111not measuring cell radio power, set the device to airplane mode and enable Wi-Fi or Bluetooth as
112appropriate.</li>
113<li><strong>Screen on/off</strong>. Colors displayed while the screen is on can affect power draw on
114some screen technologies. Turn the screen off when measuring values for non-screen components.</li>
115<li><strong>System suspend/resume</strong>. A screen off state can trigger a system suspension,
116placing parts of the device in a low-power or off state. This can affect power consumption of the
117component being measured and introduce large variances in power readings as the system periodically
118resumes to send alarms, etc. For details, see <a href="#control-suspend">Controlling System
119Suspend</a>.</li>
120<li><strong>CPUs changing speed and entering/exiting low-power scheduler idle state</strong>. During
121normal operation, the system makes frequent adjustments to CPU speeds, the number of online CPU
122cores, and other system core states such as memory bus speed and voltages of power rails associated
123with CPUs and memory. During testing, these adjustments affect power measurements:
124
125<ul>
126<li>CPU speed scaling operations can reduce the amount of clock and voltage scaling of memory buses
127and other system core components.</li>
128<li>Scheduling activity can affect the percentage of the time CPUs spend in low-power idle states.
129For details on preventing these adjustments from occurring during testing, see
130<a href="#control-cpu">Controlling CPU Speeds</a>.</li>
131</ul>
132
133</li>
134</ul>
135
136<p>For example, Joe Droid wants to compute the <code>screen.on</code> value for a device. He enables
137airplane mode on the device, runs the device at a stable current state, holds the CPU speed constant
138, and uses a partial wakelock to prevent system suspend. Joe then turns the device screen off and
139takes a measurement (200mA). Next, Joe turns the device screen on at minimum brightness and takes
140another measurement (300mA). The <code>screen.on</code> value is 100mA (300 - 200).</p>
141
142<p>For components that don’t have a flat waveform of current consumption when active (such as
143cellular radio or Wi-Fi), measure the average current over time using a power monitoring tool.</p>
144
145<p>When using an external power source in place of the device battery, the system might experience
146problems due to an unconnected battery thermistor or integrated fuel gauge pins (i.e. an invalid
147reading for battery temperature or remaining battery capacity could shut down the kernel or Android
148system). Fake batteries can provide signals on thermistor or fuel gauge pins that mimic temperature
149and state of charge readings for a normal system, and may also provide convenient leads for
150connecting to external power supplies. Alternatively, you can modify the system to ignore the
151invalid data from the missing battery.</p>
152
153<h3 id="control-suspend">Controlling System Suspend</h3>
154
155<p>This section describes how to avoid system suspend state when you don’t want it to interfere with
156other measurements, and how to measure the power draw of system suspend state when you do want to
157measure it.</p>
158
159<h4>Preventing System Suspend</h4>
160
161<p>System suspend can introduce unwanted variance in power measurements and place system components
162in low-power states inappropriate for measuring active power use. To prevent the system from
163suspending while the screen is off, use a temporary partial wakelock. Using a USB cable, connect the
164device to a development host, then issue the following command:</p>
165
166<pre>
167$ adb shell "echo temporary &gt; /sys/power/wake_lock"
168</pre>
169
170<p>While in wake_lock, the screen off state does not trigger a system suspend. (Remember to
171disconnect the USB cable from the device before measuring power consumption.)</p>
172
173<p>To remove the wakelock:</p>
174
175<pre>
176$ adb shell "echo temporary &gt; /sys/power/wake_unlock"
177</pre>
178
179<h4>Measuring System Suspend</h4>
180
181<p>To measure the power draw during the system suspend state, measure the value of cpu.idle in the
182power profile. Before measuring:
183
184<ul>
185<li>Remove existing wakelocks (as described above).</li>
186<li>Place the device in airplane mode to avoid concurrent activity by the cellular radio, which
187might run on a processor separate from the SoC portions controlled by the system suspend.</li>
188<li>Ensure the system is in suspend state by:
189<ul>
190<li>Confirming current readings settle to a steady value. Readings should be within the expected
191range for the power consumption of the SoC suspend state plus the power consumption of system
192components that remain powered (such as the USB PHY).</li>
193<li>Checking the system console output.</li>
194<li>Watching for external indications of system status (such as an LED turning off when not in
195suspend).</li>
196</ul>
197</li>
198</ul>
199
200<h3 id="control-cpu">Controlling CPU Speeds</h3>
201
202<p>Active CPUs can be brought online or put offline, have their clock speeds and associated voltages
203changed (possibly also affecting memory bus speeds and other system core power states), and
204can enter lower power idle states while in the kernel idle loop. When measuring different CPU power
205states for the power profile, avoid the power draw variance when measuring other parameters. The
206power profile assumes all CPUs have the same available speeds and power characteristics.</p>
207
208<p>While measuring CPU power, or while holding CPU power constant to make other measurements, keep
209the number of CPUs brought online constant (such as having one CPU online and the rest
210offline/hotplugged out). Keeping all CPUs except one in scheduling idle may product acceptable
211results. Stopping the Android framework with <code>adb shell stop</code> can reduce system
212scheduling activity.</p>
213
214<p>You must specify the available CPU speeds for your device in the power profile cpu.speeds
215entry. To get a list of available CPU speeds, run:</p>
216
217<pre>
218adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
219</pre>
220
221<p>These speeds match the corresponding power measurements in value <code>cpu.active</code>.</p>
222
223<p>For platforms where number of cores brought online significantly affects power consumption, you
224might need to modify the cpufreq driver or governor for the platform. Most platforms support
225controlling CPU speed using the “userspace” cpufreq governor and using sysfs interfaces to
226set the speed. For example, to set speed for 200MHz on a system with only 1 CPU or all CPUs sharing
227a common cpufreq policy, use the system console or adb shell to run the following commands:</p>
228
229<pre>
230echo userspace &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
231echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
232echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
233echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
234cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
235</pre>
236
237<p class="note">
238<strong>Note</strong>: The exact commands differ depending on the platform cpufreq implementation.
239</p>
240
241<p>These commands ensure the new speed is not outside the allowed bounds, set the new speed, then
242print the speed at which the CPU is actually running (for verification). If the current
243minimum speed prior to execution is higher than 200000, you might need to reverse the order
244of the first two lines, or execute the first line again to drop the minimum speed prior to
245setting the maximum speed.</p>
246
247<p>To measure current consumed by a CPU running at various speeds, use the system console place the
248CPU in a CPU-bound loop using the command:</p>
249<pre>
250# while true; do true; done
251</pre>
252
253<p>Take the measurement while the loop executes.</p>
254
255<p>Some devices can limit maximum CPU speed while performing thermal throttling due to a high
256temperature measurement (i.e. after running CPUs at high speeds for sustained periods). Watch for
257such limiting, either using the system console output when taking measurements or by checking the
258kernel log after measuring.</p>
259
260<p>For the <code>cpu.awake</code> value, measure the power consumed when the system is not in
261suspend and not executing tasks. The CPU should be in a low-power scheduler <em>idle loop
262</em>, possibly executing an ARM Wait For Event instruction or in an SoC-specific low-power state
263with a fast-exit latency suitable for idle use.</p>
264
265<p>For the <code>cpu.active</code> value, power needs to be measured when the
266system is not in suspend mode and not executing tasks. One of the CPU (usually
267the primary CPU) should be running the task, and all the other CPUs should be in
268an idle state.</p>
269
270<h3 id="screen-power">Measuring Screen Power</h3>
271
272<p>When measuring screen on power, ensure that other devices normally turned on when the screen is
273enabled are also on. For example, if the touchscreen and display backlight would normally be on when
274the screen is on, ensure these devices are on when you measure to get a realistic example of screen
275on power usage.</p>
276
277<p>Some display technologies vary in power consumption according to the colors displayed, causing
278power measurements to vary considerably depending on what is displayed on the screen at the time of
279measurement. When measuring, ensure the screen is displaying something that has power
280characteristics of a realistic screen. Aim between the extremes of an all-black screen (which
281consumes the lowest power for some technologies) and an all-white screen. A common choice is a view
282of a schedule in the calendar app, which has a mix of white background and non-white elements.</p>
283
284<p>Measure screen on power at <em>minimum</em> and <em>maximum</em> display/backlight brightness.
285To set minimum brightness:</p>
286
287<ul>
288<li><strong>Use the Android UI</strong> (not recommended). Set the Settings > Display Brightness
289slider to the minimum display brightness. However, the Android UI allows setting brightness only to
290a minimum of 10-20% of the possible panel/backlight brightness, and does not allow setting
291brightness so low that the screen might not be visible without great effort.</li>
292<li><strong>Use a sysfs file</strong> (recommended). If available, use a sysfs file to control panel
293brightness all the way down to the minimum brightness supported by the hardware.</li>
294</ul>
295
296<p>Additionally, if the platform sysfs file enables turning the LCD panel, backlight, and
297touchscreen on and off, use the file to take measurements with the screen on and off. Otherwise,
298set a partial wakelock so the system does not suspend, then turn on and off the
299screen with the power button.</p>
300
301<h3 id="wifi-power">Measuring Wi-Fi Power</h3>
302
303<p>Perform Wi-Fi measurements on a relatively quiet network. Avoid introducing additional work
304processing high volumes of broadcast traffic that is unrelated to the activity being measured.</p>
305
306<p>The <code>wifi.on</code> value measures the power consumed when Wi-Fi is enabled but not actively
307transmitting or receiving. This is often measured as the delta between the current draw in
308system suspend (sleep) state with Wi-Fi enabled vs. disabled.</p>
309
310<p>The <code>wifi.scan</code> value measures the power consumed during a Wi-Fi scan for access
311points. Applications can trigger Wi-Fi scans using the WifiManager class
312<a href ="http://developer.android.com/reference/android/net/wifi/WifiManager.html">
313<code>startScan()</code>API</a>. You can also open Settings &gt; Wi-Fi, which performs access point
314scans every few seconds with an apparent jump in power consumption, but you must subtract screen
315power from these measurements.</p>
316
317<p class="note">
318<strong>Note</strong>: Use a controlled setup (such as
319<a href="http://en.wikipedia.org/wiki/Iperf">iperf</a>) to generate network receive and transmit
320traffic.</p>
321
322<h2 id="device-power">Measuring Device Power</h2>
323
324<p>You can determine device power consumption for Android devices that include a battery fuel gauge
325such as a Summit SMB347 or Maxim MAX17050 (available on many Nexus devices). Use the in-system
326battery fuel gauge when external measurement equipment is not available or is inconvenient to
327connect to a device (such as in mobile usage).</p>
328
329<p>Measurements can include instantaneous current, remaining charge, battery capacity at test start
330and end, and more depending on the supported properties of the device (see below). For best results,
331perform device power measurements during long-running A/B tests that use the same device type with
332the same fuel gauge and same current sense resistor. Ensure the starting battery charge is the same
333for each device to avoid differing fuel gauge behavior at different points in the battery discharge
334curve.</p>
335
336<p>Even with identical test environments, measurements are not guaranteed to be of high absolute
337accuracy. However, most inaccuracies specific to the fuel gauge and sense resistor are consistent
338between test runs, making comparisons between identical devices useful. We recommend running
339multiple tests in different configurations to identify significant differences and relative power
340consumption between configurations.</p>
341
342<h3 id="power-consumption">Reading Power Consumption</h3>
343
344<p>To read power consumption data, insert calls to the API in your testing code.</p>
345
346<pre>
347import android.os.BatteryManager;
348import android.os.ServiceManager;
349import android.content.Context;
350BatteryManager mBatteryManager =
351(BatteryManager)Context.getSystemService(Context.BATTERY_SERVICE);
352Long energy =
353mBatteryManager.getLongProperty(BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER);
354Slog.i(TAG, "Remaining energy = " + energy + "nWh");
355</pre>
356
357<h3 id="avail-props">Available Properties</h3>
358
359<p>Android supports the following battery fuel gauge properties:</p>
360
361<pre>
362BATTERY_PROPERTY_CHARGE_COUNTER   Remaining battery capacity in microampere-hours
363BATTERY_PROPERTY_CURRENT_NOW      Instantaneous battery current in microamperes
364BATTERY_PROPERTY_CURRENT_AVERAGE  Average battery current in microamperes
365BATTERY_PROPERTY_CAPACITY         Remaining battery capacity as an integer percentage
366BATTERY_PROPERTY_ENERGY_COUNTER   Remaining energy in nanowatt-hours
367</pre>
368
369<p>Most properties are read from kernel power_supply subsystem attributes of similar names.
370However, the exact properties, resolution of property values, and update frequency
371available for a specific device depend on:</p>
372
373<ul>
374<li>Fuel gauge hardware, such as a Summit SMB347 or Maxim MAX17050.</li>
375<li>Fuel gauge-to-system connection, such as the value of external current sense resistors.</li>
376<li>Fuel gauge chip software configuration, such as values chosen for average current computation
377intervals in the kernel driver.</li>
378</ul>
379
380<p>For details, see the properties available for <a href="#nexus-devices">Nexus devices</a>.</p>
381
382<h3 id="maxim-fuel">Maxim Fuel Gauge</h3>
383
384<p>When determining battery state-of-charge over a long period of time, the Maxim fuel gauge
385(MAX17050, BC15) corrects for coulomb-counter offset measurements. For measurements made over a
386short period of time (such as power consumption metering tests), the fuel gauge does not make
387corrections, making the offset the primary source of error when current measurements are too small
388(although no amount of time can eliminate the offset error completely).</p>
389
390<p>For a typical 10mOhm sense resistor design, the offset current should be better than 1.5mA,
391meaning any measurement is +/-1.5mA (PCBoard layout can also affect this variation). For example,
392when measuring a large current (200mA) you can expect the following:</p>
393
394<ul>
395<li>2mA (1% gain error of 200mA due to fuel gauge gain error)</li>
396<li>+2mA (1% gain error of 200mA due to sense resistor error)</li>
397<li>+1.5mA  (current sense offset error from fuel gauge)</li>
398</ul>
399
400<p>The total error is 5.5mA (2.75%). Compare this to a medium current (50mA) where the same error
401percentages give a total error of 7% or to a small current (15mA) where +/-1.5mA gives a total error
402of 10%.</p>
403
404<p>For best results, we recommend measuring greater than 20mA. Gain measurement errors are
405systematic and repeatable, enabling you to test a device in multiple modes and get clean relative
406measurements (with exceptions for the 1.5mA offset).</p>
407
408<p>For +/-100uA relative measurements, required measurement time depends on:</p>
409
410<ul>
411<li><b>ADC sampling noise</b>. The MAX17050 with its normal factory configuration produces +/-1.5mA
412sample-to-sample variation due to noise, with each sample delivered at 175.8ms. You can expect a
413rough +/-100uA for a 1 minute test window and a clean  3-sigma noise less than 100uA (or 1-sigma
414noise at 33uA) for a 6 minute test window.</li>
415<li><b>Sample Aliasing because of load variation</b>. Variation exaggerates errors, so for samples
416with variation inherent in the loading, consider using a longer test window.</li>
417</ul>
418
419<h3 id="nexus-devices">Supported Nexus Devices</h3>
420
421<h5 id="nexus-5">Nexus 5</h5>
422
423<table>
424<tbody>
425<tr>
426<th>Model</th>
427<td>Nexus 5</td>
428</tr>
429<tr>
430<th>Fuel Gauge</th>
431<td>Maxim MAX17048 fuel gauge (ModelGauge™, no coulomb counter)</td>
432</tr>
433<tr>
434<th>Properties</th>
435<td>BATTERY_PROPERTY_CAPACITY</td>
436</tr>
437<tr>
438<th>Measurements</th>
439<td>The fuel gauge does not support any measurements other than battery State Of Charge to a
440resolution of %/256 (1/256th of a percent of full battery capacity).</td>
441</tr>
442</tbody>
443</table>
444
445
446<h5 id="nexus-6">Nexus 6</h5>
447
448<table>
449<tbody>
450<tr>
451<th>Model</th>
452<td>Nexus 6</td>
453</tr>
454<tr>
455<th>Fuel Gauge</th>
456<td>Maxim MAX17050 fuel gauge (a coulomb counter with Maxim ModelGauge™ adjustments), and a 10mohm
457current sense resistor.</td>
458</tr>
459<tr>
460<th>Properties</th>
461<td>BATTERY_PROPERTY_CAPACITY<br>
462BATTERY_PROPERTY_CURRENT_NOW<br>
463BATTERY_PROPERTY_CURRENT_AVERAGE<br>
464BATTERY_PROPERTY_CHARGE_COUNTER<br>
465BATTERY_PROPERTY_ENERGY_COUNTER</td>
466</tr>
467<tr>
468<th>Measurements</th>
469<td>CURRENT_NOW resolution 156.25uA, update period is 175.8ms.<br>
470CURRENT_AVERAGE resolution 156.25uA, update period configurable 0.7s - 6.4h, default 11.25 secs.<br>
471CHARGE_COUNTER (accumulated current, non-extended precision) resolution is 500uAh (raw coulomb
472counter read, not adjusted by fuel gauge for coulomb counter offset, plus inputs from the ModelGauge
473m3 algorithm including empty compensation).<br>
474CHARGE_COUNTER_EXT (extended precision in kernel) resolution 8nAh.<br>
475ENERGY_COUNTER is CHARGE_COUNTER_EXT at nominal voltage of 3.7V.</td>
476</tr>
477</tbody>
478</table>
479
480
481<h5 id="nexus-9">Nexus 9</h5>
482
483<table>
484<tbody>
485<tr>
486<th>Model</th>
487<td>Nexus 9</td>
488</tr>
489<tr>
490<th>Fuel Gauge</th>
491<td>Maxim MAX17050 fuel gauge (a coulomb counter with Maxim ModelGauge™ adjustments), and a 10mohm
492current sense resistor.</td>
493</tr>
494<tr>
495<th>Properties</th>
496<td>BATTERY_PROPERTY_CAPACITY<br>
497BATTERY_PROPERTY_CURRENT_NOW<br>
498BATTERY_PROPERTY_CURRENT_AVERAGE<br>
499BATTERY_PROPERTY_CHARGE_COUNTER<br>
500BATTERY_PROPERTY_ENERGY_COUNTER</td>
501</tr>
502<tr>
503<th>Measurements</th>
504<td>CURRENT_NOW resolution 156.25uA, update period is 175.8ms.<br>
505CURRENT_AVERAGE resolution 156.25uA, update period configurable 0.7s - 6.4h, default 11.25 secs.<br>
506CHARGE_COUNTER (accumulated current, non-extended precision) resolution is 500uAh.<br>
507CHARGE_COUNTER_EXT (extended precision in kernel) resolution 8nAh.<br>
508ENERGY_COUNTER is CHARGE_COUNTER_EXT at nominal voltage of 3.7V.<br>
509Accumulated current update period 175.8ms.<br>
510ADC sampled at 175ms quantization with a 4ms sample period. Can adjust duty cycle.</td>
511</tr>
512</tbody>
513</table>
514
515
516<h5 id="nexus-10">Nexus 10</h5>
517
518<table>
519<tbody>
520<tr>
521<th>Model</th>
522<td>Nexus 10</td>
523</tr>
524<tr>
525<th>Fuel Gauge</th>
526<td>Dallas Semiconductor DS2784 fuel gauge (a coulomb counter), with a 10mohm current sense
527resistor.</td>
528</tr>
529<tr>
530<th>Properties</th>
531<td>BATTERY_PROPERTY_CAPACITY<br>
532BATTERY_PROPERTY_CURRENT_NOW<br>
533BATTERY_PROPERTY_CURRENT_AVERAGE<br>
534BATTERY_PROPERTY_CHARGE_COUNTER<br>
535BATTERY_PROPERTY_ENERGY_COUNTER</td>
536</tr>
537<tr>
538<th>Measurements</th>
539<td>Current measurement (instantaneous and average) resolution is 156.3uA.<br>
540CURRENT_NOW instantaneous current update period is 3.5 seconds.<br>
541CURRENT_AVERAGE update period is 28 seconds (not configurable).<br>
542CHARGE_COUNTER (accumulated current, non-extended precision) resolution is 625uAh.<br>
543CHARGE_COUNTER_EXT (extended precision in kernel) resolution is 144nAh.<br>
544ENERGY_COUNTER is CHARGE_COUNTER_EXT at nominal voltage of 3.7V.<br>
545Update period for all is 3.5 seconds.</td>
546</tr>
547</tbody>
548</table>
549
550
551<h2 id="viewing-usage">Viewing Battery Usage Data</h2>
552
553See <a href="{@docRoot}devices/tech/power/batterystats.html">Viewing Battery Usage Data</a>.
554
555<h2 id="power-values">Power Values</h2>
556
557<p>Device manufacturers must provide a component power profile defined in
558<em>&lt;device&gt;</em>/frameworks/base/core/res/res/xml/power_profile.xml. To
559determine these values, use hardware that measures the power being used by
560the device and perform the various operations for which information is needed.
561Measure the power use during those operations and compute the values (deriving
562differences from other base-line power uses as appropriate).</p>
563
564<table>
565<tr>
566  <th>Name</th>
567  <th>Description</th>
568  <th>Example Value</th>
569  <th>Notes</th>
570</tr>
571<tr>
572  <td>none</td>
573  <td>Nothing</td>
574  <td>0</td>
575  <td></td>
576</tr>
577
578<tr>
579  <td>screen.on</td>
580  <td>Additional power used when screen is turned on at minimum brightness.</td>
581  <td>200mA</td>
582  <td>Includes touch controller and display backlight. At 0 brightness, not the Android minimum which tends to be 10 or 20%.</td>
583</tr>
584
585<tr>
586  <td>screen.full</td>
587  <td>Additional power used when screen is at maximum brightness, compared to screen at minimum brightness.</td>
588  <td>100mA-300mA</td>
589  <td>A fraction of this value (based on screen brightness) is added to the screen.on value to compute the power usage of the screen.</td>
590</tr>
591
592<tr>
593  <td>bluetooth.active</td>
594  <td>Additional power used when playing audio through bluetooth A2DP.</td>
595  <td>14mA</td>
596  <td></td>
597</tr>
598
599<tr>
600  <td>bluetooth.on</td>
601  <td>Additional power used when bluetooth is turned on but idle.</td>
602  <td>1.4mA</td>
603  <td></td>
604</tr>
605
606<tr>
607  <td>wifi.on</td>
608  <td>Additional power used when Wi-Fi is turned on but not receiving, transmitting, or scanning.</td>
609  <td>2mA</td>
610  <td></td>
611</tr>
612
613<tr>
614  <td>wifi.active</td>
615  <td>Additional power used when transmitting or receiving over Wi-Fi.</td>
616  <td>31mA</td>
617  <td></td>
618</tr>
619
620<tr>
621  <td>wifi.scan</td>
622  <td>Additional power used when Wi-Fi is scanning for access points.</td>
623  <td>100mA</td>
624  <td></td>
625</tr>
626
627<tr>
628  <td>dsp.audio</td>
629  <td>Additional power used when audio decoding/encoding via DSP.</td>
630  <td>14.1mA</td>
631  <td>Reserved for future use.</td>
632</tr>
633
634
635<tr>
636  <td>dsp.video</td>
637  <td>Additional power used when video decoding via DSP.</td>
638  <td>54mA</td>
639  <td>Reserved for future use.</td>
640</tr>
641
642<tr>
643  <td>gps.on</td>
644  <td>Additional power used when GPS is acquiring a signal.</td>
645  <td>50mA</td>
646  <td></td>
647</tr>
648
649<tr>
650  <td>radio.active</td>
651  <td>Additional power used when cellular radio is transmitting/receiving.</td>
652  <td>100mA-300mA</td>
653  <td></td>
654</tr>
655
656<tr>
657  <td>radio.scanning</td>
658  <td>Additional power used when cellular radio is paging the tower.</td>
659  <td>1.2mA</td>
660  <td></td>
661</tr>
662
663<tr>
664  <td>radio.on</td>
665  <td>Additional power used when the cellular radio is on. Multi-value entry, one per signal strength (no signal, weak, moderate, strong).</td>
666  <td>1.2mA</td>
667  <td>Some radios boost power when they search for a cell tower and do not detect a signal. These
668  numbers could all be the same or decreasing with increasing signal strength. If you provide only
669  one value, the same value will be used for all strengths. If you provide 2 values, the first will
670  be for no-signal and the second for all other strengths, and so on.</td>
671</tr>
672
673<tr>
674  <td>cpu.speeds</td>
675  <td>Multi-value entry that lists each possible CPU speed in KHz.</td>
676  <td>125000KHz, 250000KHz, 500000KHz, 1000000KHz, 1500000KHz</td>
677  <td>The number and order of entries must correspond to the mA entries in cpu.active.</td>
678</tr>
679
680<tr>
681  <td>cpu.idle</td>
682  <td>Total power drawn by the system when CPUs (and the SoC) are in system suspend state.</td>
683  <td>3mA</td>
684  <td></td>
685</tr>
686
687<tr>
688  <td>cpu.awake</td>
689  <td>Additional power used when CPUs are in scheduling idle state (kernel idle loop); system is not
690  in system suspend state.</td>
691  <td>50mA</td>
692  <td>Your platform might have more than one idle state in use with differing
693levels of power consumption; choose a representative idle state for longer
694periods of scheduler idle (several milliseconds). Examine the power graph on
695your measurement equipment and choose samples where the CPU is at its lowest
696consumption, discarding higher samples where the CPU exited idle.</td>
697</tr>
698
699<tr>
700  <td>cpu.active</td>
701  <td>Additional power used by CPUs when running at different speeds.</td>
702  <td>100mA, 120mA, 140mA, 160mA, 200mA</td>
703  <td>Set the max speed in the kernel to each of the allowed speeds and peg the CPU at that
704speed. The number of entries here correspond to the number of entries in cpu.speeds, in the
705same order.</td>
706</tr>
707
708<tr>
709  <td>battery.capacity</td>
710  <td>The total battery capacity in mAh.</td>
711  <td>3000mAh</td>
712  <td></td>
713</tr>
714
715</table>
716
717<h3 id="sample">Sample file</h3>
718
719<pre>
720&lt;!-- Most values are the incremental current used by a feature, in mA (measured at
721nominal voltage). OEMs must measure and provide actual values before shipping a device.
722Example real-world values are given, but are dependent on the platform
723and can vary significantly, so should be measured on the shipping platform with a power meter.
724--&gt;
7250
726200
727160
72810
729&lt;!-- Bluetooth stereo audio playback 10.0 mA --&gt;
7301.3
7310.5
73230
733100
73412
73550
73650
73775
7381.1
739&lt;!-- Strength 0 to BINS-1 (4) --&gt;
7401.1
741
742&lt;!-- Different CPU speeds as reported in
743/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state --&gt;
744
745250000  <!-- 250 MHz -->
746500000  <!-- 500 MHz -->
747750000  <!-- 750 MHz -->
7481000000 <!-- 1   GHz -->
7491200000 <!-- 1.2 GHz -->
750
751&lt;!-- Power consumption when CPU is idle --&gt;
7523.0
75350.1
754&lt;!-- Power consumption at different speeds --&gt;
755
756100 &lt;!-- 250 MHz --&gt;
757120 &lt;!-- 500 MHz --&gt;
758140 &lt;!-- 750 MHz --&gt;
759155 &lt;!-- 1   GHz --&gt;
760175 &lt;!-- 1.2 GHz --&gt;
761
762&lt;!-- This is the battery capacity in mAh --&gt;
7633000
764&lt;!-- Battery capacity is 3000 mAH (at 3.6 Volts) --&gt;
765
766</pre>
767