History log of /frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6d8dcec87200e75ca62715c8feb87794d113e957 01-Jun-2017 Sudheer Shanka <sudheersai@google.com> Update KernelUidCpuFreqTimeReader to handle uid removals.

Bug: 34133340
Test: manual
Change-Id: Iaad2061671d83e1ff6d2797e166ae903f6faec13
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ea87a4bca0d3c66de79d64e274c0f3aeb3a2f886 03-Jun-2017 Sudheer Shanka <sudheersai@google.com> Ignore entries for isolated uids if there's no mapping for them.

Bug: 25195548
Test: manual
Change-Id: If5aa7e194f4d43f2a7068899b9aa6584bfb2b7cc
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ceb24e88cbb56aa63c990693a2d6ea35dce029f5 01-Jun-2017 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Acquire network stats without BatteryStatsImpl lock" into oc-dev
1dfd194f7d8e3f5a4a208b133fcc8e4ecf831060 31-May-2017 Joe Onorato <joeo@google.com> Merge "Track Partial wakelock time in background" into oc-dev
413b13524454cd6c9ca13aa9af958dcda0d7b8b2 31-May-2017 Joe Onorato <joeo@google.com> Merge "Fix batterystat Counter misreporting when charging" into oc-dev
fe06de1fc2c4cc4734fa88a1472d8c51c5986507 31-May-2017 Joe Onorato <joeo@google.com> Merge "Batterystats track background bad ble scan time" into oc-dev
14ae39acbc1387a46946de88e068e10baa76f831 26-May-2017 Adam Lesinski <adamlesinski@google.com> BatteryStats: Acquire network stats without BatteryStatsImpl lock

Moves the network stats collection under a different lock to
prevent the main BatteryStatsImpl lock from being held while doing I/O.

Bug: 37645919
Bug: 38296815
Test: manual
Change-Id: I0d6b4a7b12b234939cb6eb3a32658b28f61dff4f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
b1f04f372c42114e864d52f4206ff07d9264c5b9 19-May-2017 Bookatz <bookatz@google.com> Batterystats track background bad ble scan time

Allows tracking ble scan time (total and background) for unoptimized
scans. Whether the scan is unoptimized is provided by the bluetooth
code when calling batterystats.

Bug: 38461344
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Test: run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testUnoptimizedBleScans
Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases -t android.dumpsys.cts.BatteryStatsDumpsysTest

Change-Id: I814482ff663424170eac4b413464d24c14a5cf91
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5b5ec326ad84a4f1c47074438df388ddc0dde3bd 26-May-2017 Bookatz <bookatz@google.com> Track Partial wakelock time in background

Changed partial wakelock time to be a DualTimer so that it can also
track the time spent while app was in background.

Bug: 62134255
Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases -t android.dumpsys.cts.BatteryStatsDumpsysTest
Change-Id: I85cca468ac126ee83a3600800bcfa75c9fc3012f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d0ddeba47bcacf1b3d4d56d14ab512038d7979d5 26-May-2017 Amith Yamasani <yamasani@google.com> Use uptime instead of elapsed for measuring duration

in time taken to read cpu stats.

This should avoid super long durations > 10 secs that are occasionally
seen in system logs.

Bug: 62104524
Test: manual
Change-Id: I9ed985a61125a207b6d4f6297091bd11b4c78616
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8c6f3c507fc77d07ab0c8edd2ff835801cc71e4d 24-May-2017 Bookatz <bookatz@google.com> Fix batterystat Counter misreporting when charging

The BatteryStatsImpl.Counter would previously increment the count even
when the timeBase was off. Then, when the timeBase was turned back on,
the count would be decreased back to the correct value. Thus, when the
timeBase was on, the reported count would be correct, but when the
timeBase was off, the reported count would be wrong (too high). Here, we
fix this.
We also make some other minor improvements.

Bug: 36728346
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Change-Id: I2fa566a8a4cad4cdff0e6caef37b1eef36a3f5c4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fdeb6b8ed3e2406c8759caf9d90c6d6a022a7860 23-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "Read cpu freq data only when needed." into oc-dev
671985f4839f8202e0a227cbec64ff818805dd5b 19-May-2017 Sudheer Shanka <sudheersai@google.com> Read cpu freq data only when needed.

Bug: 34133340
Test: cts-tradefed run singleCommand cts-dev -m ctsIncidentHostTestCases -t \
com.android.server.cts.BatteryStatsValidationTest

Change-Id: Ib235e166820b95b5cd0a496b6146ea353abdf844
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1effe000b88f6569518b63fea5ba7e5272d36e4a 19-May-2017 Adam Bookatz <bookatz@google.com> Merge "Cumulative wakelock time per uid" into oc-dev
c8c44960c0051dacac0a6cb6c65ddfafc9d1cb84 11-May-2017 Bookatz <bookatz@google.com> Cumulative wakelock time per uid

Currently, the time for each partial wakelock was tracked. If one
wants the total time that a uid held partial wakelocks (over all of its
wakelocks), they could sum over all the uid's partial wakelock
totalTimes, but this would underestimate the value because totalTimes
are pooled amongst all uids. Alternatively, they could sum over all the
uid's partial wakelock totalDurations, but this would overestimate the
value because totalDurations are not pooled within the uid (so there
will be double-counting if two wakelocks are held simultaneously). This
cl adds a new timer that specifically tracks the actual total time that
the uid spent holding wakelocks, and also provides the ability to see
how much time the uid was in the background when doing so.

Bug: 38198272
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: I20ea3546338c44ffdf06859bc840d9059fb18321
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
59f5c00b41b742eefcee450365bb522b7c0e8cc6 15-May-2017 Sudheer Shanka <sudheersai@google.com> More unit tests for classes needed in reading uid times per cpu freq.

Bug: 34133340
Test: runtest -c com.android.internal.os.LongSamplingCounterArrayTest frameworks-core
runtest -c com.android.internal.os.KernelUidCpuFreqTimeReaderTest frameworks-core
Change-Id: I4c64efd9b3d91a72c585b9e4b0e6b277297005a4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ba4ac09d23d27f4d27d0c03a605ebfa1ed4b1858 15-May-2017 Amith Yamasani <yamasani@google.com> Merge "Map isolated processes to correct uid" into oc-dev
8ee74aa3bacb7050d3734ad83d492c58d0eea61e 13-May-2017 Amith Yamasani <yamasani@google.com> Map isolated processes to correct uid

This was missed in a recent addition to track cpu times at freq.

Bug: 34133340
Test: manual
Change-Id: Ie3720a76a1201c787601bb7419cb9eba47b2aa27
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
80fc1af1205b050dba984106ed9df497e6587234 12-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Batterystats BLE results counter takes in count" into oc-dev
4ebc064c30e5322e8f479f6732dfd44f72bfec77 11-May-2017 Bookatz <bookatz@google.com> Batterystats BLE results counter takes in count

There would likely be too many BLE scan result calls for batterystats to
be healthy. Therefore, the caller can supply a count by which to increase the
counter, instead of doing it one result at a time.

Bug: 37720787
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Change-Id: Ib8b2e8d250036be24c6c3dac477bc8d34fe498a6
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9b735c5c1a4575d9f0ea9f3229ad8bf9401caee0 10-May-2017 Sudheer Shanka <sudheersai@google.com> Add time spent by uid per cpu frequency to batterystats.

Currently we have total user and system cpu time spent by the uid
in the batterystats. This change will add times spent by the uid
at each different cpu frequency to the batterystats dump which will
help in better understanding the battery usage.

Bug: 34133340
Test: manual
Change-Id: I567dc75875eb58543c0e71572d0b440e87dbb4b9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3f8e29715c00d86b4fba136430fe64871c1c6ab6 11-May-2017 Makoto Onuki <omakoto@google.com> Make batterystats less chatty

Fix 36869686
Test: manual

Change-Id: Ia5092222acd508e5539cd64ffe015a18036c9d83
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
956f36bfe2bcb16080336572e6042ae1ab66c5be 28-Apr-2017 Bookatz <bookatz@google.com> Add BLE results counter to batterystats

Batterystats provides an API to count the number of BLE scan results.

Bug: 37720787
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Change-Id: Idcb7494b39e88dcbfbb3da1ebe90b8a2f8f4d55c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c627d10650d7a9f745032d0f282760b3dc71a7a8 14-Apr-2017 Jocelyn Dang <jocelyndang@google.com> Add min and max learned battery capacity to batterystats.

BUG: 32645990
Test: manual

Change-Id: I3da569e48571cb86c640aed732abdf6c46a2bc73
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a8fc7bff5a4900f7a47da611bd9dc4322a6eab41 13-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Collect background stats: syncs" into oc-dev
2bffb5bb3ae092b9e5c6154a6db693c75ccb1b25 13-Apr-2017 Bookatz <bookatz@google.com> Collect background stats: syncs

Added background times and counts for an app's sync usage.

Bug: 35669746
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: I1c01c5044064277b97e8d330386454da3e8204da
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d4abd1eeb01187fa2ef78b64ae4f493a7bb3563f 12-Apr-2017 Adam Lesinski <adamlesinski@google.com> BatteryStats: Remove reading of cpu power

The cpu power reported by the uid_cputime kernel is inaccurate
and has only ever been recorded for dumping to batterystats.
The values have never been used in power blame calculations.

This change removes these power values which just cause noisy
data.

Bug: 36002715
Change-Id: I61bea9992aabb84d099689360fd9377b44b36e2f
Test: run `adb shell dumpsys batterystats`
Test: should not show `p=` for `Total cpu time:` line
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4a3eda992b70601e26a76d9492b2f9381cf0fe51 10-Apr-2017 Bookatz <bookatz@google.com> Fix double-detach DualTimer bug

DualTimer attempted to detach its subTimer twice when reset(true) was
called, once explicitly and once via a call to the main timer. This
fixes that problem by getting rid of the explicit detach in reset.

Bug: 37208694
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
and manually looked for "Removed unknown observer" error in logcat.

Change-Id: Ic5ff7d799d46236a74ab0825e108bef40bac0360
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ceebafe41a127c18213ca39ddf692ae1cbfb100e 06-Apr-2017 Bookatz <bookatz@google.com> Fix counting problems in StopwatchTimer.

Changed StopwatchTimer so that its count only increases if the timer is
started when its time base is running. Previously, if the time base was
off, the timer was started, the time base was turned on, and then the
timer was stopped, the count would be increased; now, it will not
(because the time base was off when the timer started). Moreover, this
likely fixes the count==-1 bug that previously could occur, since the
count will no longer be decremented if the timer is stopped after a reset.

Fixes: 36730213
Bug: 30099724
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: Iad195e431618629ce432074e0c1bd217f9818cb1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
aa4594aad251bdde8306180f07983dde173bc9e1 24-Mar-2017 Bookatz <bookatz@google.com> Collect background stats: scheduled jobs

Added background times and counts for an app's scheduled job usage.
Changes DualTimer to be a subclass of Timer so that background timers
can be easily accessed from the main timer (which is convenient for
jobs, whose ArrayMap of Timers is directly accessed outside of
BatteryStatsImpl).

Bug: 35669746
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: Ic1d85db34346ebda94ed39f134fc0794a5877815
(cherry picked from commit d253f537a0cc15851fb0308f3ea287e6bd93dfe6)
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
b23e6358af0f2ca6acec58ce579ee625e06fa635 30-Mar-2017 Amith Yamasani <yamasani@google.com> Bump up batterystats version to clear stale data

Change-Id: I96016f30f38e17fcdfdb4a52eba69471945a21e2
Fixes: 36783752
Test: manually verified the file was deleted on flash
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
29ddfe55fbea04685f1a6d6aff0f74269703c775 30-Mar-2017 Adam Lesinski <adamlesinski@google.com> BatteryStats: Clamp temperature to 0

Temperature is encoded without the sign-bit, meaning
negative temperatures cause an underflow and show up
in the history as large values. We do not expect to
deal with negative temperatures for debugging/diagnostics
so just clamp the temperature to 0.

Bug: 33270828
Test: adb shell dumpsys battery set temp -10 && adb shell dumpsys batterystats --history
Change-Id: I8a92f770e4a90333eade1bb38f21d2d87bb00430
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cb34b96796e46ea06c59ea846f934e477dec3191 25-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Collect background stats: bluetooth, wifi, sensors"
e1f480df6028a2a63c14644623cc77ff6a062576 16-Feb-2017 Adam Lesinski <adamlesinski@google.com> BatteryStats: force healthd update on screen on/off

By collecting healthd data on screen on/off, more fine grained
analysis is possible.

Test: manual
Bug: 32645990
Change-Id: If348c0e9f52524bb5c5537652e13d0376cd77576
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
867c0d72af63b67cd0abce8a0f40e94e04193aa6 08-Mar-2017 Bookatz <bookatz@google.com> Collect background stats: bluetooth, wifi, sensors

Added background times and counts for an app's bluetooth scans, wifi
scans, and sensor usage. Note that the original times for these three
are pooled (i.e. represent the blame apportioned to an app for using
these, rather than the actual time an app used these). Since background
times are not pooled, and are therefore incomparable to the original
times, an extra time, to represent the actual time, had to also be added
in the form of 'total duration' to which background times can be
compared.

Note that this total duration is now a feature of all DurationTimers and
can be used, e.g., to track actual wakelock time (not just
apportioned wakelock times). The total duration is the time used since
reset, and does not give other 'which' times (such as 'since
unplugged').

Bug: 35679958
Bug: 35677312
Bug: 35673525
Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java

Change-Id: I4b6943f76517cf5cc9420684857a5592cc7495be
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5f212c86a4fce26e5f87413df3dbfee181fa1ff8 13-Mar-2017 Adam Lesinski <adamlesinski@google.com> BatteryStats: Prevent double-detaching Counter

Detaching a Counter from a TimeBase means you can't use it anymore.
Only newly constructed Counters are automatically attached to a TimeBase.

Bug: 34200689
Test: make FrameworkCoreTests && adb install ... && adb shell am instrument -w -e class com.android.internal.os.BatteryStatsSensorTest com.android.frameworks.coretests
Change-Id: I9309000d5625aa6fe61a3c05f135e5828137d8ce
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9c2886ba5d4383a04eb5fc821b77a967574282ed 08-Mar-2017 Santos Cordon <santoscordon@google.com> Merge "Map STATE_VR to STATE_ON for Battery Stats."
e94f05019c94b04c92d2b89190a0224461b2ee90 24-Feb-2017 Santos Cordon <santoscordon@google.com> Map STATE_VR to STATE_ON for Battery Stats.

Also, sets STATE_VR to be a public API value for Android O release.

Test: Switch to VR mode, ensure "Unexpected screen state: 5" no
longer logs from BatteryStatsImpl
Bug: 35636815

Change-Id: I1f8be334967e1af1f92a3ed571c063e7b00106b1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
59fe841e60307cacf5b6af395559e843b9480b03 04-Mar-2017 Amith Yamasani <yamasani@google.com> Collect background network data stats in BatteryStats

Keep the original values the same, to avoid messing
up existing pipelines and stats, and keep additional
counters for background traffic stats for mobile and
wifi.

Bug: 35677165
Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases
Change-Id: I5f5ac3d5b659fe3d0b13703e6666a8751c5d9469
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
154d124ace83350da51e2d6f795f88f7bda6b041 16-Feb-2017 Amith Yamasani <yamasani@google.com> Fix background sensor usage counter

being out of sync with total count, due to nesting. Only update
the counter if nesting is 1.

Test: runtest -x
frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsSensorTest.java
Change-Id: Iabb153550a79afa9902569bbbbdb5815decdc613
Fixes: 34750473
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d2450862f4e97de26dd350de7ec1d6ebbdb15224 08-Feb-2017 Amith Yamasani <yamasani@google.com> Logging and partial fix for BatteryStats lock contention

Don't try to grab the write lock while holding BatteryStats lock.

Add some debugging to see if cpu stats gathering is causing a
delay in some cases.

Bug: 34961340
Test: Manual
Change-Id: I8c7d1abb239abd81a07171cd65be1fbfdbca5fdb
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e8ae5566fbcb87e017180d55c761ce98d769c232 02-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Batterystats commands to simulate screen on/off"
674c9bb2ffde84bd177fd44568d9a12b1c16dc6f 01-Feb-2017 Amith Yamasani <yamasani@google.com> Batterystats commands to simulate screen on/off

Needed for batterystats cts tests to measure partial wakelock
duration reporting.

Bug: 34233085
Test: adb shell dumpsys batterystats enable pretend-screen-off
Change-Id: Ia7c76d6a0636d206e04f01be58d1e6dc3332c50d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
442ab76d229bc8c8d18ce765ef7e4218d38aef97 01-Feb-2017 Ying Wai (Daniel) Fan <danfan@google.com> Prevent division-by-zero error when calculating battery capacity.

Bug: 34255953
Change-Id: Ie072cd5dc26faf17e8ab46ea0795750396f087c2
Fixes: 34255953
Test: formula change CL. No existing unit tests found.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9238b6124c72a216ccbbaa82f5f75828571d5841 19-Jan-2017 Ying Wai (Daniel) Fan <danfan@google.com> Correct the formula of battery capacity estimation.

Instead of
(current charge) * (current battery level percentage)
the formula should be
(current charge) / (current battery level percentage)
to estimate the charge at 100% battery level.

Bug: 34255953
Fixes: 34255953
Test: formula change CL. No existing unit tests found.
Change-Id: I56ef7af3fb097a3082e0ef24329f522d2a0229cc
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6224a32197389a80ea5f48c0dd39f720d7d9604a 07-Jan-2017 Adam Lesinski <adamlesinski@google.com> Merge changes from topic 'learned_capacity'

* changes:
BatteryStats: Report learned battery capacity as event
Parcel/unparcel charge_full state from BatteryProperties
ab9ad195d1e873f7569dec45c4e627a4e8ba67e4 06-Dec-2016 Amith Yamasani <yamasani@google.com> Track background sensor usage

Keep an additional counter for background access
of sensors. Increment the count when sensor is
accessed while process is in the background state.

Bug: 33553631
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsSensorTest.java
Change-Id: I87d7dbdaf4c34aa9dd9c7e13134d8f5f759f4e2b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
497516d04bc729b29755ed5a105061e0c95550d9 19-Dec-2016 Adam Lesinski <adamlesinski@google.com> Reset BatteryStats when too large for clients to handle am: 45489787d7
am: 66c7e9c20e

Change-Id: I20e9da9f7580b6f483332649459a32d7562ca2cf
66c7e9c20eba46582c2d98e04a252daf529a1b8d 17-Dec-2016 Adam Lesinski <adamlesinski@google.com> Reset BatteryStats when too large for clients to handle
am: 45489787d7

Change-Id: Ie90ad79b71198d0fe0ead12048aec9bf6658a35a
45489787d7f84a5530c1e88bebc1eb6aa614bd74 16-Dec-2016 Adam Lesinski <adamlesinski@google.com> Reset BatteryStats when too large for clients to handle

When BatteryStats history is too large, the Settings app crashes.
Reset the battery stats by marking an *OVERFLOW* event at the
beginning of the newly reset history.

This seems to happen in Retail mode when the devices are on charger
for an extended period of time and accumulate a sufficiently large
history. Resetting makes sense because the phone is most likely
charged and will reset anyways when unplugged.
Bug: 32540341
Test: Manual

Change-Id: I8c2892458b5d9ce64b1c44aa2e2a000340e71e63
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c6bd4243a46acc85058fcad2eb6957c42f591006 10-Dec-2016 Kweku Adams <kwekua@google.com> Fixing issue in current and max duration calculations.

It looks like one operation was done out of order and some of the times used in
the calculations were leading to incorrect results.

BUG: 31023263
Test: bit FrameworksCoreTests:com.android.internal.os.BatteryStatsDurationTimerTest

Change-Id: I417cc28c5a55748067b6c7f682a66fe3dbc09f09
(cherry picked from commit 47db5a8bf74a77306b811d14e3c052cdf86ef704)
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
47db5a8bf74a77306b811d14e3c052cdf86ef704 10-Dec-2016 Kweku Adams <kwekua@google.com> Fixing issue in current and max duration calculations.

It looks like one operation was done out of order and some of the times used in
the calculations were leading to incorrect results.

BUG: 31023263
Test: bit FrameworksCoreTests:com.android.internal.os.BatteryStatsDurationTimerTest

Change-Id: I417cc28c5a55748067b6c7f682a66fe3dbc09f09
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
041d917baaf62ca041638d775fc618ccd21f2d3a 12-Dec-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Report learned battery capacity as event

This adds the notion of int formatters to events, which allow
events to supply a value other than a UID.

Bug:32645990
Test: Manual
Change-Id: I3855f6b7d16d355c9df8cd2d576cc7faae4a1c4f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a448099feadde8d6e6b2cac2b94415b468678c14 08-Oct-2016 Dianne Hackborn <hackbod@google.com> Fix issue #31305336: File corrupt: too many wake locks 101 am: cb99a72e62 am: 50b9f3513c
am: a89e1ec692

Change-Id: Ia020798e19ced931b0f690c8626ccf728e4157e4
cb99a72e62bcfb30002820f0543aa23dbbdd6162 04-Oct-2016 Dianne Hackborn <hackbod@google.com> Fix issue #31305336: File corrupt: too many wake locks 101

The limit is MAX_WAKELOCKS_PER_UID+1, since OverflowArrayMap
will add one more to contain the overflow.

Change-Id: I53004582daa0c405427308816728f2c1d2bef40d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3e1cd845e6f2db3125647f025356ce334a4e7263 14-Aug-2016 Adam Lesinski <adamlesinski@google.com> SamplingTimer: Fix issue with summary recording too much am: 9edd6be542 am: e5852eb501
am: 4e4e50cd02

Change-Id: If5f2313532774ef113fbb682beba6b51de45b45c
9edd6be5424a7104d841703f929821a5a77d6c04 13-Aug-2016 Adam Lesinski <adamlesinski@google.com> SamplingTimer: Fix issue with summary recording too much

The summary is supposed to just hold enough data to continue counting
once the device has reset. Since kernel stats reset when the device
resets, and the first update is ignored to account for soft resets where the
kernel continues running, SamplingTimer should not be recording the last value
it saw from /proc/wakelocks in the summary.

Bug:30575302
Change-Id: Ic193bc5af9a0ede514e3abc8146523d7316c47d3
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
adbee556a9e8f399acda17958eed1ba33ad07218 25-Jul-2016 Joe Onorato <joeo@google.com> Have BatteryStats track and report the running wakelocks.

The times reported are in the screen off / on battery time base.

Bug: 29546924
Change-Id: I025b2959becb256a26cf531e944786d4e9a59149
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ed2e7c894e0b5889d96e1a4dd1c6fc3cb565d246 03-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Have BatteryStats track and report the running wakelocks."
92fd23fc6217add0d781b38619fa635add4e15e6 25-Jul-2016 Joe Onorato <joeo@google.com> Have BatteryStats track and report the running wakelocks.

The times reported are in the screen off / on battery time base.

Bug: 29546924
Change-Id: I025b2959becb256a26cf531e944786d4e9a59149
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cc30b55159e037c020165336ade9944e2808d109 31-Jul-2016 Dianne Hackborn <hackbod@google.com> Work on issue #30407061: OverflowArrayMap.stopObject unable to find object am: 657153bd28 am: ae7bdd8dde
am: 347c006732

Change-Id: Ib69b728931b30b2092becb89d55a46b92245a0fc
657153bd28b36e0eaa223b489f1a80fc85e29be8 29-Jul-2016 Dianne Hackborn <hackbod@google.com> Work on issue #30407061: OverflowArrayMap.stopObject unable to find object

Add more debug info when this happens to try to better
understand what is going on.

Change-Id: Id8c979d1c2d3769ce68156fb7e69d5ff9d5ded1c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3a2260598ab8e45f1f1db9a05057532da279a541 01-Jul-2016 James Carr <carrja@google.com> Addition of memory power to BatteryStats

Initial implementation of some classes that pipe memory power use
information from the kernel to BatteryStats framework. Reads how much
time has been spent in distinct bandwidth buckets.

Change-Id: Iefb4b4c0a4e0d0f8d7a773075324ebd38ed154f2
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d0db6f00435b83c88f041ccf0cfcb9986ae8e6ef 18-Jul-2016 Dianne Hackborn <hackbod@google.com> Add reporting of long wake locks.

These appear as a new event in the battery stats history,
"longwake" in the long version and "Elw" in the checkin.

The power manager keeps track of which wake locks are held
for a long time and reports them to battery stats. Long
is currently considered 1 minute or more. Once it is long,
the start event will appear, and once if is released the
event will end.

In the case of a wake lock changing (typically its work
source changing), for purposes of this accounting this is
considering a pure release of the old state and start of
the new state... so the timer will reset back to one
minute until the wake lock is considered long. This is done
to prevent things that make lots of changes to wake lock
work sources from spamming the log.

Bug: 28753137

Change-Id: I33b6168c57a7ea6ea558273dec731704123124a5
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5f056f6d87b2b9f2abc1b37c5d8530d57c6230cd 15-Jul-2016 Adam Lesinski <adamlesinski@google.com> Record UID of wakeup packets

Bug:28931278
Change-Id: I50a3b6a8026b4d06aaa2730cd531658d280ddb73
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1a76a62b8d4bfaaa4a40b4dcce1ac88dd3e4f387 22-Jun-2016 Adam Lesinski <adamlesinski@google.com> Prevent early boot crash reading PowerProfile

The PowerProfile in BatteryStatsImpl may not be ready when
resetting stats early in the boot sequence.

Bug:29559031
Change-Id: I51bba762231a08804f1b68505bb1b0523476081d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
f9b20a9ec4d92c542a0a38630a8b8c22729c5393 18-Jun-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: record best estimated battery capacity

Using the coulomb counter, record the estimated max battery
capacity.

Bug:28743761
Change-Id: I1270b062cf4a1e6fd69ea1da3de11a85a81b3663
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
67c134f849711c30e8cfba375b9e3c8616b4b277 11-Jun-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix read/write parcel order

Also moves discharge coulomb data to BATTERY_DISCHARGE_DATA checkin line.

Bug:29264326
Bug:28743761
Change-Id: I78881e166c11f40b2397e04d2cab8d5200c71eea
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3ee3f63eb88741bb726c1481387ccf8a46fb57fb 08-Jun-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Record fine grained battery discharge

For devices that report battery discharge via a coulomb counter,
record how much of the battery was discharged while the screen
was on/off.

Bug:28743761
Change-Id: Ie2d1708864352029ff466c1fed14fc057e19b93b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8ce3694181f853701d31ee4eb1dc46dbfab044d7 27-May-2016 Adam Lesinski <adamlesinski@google.com> Fix issue where max idle time > total idle time

If the batterystats were reset while the device was
idling (via command line most likely), then also reset the
last time the device started idling so that the max idle time
calculation is correct.

Bug:28452600
Change-Id: I8a3d5dc3081deda76356c03d891e098baa85f88a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d84ad30ee62ee9610ed4a59a8ce4dcbb8eddf7d8 18-May-2016 Adam Lesinski <adamlesinski@google.com> Fix parsing of kernel wakelocks

We handled stale wakelocks (wakelocks that disappear from /d/wakeup_sources)
differently in previous version of Android. They would be set stale, but still be
updated with their previous counts (they would never disappear).

The method setStale has been replaced with endSample(), which is semantically different.
Once a SamplingTimer has endSample() called, it expects any future calls to update() to
be a new sample, meaning the entire amount passed to update() is included in the kernel
wakelock's total. Since stale wakelocks were never removed from the list, this would
increase by large amounts when nothing had actually changed.

This was exacerbated by the fact that there was a bug where the last wakelock in
/d/wakeup_sources was never parsed, so if the order ever changed, this "stale" wakelock
would suddenly re-appear and the entire amount reported would be charged to the wakelock,
instead of just the difference since the last update.

All this was exposed when we added support to handle wakelocks that would disappear and
reappear with smaller values, meaning the kernel had pruned them from its accounting and
reset them.

Bug:28601080
Change-Id: Ic96027f7d580dac5e20aa73d67e5cedac4ccabeb
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fa97fcf7b9b9999102bc0c6b298114375b27a1c3 14-May-2016 Ruchi Kandoi <kandoiruchi@google.com> network: Adds the functionality to parse uid in netlink messages.

Netlink notifications about the state of the modem contains uid too.
This patch adds the functionality to add that. It also fixes the bug to
parse the timestamp in the message even in cases where the length is
greater than expected.

Bug: 28527904
Change-Id: I4643bff3eb5b1ffa2dc0b78f1c6947d60487e0d8
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a8018ac47a0c0725882a041a1c42e67f52129f02 03-May-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix units on battery charge counter

The unit for the battery charge counter is in micro-Ampere-hours, not coulombs.
We store the value as uAh but display it in dumpsys as mAh.

Bug:27174034
Change-Id: Ib5cc1ee1c5c191336a3e1f18dbb12c38e833f8d0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4f928358d2a4023dc6ba5a0bbdb1a63a3e1bfa7a 30-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "BatteryStats: Reset per-User Bluetooth and Modem controller activity" into nyc-dev
1a2b39e61cd52e21b7e51391fa79d400076085ac 30-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Reset per-User Bluetooth and Modem controller activity

Bug:28469956
Change-Id: I4db68ecc5b7bde8dd552caadee489b7bad3d6cbc
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
926969b411ca52eeefd6b01c0c7970d8a65ee526 29-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Keep track of coulomb counter

Bug:27174034
Change-Id: Ica66817faa20b9788536f28f0e593483f033904b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
68cdf1997f7b007e4c81089bc402a0356292f4c2 04-Apr-2016 Badhri Jagan Sridharan <Badhri@google.com> Add low power stats to batteryhistory

Exports SOC specific low power state info to batterystats service.
BatteryStats service queries the powerHAL module whenever and
updates the HistoryStepDetails whenever setBatteryState is called by the
BatteryService. The stats get appended to the battery history whenever
there is a change in the battery level.

Bug: 26564574
Change-Id: I02b4db00aec0c69d1558492224f3a4dc1c386fa6
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1a8a717ab517e7b5ace00bb4d3370e0f3a2677b2 23-Apr-2016 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Fix up semantics of SamplingTimer" into nyc-dev
6a4d9a3c9f7cbd30a7093f5088a72271a5e504c7 23-Apr-2016 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: use the same timestamp for comparing intervals" into nyc-dev
757c6eacc8114613e2a07a5e68628bf202ce97ab 21-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix up semantics of SamplingTimer

SamplingTimer has been losing some data, as well as not correctly handling
entries that have gone away and come back with less data (reset).

This change correctly ends a SamplingTimer sample by adding the accumulated amount
to the total, then reseting the running counter to accept new values.

This is also triggered automatically when the incoming data is less than what is currently
recorded.

Bug:25695597
Change-Id: I6b540906e6be527578d1003485384a75ba211b52
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9acfd8166b140b0c553bac6fdc01c26584a288b3 20-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: use the same timestamp for comparing intervals

Use the timestamp provided by the modem to compare time.

Bug:28133571
Change-Id: I046bc1f2b90ba9b8b8245f031925476680ba5275
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
98f0d4692c6634ff5d4ffbbc150d405da66c4c38 20-Apr-2016 Adam Lesinski <adamlesinski@google.com> Record in progress count when parceling Timer

The total time is computed before parceling, but the total count is not.

Bug:27747854
Change-Id: If3afdca9605f74d96a54fb9df17f6df761b99e55
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
388fc336b3f5c31df70fa01cf130f86b8c8d545f 13-Apr-2016 Joe Onorato <joeo@google.com> Add support for null tag names from apps.

For Wakelocks and syncs there is no requirement that an app actually
supply a tag/name. Jobs will always have system-supplied tags.

Bug: 26276001
Change-Id: Ie3b8e48a395de1506a2f15d5b9c9eab726bc6d0a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d9b99be587962e5cb696327cf837f8b82ecd6b5c 31-Mar-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Add ble scans to checkin data and start global ble scan timer

Bug:27930206
Change-Id: Ieb81eddeb0ac54ad93615f3abdc18cbcab19a729
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2fefbcf0d1b91f37684387971721c90112a9ac89 18-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #27653326: Sync doesn't work in doze maintenance

Add a (configurable) delay between when we start a maintenance
window until the minimum time we will end it.

Also switch to using the alarm manager callback API. (Yay!)

Also fix a little printing problem in the alarm manager dump
so we put the package name and not some class hash in the
summary string of an alarm entry.

Change-Id: I4281e5c80bc8b26ebc1fb6f603ec33ec0e379daa
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6fdd3afdcc43c1dec03ee82e9e1d69e88170d932 17-Mar-2016 Phil Weaver <pweaver@google.com> Merge "Treat accessibility actions as user activity" into nyc-dev
da80d676c70fa07d4efe566b2c74b3fbc61805b0 16-Mar-2016 Phil Weaver <pweaver@google.com> Treat accessibility actions as user activity

Resurrecting ag/665912.

Bug: 19531976
Change-Id: Ibdddd507215e61b9f4313c36eab8845e9940a7ac
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
816433093ca816baacd34fa1ac8896af171fe4cd 15-Mar-2016 Roshan Pius <rpius@google.com> Fix a bug in ControllerActivityCounter

We were returning the RxtimeMillis counter instead of idleTimeMillis
counter in |getIdleTimeCounter|.

BUG: 27268322
Change-Id: If08a64095b375e078aef2a935b144c4285ead08b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
713fec85b8612256211f09c62b8958a99fe5b9db 04-Mar-2016 Joe Onorato <joeo@google.com> Add an API for apps to get their System Health / Battery Stats data.

Change-Id: Ib27e1be469b826f6d83d73ce6024102bbdb1d47a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
09c09fd345a6b4c9619885428dce9802ad7b8cd8 27-Feb-2016 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Fix issue where network traffic accounting might be lost" into nyc-dev
6cca414de21e515e1db4164b15b33355c724cf1a 26-Feb-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix issue where network traffic accounting might be lost

Both bytes transmitted and received must be 0 if we are to short circuit and
ignore the UID's network delta.

Change-Id: Ia69f605c7d5954b8f2c3671bab596dc9925f1d02
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e1acd636d492f5c828a8abaccfd2fed185ddc0d6 23-Feb-2016 Joe Onorato <joeo@google.com> Make getBatteryUptimeLocked protected so it can be mocked.

Also fix test names.

Change-Id: I43477e61c22cd36735214951c45c52b39095e1b5
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
abded113bde548734600dc1b6e4ce2e94f48e32e 09-Feb-2016 Joe Onorato <joeo@google.com> Add unit tests for BatteryStatsImpl.

- Add a Clocks interface to wrap SystemClock.uptimeMillis and
SystemClock.elapsedRealtime.
- Make the inner classes static so they can be created independently,
which meant passing explicit pointers to the BatteryStatsImpl and
the Uid objects in a lot of places.
- Make several fields protected so they can be accessed by the tests (they are
still @hidden)
- Add a test suite for the battery stats.
- Add the tests

Change-Id: I4e45afedc64f7050985c28a7eb4f5c1ddbaa63fa
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9f55cc71b9b0a27604d448b5c54e3c377b7a067f 28-Jan-2016 Adam Lesinski <adamlesinski@google.com> Track BLE scans in BatteryStats

Distribute the power used by apps scanning with BLE.

Bug:22718669
Change-Id: I626d8a459fc28fdd7dac682c9ac7c8434945109d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a426817a06ed228cc52097c866a7d263bddadbb8 29-Jan-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix DivideByZero error

As we hand out proportional blame to apps for transmitting/receiving
packets, make sure to check that the total packets sent never
becomes zero.
Bug:26873610

Change-Id: I3e0fc3c9e8d4dafce2e88c75d8f44701d8fba0d4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
21f76aa77075be5e057c36040d7d6e695c669b72 25-Jan-2016 Adam Lesinski <adamlesinski@google.com> Record ModemActivityInfo and distribute power blame to apps

Telephony expsoses a getModemActivity() method, which BatteryStats
will poll when a change in network activity occurs (on the modem).

The time spent in various states (tx, idle, rx) are distributed amongst
the apps that did rx/tx traffic during that window.

Bug:23147562
Change-Id: I480a85df95786f87c382b96816fe2ed4bb2d5a42
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
50e4760214dc3bab81b5ccf6df4d5ce5fa34d723 05-Dec-2015 Adam Lesinski <adamlesinski@google.com> Record bytes transferred for bluetooth

Bug:26039657
Change-Id: Iec42459d12f4106d5733f55313e8544d58930285
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
794a18f5a215787570329018c50e2fa08133f893 11-Dec-2015 Adam Lesinski <adamlesinski@google.com> Prevent DivideByZero error in BatteryStatsImpl am: ba88e68fe4 am: 4e4ff058c1
am: 0b754d122c

* commit '0b754d122c3b9db395a86d9a098f6a29bf042b53':
Prevent DivideByZero error in BatteryStatsImpl
ba88e68fe47b66f1fc5d10c15f04f20fe662399e 08-Dec-2015 Adam Lesinski <adamlesinski@google.com> Prevent DivideByZero error in BatteryStatsImpl

It was assumed that when a UID had either rx or tx bytes/packets that it would
have the other as well.

Bug:25706750
Change-Id: Iefac59a6bd02876aed9a0bac218d187b81807a95
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a8d10945a608ac6f85a6ab85b69b9a118d7853d8 20-Nov-2015 Dianne Hackborn <hackbod@google.com> Fix reporting of uid state in battery stats.

Now that the activity manager keeps track of per-uid process states,
we can push that already rolled-up data into battery stats to directly
track the times in those states.

The problem with the reporting was actually that we weren't dealing
correctly with negative process states, which is now fixed. (It was
interpreting them as FOREGROUND rather than not running.)

Also split out a number of new states -- TOP, FOREGROUND_SERVICE,
TOP_SLEEPING -- from FOREGROUND. This should allow us to get a much
better idea of how much an app has been actively in use: TOP is when
it is directly visible to the user or in use by such, FOREGROUND_SERVICE
is when it is running in the background in a way the user is aware of.
Also when reporting these numbers, they are no longer added together as
reported but kept as separate times.

Change-Id: I6d307503a4b4ad5c0d5d49305ef63f8eb858e2c9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3944c81cd73694e3e1f9658fbb9ebc6e22df02e0 14-Nov-2015 Adam Lesinski <adamlesinski@google.com> Fix batterystats battery level int packing

We introduced some new flag at the lowest significant bit of the
battery level int but failed to account for it when unpacking.

Bug:25596467
Change-Id: I4320e6fcc208ec6de249b14fe3e399ab2f32d839
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
08c47a5dece977a55d250d98bda9e2a8df8b6ed0 15-Oct-2015 Dianne Hackborn <hackbod@google.com> Initial implementation of light-weight idle mode.

This mode turns on after the screen has been off for 15 minutes,
and then cycles through 15 minutes of idle and 1 minute of
maintenance, ragardless of whether the device is moving around.

It currently only impacts network access and sync/job scheduling.
It does not remove access to wake locks or alarms for any apps.
It also doesn't report in the public API that the device is in
idle mode (since it isn't modifying the behavior of the power
manager) -- this is probably what we desire, since we don't want
stuff like GCM to be reporting these frequent changes.

We'll probably at least want to have the alarm manager do some
kind of more aggressive batching of alarms in this most (not allowing
more than one wakeup every minute?). That's for the future.

Also updated batterystats to include this new information, which
means the format of some of the data has changed -- device_idle
is no longer a flag, but an enum of (off, light, full), and there
is no information about time spent in light modes.

Also added new data about the maximum duration spent in both light
and full idle modes, to get a better understanding of how those
are behaving.

And did a little cleanup of DeviceIdleController, removing the
sensing alarm which was redundant with the regular alarm.

Change-Id: Ibeea6659577dc02deff58f048f97fcd9b0223307
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a57a5404400b8dec5144d275452101e283f772b1 28-Sep-2015 Adam Lesinski <adamlesinski@google.com> Fix asymmetry in parceling/unparceling code for BatteryStats summary

Bug:24434303
Change-Id: I638979e54076004860035396738f6a1281e26c20
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d5f10154c772b925f6527e25aeb8461de8c710cd 27-Sep-2015 Adam Lesinski <adamlesinski@google.com> Bump BatteryStats version

Bug:24434303
Change-Id: I697deb30c211c77c36cdd810259507f965f3b93b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
52290c9c4fca5bec384382406dd1b4d28b424a89 22-Sep-2015 Adam Lesinski <adamlesinski@google.com> Fix Array Index Out of Bounds in BatteryStatsImpl

If the power profile was not set yet, the default sizes of
cpu freq arrays could have been too small.

Bug:24244089
Change-Id: Ic17a1e8f2058c51fbdda14db35b7b62f4880be00
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6832f39416cbe2cc9655af4eabefe39c5d272254 06-Sep-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Better big-little CPU accounting

Generalize cpu clusters so we can measure frequency
and power usage across heterogeneous cpu clusters.

This also brings back reading of cpu-times for power calculation.

Bug:22773176
Change-Id: I9c794ae9756c782c0e971c7f5fcebbe70374b269
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
865b79b43b75361fceb3aa1c99ad6f6e7c90e6ac 19-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #23326715: Clarify --checkin/-c options in batterystats

Change-Id: I3f026447ba7c6d2c3f9ef065269c31a78cf73512
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
385dfd349ff773c499859ee44552995e9c25759c 04-Aug-2015 Mitchell Wills <mwills@google.com> Merge "Charge apps for wifi tx time while scanning" into mnc-dev
f901649bd920adbc1f956782d0bb0b5f7640afe1 30-Jul-2015 Mitchell Wills <mwills@google.com> Charge apps for wifi tx time while scanning

Bug: 22955562
Change-Id: Ie2c6ab65e7b592272e1cad120ac606fcfd6ea677
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fbabe7dd6a25f1ed1228ea65a2305f298427a99b 03-Aug-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Add debug logging to find source of b/22716723

Bug:22716723
Change-Id: I97b940b702666b393555622d034e1c694b1e346a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d48954fb6bd5fb3170ea44b95c87ed2b7a70d535 23-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22414729: Checkin start clock time is different from hsitory reset time

There was a mistake in the code that was supposed to recover from the
initial time on a new device being bad until the real time ultimately
gets set, which was causing us to update the start clock time every time
there was a time change (instead of just when the original start time
appears bad).

Rework all of this, so we now count the start time as bad if it is more
than one year before the current time, only modifying it in that case.
Also when modifying it, adjust the time we set it to take in to account
how much realtime has actually elapsed so far in the battery stats.

Change-Id: If74bd711d9b7618c8f6148a9935c452aaaa7e257
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
280a64e793d081847c5dcea23ed9be38aa5332d2 13-Jul-2015 Dianne Hackborn <hackbod@google.com> Improve tracking of screen on reasons.

- New screen on app op to record the last time each app has
caused the screen to be turned on.
- New battery stats event that tells us the reason the screen
has been asked to turn on.
- Propagate out power manager API to specify the reason a caller
is asking to have the screen turned on.

Note that currently the window flag to turn the screen on bypasses
much of this because it is being handled in the window manager by
just directly telling the power manager to turn the screen on. To
make this better we need a new API where it can specify who it is
calling the API for.

Change-Id: I667e56cb1f80508d054da004db667efbcc22e971
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
062e66cb15c856f840ea0806bcf90848c35baa4f 14-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix units in wakelock distribution calculation

This is mostly for checkin stats, this is not used in any computation.

Bug:22468534
Bug:22391540
Change-Id: Ib3d0c86db5044092d3d76acf8f001337272af2ff
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9ae9cba0209a8baf0a5d7463dc1c9a4831c916f6 09-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fail gracefully on corrupt battery stats

Bug:22328963
Change-Id: Id0b4c6334706e58483d5fdfd2c1137bfb821c409
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
61db88fc8b4a5729d9ce6bc1b7bfaac5c09c8f90 02-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Remove isolated UIDs from /proc/uid_cputime when they are not in use anymore

Bug:22225933
Change-Id: I384a3c37ad45af981cca5fc3e92643da948d48d0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a7a4cccf7d90324a049fbfd271d25cad51633922 27-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Record cpu power usage from /proc/uid_cputime

For now we are just recording the power usage and not using it
to calculate battery power usage or app blame. If it looks like
it is accurate, we'll adopt the values from the kernel instead of
estimating ourselves.

Bug:21498425
Change-Id: I6617e3c0ff279a65f4ff84472082f36fe4beb336
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6a8bd7bc13251fe1710cb529d14ee28b0c4ab5d0 20-Jun-2015 Jeff Brown <jeffbrown@google.com> Repurpose doze wake lock stats for draw wake lock instead.

The doze wake lock is an internal implementation detail with no
power impact. However the draw wake lock is much more interesting
to track because it's essentially like a special purpose partial
wake lock which may be acquired while dozing.

Bug: 21949905
Change-Id: Iedd5f366eb010a47a9691374c5cd3d85ea68173d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9425fe21c9a8ab894e4a3b12a418564c4349394e 19-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Record doze wake locks

Doze wake locks don't actually hold the CPU awake, so we should record them
separately from full wakelocks, which is what we did before.

Bug:21949905
Change-Id: Ib4db3399069e0ad11f1f0dc6925a87ad0ad21ff9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8b156e37d5238487f1b3742fe9fb8a0632bfd66c 19-Jun-2015 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Update external stats individually." into mnc-dev
a7c90c84e46501b3afed221a448079d567ed853c 18-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Update external stats individually.

When wifi traffic causes a stats collection, we shouldn't care about
cpu or bluetooth updates.

Bug:21478443
Change-Id: I177dc0fc09951813cb4a702ad0e5d951d69f8c22
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
0348ba2e2303d9dce57a6b5d19cc47ecc5089afe 19-Jun-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #20494208: Go out of device idle when headset button is pressed" into mnc-dev
b6683c428698105f715985a96066192aa62e9f53 19-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #20494208: Go out of device idle when headset button is pressed

Rework how we record active transitions in battery stats to be
more general, and add an API that others can call in to
DeviceIdleController to request that we go out of idle mode.
use this for VOICE_SEARCH_HANDS_FREE.

Change-Id: Ie58de60e63036a4142881283835961fbcceec892
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
72478f053f403e29223dba6cc7be9e5bf115f670 18-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Fix regression in wakelock power distribution

We used to give 50% of the cpu time of each app to any app holding a wakelock
while the screen is off.
Since we switched to the new kernel module for measuring app's cpu time, this distribution
was lost.

Bug:21876567
Change-Id: I42c294547f63d150d9929271ca0e27fedaaa9d77
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3c0ce5ca14ba13f432f4309c001abcb1d7cfc159 12-Jun-2015 Navtej Singh Mann <navtejsingh@google.com> fix ArrayIndexOutOfBoundsException while starting WifiScannerScan

bug: 21663831
Change-Id: I9aea30907aae00c98d8fb1dc1fff3f4935108fa4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8576cf941dc20b64d60b6b7f5d0879b823628393 09-Jun-2015 Adam Lesinski <adamlesinski@google.com> Fix calculation of power drain from BT and WiFi

Unit issue (mV vs V).

Change-Id: I08843312339ccf35a3b55b1c2385c36fdbf61ead
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
df6235cd760738559c829f2fcfee1e659b5e78b1 09-Jun-2015 Adam Lesinski <adamlesinski@google.com> Bump the BatteryStats parcel VERSION

A previous change forgot to bump the version, leading to
corrupt data.

Bug:19683715
Bug:21574065
Change-Id: I30c9039694b02d576909e8f60c25f175986b8c5c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8f955f89c2ff19aac7f3e009c825beda3618f630 06-Jun-2015 Ruben Brunk <rubenbrunk@google.com> Merge "Add UI for camera + flashlight battery reporting." into mnc-dev
7b83b0c75ca929d29a623f31d8c7006d22176b76 05-Jun-2015 Adam Lesinski <adamlesinski@google.com> Update docs to reflect correct time units

Change-Id: Id2757e45e989b148671cf83d51011984e07cd017
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5b1308f02d720808727af61863bd59c227d6fe02 04-Jun-2015 Ruben Brunk <rubenbrunk@google.com> Add UI for camera + flashlight battery reporting.

Bug: 11694505
Change-Id: Ieefa78a1d641851f4141fe666dae7b9fde394f09
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6d2c363fd59af805380622ff7a3ce4c34975aab2 27-May-2015 Ruben Brunk <rubenbrunk@google.com> Track camera and flashlight usage in battery stats.

Bug: 15986092

Change-Id: Idf03981271721c44fd43327d5d90cf6f3fecfacb
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
719e61fa5fe4776a96fc1a6e4e60550a4b1d72df 16-May-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Enable bluetooth energy collection

Device firmware has been fixed and bluetooth energy values
should be correct now.

Change-Id: I9b9eff378d81e8de4a3f475c071a4ef26cc97f21
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
038959e851603500eb39b52fef33cbe75dbd73e3 15-May-2015 Adam Lesinski <adamlesinski@google.com> Merge "Remove UID from kernel cpu accounting when uninstalled" into mnc-dev
b99e6d69c30056520f7cb793e4be1851b3bd8426 15-May-2015 Adam Lesinski <adamlesinski@google.com> Merge "Parse uid_cputime proc file" into mnc-dev
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c352722e8af0a5510144b5f32ea87561db553f42 13-May-2015 Dianne Hackborn <hackbod@google.com> Ignore small time changes in alarm manager.

It turns out switching to the new kernel alarm
reporting causes lots and lots of spurious flags
that the clock has changed. The alarm manager
would blindly trust these, thinking the world has
changed on it and recomputing everything and reporting
this to everyone else. This was expensive.

We now verify that the time has changed sufficiently
that it is worth caring about. This is basically the
same algorithm that battery stats was using to avoid
recording small clock changes, so we are really just
pushing this down into the alarm manager and can now
remove that from battery stats.

Also since we are getting these so much, make use of
the other information in about the wakeup that tells us
if an alarm went off to avoid doing anything if it didn't.

Change-Id: I6f4f4226db6eb2b38ca73860786e7cf7c9136cc3
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
b83ffee5a40bf00e156152ad85bf8cf6bb96e2f1 12-May-2015 Adam Lesinski <adamlesinski@google.com> Remove UID from kernel cpu accounting when uninstalled

Bug:20182139
Change-Id: I77d41570c6aa0efd927b7beb266ef249ed9abff1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
06af1fac166a83507450b6bbb1f98a8dde68d92e 06-May-2015 Adam Lesinski <adamlesinski@google.com> Parse uid_cputime proc file

Instead of using the ProcessCpuTracker as the source of truth, we
periodically poll the new uid_cputime kernel module for stats
on all UID cpu time.

TODO: Need to tell the kernel when to stop tracking UIDs (aka on package
uninstall).

Change-Id: Id1d251aae23ab53f7acc0aba3bca5118bc2c194a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e283d33feda27f54672f90512c25304842cd7eb4 16-Apr-2015 Adam Lesinski <adamlesinski@google.com> Report WiFi and Bluetooth energy collection in checkin stats

Also removed some legacy bluetooth energy collection
that was never invoked.

Also fixed an issue with Wifi scan power estimation.

Bluetooth energy recording is still disabled as strange results
are still reported.

Change-Id: Iafa37eba285fd933ff221116b14af260e904fa4f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
0c820db22c83808fdb06c7cb06aaf13ef4b559a3 15-Apr-2015 Dianne Hackborn <hackbod@google.com> Some improvements to battery stats data.

History now records when wifi data activity starts and "ends"
based on the triggers we get from the kernel used to determine
when to collect data. (Basically the same as the current cell
data, but of course when it ends is just an arbitrary x seconds
after the last data traffic.)

Re-arranged the state bits to make room for this data in the
right place and move some other things that make more sense to
have in states2.

Try to improve overflow handling, so when it happens we allow
the various bit states to drop to 0 instead of being stuck
active for an indeterminant amount of time.

Added recording of the points where we decide we want to
retrieve new power stats, giving the reason for doing so.
These are only recorded when full logging is turned on.

Change-Id: Ic5d216960a07e0eb658731cdfba7f49ad3acf67e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1e38382b542f5cef9957a89692b02c55a3dd351c 10-Apr-2015 Dianne Hackborn <hackbod@google.com> Fixes to idle alarm scheduling, package importance.

- Add new API to ask the activity manager what the current
importance of a particular package name is (along with a few
new useful importance levels).

- Fix my last alarm manager change to actually execute the
alarms we have now decided should run even while we are idle.

Change-Id: I1f14712b4e390770d53b185c96a1b36f6aadd687
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1739076ef9cc940c54cbde3f0576f0dc228f7d68 10-Apr-2015 Adam Lesinski <adamlesinski@google.com> Fix deadlock issue in BatteryStatsHelper.

It was assumed that BatteryStatsHelper could safely call into system services.
Because it is used when dumping information from the BatteryStatsService,
this assumption was incorrect.

Now the BatteryStats object carries around the state of the energy reporting
for Bluetooth and WiFi, so BatteryStatsHelper avoids a query into WiFiManager.

b/19729960

Change-Id: I8745cf6aafeea8e862e34fe63b20056f6ba54b40
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4870e9d5eba59fb257a87f97f1adf0b734cf48d3 09-Apr-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode and other power stuff.

Add idle mode support to the alarm manager. Introduce
a new concept of flags associated with alarms to tell
the alarm manager how to treat the alarm -- they allow
everything from the alarm that will bring us out of idle
mode, to alarms that are allowed when idle or should
also bring us out of idle. The standalone boolean is
now also a flag.

(Note there is currently no protection from user space
setting the flags however it wants; I will be working
on that in a follow-up change.)

When in idle mode, the alarm manager pushes all alarms
that shouldn't execute during that time over to a
separate list that is not executed until out of idle.
To help with this, I reworked a bit how Alarm objects
are managed, so that when rebatching or moving between
lists we don't have to allocated new objects but can
just use the same existing instance.

Also tweaked the sync manager to deal with idle mode,
which currently just means doing the same thing as when
low on storage -- turning off sync.

Add new ACTION_CHARGING and ACTION_DISCHARGING broadcasts
that apps can listen for to know when the device is actively
charging and discharging. These are better than the old
POWER_CONNECTED and POWER_DISCONNECTED ones because we only
report charging when we actually see that there is enough
power being provided to charge the battery (and will report
discharging if there is not enough power).

The job controller uses these new actions for scheduling
jobs that want to run while plugged in. Removed the
"stable charging" stuff while doing so, since the new
charging state serves as an even better signal for that.

Introduced two new process states: FOREGROUND_SERVICE and
TOP_SLEEPING. This will allow us to treat foreground services
specially (such as still allowing network access to them for
background music playback) while not mixing them together with
whatever happens to be the top activity while the device is
asleep.

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e08af19fcc7b13d526f3dfd24d58300947cf1146 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: I88c539074607d7261f6c5cf1dbae47c3cf53f253
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e9b9b73ab598a912de04fbd5501bca5924ce8f71 07-Apr-2015 Bart Sears <bsears@google.com> Revert "Adding per UID WiFi power distribution."

This CL is breaking the clockwork settings app in master. Reverting
until Adam has a chance to investigate.

This reverts commit b943fabfc8ddb581dc2fd7288f87428dcb5d27b7.

Change-Id: Ieb11423c11cf9874a6175dce49843d0e1080c590
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
b943fabfc8ddb581dc2fd7288f87428dcb5d27b7 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: Ia3d97e0a1c3352127185c18626d8ba8221c9ab40
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
030980a1fbf0caecfe39722472ae16a8a6987055 02-Apr-2015 Kweku Adams <kwekua@google.com> Fixing issue related to printing out of display state and idle mode in the batterystats checkin.

Change-Id: I533bd53f375bf6d9f818a8e8aa75932986ad779b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4b6bd8d36b093d36d9ae80b43e95049c259d7319 19-Mar-2015 Adam Lesinski <adamlesinski@google.com> Retrieve WiFi info outside of BatteryStatsImpl

In order to not deadlock the system, we need to retrieve
WiFi energy info outside of the BatteryStats lock. We do this,
then pass that data down to BatteryStatsImpl to process.

b/19729960

Change-Id: Ib8beba1d5ac81d89144d502c4b688d0a88c5b102
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1e725a7ec9eb79bb447d5171839c453d672a895c 25-Mar-2015 Dianne Hackborn <hackbod@google.com> Battery stats: wakeup alarm tracking, general cleanup.

Instead of just tracking the total number of wakeup alarms
per package, track a count for each tag. Note this is only
wakeup alarms, not non-wakeup alarms.

Also tighten up the code a bit by exposing the actual ArrayMap
container through most of the BatteryStats API, so we can more
efficiently iterate over them (which is all we ever want to do
with those containers at that point).

Finally remove all printing of "since unplugged" stats, as
another step towards completely removing that tracking. If
nobody screams, hopefully soon we can go through and just get
rid of all the extra state we are carrying around that is
tracking that data.

Also note that currently the per-tag wakeup alarm data is
being reported in the human-readable stats, but in the checkin
data it is still being rolled up into a single number. To fix
this, I need to completely rework the pkg entry line to have
separate data for services and wakeup alarms (so have three
types -- pkg for the start of a package, wal for a wakeup
alarm, svc for a service).

Change-Id: I8033acca8742935cfe95511cdea730a405b17cab
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
88e98dfa59e68a860d8c3b462ec03bc0b06d6b5c 23-Mar-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode.

- There is now an API for people to find out about
its state.
- Moved DeviceIdleController to be closer to the
power manager implementation, since they are
closely related.
- Job scheduler now knows about idle state and doesn't
run jobs while the device is idle.
- Battery stats now keeps track of "idling" vs "idle mode".
Idling is when we consider the device to be idle,
independent of whether we are actually in deep idle mode.
This allows us to keep track of longer-term changes
independently of cycling in and out of idle mode.
- Battery stats also now keeps track of package changes in
its daily stats.
- Small optimization to network policy manager service to
not touch uids that do not have the NETWORK permission.

Change-Id: I0b3304fb3722c78cdfdd0c1eada7369ece7cbcf9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
39fa40cbadba3491b537ff2b5660d6507098da19 20-Mar-2015 Adam Lesinski <adamlesinski@google.com> Merge "Disable WiFi energy data collection to avoid deadlock"
cb204c3334efcf0d49e0c9ba307afa7225157004 20-Mar-2015 Adam Lesinski <adamlesinski@google.com> Disable WiFi energy data collection to avoid deadlock

This is a temporary fix to prevent deadlocking in the
system. Need to come up with a better solution for
accessing WiFi and other subsystems from BatteryStats.

b/19729960

Change-Id: I464e7490c9780249d2a3eef05ce084a7d84372c0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8ad2af7e5b28f71e7bdfc1bb097937c6c1d22b18 18-Mar-2015 Dianne Hackborn <hackbod@google.com> First stab at device idle mode.

Introduce a new device idle controller service that
monitor's the device state and determines when to go
in to idle mode. When in idle mode, all we do right
now is turn off network access the same as we do for
power save mode. Many more things should come in the
future -- stopping the alarm manager from scheduling
(most) alarms, telling GmsCore for it to stop doing
stuff, etc.

Battery stats now has state tracking for devie idle
mode, as well as events for the reasons we can come
out of idle mode (significant motion or the device
becoming active). Also added new events noting when
packages are installed.

Renamed the "low power" event in battery stats to
"power save" because the former was just way too
confusing.

Finally, fix buffer size reading kernel wake locks.
(Stupidly, just increasing the buffer size. Ideally
we should try to be smarter and grow our buffer to
fit the data available, but I'll leave that for
another time.)

Change-Id: I0be2062466c83ee9d890c6cf5a228d9cc4090eca
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
33dac5593519a3e9eb83550faf0d55f9f0caefdf 09-Mar-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Record energy info stats from WiFi and Bluetooth controllers

Surface some of this information in BatteryStatsHelper. If we are given a
total energy from the WiFi controller, we normalize the computed
energy of each app and blame them for a fraction of the real energy.

Change-Id: I64051b600f5d9f6ac4580d56ef0977971eb4be2d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
62793e4382b4b0b53d7373d92a62dc4e3ccbde05 09-Mar-2015 Dianne Hackborn <hackbod@google.com> Battery stats issues: fix jiffy handling, print scan counts.

Issue #19431959: Framework incorrectly assumes that kernel
clock_ticks are 10ms

We now retrieve the time of a jiffy from the kernel, and all CPU
times are now handled in milliseconds.

Issue #19571810: Add per-app breakdown of number of WiFi scans
in batterystats checkin data

Added to the report (the information was already being tracked).

Change-Id: If1702d6b9bcf851704129f1811471e68ed576a5d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d4a8af7b6a4dd663cb9c4d993ee41ca82af3c4cd 03-Mar-2015 Dianne Hackborn <hackbod@google.com> Add new "daily stats" tracking to battery stats.

Currently is only used for tracking the daily charge
and discharge rates. We keep up to 10 days of data.

Change-Id: I54e29e35ff60d9277da9e476cdab22f4a6d540bf
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d1eccbea388fde6a575acb4e797efdd07798344a 18-Feb-2015 Dianne Hackborn <hackbod@google.com> Add some detailed data as part of battery history.

Every time the battery level changes, a new extended
detailed use data structure is written to the history.
This currently only contains delta CPU use since the
last detailed entry (total CPU and to three uids), but
it gives us the infrastructure for adding more detailed
data in the future.

A detail entry for regular history looks like:

Details: cpu=15730u+2307s (u0a57=11312u+502s, 1000=2344u+701s, 0=473u+991s)
/proc/stat=15377 usr, 1797 sys, 197 io, 0 irq, 8 sirq, 23103 idle (42.9% of 6m 44s 820ms)

u is user-space cpu time, s is system/kernel time.

The equivalent check-in output is:

9,h,0,Dcpu=15730:2307/10057:11312:502/1000:2344:701/0:473:991
9,h,0,Dpst=15377,1797,197,0,8,23103

Also add a new "unplug" command to the battery service,
to easily put it into a state where it always considers
the device to be running on battery.

Change-Id: Ic76d966f11e592b9dd671879977bf999ebc11eef
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
29cd7f19625a2a2a8528469e55f3aa495107b9e7 08-Jan-2015 Dianne Hackborn <hackbod@google.com> Fix issue #18827122: system server crashed on broadcasting...

...an intent with invalid or null package uri

Also tweak battery stats to record in the history when we shut
down, to understand when restarts are due to clean shutdowns or
crashes.

Change-Id: I6443dafc23e356be9f569906f6081152d4f92d2b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8e 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17323751: Additional items in aggregated battery stats

- Now aggregate number of times each process has crashed and ANRed.
- Now aggregate total number of connectivity changes.
- Now record connectivity changes in the history.

Crash and ANR counts are new entries at the end of "pr" in checkin.

Connectivity change counts is a new entry at the end of "m" in checkin.

Connectivity changes in the history checkin are Ecn and include the
type of connection and its state.

Change-Id: I0c01186446034cf6c3fb97d45f5e3b5c69a0438a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d537987b173f6b48f5196a2ae7d445af1a49e2bb 25-Nov-2014 Kweku Adams <kwekua@google.com> Changing AUDIO_TURNED_ON constant.

Changed so that it's set to a different value from WIFI_MULTICAST_ENABLED.

Change-Id: Ied3a2c2bf891f887ec3c7b5249453af4524c099a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fb3809ca63c17ac09162e08ee3eef0bdae16dc73 30-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17705755: Battery stats resets at incorrect times

Revert back to (mostly) KK behavior, fix a problem where we were
collecting some data in an inconsistent state.

Change-Id: Ida3ca3fb734a9d7d61a90fd5044152e927c59e02
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
73d6a821aeecd6003c70c32f7ae6c38f062c4290 29-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17656716: Unhandled exception in Window Manager

Remove the checks for large parcel sizes. Those were triggering,
and identifyng the area of the problem, but also cause a lot of
trouble by making the unsafe deadlocky code there much more likely
to deadlock.

Add logging for strict mode IPCs, since those seem to be the
problem. Only log when things look bad.

Also add a log when battery stats are reset, to diagnose why they
are getting reset when they shouldn't be.

Change-Id: I588c858fb8d8c45f3c9c164ae2de9ae01547b304
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a7d0d557718d0feaa2760666cd95c66e2d88c551 13-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17477510: Time change notifications sent too often

This gets rid of the spam from the battery history, by not creating
an event unless the wall clock time has changed by more than
+/- 500ms.

We'll do the remaining work in MR1.

Change-Id: I8d1cc41b5504261033d3b0ccdcf9e7cf70df9d04
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c3940bc1ba753bcbeb9849239ec4b2ec685c40e2 06-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17397177: BatteryStats reporting error on job start/stop

Dumb, dumb, dumb mistake.

Also fix battery stats wakeup reason tracking to use a SamplingTimer
(like kernel wake locks) so we can track both the duration and count
for each wakeup reason.

Change-Id: I89d69661006dc533622b1b7e68a139166d3a6975
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
7d9eefd871f1cdc5ebc36fa92dae48a737ae2928 28-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16953886: History and batterystats checkin summary...

...start timestamps are in 1970s

Look for the wall clock time being very small, and try to update
it to a better value if we see one.

Also handle time change events to update the current time we a re
tracking.

Change-Id: Ifbae2b8c43ab5baa75ee4f672a752a542e23b52d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
acc4a120742eed5905de2c7ee690f251cc32a0ae 19-Aug-2014 Dianne Hackborn <hackbod@google.com> Temporary: raise overflow limit, print all wake locks.

Change-Id: I02baa775b8e0659bd9cd4547b8671730f056cb86
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d953c53d3b04d772bb1b62ede1c2011641ca82b5 17-Aug-2014 Dianne Hackborn <hackbod@google.com> Work on issue #16629489: Google (Play?) Services eating through battery

There is a bug in how we deal with name overflows combined with resetting
the battery stats data. If we do a reset while a wakelock is being
actively held that has been put into the overflow bucket, then we can
end up reducing the number of known wake locks in the list so when after
that it is released we try to release it under its real name rather than
the overflow name.

This means we need to keep track of which wake locks have been placed
in the overflow bucket while they are actively being used, so we can be
sure to properly handle it as part of that bucket until it is eventually
released.

This makes things... somewhat more complicated. So now we have a class
to take care of all these details, and also use it for other places where
we have the same overflow semantics sync and job stats.

Also fix potential deadlock -- BatteryStatsHelper needs to call on to
ConnectivityManager to find out of there is telepohny, however we use
that class when doing a dump while the battery stats lock is held. To
fix this, we check the connectivity state up in the battery stats service
before acquiring the lock and propagate that information through to the
dump code.

Change-Id: Ib452206af5c36f4b0f03cc94d2845d36613d1ba5
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9da2f1e007268a42248a1778aa9b560e3ce3b704 14-Aug-2014 Jeff Sharkey <jsharkey@android.com> Some networks may have null ifaces, I guess?

Seems like a bug further upstream, but guard ourselves against it
for now.

Bug: 17033841
Change-Id: Id0e5895c3389b63d4e34b1fb064efef8b72cd609
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cd0e335be354d117c553bb87b3432a75d550d21a 08-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issues #16655104 and #16875776 in battery stats.

Issue #16655104: Android system used 21% of battery

We weren't clearing the current process state when we now retain
process objects across resets.

Issue #16875776: abnormal outliers in screen-off battery life in go/batterystats

The checkin data since charged was using the since unplugged data
for the amount of drain with the screen on/off.

Also added a new version tag in the checkin output containing
the platform build number and internal version format number, to
start moving away from the wasteful version code on every line.

And fixed a bug in figuring out when things have changed over
discharge levels.

Change-Id: I89b89513a748016aacc848f14bbbc8b2400d92ca
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
0068d3dcf1f1a804554a1a09e3b173ac12651786 07-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue @16555033: Battery history overflowing too much

- No longer track process starts/stops normally.
- Increase buffer size to 256KB.
- Buffer size increase requires reworking how battery stats
are retrieved, since it is going to be hitting IPC limits.
- Also, store the last full stats after a reset, to be reported
at the next checkin.
- Also, discharge and charge times are tagged with the screen
and battery save state during that time.

Change-Id: Ie108ac9b626846108a9bb858101ac2b93276ac16
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
10eaa8574bb220e7dddf9a78057f83dc64ee5687 23-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16467284: Make noteStartVideo and noteStartAudio nesting

Also add new methods to clear these states, so we can avoid any
nesting issues from getting the tracking state stuck.

Change-Id: Iba0eaba2a9a186355c24d392f16118982c5331ed
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fdb1956ff71ff57fcdaafaaeb7f42c19de3d7c2f 12-Jul-2014 Dianne Hackborn <hackbod@google.com> Fix issue #15681802: Missing RESET:TIME in complete battery histories

But wait, there's more!

- Keep track of sync durations in the aggregated stats.
- Add events for users that are running and in the foreground.
- Rework the activity manager's tracking of stuff using
battery in the background to be based on proc stats, which
allows it to be better about determing when it should reset
its tracking of background work.
- Also add tracking of scheduled job execution, like we are
doing for syncs.
- And once I started hooking battery stats in to
JobSchedulerService, I found a few things I couldn't stop myself
from changing: (1) make it very explicit that it doesn't start
scheduling jobs until we have reached the point in system boot
where third party apps are allowed to run, and (2) adjust
the various for loops to not use iterators.

Change-Id: I69d812e27bcfee9e58a614f0f6b1c7545d7530b1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
61659e5daaea80104d4d0fd567e78b5f757b5df4 10-Jul-2014 Dianne Hackborn <hackbod@google.com> Add tracking of uid process states in battery stats.

We now keep track of how long each uid had processes in
various states: foreground, active, running. This is based
on a collapse of the various activity manager process states
into these three bins.

You'll see these in a checkin like this:

8,10013,l,st,61504,61504,83109

Also fix issue #16021555: App showing up as on "top" even
when the screen is off. This is "fixed" by just saying we
always report the current app at the top of the activity stack,
regardless of the state of the screen.

Change-Id: I1204904225101243eb00b43425d9806bffdd2ab9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
abc7c499133fe640d6ece2b28d43b52e66cdaa9a 01-Jul-2014 Dianne Hackborn <hackbod@google.com> Issue #15986092: Add power tracking of flashlight.

Not yet hooked up.

Change-Id: Id95e44ecc365e9f38169c0a629b0a48ddb29aa06
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3251b9075246841a7b1ddecf10859b1abd858f33 20-Jun-2014 Dianne Hackborn <hackbod@google.com> Add some wifi tracking to battery stats.

Now track supplicant state and wifi signal strength.
Output looks like this:

+12m45s235ms (1) 095 +wifi_full_lock +wifi_running wifi_signal_strength=3 wifi_suppl=scanning
+12m46s095ms (1) 095 -wifi_full_lock wifi_suppl=associated
+12m46s469ms (2) 095 wifi_suppl=completed +proc=u0a74:"com.google.android.videos"
+12m52s103ms (1) 095 +wifi_full_lock wifi_suppl=disconn

Also modify history dump so that when we hit a RESET or START
command, we clear our previous history data, so the next event
will include new data. This means if you are scanning through
the output, you must at this point clear any binary stats you
have like "running" or "wake_lock" or else you will continue to
think they are on until whatever point later they get turned on
and then back off.

And a small bug fix in proc stats that would cause the system
process to crash.

Change-Id: Ibec416a1ef786d428bd0d1d86e6e3296c41f7648
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
f7097a5b697fedb6976774e55a51471405a23c0e 13-May-2014 Dianne Hackborn <hackbod@google.com> Add kernel and native memory data to procstats.

We now collect memory use data in the kernel and native
application for aggregation in procstats. This should
allows us to do aggregated summaries of how memory use
is distributed across the system -- how much is free vs.
how much is in use.

Fix a bug in how we were tracking per-app version codes:
apps that used a shared user id to have multiple packages
run in the same process could get their version codes
cross-wired. Now we keep track of version codes in the
list of packages associated with a process.

Bumped the checkin version code to 5, so that we can
distinguish checkins that have this corrected data.

Also fix a bug in battery stats monitoring radio state.

Change-Id: I1c849f2df442df679a34ad7b0ca0c5870bfac8df
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fc0641340ff927d9c35d5613723d25858f751118 02-Jun-2014 Dianne Hackborn <hackbod@google.com> Some battery stats history fixes.

- Now the full wake history uses the history tag if it can.
Hopefully this will still result in a consistent history,
since that isn't really want the tag is for... but the
current implementation in places will probably make this work.

- Possibly fix a bug with inconsistent state between partial
history snapshots: after a snapshot is printed, don't allow
any more batching into the most recent history entry, so the
next snapshot will not miss anything that might get placed
into it soon after.

Also rework command line arguments for enable/disable to make these
commands instead of options.

Change-Id: Ia33445cad1538bf8df549cef284f1e736efbc079
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
536456f2d4c0d93bb55950ce5edc24e9bb9547eb 24-May-2014 Dianne Hackborn <hackbod@google.com> Fix issue #15195464: battery history says wakelock held when it's not

Simplify full wake lock logging, so wake_lock_in is a completely
separate event from wake_lock and provides the full real raw log
of wake lock events.

Also attempt to address issue #15018750 (Incorrect wakelock reporting)
by no longer being complicated and rolling up previous state in to a
new history slice.

Bug: 15195464
Bug: 15018750
Change-Id: I32154bdfc2f07113be969f9db5503b2f2807a427
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
293251318168ad2dbfeb3d18176936fe2cc16325 22-May-2014 Dianne Hackborn <hackbod@google.com> (DO NOT MERGE) Battery monitoring fixes:

- Improve monitoring of level changes to not be confused
when it goes up while draining or down while charging.
- Put back in connectivity service code to tell battery
stats about the interfaces.
- Turn back on reporting of mobile radio active state
from the RIL.
- Fix bug in marshalling/unmarshalling that would cause
the UI to show bad data.

Change-Id: I733ef52702894cca81a0813eccdfc1023e546fce
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9a7554300637902bbb25991ffba41a9b8f682eff 16-May-2014 Dianne Hackborn <hackbod@google.com> Fix recording of wake_lock_in.

There was a bug that would allow the nesting count
to get off. Also better documentation of times in
HistoryItem, and new option to disable resetting of
the stats when unplugging.

Change-Id: If1b39a02475c5b620c67b700a323a6d0462d5c61
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cbefd8dd2befcb768f911a63becc427ec4c13250 14-May-2014 Dianne Hackborn <hackbod@google.com> Battery stats more wake history, power save mode.

Add new option for battery stats to record the full wake
lock history, and recording the current power save mode.

Also add in some additional error constants when generating
Binder error exceptions.

And fix issue #14974572: Avoid repeating wakeup_reason at
the beginning of history

Change-Id: I7c1a2ab9569de216634f63d8ad69f1294ef1d235
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
37de0989359be9c31b91d3608d2cfe63546c38ea 09-May-2014 Dianne Hackborn <hackbod@google.com> Battery stats tweaks.

- Generate currently active events when a partial
history is requested.
- Tag wake lock release with the wake lock name if it is
different than the one that was acquired.
- New RESET mark for the start of the history.

Change-Id: Ic105656649c46f52855946ed0ad7f98f1d24dedc
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e95c3cd89591ba586aa8a0f7a17660c6fb8770bc 03-May-2014 Jeff Brown <jeffbrown@google.com> Plumb display state and interactive information to BatteryStats.

Fixes an issue where dozing was treated the same as the screen
being fully on. Now dozing is treated the same as the screen
being fully off which is slightly better. The decision of how
to represent this state is now internal to the battery stats
so it can be improved later.

Removed noteInputEvent() since it is unused.

Bug: 14480844
Change-Id: Iee8cf8dce1a1f91c62678bb6d3d9fe567ad6db42
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ab5c0ea43cf457b20ab4267a14b224f39e0511bf 29-Apr-2014 Dianne Hackborn <hackbod@google.com> Add IBatteryStats API to retrieve current charge times.

Also include charge/discharge information in dumpsys.

Change-Id: Ica1b333ad334dc698d4a67da391b378757662f41
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
260c5020ae65ddd14668b8ae496c169082aa13f6 29-Apr-2014 Dianne Hackborn <hackbod@google.com> Implement better computing of battery drain time, actual charge time.

Also move time formatter in to framework for use elsewhere.

Change-Id: I42b6a44414b68754af65c522bef5591da5643909
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2ffa11e4b71c545e34533ef827bdc1a07fbe8246 22-Apr-2014 Dianne Hackborn <hackbod@google.com> Start collecting mobile radio activity from the radio.

Hook in to the new radio API to find out when the radio
is active and use that to track its state in batter stats.
We also still have the data being tracked from the kernel's
emulation, and continue to use that if we don't get data from
the radio.

Currently this monitoring is turned off until some issues
in the radio can be fixed that are providing bad data.

Also add a new API to get estimated drain and charge times.

Change-Id: Ifc4900fabb8f848f9cda361dce698664ea75f175
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
99009ea7dcc196cd97756d70ed69499025229bd9 19-Apr-2014 Dianne Hackborn <hackbod@google.com> Try to always print time stamp in battery history.

Also fix printing of string pool to quote the strings
and escape characters, and change history time stamps
to print starting at 0 and going up.

Change-Id: I2d0c080f2b5de7b27b20a7357c2c0cf481c82d8c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ef640cdfb29caf9d0abf4aba020afbc3eb3e0443 25-Mar-2014 Dianne Hackborn <hackbod@google.com> Don't allow -1 uids for wake locks.

Change-Id: Ia1b412a166f69247be3b047138349e7b4031bd7d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4590e52f3d0558e01322fe4dd55bb612afdfb079 24-Mar-2014 Dianne Hackborn <hackbod@google.com> Battery stats: wake locks, radio active, cleanup.

- Improve wake lock work source updates to also update the current
history tag, in case the new work source gets recorded in the
history.

- Fix bug in recording radio active time that was not distributing
any time to apps.

- No longer hold a wake lock while dispatching data conn active call,
since it comes with its own timestamp.

- Fix issue where the top app was not being cleared while the screen
was off.

- Remove obsolete STATS_LAST stats type.

- Fix bug that was not clearing the total run time when resetting
the stats.

Change-Id: Iabe17a9edf34f762374ae09fcffb8a819cf72e30
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a1bd79268be693f04f4adee90673d6ed400cc9fd 21-Mar-2014 Dianne Hackborn <hackbod@google.com> Battery stats: track actually running time

Use the uptime while creating the battery stats history to
generate a new event indicating when the CPU is actually running.
We can do this in combination with the new event reporting when
the CPU comes awake, looking at the difference between the
uptime and elapsed time at that point to determine when it last
when to sleep.

Also use this information to generate a new set of aggregated
states, the uptime caused by each wake reason.

Finally use new radio down timestamp to adjust the times we
compute for radio use. Note that this information is not (yet)
being used to adjust how these are recorded in the history.

Change-Id: I723b3b526c8e7d64de0cac9d1193e04132d5a3e4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
40c8725804f46c9d53f2815e0ee69e6cfb0152cc 20-Mar-2014 Dianne Hackborn <hackbod@google.com> batstats: fix wake lock tracking, service bug

- Fix bug I introduced in handling wake lock changes where
we weren't iterating over the new work sources correctly.
- Fix bug in ActiveServices that would wtf too much.
- Prepare to start tracking uptime in the battery history.

Change-Id: Ia94316be51bc6eab7b02f214a5c40c08e99cc3b1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
bbb7472b8e378a46a1e77747265c19d22bd6968c 13-Mar-2014 Dianne Hackborn <hackbod@google.com> Fix some uid issues in battery stats.

Change-Id: I9f7773568ff12603d51b26d50d758add09bedbb2
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e5167ca61e2c5607aad9041b44158581bc61b4d8 08-Mar-2014 Dianne Hackborn <hackbod@google.com> Reduce wake lock noise in battery history.

When the work source of a wake lock was changed, this would
cause the old wake lock to be released in battery stats before
the new one was acquired (the power manager would correctly
keep holding the associated wake lock). This resulted in a
pointless entry in the battery history showing the last wake
lock being released and a new one acquired.

This change adds a new path in to battery stats to report
when a wake lock has changed, allowing it to acquire the
new wake locks first before the old ones, so it can't drop
down to zero wake locks. This also provides better timing
information, as the same current time can be used for both
operations.

In addition, added a new kind of history entry for the
current time, so you can tell when in actual world clock
time the battery data is happening.

Change-Id: Ibbf2eed83bb93f31f60267889b7bc5b9e71e355f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c51cf03cf2458c8c137f60c7379f2cccf681d16f 03-Mar-2014 Dianne Hackborn <hackbod@google.com> Start recording wakeup reasons in battery history.

Depends on a modification to libsuspend so that we can get
a callback each time the device wakes up, to read the current
wakeup reasons from the kernel. These are then stuffed in
to a new field in the battery history.

Also add new dump options --history-start and --charged
to better control what is dumped.

Finally the alarm manager uses a "*walarm*" tag for history
item wake locks that are coming from a wakeup alarm.

Change-Id: I457571973d5b2b5fdc4e4b63ab16275db20d7edd
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
97ae538554e5d894774ddd55c266434ce1d67492 06-Mar-2014 Dianne Hackborn <hackbod@google.com> Formalize time bases in battery stats.

Battery stats used to revolve around a single time base
it maintained, "battery uptime and realtime." This is derived
from the system's uptime and realtime, but only increments while
the device is on battery. It is used to update its timers for
things like the screen being on, wake locks, etc only while the
device is not plugged in to power.

This change formalizes that time base into a separate class that
maintains all of its state. This is used to introduce a new
time base, "battery screen off," which only increments while the
device is on battery *and* the screen is off. Wake locks are now
based on this time base, so we don't count them while the screen
is on -- it is misleading to have them increment while the screen
is on because the device is defined to always stay awake anyway
during that time, so what they are doing is irrelevant.

Change-Id: I020e20c930d8dca2953c6c3ddef1dc93c24161a5
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
77b987f1a1bb6028a871de01065b94c4cfff0b5c 27-Feb-2014 Dianne Hackborn <hackbod@google.com> Hold a wake lock while dispatching network activity events.

Also add new API for determining whether the current data network
is active, and thus better scheduling network operations. This
API is designed to not be tied to a mobile network -- regardless
of the network, apps can use it to determine whether they should
initiate activity or wait. On non-mobile networks, it simply always
reports as the network being active.

This changed involved reworking how the idle timers are done so
that we only register an idle timer with the current default
network. This way, we can know whether we currently expect to
get callbacks about the network being active, or should just always
report that it is active. (Ultimately we need to be getting this
radio active data from the radio itself.)

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d45665bf0b26fddf5716a0fd43036848d9301960 26-Feb-2014 Dianne Hackborn <hackbod@google.com> Collect per-uid mobile radio usage.

We now compute radio active time per application, by distributing
the active time across all applications each time the radio goes
down, weighting it by the number of packets transferred.

Per-app radio power use is now computed using this radio active
time.

This also gives us a new metric "ms per packet", which give an
idea of how effectively an application is using the radio. This
is collected and reported as a new set of stats in the human-
readable checkin. (It can be computed from the raw checkin data).

Also improve sync reporting to include the sync source as used
in wake locks, not just the component name.

Change-Id: I0b0185fadd1e47ae749090ed36728ab78ac24c5e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a1f1a3c573acd91024fda0ceb3b921c73b186963 25-Feb-2014 Dianne Hackborn <hackbod@google.com> More battery stats.

- Add events for sync.
- Add more descriptive tags for wake events.
- Fix battery reset.
- Fix tracking of wifi data.

Change-Id: Ic07f2a86a5ed33e7da57eb1108c31c777ecd801f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fb7b50a0263e500a6a8d2bbd7366b06d1fc91fe3 25-Feb-2014 Dianne Hackborn <hackbod@google.com> Fix some issues with network usage in battery stats.

Change-Id: I8b354872511fcb55cecb2e09aada2eab41a1e202
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d0c5b9abed60b7bc056d026bf0f2b2235410fb70 22-Feb-2014 Dianne Hackborn <hackbod@google.com> Improve how battery stats collects network stats.

This optimizes the path for battery stats to collect
per-uid network usage. It now collects wifi and mobile
usage separately, with a path that allows it to recycle
all data structures and filter out stats it isn't
interested in before they come back to java.

This is setting us up for the actual goal, to collect
mobile stats independently each time the mobile radio
goes down, allowing us to distribute mobile radio usage
across uids based on the number of packets they transferred
during a session.

Change-Id: I21a0f517cf087ea5aa8b8dd535e20b46e361a52b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
00e2521d2a75c51585795e5c74b5857c543eb120 19-Feb-2014 Dianne Hackborn <hackbod@google.com> Fix issue #13095629: Device is in restart mode for long time...

...during taking OTA

Add some sanity checks.

Change-Id: I6bec1b8d8443c4b3c2a706635acf89c8e5051428
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ca1bf21c511dc7d513b631a1af8498b5b08d107a 14-Feb-2014 Dianne Hackborn <hackbod@google.com> Implement wifi part of issue #12973036: Improve power_profile.xml

Add battery stats tracking of wifi state.

Also update when we retrieve the current time to use a more
consistent value across stats tracking.

Change-Id: I6a7c3efd58ff2c8ea86dac141c8f848e7996d63f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e13c4c0b664dabdc069ca8f9601d96a337eb02f9 12-Feb-2014 Dianne Hackborn <hackbod@google.com> Start tracking radio up time.

We now always turn on network state tracking for mobile,
and push this information down to battery stats.

In battery stats we use this to both log the changes in
the history and keep track of the total time the mobile
radio was active.

Power computation is switched over to using this information
to help determine power use, which will hopefully make it
more accurate (not counting inaccuracies in knowing when it
actually goes down).

Note yet done is aggregating this data per-uid, to better
emphasize which apps are causing the radio to be up. Right
now we just spread the total time across all uids weighted
by the total number of packets they have sent and received.

Also put in the battery stats infrastructure for bluetooth to
address issue #12973036: Improve power_profile.xml

Change-Id: I39d11b7ff6ae4f336f253d1cba308d8569de7e0d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
eaf2ac464b1cd741d7d0fe700771b1b7c00ddb29 07-Feb-2014 Dianne Hackborn <hackbod@google.com> Battery stats: more events, fixes.

Add new history events for top application package and
foreground application packages.

Doing this involved a fair amount of improvement to history
events. The event code is now separated out to have "start"
and "finish" identifies, and we use that to now keep track
of which events are active. With that, when resetting the
stats, we can spit out all of the currently active events at
the front of the new history.

Also fixed some problems when I re-arranged the history delta
int bits that were conflicting with the packing of the battery
status bits. These packing structures are changed to work
together correctly.

Change-Id: Ic8b815060dd8a50ff4a0a209efc2e1044215cd88
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3d658bf20e2d56e36941e7407deebeec1276fbcf 05-Feb-2014 Dianne Hackborn <hackbod@google.com> Improve logging of first wake lock, history size.

We now try to have a better label for the first wake lock
that is acquired in the log. This is done in two ways:

- The alarm manager now sorts the alarms it is going to
execute so that wakeup alarms are first, which are more
important w.r.t. which one should be logged.
- There is a new power manager facility to make a wake lock
as "unimportant for logging," which just means in battery
stats that a wake lock acquired after that can be considered
the actual one to log. This is only used by the alarm manager
to mark its TIME_TICK alarms as unimportant for logging.

Also reworked the battery history code to be cleaner and a bit
smaller. There is no longer a separate EVENT command, instead
the event code and tag are just another thing that can be included
in an UPDATE command.

The bits used in the first history int are also re-arrange, so
that only the ones that really change a fair amount in the state
bits are up at the top and there is no longer space used for
the command code (since now it is always just UPDATE). This
allows us to have more room for the time delta at the bottom,
to better avoid situations where we need to write an int delta.

Change-Id: I1bb860ae5b558a248800b090b03a84fbf7acd68a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
71fc13eb583eecc677b177b8010538a08aebb43d 03-Feb-2014 Dianne Hackborn <hackbod@google.com> More battery history improvements.

- Better batching of history items. Fixed problems where empty
entries would be created because state toggles got lost.
- The string pool is now a HistoryTag pool, containing both a string
and uid; now an entry only requires 16 bits in the history data.
- Acquiring the first wake lock also now includes a HistoryTag
identifying who did the aquisition.
- Cleaned up printing of signal strengths and cell radio types.
- There was code that tried to allow you to add new history entries
while iterating the history... but these should never happen
together, so turned that into a failure... and fixed an issue
where we could leave the battery stats in a state where it
thinks it is continually iterating.

Change-Id: I1afa57ee2d66b186932c502dbdd633cdd4aed353
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5f4a5f9536eb171bf21a9293198d90c9891e7205 25-Jan-2014 Dianne Hackborn <hackbod@google.com> Add "start time" timestamp to battery stats.

Change-Id: I902269b98b40b2421245bfd8971f34df5ff9214e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
099bc627c463d9941e23e480f25a78a154429c55 22-Jan-2014 Dianne Hackborn <hackbod@google.com> Battery stats improvements.

- Adjust total power use when there is unaccounted power so that our
percentages don't end up > 100%.
- Fix accounting of isolated uids to be against the owning real app
uids.
- Rework how we put cpu use into the battery stats to no longer need
this uid name cache that can confuse the uid it is associated with.
- Finish implementing events in the history, adding a string pool and
reading/writing/dumping them.
- Add first two events: processes starting and finishing.
- Fix alarm manager reporting of wakeup alarms to be adjusted by the
WorkSource associated with the alarm, so they are blamed on the
correct app.
- New "--history" dump option allows you to perform a checkin of
only the history data.
- Fixed BitDescription bug that would cause incorrect printing of
changes in some states.

Change-Id: Ifbdd0740132ed178033851c58f165adc0d50f716
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
09d30981f8e882ffaa336aa4665bfe348557895a 16-Jan-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 6f357d32 to master

Change-Id: I1979e6ed1acddbe656f5010114fd900f10865e75
6f357d3284a833cc50a990e14b39f389b8972254 16-Jan-2014 Jeff Brown <jeffbrown@google.com> Start untangling system server early bootstrapping.

Refactored SystemServer to get rid of a bunch of legacy cruft related
to how the ServerThread used to be started up.

Create system context first when system server starts. This removes
the tangled initialization order dependency that forced us to start
the activity manager service before most anything else.

Moved factory test related constants into the FactoryTest class.

Partially migrated Installer, ActivityManagerService, and
PowerManagerService to the new SystemService pattern. There's more
work to be done here, particularly around the lifecycle of the
power manager.

Bug: 12172368
Change-Id: Ia527dd56e3b3fd90f9eeb41289dbe044921230d4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a7c837f043c1ca0bdecd42645ba7da8c5717566d 16-Jan-2014 Dianne Hackborn <hackbod@google.com> Add battery power use reporting to batterystats service.

Move the BatteryStatsHelper class (which computes power use based
on the raw battery stats) out of the settings app and in to the
framework. It is now used by batterystats dump output to print
the computed power information from its current stats.

This involved a lot of refactoring of the BatteryStatsHelper code
to remove all of the UI dependencies. I also did a bunch of cleanup
in it, such as making all power computations be in terms of mAh.

Change-Id: I8ccf2c9789dc9ad34904917ef57050371a59dc28
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
57ed6a6440ff010494a03c6c68ce6dc0924b57d6 10-Dec-2013 Dianne Hackborn <hackbod@google.com> Improvements to battery stats.

Now collect per-network packet usage data.

Big reworking of history to be able to start adding more events to it.
Also rework how the checking dump is done to make it more compact, so
maybe we can start uploading it.

Change-Id: I2b29e049ebe073671d0dbe38324223cc2ec0d043
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c3eef19047b897bfb6e3cf42220d5146b187c66e 07-Nov-2013 Robert Greenwalt <rgreenwalt@google.com> am f1612bcf: am e8c51298: Merge "Add BatteryStats for Wifi Batched Scanning." into klp-dev

* commit 'f1612bcfdd2cb517948f14369fd0977ceb55d19c':
Add BatteryStats for Wifi Batched Scanning.
a029ea131836725b050e1a7550aa171b68171522 26-Sep-2013 Robert Greenwalt <rgreenwalt@google.com> Add BatteryStats for Wifi Batched Scanning.

bug:10690989
Change-Id: Ia39b715ee6d5733970095bc76de0ed40ff8208c0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
b4328566fa415b69974a9721ec690a1b74880873 06-Nov-2013 Patrick Tjin <pattjin@google.com> am 5eecb9e8: am bd9513f3: Merge "Add HSPA+ to BatteryStats" into klp-dev

* commit '5eecb9e8d44b3864a3261a3c5ebfbb9c606e77f5':
Add HSPA+ to BatteryStats
b71703cfdfbac35a6e5afaa437d073cf835c25db 06-Nov-2013 Patrick Tjin <pattjin@google.com> Add HSPA+ to BatteryStats

HSPA+ was being shown as connection type other in battery
statistics because it was not updated when TelephonyManager
was changed.

Bug: 11552902
Change-Id: I85ce7c393bf93010a4ac8437f14684015ad0391a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
81b7caf0d12fb56ab40592467d6b1cbcaef8f0b4 30-Oct-2013 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 5214dae4 to klp-dev-plus-aosp

Change-Id: I769e7acbe207b9c3a60ff1576d11b3ab40b8c66d
c7e9e8b4f3e264375b416eff830739ecf0dc206c 15-Jan-2013 Sungmin Choi <sungmin.choi@lge.com> handle negative temperature

When the battery temperature drops to below zero, BatteryLevelInit()
fails to show negative temperature. Because the type is unsigned
and the size of bit field is 10 bits.
So to handle negative temperature, change the type of battery temperature
from "char" to "short". And extend the size of temperature bit field
from 10 to 11 bits, which first bit is used for the sign bit.

Before:
31 24 14 0
+---------------+---------------------+-----------------+
| Battery Level | Battery temperature | Battery Voltage |
+---------------+---------------------+-----------------+

After:
31 25 14 0
+-------------+-----------------------+-----------------+
|Battery Level| Battery temperature | Battery Voltage |
+-------------+-----------------------+-----------------+

Bits 31..25: battery level percentage (7 bits unsigned)
Bits 24..14: battery temperature (11 bits signed)
First bit is used for the sign and others for the temperature
Bits 13..0: battery voltage in 0.001 volt units (14 bits unsigned)

Becuase of changing the format, let the BatteryStatsImpl.VERSION field
increment.

Bug: 8009514
Change-Id: Iaa12f4d3f14e6cf4d73bc1a23d81c60f9677a499
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
904a857d5a319e32d1df065b38e3191324b35b0f 29-Jun-2013 Dianne Hackborn <hackbod@google.com> More work on procstats: save/restore state, fixes.

We now persistent the current procstats to storage
to keep them across boots. Still need to do division
and pruning across days; right now they will just keep
collecting forever.

Also fix some bugs in the checkin output.

Change-Id: I4dd9317dbe2ee0642af8f2f0be1f2bd9c4055e80
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
13ac041b9f21043bc7c848a743be618bfd7a67e9 26-Jun-2013 Dianne Hackborn <hackbod@google.com> Update procstats to start collecting/reporting pss.

Completely reworked how it manages its data, since trying
to keep track of all of the possible pss data with the old
data structures would have made it huge. Now we have a sparse
data structure for pss and process times. (Will switch service
times over to it soon.)

Currently the only thing that collects pss data is running
"dumpsys meminfo". More will be added later.

Modified checkin output to also scale better as more distinct
data categories are added, and added output of pss data. Now
instead of dumping every possible entry as a comma-separated
list, it dumps a comma-separated list of only the entries with
data, tagged with the state they go with.

Also fixed some problems in the checkin reporting of batterystats
(it needs to escape commas), added checkin reporting of the history
list, fixed parsing of kernel wake locks to strip quotes, fixed
wake lock name that the sync manager generates to be more sane.

Change-Id: Ibf4010838a9f685ebe1d93aff86c064ccc52b861
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8c84109b9fbbf473b225707a38261ff5f99d95fb 24-Jun-2013 Dianne Hackborn <hackbod@google.com> Use FastPrintWriter... everywhere.

One problem this turned up is, because FastPrintWriter does
its own buffering, a lot of code that used to use PrintWriter
would fail -- if it pointed to a StringWriter, there was no
buffering, so it could just immediately get the result. Now
you need to first flush the FastPrintWriter.

Also added some new constructors to specify the size of buffer
that FastPrintWriter should use.

Change-Id: If48cd28d7be0b6b3278bbb69a8357e6ce88cf54a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cbfd23ee6f14445c3e17c5169abbc80c216fa137 11-Jun-2013 Dianne Hackborn <hackbod@google.com> Add new API to retrieve a dumpsys of a single package.

Adds a platform API, and pm command. Fixes some issues with
dumping per-package data in package manager, makes battery
stats able to dump per-package state.

Change-Id: I76ee6d059f0ba17f7a7061886792b1b716d46d2d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
7a1c3fce478122b9f03464117dc94d44f7c1995e 04-Jun-2013 Jeff Sharkey <jsharkey@android.com> Accumulate network statistics based on deltas.

Network stats are now read out of the kernel in one sweep, instead of
reading per-UID. We now accumulate the delta traffic between each
stats snapshot using the well-tested SamplingCounter pattern.

Since Wi-Fi and mobile traffic have different costs, track each
separately. Avoids counting misc interfaces like loopback and
ethernet under total.

Bug: 5543387
Change-Id: I642004dc530113c27ef79f2abbae51d8af30117f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
84f3c5689cffbfc1e45a0101d5bb636323769f54 05-Jun-2013 Jeff Sharkey <jsharkey@android.com> am ffbbe945: am d293d229: Merge "Create missing Uids when recording network stats." into jb-mr2-dev

* commit 'ffbbe945066bf0b295ff65edfb1c49f7a4311718':
Create missing Uids when recording network stats.
51797ed706e6e30cddfc0c1e3a9865064f8cdd6e 04-Jun-2013 Jeff Sharkey <jsharkey@android.com> Create missing Uids when recording network stats.

Bug: 5543387
Change-Id: I138c8d2f84e6fd737f2f6ef0945e75ca31256e3d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fee8cd75823413a28f004d13e1f25a8954ac2900 10-May-2013 Dianne Hackborn <hackbod@google.com> am e8c9b39e: am 83d6df27: Merge "Help on issue #8863955: Google Services keeping phone awake..." into jb-mr2-dev

* commit 'e8c9b39ec976029d3571f8904a3db21d6514ecf6':
Help on issue #8863955: Google Services keeping phone awake...
af17baa27196e785989e99b0ecbe7f1c98a1f0cb 10-May-2013 Dianne Hackborn <hackbod@google.com> Help on issue #8863955: Google Services keeping phone awake...

...because of Google Play Services

Raise the limit on the number of wake locks we track per uid.

Get rid of the separate limit for the system process, since it
now isn't any larger than the new limit for regular processes.

Change-Id: Ic10c81cad7d4ad4aabf1f53f78191a0973a1d784
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ec43a6bc17d90058ba2c00e016846c863ab239bc 30-Apr-2013 Jeff Sharkey <jsharkey@android.com> Better --unplugged support when dumping battery.

Also fixes logBatteryStatsLocked() to output valid dump data, instead
of just a usage message.

Bug: 8708665
Change-Id: Ie0d8d90e1a470b7e1e902643333309c2cf7bdb72
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3e013e85b0dfb9db58a4401b80d672a7eeb09d47 25-Apr-2013 Jeff Sharkey <jsharkey@android.com> Track foreground activities in battery stats.

To help correlate battery usage against actual foreground app usage,
start tracking time on a per UID basis. It uses the nesting feature
of StopwatchTimer to track multiple PIDs inside the same UID.

Improves units on docs, and persists foreground CPU time with a
consistent ordering. Reports foreground activities time and
foreground CPU time.

Change-Id: I95d12963923e3fd421730f6fbfc842dfd8d3a055
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9a2c2a6da90abbcc9a064c20e93ed885651f4ae1 15-Jan-2013 Jeff Sharkey <jsharkey@android.com> Parse network stats using native code.

Switch to parsing detailed network stats with native code, which
is 71% faster than ProcFileReader.

Change-Id: I2525aaee74d227ce187ba3a74dd08a2b06514deb
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a06de0f29b58df9246779cc4bfd8f06f7205ddb6 12-Dec-2012 Dianne Hackborn <hackbod@google.com> New "app ops" service.

Initial implementation, tracking use of the vibrator, GPS,
and location reports.

Also includes an update to battery stats to also keep track of
vibrator usage (since I had to be in the vibrator code anyway
to instrument it).

The service itself is only half-done. Currently no API to
retrieve the data (which once there will allow us to show you
which apps are currently causing the GPS to run and who has
recently accessed your location), it doesn't persist its data
like it should, and no way to tell it to reject app requests
for various operations.

But hey, it's a start!

Change-Id: I05b8d76cc4a4f7f37bc758c1701f51f9e0550e15
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
86d09388ee1b98513de40dfff5de6e7c3b24cc07 08-Aug-2012 Jean-Baptiste Queru <jbq@google.com> am bce41358: am 9ab84c20: Merge "Fix wrong count return for getPhoneSignalStrengthCount"

* commit 'bce413587973eae29a783d7e273dc2f7db06f7c9':
Fix wrong count return for getPhoneSignalStrengthCount
df693de4fe12f081555b449e2726e205fbd86572 27-Jul-2012 Jeff Brown <jeffbrown@google.com> Fix inconsistency in user activity types.

Looks like BatteryStats was not updated when we reduced the number
of user activity types from 7 to 3.

Change-Id: I7465f86c78baa561a6555c33f681553b870827f2
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
fb900813511df0706469ad340bfb0810b5a12cd7 17-Jul-2012 Catherine Liu <wlcl05@motorola.com> Fix wrong count return for getPhoneSignalStrengthCount

Test report for the time spent in each signal strength bin, along
with the number of times that bin was entered showed the result
as Bin=3 Time=3211926000 Count=0. With a non-zero Time, the Count
value 0 was wrong.

The cause of the problem was that getPhoneSignalStrengthCount() used
mPhoneDataConnectionsTimer, instead of mPhoneSignalStrengthsTimer,
to get the count.

Change-Id: I55ac1125abfcfdc105605d76d1c706ac315b90cc
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
73f534a2dd324d631696ced762f5c0ab1f254f74 19-Jun-2012 Todd Poynor <toddpoynor@google.com> Battery stats: parse wakeup sources stats for android-3.4

Change-Id: I30b2362ca7260d187e8ed4e047b30c446d32ca98
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6ccaa540a18a69e5343e3e4d507f341880fcde5a 16-Jun-2012 Nick Pelly <npelly@google.com> Include WIFI scan's in Battery Stats.

Call noteWifiScanStartedFromSource() when a scan is started.
Call noteWifiScanStoppedFromSource() when a scan is finished.

The current implementation tracks to UID that requested the scan, and
correctly tracks the duration of the scan. It ignores scan requests
that occur when a scan is already in progress. It does not distinguish
between active and passive scans.

Repurpose all the noteScanWifiLockAcquired/Released() plumbing
for WIFI scan tracking. The WIFI scan locks were never reported
to the user. Use noteFullWifiLock() when WIFI scan locks are used -
this makes sense because the power draw for a WIFI scan lock
should be about the same as for a full WIFI lock.

Bug: 6642581
Change-Id: Ida6e87992853698545b89f875c973a239218317d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e8914c36276710de50b347c1e6aecfa45d6a56cd 02-May-2012 Jeff Sharkey <jsharkey@android.com> Begin collecting xtables iface counters.

Add method to parse new iface_stat_fmt proc stats, or return null
when kernel support is unavailable. Add test and remove older, unused
parsing code. Create new "xt" recorder to persist the new xtables
counters when available.

Add SSID support to NetworkIdentity to fix policy tests.

Bug: 6422414
Change-Id: I77f70e9acb79a559ab626f3af5c4f3599801ed43
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
418d12dc8f2c518b673ebc522de4af6f7dbf0bf3 14-Dec-2011 Jeff Sharkey <jsharkey@android.com> Avoid reading network stats when disabled.

Bug: 5518868
Change-Id: Idb5c588b018bf735597ad7ff904ecc69224dd0a0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
45f06460e9aeadadad27e6c87817940cd96128ef 22-Nov-2011 Amith Yamasani <yamasani@google.com> Fix an NPE on overflow in BatteryStats history.

When the battery stats buffer hits 128KB, it hits a code path
that causes an NPE. This can happen depending on usage and charging
patterns and manifest in bad ways, such as failure to boot up
or random crashes, or refusing to go to sleep.

Bug: 5645407
Change-Id: I21d5d189431f776f25bcb7d598c86e598ad8cb17
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c24ab866b0d46685f6ddd340b9c84375cf8d6831 19-Oct-2011 Dianne Hackborn <hackbod@google.com> Work on issue #5465917: Wakelock *overflow* held for very long times

- Fix ordering problem in sync manager that would cause its wake
locks to slightly appear in the system process when they should
be fully accounted against the app.
- Allow the system process to have more wake lock names in its
battery stats.
- In the bug report output, print totals of the wake locks for each
process, to make it easier to parse what is being printed for things
like the system process with a huge number of individual wake locks.

Change-Id: I3cf39330f22f3c51c11e65e4124150d73a7da2dd
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1059c3c30ad96a15695c1a92ae8896e078a6309f 05-Oct-2011 Jeff Sharkey <jsharkey@android.com> Move battery stats to xt_qtaguid for data stats.

Replace TrafficStats calls by reading values from xt_qtaguid kernel
module. To keep BatteryStatsImpl changes lightweight, cache recently
parsed stats. Tracks mobile ifaces from ConnectivityService.

Refactor xt_qtaguid parsing into factory outside of NMS. Add stats
grouping based on UID, and total based on limiting filters like iface
prefix and UID.

Bug: 4902271
Change-Id: I533f116c434b77f93355bf95b839e7478528505b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e8c88e6f764a77d94b0051ea169a82a61fcc0d0e 18-Aug-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5163456: logspam/tight loop in BatteryStatsImpl

No longer use the old history code.

Change-Id: I878ffe16e0014453c46db6a4f7228a81468d8cb9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ae3844527a305cef8bbd1c895b79be45a6c51dbc 28-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix battery history management.

When rebooting the history time offset was not being handled
correctly, causing garbage data.

Change-Id: Ieca5a72c4c7c374bfe7f8673eed87354af148ef0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5e3357fcee2a23a08434873a89e8ada4c6e6d893 02-May-2011 Conley Owens <cco3@android.com> Merge commit '5eb49e0f' into m

Conflicts:
core/java/com/android/internal/os/BatteryStatsImpl.java

Change-Id: Idc9c84c2ca7dec2540ceccead7927fddb912ff12
5eb49e0f1e8e03e8808d8d7da6d5ffb761400e0b 30-Apr-2011 Conley Owens <cco3@android.com> am e321d064: am 2f463ef1: Merge "Adding a sanity test in the while loop in readHistory()"

* commit 'e321d06430304fa93282c765aa6070c908121a16':
Adding a sanity test in the while loop in readHistory()
2f463ef18bb235be57b39cbda536bcd2df2d0908 29-Apr-2011 Conley Owens <cco3@android.com> Merge "Adding a sanity test in the while loop in readHistory()"
1fadab5c36445bb9f0997904dbce44f8e234f847 15-Apr-2011 Dianne Hackborn <hackbod@google.com> More battery stats improvements.

We now write to the parcel using deltas. For common situations,
it only takes 4 bytes to write a delta (new command, time delta,
significant state changes, flags indicating additional state that
follows).

Increasing the buffer size to 128K, this give us 32,768 samples
if they all fit in the smallest delta. A device that is doing
something every minute (like acquiring a wake lock or doing a
wifi scan) for our max target battery life of 30 days would
generate 43,200 samples.

Also some turning to the maximum time between samples at which
we decide to completely collapse two samples.

Change-Id: I074a698d27ccf9389f9585abfc983af2f5ba7a54
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
0ffc988a7f47013805d5abeed1c20f159b3bd799 14-Apr-2011 Dianne Hackborn <hackbod@google.com> Rewrite battery history storage.

We now write battery history directly into a buffer, instead of
creating objects. This allows for more efficient storage; later
it can be even better because we can only write deltas.

The old code is still there temporarily for validation.

Change-Id: I9707d4d8ff30855be8ebdc93bc078911040d8e0b
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
32de2f67ea8276086ae91cbda1d0ef06caf4b3cb 09-Mar-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4068088: NPE at com.android.internal.os.BatteryStatsImpl...

...addHistoryRecordLocked(BatteryStatsImpl.java:1210)

It was doing a bunch of stuff without holding a lock!

Change-Id: Ie5b56514370e0bfc87ba7737d75e01df0859817e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
22577b8d3a39c1373594ba3e4427212eee4cd6d4 24-Feb-2011 Jason Chen <jasonchen@google.com> am 5ff79c3b: Merge "DO NOT MERGE Cherry-pick of Ie4026a7c back to GB" into gingerbread

* commit '5ff79c3b06d7087153617dc973491fc890700af5':
DO NOT MERGE Cherry-pick of Ie4026a7c back to GB
9248e95a2f03afe4cded90f0209ab825f253dd37 06-Jan-2011 Dianne Hackborn <hackbod@google.com> DO NOT MERGE Cherry-pick of Ie4026a7c back to GB

Original change description follows:
-----------------------------------

Implement issue #3326435: Battery stats improvements

Keep track of discharge while screen is on vs. off.

Checkin looks like:

5,0,u,dc,1,1,1,0

The last four numbers are, from left:

- Maximum battery drain over time period.
- Minimum battery drain over time period.
- Battery drain while screen was on.
- Battery drain while screen was off.

Change-Id: Ie3cfe52df29b3f28ba8dc3350abe6cc967c76324
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3d865240e776374ced4ea50e6cb7f8ac92a32640 21-Feb-2011 Per Andersson <per.andersson3@sonyericsson.com> Adding a sanity test in the while loop in readHistory()

Adding a sanity test in the while loop in readHistory() which
is useful in case the file read (batterystats.bin), is corrupt.
The file can get corrupt (missing end of file marker -1) if
writeHistory fails for some reason. Without this change
readHistory will continue looping untill an OutOfMemory is
thrown.

Change-Id: I3418d258e7cb99aa2f9d934c9449a19806499ce4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5284090631e638b916d9a453212e9dc802656a67 18-Feb-2011 Wink Saville <wink@google.com> Changes for ril.h version 6.

Change-Id: Iacd9d362c4836546ac277cf3571227d426a721aa
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4bc6bb85df4f3d9ebf3d04ecad16aef3307c508f 08-Jan-2011 Dianne Hackborn <hackbod@google.com> am 97b0b7bb: am 3ea5728e: Tweak level at which we reset battery stats to 90%.

* commit '97b0b7bbd41bf3bc6095a513c329e1143300ec3a':
Tweak level at which we reset battery stats to 90%.
97b0b7bbd41bf3bc6095a513c329e1143300ec3a 07-Jan-2011 Dianne Hackborn <hackbod@google.com> am 3ea5728e: Tweak level at which we reset battery stats to 90%.

* commit '3ea5728e703554f8ba0bb3aa1367d6dc45d704bb':
Tweak level at which we reset battery stats to 90%.
c1b40e361c6cd3bdc53499f17ac09f45e6873059 06-Jan-2011 Dianne Hackborn <hackbod@google.com> Implement issue #3326435: Battery stats improvements

Keep track of discharge while screen is on vs. off.

Checkin looks like:

5,0,u,dc,1,1,1,0

The last four numbers are, from left:

- Maximum battery drain over time period.
- Minimum battery drain over time period.
- Battery drain while screen was on.
- Battery drain while screen was off.

Change-Id: Ie4026a7cc8aabb2a6d47d03d2e278aa51c2d5ddf
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3ea5728e703554f8ba0bb3aa1367d6dc45d704bb 06-Jan-2011 Dianne Hackborn <hackbod@google.com> Tweak level at which we reset battery stats to 90%.

Change-Id: I81151809100912c7956536d5d47279d2c2fea8c4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ccc714131359eb1022d8c6702b7d82ab9e93f27c 13-Dec-2010 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 78e9f4cb to master

Change-Id: I1135361e6d66f524c3f349e2bf1f31bd4191c634
78e9f4cbaece783b7b87ce3fb0a157dae766012a 13-Dec-2010 Dianne Hackborn <hackbod@google.com> am e4a59519: Fix issue #3154576: battery stats checkin should include UID -> packages+ map

* commit 'e4a5951925f16f18dae91ed65567e96528f17fee':
Fix issue #3154576: battery stats checkin should include UID -> packages+ map
e4a5951925f16f18dae91ed65567e96528f17fee 07-Dec-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3154576: battery stats checkin should include UID -> packages+ map

Includes some other small fixes to battery collection and a few
other things.

Output of package info looks like this:

5,0,i,uid,1000,com.android.settings
5,0,i,uid,1000,com.android.providers.subscribedfeeds
5,0,i,uid,1000,com.android.providers.settings
5,0,i,uid,1000,com.android.server.vpn
5,0,i,uid,1000,android
5,0,i,uid,1000,com.android.systemui
5,0,i,uid,1000,com.google.android.backup
5,0,i,uid,1001,com.android.phone
5,0,i,uid,1001,com.android.providers.telephony
5,0,i,uid,1022,com.android.nfc
5,0,i,uid,10021,com.google.android.location
5,0,i,uid,10021,com.google.android.syncadapters.calendar
5,0,i,uid,10021,com.google.android.gsf
5,0,i,uid,10021,com.google.android.syncadapters.contacts
5,0,i,uid,10026,com.android.providers.downloads.ui
5,0,i,uid,10026,com.android.providers.media
5,0,i,uid,10026,com.android.providers.drm
5,0,i,uid,10026,com.android.providers.downloads
5,0,i,uid,10032,com.android.launcher
5,0,i,uid,10039,com.google.android.gm
5,0,i,uid,10041,com.google.android.gallery3d
5,0,i,uid,10049,com.android.providers.calendar

Change-Id: I9e38f254eef146339113ad270f5c6e8b60fb7a1d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d9c17cc1178bc09d30eead05bf5be7ec5a05cbe7 09-Dec-2010 Jean-Baptiste Queru <jbq@google.com> merge from gingerbread

Change-Id: I12d6ef65986db41e658bf8d476a8e18c4dd89917
e59e0309a1301908eae0075db02413fda90848d5 07-Dec-2010 Dianne Hackborn <hackbod@google.com> Add more checks for bad values to protect from corrupt files.

Change-Id: I5e282099e7c6fcc8756146fc7282eec31937af1f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3fa82a9fe89c55e4217307e06cc185812ad5a8f5 08-Dec-2010 Dianne Hackborn <hackbod@google.com> am c4b7088f: am 42a23783: Merge "Add more checks for bad values to protect from corrupt files." into gingerbread

* commit 'c4b7088f19f8111ea5f34fba41da4a93899708cd':
Add more checks for bad values to protect from corrupt files.
c4b7088f19f8111ea5f34fba41da4a93899708cd 08-Dec-2010 Dianne Hackborn <hackbod@google.com> am 42a23783: Merge "Add more checks for bad values to protect from corrupt files." into gingerbread

* commit '42a23783aaabdb4e6f37ccd822d8c85f31ba8519':
Add more checks for bad values to protect from corrupt files.
7b9c56fe0fb99207218827a569eb12fd24901193 07-Dec-2010 Dianne Hackborn <hackbod@google.com> Add more checks for bad values to protect from corrupt files.

Change-Id: I4174c358c49b93e74920b00fcfd6c68659bf7d08
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
962a990a45a2a9f9c3002064e71f9c2fed86acf1 02-Nov-2010 Robert Greenwalt <rgreenwalt@google.com> Add some network/phone type constants.

Support for LTE (and SIP-based voice) and the stepping-stone eHPRD.

bug:3125398
Change-Id: Ied3d96fa09d9c758a82a2fd1817f55db711d1a4f
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5a1e4cf83f5be1b5d79e2643fa791aa269b6a4bc 19-Oct-2010 Jaikumar Ganesh <jaikumar@google.com> Update BT APIs return type from Set to List.

Change-Id: Ia27220dd26cde13007f6938c830517ee7f6968ce
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6dcab2099bbf1351934a53c05be7e4634b0ae2fd 21-Oct-2010 Dianne Hackborn <hackbod@google.com> am 153bf6c8: am e9e23405: Merge "Fix issue #3113424: Battery stats don\'t reset on Crespo" into gingerbread

Merge commit '153bf6c8d7579abca63909424a8602a0f3b8bcd4'

* commit '153bf6c8d7579abca63909424a8602a0f3b8bcd4':
Fix issue #3113424: Battery stats don't reset on Crespo
153bf6c8d7579abca63909424a8602a0f3b8bcd4 20-Oct-2010 Dianne Hackborn <hackbod@google.com> am e9e23405: Merge "Fix issue #3113424: Battery stats don\'t reset on Crespo" into gingerbread

Merge commit 'e9e23405833a5fedb6a1c2dcec87d84e39d1d13d' into gingerbread-plus-aosp

* commit 'e9e23405833a5fedb6a1c2dcec87d84e39d1d13d':
Fix issue #3113424: Battery stats don't reset on Crespo
266e607bde58aa6ee78ada6e61715c3047568b28 20-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3113424: Battery stats don't reset on Crespo

Change-Id: I38cc3cdfa9cb1466fe3659f001ee57aecf9df179
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
875ecaa511ce36c8044ccdf48ee2a3e69dd633fe 18-Oct-2010 Dianne Hackborn <hackbod@google.com> am 13e46665: am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to have their UID changed over time." into gingerbread

Merge commit '13e46665ff69c1a37880762d7d611aacdf02dac7'

* commit '13e46665ff69c1a37880762d7d611aacdf02dac7':
Work on issue #3101415: Crespo apps seem to have their UID changed over time.
13e46665ff69c1a37880762d7d611aacdf02dac7 16-Oct-2010 Dianne Hackborn <hackbod@google.com> am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to have their UID changed over time." into gingerbread

Merge commit '736f5ec476526f3431d81dec5fb695bdee27e21a' into gingerbread-plus-aosp

* commit '736f5ec476526f3431d81dec5fb695bdee27e21a':
Work on issue #3101415: Crespo apps seem to have their UID changed over time.
8bdf5935c0db4a66ab33a10b43398d2523cfa15d 15-Oct-2010 Dianne Hackborn <hackbod@google.com> Work on issue #3101415: Crespo apps seem to have their UID changed over time.

fsync!

Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
50d3fa72d88aa4dcba4286b77439c60ab5dc7fa9 11-Oct-2010 Dianne Hackborn <hackbod@google.com> am d5423321: am 9934fa77: Merge "Fix issue #3074745: Crash in system process" into gingerbread

Merge commit 'd5423321b920be10c00fbcbc5a702f15e00693a5'

* commit 'd5423321b920be10c00fbcbc5a702f15e00693a5':
Fix issue #3074745: Crash in system process
d5423321b920be10c00fbcbc5a702f15e00693a5 08-Oct-2010 Dianne Hackborn <hackbod@google.com> am 9934fa77: Merge "Fix issue #3074745: Crash in system process" into gingerbread

Merge commit '9934fa77efab362729d0d3cb8aa0bdcd31d63ead' into gingerbread-plus-aosp

* commit '9934fa77efab362729d0d3cb8aa0bdcd31d63ead':
Fix issue #3074745: Crash in system process
f47d8f272c13f0fd264d5a71bcff1c18da10d854 08-Oct-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3074745: Crash in system process

Also some tweaks to battery history collection to hopefully
improve the data we have.

Change-Id: I178a54a8c2d15cf38dcceaeef939406f50059aa4
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3f03496ad97b5f60ab432bca2d17a3e07b4ade47 28-Sep-2010 Jaikumar Ganesh <jaikumar@google.com> Update code for new BT APIs.

Change-Id: I53aa17b6c2a5ee50d47df91960a7f997eb7b1107
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8952a4488e81205e3013b6b456dec503e05eebd0 24-Sep-2010 Dianne Hackborn <hackbod@google.com> am 287952c3: Fix issue #3022508: Crash during media scan

Merge commit '287952c35e148811c106bc0f5036eabf20f71562' into gingerbread-plus-aosp

* commit '287952c35e148811c106bc0f5036eabf20f71562':
Fix issue #3022508: Crash during media scan
287952c35e148811c106bc0f5036eabf20f71562 23-Sep-2010 Dianne Hackborn <hackbod@google.com> Fix issue #3022508: Crash during media scan

Don't kill processes for excessive wake lock use, even if they
are in the background, as long as they have running services.

Also fix some problems with this, such as not noting the kill
in battery stats.

And add killing of processes for cpu usage as well, along with
some optimizations to computing CPU usage.

And fix BatteryWaster to be better behaving for testing these
cases.

Add new "monitor" command to am to watch as the activity manager
does stuff (so we can catch things at the point of ANR).

Finally some miscellaneous debug output for the stuff here, as
well as in progress debugging of an ANR.

Change-Id: Ib32f55ca50fb7486b4be4eb5e695f8f60c882cd1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4b187e804fdfdbc825e17646e82e0218e316a339 21-Sep-2010 Dianne Hackborn <hackbod@google.com> am 8e1b84e7: Merge "Some battery improvements:" into gingerbread

Merge commit '8e1b84e7654ddeeb77a03f5eca10c6669b1cb42b' into gingerbread-plus-aosp

* commit '8e1b84e7654ddeeb77a03f5eca10c6669b1cb42b':
Some battery improvements:
ce2ef766cad1bb186ea522f76c4ac6a8bb3dfa87 20-Sep-2010 Dianne Hackborn <hackbod@google.com> Some battery improvements:

- New API for iterating over history that will allow a better implementation
in the future.
- Now do writes asynchronously.

Also improve the documentation for Activity.onRetainNonInstanceState().

Change-Id: Idf67f2796a8868eb62f288bcbb2bad29876c8554
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1f377298e2aaf6a1736295c0413d468eb1db5091 18-Sep-2010 Dianne Hackborn <hackbod@google.com> am 58e0eefe: Improve power tracking of WIFI use.

Merge commit '58e0eefeb5e2e270e2b04369bbf29fc22abda8d5' into gingerbread-plus-aosp

* commit '58e0eefeb5e2e270e2b04369bbf29fc22abda8d5':
Improve power tracking of WIFI use.
58e0eefeb5e2e270e2b04369bbf29fc22abda8d5 16-Sep-2010 Dianne Hackborn <hackbod@google.com> Improve power tracking of WIFI use.

We now distribute "wifi started" time across all apps that are
holding WIFI locks that cause it to be started. But only when
WIFI would not normally be running. Also have a mechanism to
distribute other WIFI work that has happened across those processes
based on their use.

Also fixed a bug where we were not retaining the CPU speed step
stats across boots...!

Change-Id: I00e3153b98429166273750512cc37e7975211ab9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
53686433a9790bcfe7211a661b26783ee12bb436 13-Sep-2010 Dianne Hackborn <hackbod@google.com> am 7e9f4eb2: Track client requests through location manager.

Merge commit '7e9f4eb2608148436cef36c9969bf8a599b39e72' into gingerbread-plus-aosp

* commit '7e9f4eb2608148436cef36c9969bf8a599b39e72':
Track client requests through location manager.
7e9f4eb2608148436cef36c9969bf8a599b39e72 11-Sep-2010 Dianne Hackborn <hackbod@google.com> Track client requests through location manager.

This fixes a problem where applications could ask the location
manager to do very heavy-weight things (like... say... update
location every minute), which would get accounted against the
system instead of the application because ultimately it is the
system making the heavy calls (wake locks, etc).

To solve this, we introduce a new class WorkSource representing
the source of some work. Wake locks and Wifi locks allow you
to set the source to use (but only if you are system code and thus
can get the permission to do so), which is what will be reported
to the battery stats until the actual caller.

For the initial implementation, the location manager keeps track
of all clients requesting periodic updates, and tells its providers
about them as a WorkSource param when setting their min update time.
The network location provider uses this to set the source on the
wake and wifi locks it acquires, when doing work because of the
update period.

This should also be used elsewhere, such as in the GPS provider,
but this is a good start.

Change-Id: I2b6ffafad9e90ecf15d7c502e2db675fd52ae3cf
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8615fdc15146d27cc2d3a8efbe57f0a425b19efb 10-Sep-2010 Dianne Hackborn <hackbod@google.com> am 506d724c: Merge "DO NOT MERGE. I like\'d ctate\'s change so much I\'m doin it myself!" into gingerbread

Merge commit '506d724cc356a7ba73995ef2929c65062277c83d' into gingerbread-plus-aosp

* commit '506d724cc356a7ba73995ef2929c65062277c83d':
DO NOT MERGE. I like'd ctate's change so much I'm doin it myself!
618b8c1e988ac6c8006da66ca9e8a1e1d49c9dd5 10-Sep-2010 Dianne Hackborn <hackbod@google.com> DO NOT MERGE. I like'd ctate's change so much I'm doin it myself!

Change-Id: If571d3ff5e73252a0653c30ec40178ec1591ddd9
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
195dc210cb59ba3f660e31a95334fc3fa4d3ad2c 10-Sep-2010 Dianne Hackborn <hackbod@google.com> am a4ce31f5: Merge "Small fixes to battery stats." into gingerbread

Merge commit 'a4ce31f5e080eae6c97e6f37040db0c7f0fc78f2' into gingerbread-plus-aosp

* commit 'a4ce31f5e080eae6c97e6f37040db0c7f0fc78f2':
Small fixes to battery stats.
b8071d790a32dc715c0fd6d4e7e1bbea6c8f7a02 10-Sep-2010 Dianne Hackborn <hackbod@google.com> Small fixes to battery stats.

Change-Id: Ibbf7c548a8e787a046de3659094cea64908e3deb
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5fdacb8a2818136218afdea4308ad1b10049a201 08-Sep-2010 Dianne Hackborn <hackbod@google.com> am ee455f5a: Merge "People holding partial wake locks now get blamed for CPU usage." into gingerbread

Merge commit 'ee455f5a9572bc0d23c3328f6c22da91dc109a50' into gingerbread-plus-aosp

* commit 'ee455f5a9572bc0d23c3328f6c22da91dc109a50':
People holding partial wake locks now get blamed for CPU usage.
0d903a84d04d241a648ec429e3a0e82c712677fd 08-Sep-2010 Dianne Hackborn <hackbod@google.com> People holding partial wake locks now get blamed for CPU usage.

For the duration of the wake lock, 50% of all CPU usage is now
accounted against the app(s) holding partial wake locks, evenly
distributed between them. This is only while the device is on
battery and screen off.

Change-Id: I3e5c978b792b6ef17bf8540705bfe8343dadd464
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
75f0024cf40eadb2cdaa6ae53409c515b68f21c1 07-Sep-2010 Dianne Hackborn <hackbod@google.com> am 6e86915e: Merge "Fixes to battery stats debug output." into gingerbread

Merge commit '6e86915e8f5dfffa60ae5d1a4ca9aa74912fd026' into gingerbread-plus-aosp

* commit '6e86915e8f5dfffa60ae5d1a4ca9aa74912fd026':
Fixes to battery stats debug output.
b5e3165129a5871cf679a67d9e9323ffad3d4902 07-Sep-2010 Dianne Hackborn <hackbod@google.com> Fixes to battery stats debug output.

Change-Id: I32e7cad9633b8c517a74573069e426d9f835a83d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
a3ece8bde37acd81b08c4e3c1cb0e6d006ade3e0 20-Aug-2010 Dianne Hackborn <hackbod@google.com> am 32519259: Merge "Fix a few small battery stats problems:" into gingerbread

Merge commit '325192593b057f4360e1abddf490b4fae7d60b12' into gingerbread-plus-aosp

* commit '325192593b057f4360e1abddf490b4fae7d60b12':
Fix a few small battery stats problems:
99d0452ddc0a0435030a462bda9f4d57b58bad9a 20-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix a few small battery stats problems:

- Actually aggregate discharge amounts.
- Actually print the unplugged battery info when currently plugged in.

Change-Id: I22dd6feb73ac1364eb169d3239ce403b0755bb6c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2e47052fc4ad3439adc2322fd953fd58a85d457c 16-Aug-2010 Dianne Hackborn <hackbod@google.com> am 567722ee: Merge "Fix problems with determining when to kill apps for wake usage." into gingerbread

Merge commit '567722eee190f7cf88dc7ea95167db76d5514842' into gingerbread-plus-aosp

* commit '567722eee190f7cf88dc7ea95167db76d5514842':
Fix problems with determining when to kill apps for wake usage.
1ebccf531d1049853b3b0630035434619682c016 15-Aug-2010 Dianne Hackborn <hackbod@google.com> Fix problems with determining when to kill apps for wake usage.

Also improve debug printing of various times.

Change-Id: Ifcc288fd1bcbf44c069875ba97925b9e7ffe9a48
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
66b0343e9e32203cdd39b854852cf575ca2fcd6b 14-Aug-2010 Dianne Hackborn <hackbod@google.com> am a8d9291d: Merge "Various battery info things:" into gingerbread

Merge commit 'a8d9291d7f93d1aa0d24d71d65c7de2894812177' into gingerbread-plus-aosp

* commit 'a8d9291d7f93d1aa0d24d71d65c7de2894812177':
Various battery info things:
9adb9c3b10991ef315c270993f4155709c8a232d 13-Aug-2010 Dianne Hackborn <hackbod@google.com> Various battery info things:

- Now track wake locks in battery history.
- Now track sensors in battery history.
- Some filtering of sensory data.
- Fixes to some data that wasn't cleared when resetting battery stats.
- Print amount discharged since last charge.

And the big part -- keep track of wake locks held per process,
and kill processes that hold wake locks too much while they are in
the background. This includes information in the battery stats
about the process being killed, which will be available to the
developer if the app is reported.

Change-Id: I97202e94d00aafe0526ba2db74a03212e7539c54
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
ff74e22b59f8157580953fcd69e3c32aa8f68eb2 29-Jul-2010 Romain Guy <romainguy@android.com> am ce3ac5f0: Merge "Corrected buffer overflow when parsing /proc/wakelocks"

Merge commit 'ce3ac5f02970fcab91e16ecb573931d209b1985c' into gingerbread-plus-aosp

* commit 'ce3ac5f02970fcab91e16ecb573931d209b1985c':
Corrected buffer overflow when parsing /proc/wakelocks
3bee5af8162c177f8c8f4199489a401058ab26a9 23-Jul-2010 Dianne Hackborn <hackbod@google.com> Battery stats: start removing last stats, keep total discharge.

Change-Id: I59c4bcbb9893adb237017add76b83c22153f94ef
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3372f2e259247810627fd22033406163284f4f64 30-Jun-2010 Johannes Carlsson <johannes.carlsson.x@sonyericsson.com> Corrected buffer overflow when parsing /proc/wakelocks

The android_os_Process_parseProcLineArray in android_util_Process.cpp
writes up to buffer[endIndex]. This sometimes caused an assert to be
triggered in NewStringUTF when the output from /proc/wakelocks was
larger than 4096 bytes. The buffer was also increased in order to be
able to parse all wakelocks completely.

Change-Id: Idf8e66d61ad979377569048f59c3eee278b146db
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1e4b9f3936d6f357e89360293e05a0e16d5fa440 23-Jun-2010 Dianne Hackborn <hackbod@google.com> Remove InputConsumer, replacing with InputQueue.

Change-Id: Ib06907278457aaee842b123adc072840ca3602d8
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
6b7b4845212b3a439c527f2e1eca205b6b45fceb 15-Jun-2010 Dianne Hackborn <hackbod@google.com> Various improvements to battery stats collection

We now clear the battery stats when unplugging after the
battery is full. This allows us to use the "total" stats as
a new "since last charged" stat. Total is gone. I never used
it, it was worthless. Since last charged is a lot more
interesting.

The battery history now collects a lot more stats, and keeps
control over how much it can collect. Printing is now more
descriptive.

The kinds of stats have been renamed to SINCE_UNPLUGGED and
SINCE_DISCHARGED. The other two stats are still there, but
no longer printed; a future change will eliminate them
completely along with all of their state.

Change-Id: I4e9fcfcf8c30510092c76a8594f6021e9502fbc1
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
32907cfb38bda2d3c052cf5139c5b592678fedbb 11-Jun-2010 Dianne Hackborn <hackbod@google.com> Adjust activity manager process OOM adj.

Modify OOM adj classes a bit, to take into account the new
heavy weight app type, and give "foreground services" their
own category to have a bettery chance to manager them when
things go wrong.

Also add some new code to battery stats to keep a history
of changes to the battery level.

Change-Id: I29f5ab6938777e1a7eafd7d8c38b5e564cc9f96a
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e5795610bdc97aebfaa863b5134294aed5c7c1f2 05-Apr-2010 Amith Yamasani <yamasani@google.com> Fix a crash in BatteryStatsImpl, due to a previous fix.

This is probably the real fix for the original bug. The last line was probably not
well formed and resulted in an overrun in the native code.

Bug: 2564824
Change-Id: I8a9cc267f8045a61eff4b5d532258afa32a8b837
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2098eadfba7aba5d667579222f0fac76d1235ff0 02-Apr-2010 Amith Yamasani <yamasani@google.com> Potential fix for bug: 2564824 : Device runtime restart in BatteryService

Look for corrupted bytes and replace with ?

If the problem is in the parsing code, then this will not help.

Change-Id: If33643f126a4099d4113e37760c6ef74683fe97e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
4cee725b1fd3958d850fc83214797f76d5f6b468 19-Mar-2010 Christopher Tate <ctate@google.com> Use atomic++ rather than lock/++/unlock in the input dispatch code path

Decouples the input dispatch thread from the battery-stats object lock regime,
to avoid the possibility of ever blocking the input dispatch thread on its
behalf. The stats object is widely used and can sometimes be locked for a
very long time (on the order of seconds) during certain extensive dump
operations.

This change does not alter the data format of the battery stats' externalized
representations.

Fixes bug #2530346

Change-Id: Iee288be3bf4936641b532dceecb8f6de8f552bf0
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1afd1c90ebe789b8d3a137004127a50d2db7e3b5 19-Mar-2010 Dianne Hackborn <hackbod@google.com> Maybe fix issue #2457218: Corrupt batterystats.bin file preventing phone boot - LIBtt68127

No steps to repro, but makes the code more robust by using the standard
JournaledFile class and doing sanity checks on the input it reads.

This required moving the JournaledFile class in to the framework (and
we really should get rid of either it or AtomicFile, but they have
different recovery semantics so that is tough). Also went through and
cleaned up the file management in various places.

Change-Id: Ieb7268d8435e77dff66b6e67bb63b62e5dea572e
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9e0f5d9a63ba88c2bf69df0557f8c9696db370c4 23-Feb-2010 Dianne Hackborn <hackbod@google.com> Fix some random bugs.

2185256: After open &close of device keyboard shortcut does not added to Home desktop.

ActivityThread was losing the last saved state when restarting or launching into
a paused state.

2366174: defaults not cleared when they should be

PackageManagerService now removes any preferred activity records for a package
when it is uninstalled.

2154556: Battery stats can have an unbounded number of wake locks

We now start combining wake locks into one shared record when we hit a
maximum limit (currently 20).

2442519: Foreground services can have no notification by providing a bogus one.

If the notification manager rejects our notification, the service is forced to
no longer be in the foreground.

2442383: Finalization issues in com.android.server.am.PendingIntentRecord.java

Cleaned up finalization to call super class and avoid the big activity manager
lock (we still need to use the locks inside of the message system, but these
are much less likely to be a problem).

2284190: Cannot call a phone number using adb

We weren't getting the calling uid/pid in startActivity() if the caller did not
supply an application record.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
18d200fd2aa26e4c9b6ca7c38bb5fd6b81e40259 02-Feb-2010 Mike Chan <mike@android.com> BatteryStatsImpl: initalize audio timer

Signed-off-by: Mike Chan <mike@android.com>
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1719a39a4c0ff3afbf9c9e5f03f20ba50f490902 08-Dec-2009 Ken Shirriff <kens@google.com> Migration to TrafficStats.

TrafficStats is the SDK version of NetStat.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
cfc893d27a59bddbc5d0da0038e8313f6c379f86 18-Nov-2009 Amith Yamasani <yamasani@google.com> Fix for 2267410 : Battery use doesn't show CPU usage on non-wiped devices

Due to a change in cpu stepping values, the batterystats.bin file needs to
be wiped for Battery Use app to show CPU cost correctly.
Bumping up the version number of the file fixes this.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
f37447bad3773b62176baa837908daf6edb44273 09-Oct-2009 Amith Yamasani <yamasani@google.com> Proper fix for zero signal strength and no_service. Fixes #2176141

Track phone service state changes and use a separate timer for out-of-service
since the hunting can timeout on some devices.

Store the timeout value in the config.xml, as it is device/network specific.

Settings App will also change to use the hunting duration to compute the cost
of zero signal.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
8550f255232eb4e4852466c5297fdc125887f5af 30-Sep-2009 Suchi Amalapurapu <asuchitra@google.com> Check if rename of backed up file fails before persisting new changes.
If not these system services will end up with inconsistent settings files
when the device runs out of storage.
Delete mangled settings file in PackageManager if the current write fails
so that we don't end up overwriting the backed up version with the
mangled version
Include null check when retrieving fwd locked resource for an existing package
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
53b707ba26055f3b7597db5826dee64987bfb83a 30-Sep-2009 Amith Yamasani <yamasani@google.com> Handle bad lines in /proc/wakelocks : Fix for 2124260

Use the return value from the native parser to skip over bad lines. When
the wakelocks overflow, there could be empty or badly formatted lines.
Skip over them.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e43530ab571e901f94361078c7c1f970a0bd27f2 21-Aug-2009 Amith Yamasani <yamasani@google.com> Track CPU speed stepping to get more accurate CPU cost per app.

More CPU speed stepping happening with newer devices, so we need
to qualify CPU time with the CPU speed, since power consumption
varies greatly by speed. Apps that peg the CPU should get a higher
penaltly.

Also, fix for 2062930: NPE at VolumePreference.onKey()
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
82cb029e2a4907ee55fed4a00493b76b3e11a7a1 18-Aug-2009 Amith Yamasani <yamasani@google.com> Get At command count from Bluetooth headset.

Pass in the BT headset object when available to the BatteryStats.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3f7e35c2c7d3d7f08f50c1d93cd16b1f49354ccc 14-Jul-2009 Amith Yamasani <yamasani@google.com> Bluetooth at command tracking.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
819f928f6a9dc3fdf408236f33e17f03a7dfed2c 25-Jun-2009 Amith Yamasani <yamasani@google.com> Add a method to Process to get uid for a pid.

Use the uids to track native processes. Cache the uids to avoid
checking /proc every time.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
32dbefda71c50bf848da21fb5d1255273439f90d 19-Jun-2009 Amith Yamasani <yamasani@google.com> Track native processes and airplane mode.

Turn signal strengths on/off when toggling airplane mode.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
2e418428987132ea66533cbc05f9c526eb59519a 23-Jun-2009 Dianne Hackborn <hackbod@google.com> Possibly fix an issue where we thought an app was always using GPS.

There may be some race conditions in the gps provider where it can cause a uid
to be double booked for gps usage and never released. Address this by tweaking
some locking (so mLocation and the uid array are protected by a lock both when
reading and writing). Also add some code to log a warning if someone tries to
note a particular uid multiple times, since the code will break in that case.

Finally, fix a problem in the battery stats where we weren't allowing a new Uid
structure to be created in many cases for calls coming in.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3718aaabe6259dcf86a3666ff92d16e4be5da555 09-Jun-2009 Amith Yamasani <yamasani@google.com> Allow arrays of values for power profile data.

Parse arrays for data that has different levels with non-linear
power increase.
Track radio data awake_time from kernel and mobile/total data
transfers.
Use dummy values for default power_profile.xml. Actual values will
be in a product overlay.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
eaeb663bcd7a82b654954b42663232cbd7bef7e7 04-Jun-2009 Amith Yamasani <yamasani@google.com> Track activity foreground CPU usage for battery stats.

Track the foreground CPU time of an activity so that we can tell if apps are
spending more time in the background compared to foreground.
Update power profile values for screen backlight and GPS.
Fix some javadoc bugs (milliseconds vs. microseconds).
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c33fe6c9a71008d51aab7775532d73a3eaf12370 28-May-2009 Amith Yamasani <yamasani@google.com> Fix a hang during bootup.

Some data was not being written to the battery stats during shutdown. So there was insufficient
data when reading back at bootup.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
244fa5c05b2cc8c4c0754aeed4ee42c588ea89d1 22-May-2009 Amith Yamasani <yamasani@google.com> Initial checkin for App Fuel Gauge infrastructure.

This adds the PowerProfile class and data file that provides power consumption numbers
for different subsystems. Also added Audio/Video subsystems to track on a per UID basis.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
58ff0217a617d5b03d18f0ef532f254f8ba6de2b 20-May-2009 Robert Greenwalt <robdroid@android.com> Increment BatteryStatsImpl's VERSION.
That'll make it stop trying to interpret older records with the new format.
Also applied other comments involving name changes to remove un-needed 'Wifi' labels in WifiManager API, etc.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
e9b06d754af03faf27012fbed1e7559ec1ba7c79 19-May-2009 Wink Saville <wink@google.com> Teleca 2b changes
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
5347bd4cda2b6afc18f8acab48e52131f35ed13c 14-May-2009 Robert Greenwalt <robdroid@android.com> Add wifi multicast filter api (enable/disable).
Fixes 1833432. Automatically re-disables any request when the app
exits/crashes. Also hooked into Battery Stats for power managment analysis.
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d8593312296fd2193a070c1a074840d83b7f49cb 30-Apr-2009 Marco Nelissen <marcone@google.com> Don't crash when /proc/wakelocks can't be opened. Might make board bringup easier.
Verified with simulator, which doesn't have /proc/wakelocks
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
1d442e0d990b581357f33f5463c7c5cb49b551e8 21-Apr-2009 Dianne Hackborn <hackbod@google.com> More optimization of dumpsys output.

There are three major classes of changes here:

- Avoid writing lines where their values are often empty, false, or some other typical thing.
- Use partial writes to the PrintWriter to avoid creating temporary strings.
- Use StringBuilder where we need to generate real String objects (and where possible cache the result).
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
c64edde69d18498fb2954f71a546357b07ab996a 18-Apr-2009 Evan Millar <> AI 146853: Add kernel wakelock data to batteryinfo dump.
BUG=1755458

Automated import of CL 146853
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
633a1740ce5951ccb5d478ba2795f6f4fada1646 03-Apr-2009 Evan Millar <> AI 144333: Change the way the battery level tracking code works in BatteryStats. Before we simply kept track of the last
2 levels as recorded at plug and unplug events. During charge cycles this would be useful because it would tell us
what the start and end levels were in the last discharge cycle. However during a discharge cycle this information could
be misleading as it would give you the level at the last unplug event (beginning the the discharge cycle) and last plug
event (end of the previous discharge cycle).
Now we are still keeping track of 2 values, but they are "discharge cycle start level" and "discharge cycle current level".
During a discharge cycle this will give you the level the current discharge cycle started at, and the current level. During
a charge cycle the same data will be supplied as before (the start/end of the last discharge cycle).
B=144249

Automated import of CL 144333
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
617f877c06c82584a38f41bb60d836e08c5e3bda 01-Apr-2009 Dianne Hackborn <> AI 143800: am: CL 143748 Fix issue #1743326 (More battery stats)
Adds stats for:
- Number of raw user events that have happened in the system.
- Number of times user activity has been reported, dividied by UID and type of activity.
- Duration of screen brightness levels in 4 buckets.
- Per-UID tracking of who has turned on Wifi and how long we can attribute it being on because of them.
Original author: hackbod
Merged from: //branches/cupcake/...

Automated import of CL 143800
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
627bba736d022c39696b7c582a6af5592d2b8c33 25-Mar-2009 Dianne Hackborn <> Automated import from //branches/donutburger/...@142347,142347
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d4c5f8919b0522bcaab41a5863c313fec52d3a79 25-Mar-2009 Eric Shienbrood <> Automated import from //branches/donutburger/...@140679,140679
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
105925376f8d0f6b318c9938c7b83ef7fef094da 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
3001a035439d8134a7d70d796376d1dfbff3cdcd 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java