History log of /frameworks/base/core/java/android/os/BatteryStats.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
883db32859fabb779386ca0994a5a16e72eaac7b 09-Jun-2017 Lei Yu <jackqdyulei@google.com> Merge changes from topic 'battery_smear_move' into oc-dev

* changes:
Batterystats logs smeared power model values
Copy smearing method to BatteryStatsHelper
17d7d9dcdf581ccbee46c65ab036b529011720cb 08-Jun-2017 Bookatz <bookatz@google.com> Batterystats logs smeared power model values

Fixes: 62302932
Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases -t android.dumpsys.cts.BatteryStatsDumpsysTest
Change-Id: I8942aa9bc557fada4cf0be76aee6bd0bcee9ebb6
/frameworks/base/core/java/android/os/BatteryStats.java
6d79993cb3abaf7667dbadf1d9d8c5d63374af8d 07-Jun-2017 Bookatz <bookatz@google.com> Avoid background getTotalTimeLocked misreporting

It has been discovered that for background values of
AggregatedWakelock, Sync, Job, and partial wakelocks,
the value of getTotalTimeLocked is wrong and often very
negative. getTotalDurationMsLocked, which should provide the exact same
value in all of these cases (since background data is never pooled),
does not have this problem. So while the source of the bug is sought
out, we should use getTotalDurationMsLocked instead of getTotalTimeLocked for
these data.

Bug: 62352334
Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases -t android.dumpsys.cts.BatteryStatsDumpsysTest
Change-Id: I78e84368615578483ab8e9e5f0ee1d067491be08
/frameworks/base/core/java/android/os/BatteryStats.java
1dfd194f7d8e3f5a4a208b133fcc8e4ecf831060 31-May-2017 Joe Onorato <joeo@google.com> Merge "Track Partial wakelock time in background" into oc-dev
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/android/os/BatteryStats.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/android/os/BatteryStats.java
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/android/os/BatteryStats.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/android/os/BatteryStats.java
7080fa528272d4353e9979cf693e5b4dc1d0db8b 09-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add BLE results counter to batterystats" into oc-dev
941d98febab09334487e77731bed1355badec094 03-May-2017 Bookatz <bookatz@google.com> Wakelock durations are 0 instead of -1 if unused

Previously, wakelock max/current/total durations were initialized to -1,
instead of 0. So if, e.g., an app held a full wakelock but not a partial
wakelock, then the partial wakelock would return -1 for these data. This
cl changes that to be 0. The value will only be -1 if the data is not
tracked (as is currently the case for full and window wakelocks), in
which case if the wakelock was held, -1 will be given to signify the
lack of tracking.

Test: manually confirm 0 instead of -1 in batterystats dump.
Change-Id: I934022294ba5adafb2e4d9a5be1dc20aab045cb0
/frameworks/base/core/java/android/os/BatteryStats.java
506a8183fd9de03b73d6f71168da8e95089b8819 01-May-2017 Bookatz <bookatz@google.com> Added actual (unpooled) partial wakelock times.

Previously, partial wakelock times reported the blame apportioned to the
app (i.e. the times were pooled). This CL adds another field to provide
the actual time the partial wakelock was held (unpooled, irrespective of
other app's wakelock usage). Full and window wakelocks also now have the
equivalent field, but it always returns -1 (like their max and current
durations), since none of those are currently tracked. Kernel wakelocks
are unchanged.

Test: cts-tradefed run cts-dev -m CtsDumpsysHostTestCases -t android.dumpsys.cts.BatteryStatsDumpsysTest
Bug: 18998184
Change-Id: Ic4cc8c3abba9afa60902d0c8e17e11abeef52a96
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
a63e911ad24a004e34ee9c1f2083b1fc53c7f2ab 06-Apr-2017 Adam Bookatz <bookatz@google.com> Merge "Change wifiScanActualTime csv from usec to msec" into oc-dev
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/android/os/BatteryStats.java
ce49acad1031b31ac2d73fd85e63a1808229c611 03-Apr-2017 Bookatz <bookatz@google.com> Change wifiScanActualTime csv from usec to msec

The wifi scan actual time is desired (in the batterystats.proto) to be
in msec instead of usec. It makes more sense to therefore output the
value in msec rather than convert it when it gets read into the proto.

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

Change-Id: I22fce69b6faecd00f79837369344e04b426a1c33
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
134c59bb40126e8644748d5ad021232c27604d3e 09-Mar-2017 Kweku Adams <kwekua@google.com> Renaming the second active event to avoid confusion.

BUG: 23532995
Test: make -j 32 ...

Change-Id: I8d44e98520f40f46727cb57ba77932eee2b1b0ea
/frameworks/base/core/java/android/os/BatteryStats.java
e0dd9c1293f205fdc98445dc17edf865aac073c8 08-Mar-2017 Kweku Adams <kwekua@google.com> Surrounding some field names with quotes to avoid breaking CSV assumptions.

Some names can include commas, and if they're not surrounded by quotes,
then CSV parsing breaks, as was the case in
https://github.com/google/battery-historian/issues/94#issuecomment-282790498
and several other circumstances.

Test: flashed local device and ran batterystats output through Historian

Change-Id: I070c5d873d9f79996a581bf0a5f664136c0af454
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
b0449e01caf08f09e265c01c96fd7695ce124d6a 12-Oct-2016 Kweku Adams <kwekua@google.com> Fixing unit issue in dis/charge time remaining parameter.

Although currently not used, the parameter is expected to be in microseconds,
not milliseconds. Hopefully this will avoid issues if the time is used in the
future.

Test: ...make sure it builds locally

Change-Id: Ie131370d3e8c8105623fc60375054f4b22cec110
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.java
2dd7e5e3ef0a20864a5908fd8c0896776575d68a 21-Jul-2016 James Carr <carrja@google.com> Calculate and account for memory power use

Use PowerProfile to calculate mAh (MemoryPowerCalculator), and
involve this calculation in the overall accounting of battery
for when the phone is unplugged from a charger.

Note: Depends on ag/1196281

Change-Id: Id02bef19c9b250c614df0a6c88711b486faaef46
/frameworks/base/core/java/android/os/BatteryStats.java
ebbbead91578c1e8883f3251b94aa502360cab46 20-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "BatteryStats: Don't print empty platform idle state" into nyc-mr1-dev
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/android/os/BatteryStats.java
5f056f6d87b2b9f2abc1b37c5d8530d57c6230cd 15-Jul-2016 Adam Lesinski <adamlesinski@google.com> Record UID of wakeup packets

Bug:28931278
Change-Id: I50a3b6a8026b4d06aaa2730cd531658d280ddb73
/frameworks/base/core/java/android/os/BatteryStats.java
8568d8fd4f2cce8d68e80bc845dc20bedc47d4e1 16-Jul-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Don't print empty platform idle state

Bug:28863586
Change-Id: Iac1fae2063498337c7325011603933aa4f6ebfdd
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
e8a442ccd6dacebc47fe8df782258b004901dab2 11-Jun-2016 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Fix read/write parcel order" into nyc-dev
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/android/os/BatteryStats.java
094c40b2cc70fefb29771fb90d7ea7437905b3a5 10-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "BatteryStats: Record fine grained battery discharge" into nyc-dev
b55d741c9a656387b145d7b3504836e24124506d 10-Jun-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Bump checkin format version to 18

Bug:28811636
Change-Id: If2229c438e60f20746c91bccbcaa6d72ca5f0802
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
1476d32b87d85885838fb066bcca48f1df9750b6 05-May-2016 Joe Onorato <joeo@google.com> Add the individual wakeup alarm counts to the batterystats checkin.

Bug: 28601365
Change-Id: I94ad69eeb575f75d62bd45076184f521bd11052d
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
5b2747e1338a1a4c59597cfa29e612b858b4a810 25-Apr-2016 Kweku Adams <kwekua@google.com> Removing extraneous field from batterystats dumpsys.

Accidentally introduced in ag/851920.

Change-Id: I89ac490cef1735defa7165e6d27beae20490091d
/frameworks/base/core/java/android/os/BatteryStats.java
010bf374d8145528f8733dfa6ef101b15de23a8d 11-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Introduce Async external stats requests

Instead of calling out to external processes with a blocking IPC,
pass along a Binder on which the external process can pass back
the response. The calling process can then wait for the reply with
a timeout.

This eliminates watchdog restarts of the system_server when an external
process like telephony or bluetooth hangs.

Bug:26842468
Change-Id: I1b242e4ed22a63f1a4a0be8c78de8ac4d7bf56c5
/frameworks/base/core/java/android/os/BatteryStats.java
ba9d893976f02e003debd14b8685fb60fce7ef8e 12-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Don't log BluetoothScanTimer when it doesn't exist

Bug:27998591
Change-Id: I80ca8a2353141c16595b4be0b0aed195f40e366a
/frameworks/base/core/java/android/os/BatteryStats.java
a0200e37026ef3fd0b3e677d3ecb73a16e108ce5 31-Mar-2016 Dianne Hackborn <hackbod@google.com> (Docs only) Make battery stats process state docs more clear.

Change-Id: I7e86705ec5fa7be8d6a74e708bbf166bec17494f
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
9cfba3502079f5919ec065da2f8d86fe35c475da 25-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #25817435: Batterystats missing UIDs for secondary users

Change-Id: I9ad907571f04b5825d234758347659544a4de6ab
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
2208e743e4c2da29008f6503c2d678c7e28e7812 19-Feb-2016 Adam Lesinski <adamlesinski@google.com> Remove extraneous field from batterystats dumpsys

Change-Id: Iea913e993e61d114c499e6218ad0abf9a8e80690
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
50e4760214dc3bab81b5ccf6df4d5ce5fa34d723 05-Dec-2015 Adam Lesinski <adamlesinski@google.com> Record bytes transferred for bluetooth

Bug:26039657
Change-Id: Iec42459d12f4106d5733f55313e8544d58930285
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
da43a3aacaba069e79f1dbfa491f6bc0b6f7fa95 31-Aug-2015 Adam Lesinski <adamlesinski@google.com> Merge "BatteryStats: Start using cpu power from kernel" into mnc-dr-dev
ab7672d45a66613e23c7769208fc5bc62fe6b363 21-Aug-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Start using cpu power from kernel

This allows us to stop using approximate methods of attributing
cpu frequency time across apps and to use a more precise kernel
method that is aware of the time spent by a process on a given core
at a given frequency.

Bug:22773176
Change-Id: I3c34365fa8c73204f178a5610423901b13453d06
/frameworks/base/core/java/android/os/BatteryStats.java
bb5ac7976d4df640dbe9800d2a47425180082470 21-Aug-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Bump checkin version

Bug:23391894
Change-Id: I2af980531e07b106cc560c877fa128bbd9c2f18e
/frameworks/base/core/java/android/os/BatteryStats.java
782327bde70bfb92352a0270baeae04361b6e9c2 31-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: include mobile radio active count and unknown time in checkin

These are important values to help diagnose modem related wakeup issues.

Bug:22803686
Bug:22857991
Change-Id: Ie0164ebd194567bc10d1165d671a583674a39829
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
fd854ee58c5d56f84047007ead9f88a767ae956f 14-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21626564: MMS should be receivied while Dozing

We now place whoever is receiving the MMS on the temporary
whitelist while doing so, so they can get network access to
download it.

There was also an issue that needed to be fixed where we
were no longer updating the list of allowed uids while
dozing based on their proc states... we now do that.

Also did a bit of optimization of the temp white list update
path do the network policy manager, instead of going through
a broadcast we now directly call in to the network policy
manager. This also allows us to have a synchronous version
of updating the list, so we can know the app has network access
before we tell it to do anything.

Finally added battery stats events for things going on and off
the whitelist so we can diagnose the behavior there.

Change-Id: Ic7fe010af680034d9f8cb014bb135b2addef7455
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
57123001a416509ea7680501424d2ddf3ae55088 13-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStatsHelper: Fix some lost power

Looks like we were losing some power calculations from the CPU side of Bluetooth and
WiFi if there was no controller activity ocurring.

Also add finer breakdown of power to BatteryStats dumpsys for WiFi and Bluetooth.

Change-Id: Ic3ce3e4e3b854f17f9a32fd4bdc47a8ea74ca439
/frameworks/base/core/java/android/os/BatteryStats.java
6776849dc5ff851a225745393f082b702754e278 09-Jun-2015 Amith Yamasani <yamasani@google.com> Report app standby state to batterystats

Also reduce idle checks to the target user if possible.
Optimized calls to some internal methods

Bug: 21639147
Change-Id: If1faf26f862e5c4ca905f2603a4ba52a8d1af954
/frameworks/base/core/java/android/os/BatteryStats.java
628ef9cbedf42fbfb04edf4381671e2fdb795c67 10-Jun-2015 Adam Lesinski <adamlesinski@google.com> Add more blaming output to batterystats dumpsys

Change-Id: I3216f13f16d89a72617d54638df43ce39183da9e
/frameworks/base/core/java/android/os/BatteryStats.java
8f955f89c2ff19aac7f3e009c825beda3618f630 06-Jun-2015 Ruben Brunk <rubenbrunk@google.com> Merge "Add UI for camera + flashlight battery reporting." into mnc-dev
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/android/os/BatteryStats.java
11df5b66ef621c4d67f5b4980e879784de43fd70 02-Jun-2015 Ruben Brunk <rubenbrunk@google.com> Merge "Track camera and flashlight usage in battery stats." into mnc-dev
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/android/os/BatteryStats.java
049c88b48ae4dfdf4cdc85aac85607bb4225e7c7 28-May-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Output per-app wifi controller distribution

Currently we only output this data on checkin, adding the output
to dumpsys as well.

Change-Id: I649474b576d7341bbf54ff95c0b0e6fed367bcb0
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
e08af19fcc7b13d526f3dfd24d58300947cf1146 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: I88c539074607d7261f6c5cf1dbae47c3cf53f253
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
b943fabfc8ddb581dc2fd7288f87428dcb5d27b7 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: Ia3d97e0a1c3352127185c18626d8ba8221c9ab40
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
8cfb58bd58746127d1a8aa39e34a94f7948738d8 04-Mar-2015 Dianne Hackborn <hackbod@google.com> Fix reading of daily data.

Change-Id: I1f581197c938109cfe5cc21109eea57b4e0434dc
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
0ee10f6d263e5476d0eb8f8ba82ff5cd522883e9 15-Jan-2015 Dianne Hackborn <hackbod@google.com> Fix issue android-app doc, bump battery stats checkin version

Issue #18983662: API Reivew: clarify Intent docs for URI_ANDROID_APP_SCHEME
Issue #19019830: Bump up battery stats checkin version

Change-Id: I0bd8f32b9d8d5978bd01d421ea2232d20def340a
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
ad6a99b32a0d062c967019e5cd9858071a9c6617 18-Nov-2014 Dianne Hackborn <hackbod@google.com> Add time estimates to batterystats dump.

Also fix some java docs.

Change-Id: Ie705f236db6f06e34fa5581c20852e5c8f7c2c17
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
213bb2fd4da092826e45aae1a50403ab9c634d70 08-Jul-2014 Ashish Sharma <ashishsharma@google.com> Report wakelock time in checkin stats in ms. Bump version.

Change-Id: Icd5cebb3434572cb226ef018629fcfca8bfc08e8
/frameworks/base/core/java/android/os/BatteryStats.java
cba121541223a5fcaa6afe9cdf472b63865ea173 08-Jul-2014 Ashish Sharma <ashishsharma@google.com> Correctly attribute User Activity to the uid in checkin batterystats.

Change-Id: Iacca5985c0b5a68026da6b2b5c9607f8cb71aad5
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
6020071df901be17bedb0b59ab634555a1d95ecb 24-May-2014 Ashish Sharma <ashishsharma@google.com> Include START event (reboots) in partial history.

Change-Id: Ia1e5fba6c2c7bdb3f09eb5958d7134564d60e8b0
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
bffcf1c2dae4fcfb8b7ee7d1ee7ff8951ad04d88 09-May-2014 Ashish Sharma <ashishsharma@google.com> Bump the batterystats checkin stats version number.

Change-Id: Ie403b89022e4d1f6ad0e07e70c95f39a1d5fa530
/frameworks/base/core/java/android/os/BatteryStats.java
996e269d93d09615e242edcbd7a6218e065aeb7b 06-May-2014 Jeff Brown <jeffbrown@google.com> Merge "Plumb display state and interactive information to BatteryStats."
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/android/os/BatteryStats.java
81850c48fd4fe1cb59c752cdfb4c81307631a46b 05-May-2014 Ashish Sharma <ashishsharma@google.com> Avoid creating new battery history types because of no separator.

Change-Id: I325743142bee21e4dbca5bf9ed6135b7ca5340ec
/frameworks/base/core/java/android/os/BatteryStats.java
d06dcfd3db609d796165d602a2b7914c0b4f64bb 02-May-2014 Dianne Hackborn <hackbod@google.com> Change wake reason checkin tag to "wr".

The old "Wr" was also used for Wifi Running.

Also include discharge/charge time remaining in
checkin output.

Change-Id: I303a0be902002d0399b9eb76773857da9103e8ce
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
5f4a5f9536eb171bf21a9293198d90c9891e7205 25-Jan-2014 Dianne Hackborn <hackbod@google.com> Add "start time" timestamp to battery stats.

Change-Id: I902269b98b40b2421245bfd8971f34df5ff9214e
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
c46809e9979204aa9a131d8933da23d298411441 16-Jan-2014 Dianne Hackborn <hackbod@google.com> Whoops add a line separator.

Change-Id: Ie596527a39319fcf3f80a444fed9e62f90163ea5
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
81b7caf0d12fb56ab40592467d6b1cbcaef8f0b4 30-Oct-2013 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 5214dae4 to klp-dev-plus-aosp

Change-Id: I769e7acbe207b9c3a60ff1576d11b3ab40b8c66d
49021f5f790c31f62d4cee9fafcae13505bed798 05-Sep-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10422349: Limit/change the battery history data in batterystats

Don't include history in real checkins; have a new compact option
for bug reports.

Change-Id: I077f9218b365154f6bae9cc685c2c6b378e0283a
/frameworks/base/core/java/android/os/BatteryStats.java
8a0de58ece89c467c8e7415097d193e5f8db9db8 08-Aug-2013 Dianne Hackborn <hackbod@google.com> Get ProcessStats callable from other processes.

Also fix a bug where, when parceling the stats, we were
computing the final duration values too late. We need to
do that before we write the long table.

Change-Id: Idb6c1ed95417448c56973fe5866bfb3570e525f4
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.java
a4cc205ee840a5374a96c9635dc5121d82a3eaf9 09-Jul-2013 Dianne Hackborn <hackbod@google.com> More procstats work.

The historical data is now a more central part of the stats.
When a checkin happens, the data is not deleted, just marked
as checked in so we can continue to access it.

The default procstats dump is now a new "summary" mode that
shows a more useful set of data for all of the running processes.
By default the current and all committed states are shown; you
use "--current" to only show the current. Use "--details" to
get the previous more detailed data (which now includes detailed
process data like the per-package data).

Also tweaked uid printing to be a little more compact.

Change-Id: I5414ea7c07134ebd5dc83f6f7b9f6e30151eda85
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
91268cf21eace600792d04db1ac62e9268f48002 14-Jun-2013 Dianne Hackborn <hackbod@google.com> More work on process tracking.

Re-arranged code to be more flexible, now track
state of services, dump ordered list of running
processes while memory was critical and low.

Also rename battery stats service from "batteryinfo" to "batterystats".

Change-Id: I0f4f0c8d443c49d255cb84d0fc917e8ec18b152e
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
7f84c065fa1615ee9afb5c229ec9b9319ab88920 05-Feb-2013 Mathias Agopian <mathias@google.com> allow the framework to access a Sensor's handle

this is needed in another CL to fix an issue where
sensors power usage is always reported as 0.

Change-Id: Ie496b98bf4b7e69911bdc99bee14cc924e1d71e8
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
8103890a59de6ed4abaedaad80e66666ea59f9b5 27-Nov-2012 Dianne Hackborn <hackbod@google.com> Improve debugging for issue #7586414: AlarmManager wakelocks held

In alarm manager, print a summary of the top 10 alarms by time
being executed. Keep track of execution time (and wake count) of
each type of alarm for each application so this can be printed in
the summary (and used to compute the top 10 alarms). Rework how
the alarm summary stats are tracked so that we don't need to hold
on to the full Intent for each stat and can get the Intent information
at the time the alarm is sent rather than waiting for whatever Intent
comes back in the result.

Also in the battery stats: sort the kernel wake locks by time, add
a new section showing all partial wake locks across all applications
sorted by time.

Finally a new LocalLog class that is used by AlarmManager to log
important warning messages, so these can also be later found in
its dumpsys output.

Change-Id: Icc07810053e60fb623a49937e696819cb8352b06
/frameworks/base/core/java/android/os/BatteryStats.java
37a37f445cbcd64376af153dd79ea2a123d9405d 15-Aug-2012 Brian Muramatsu <btmura@google.com> add wireless charger support

bug: 6879638

- add new enum value BATTERY_PLUGGED_WIRELESS
- check for sys online file with contents "Wireless"

Change-Id: I22dc3c40f50573c98643e7b5cbcb237d0216530d
/frameworks/base/core/java/android/os/BatteryStats.java
4c7a4a776741ddaa49df1361aa3a8f3977e59196 03-Aug-2012 Raph Levien <raph@google.com> Fix bug 6930875: ArrayIndexOutOfBoundsException on Battery details

The wrong constant was used to count the number of user activity types.
The number of types changed recently, so before then nothing bad
happened. Now we get an AIOOB.

This is the change to NUM_USER_ACTIVITY_TYPES:

Change-Id: I05045180129b30fa09fe5f5e1e3b0ac25fee23b4
https://googleplex-android-review.googlesource.com/#/c/211982/
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
1c6afcbf1f0daf3fb5eb3501656963e3a8a99e3b 04-May-2011 Conley Owens <cco3@android.com> am 2d40bf91: am eac835e5: am 9c4ba258: Merge "Removing dead store; it was likely a relict of debuging code."

* commit '2d40bf91e6ad71505ec84743c5ad0b854ecf5928':
Removing dead store; it was likely a relict of debuging code.
2d40bf91e6ad71505ec84743c5ad0b854ecf5928 04-May-2011 Conley Owens <cco3@android.com> am eac835e5: am 9c4ba258: Merge "Removing dead store; it was likely a relict of debuging code."

* commit 'eac835e52e8378b33a2b34b7edb803290154588d':
Removing dead store; it was likely a relict of debuging code.
ad3b2e3a164661ea032a55cb01aadc2a74bd5917 29-Apr-2011 Jozef BABJAK <jozef.babjak@gmail.com> Removing dead store; it was likely a relict of debuging code.

Change-Id: I685c6df119212f48f90dd40d01a3638a33ce2800
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
5284090631e638b916d9a453212e9dc802656a67 18-Feb-2011 Wink Saville <wink@google.com> Changes for ril.h version 6.

Change-Id: Iacd9d362c4836546ac277cf3571227d426a721aa
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.java
ccc714131359eb1022d8c6702b7d82ab9e93f27c 13-Dec-2010 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 78e9f4cb to master

Change-Id: I1135361e6d66f524c3f349e2bf1f31bd4191c634
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/android/os/BatteryStats.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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
b8071d790a32dc715c0fd6d4e7e1bbea6c8f7a02 10-Sep-2010 Dianne Hackborn <hackbod@google.com> Small fixes to battery stats.

Change-Id: Ibbf7c548a8e787a046de3659094cea64908e3deb
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.java
b5e3165129a5871cf679a67d9e9323ffad3d4902 07-Sep-2010 Dianne Hackborn <hackbod@google.com> Fixes to battery stats debug output.

Change-Id: I32e7cad9633b8c517a74573069e426d9f835a83d
/frameworks/base/core/java/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
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/android/os/BatteryStats.java
94b916da2ce7b5fb8d87e884fad7132ef3091720 20-Jul-2010 Jason Parks <jparks@google.com> Only print out wake locks in the if the wakelock was held.

Change-Id: I742121b70bd0e56ca2efe05fffa9fe3e4ad7b619
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
15a4d2ffd04dc6c70f2cd17dae12ac6bc14c69ab 12-Mar-2010 Kenny Root <kroot@google.com> Add correct copyright headers to multiple files

Format for the list of changes shows the origin commit reference followed
by the file name.

33931-p9 awt/org/apache/harmony/awt/gl/font/AndroidGlyphVector.java
33931-p9 awt/org/apache/harmony/awt/gl/image/PngDecoderJava.java
133776-p9 core/java/android/app/IntentService.java
127013-p9 core/java/android/appwidget/AppWidgetHost.java
27863-p9 core/java/android/bluetooth/BluetoothAudioGateway.java
60765-p9 core/java/android/content/SyncResult.java
43920-p9 core/java/android/content/pm/ActivityInfo.java
43920-p9 core/java/android/content/pm/ApplicationInfo.java
43920-p9 core/java/android/content/pm/InstrumentationInfo.java
43920-p9 core/java/android/content/pm/PackageInfo.java
44103-p9 core/java/android/content/pm/PackageItemInfo.java
68960-p9 core/java/android/content/pm/PackageStats.java
43920-p9 core/java/android/content/pm/ResolveInfo.java
43920-p9 core/java/android/content/pm/ServiceInfo.java
60641-p9 core/java/android/content/res/Configuration.java
60734-p9 core/java/android/content/res/TypedArray.java
137672-p9 core/java/android/inputmethodservice/ExtractButton.java
123112-p9 core/java/android/inputmethodservice/ExtractEditText.java
119291-p9 core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
112946-p9 core/java/android/inputmethodservice/IInputMethodWrapper.java
115078-p9 core/java/android/os/BatteryStats.java
124790-p9 core/java/android/text/style/UpdateAppearance.java
45083-p9 core/java/android/view/RawInputEvent.java
101491-p9 core/java/android/view/inputmethod/EditorInfo.java
114701-p9 core/java/android/view/inputmethod/ExtractedText.java
123112-p9 core/java/android/view/inputmethod/ExtractedTextRequest.java
119291-p9 core/java/com/android/internal/os/HandlerCaller.java
129279-p9 core/java/com/android/internal/os/PkgUsageStats.java
114701-p9 core/java/com/android/internal/view/IInputConnectionWrapper.java
114701-p9 core/java/com/android/internal/view/InputConnectionWrapper.java
84364-p9 opengl/java/android/opengl/EGLLogWrapper.java
11355-p9 opengl/tools/glgen/src/CFunc.java
11355-p9 opengl/tools/glgen/src/CType.java
11355-p9 opengl/tools/glgen/src/CodeEmitter.java
11355-p9 opengl/tools/glgen/src/GenerateGL.java
11355-p9 opengl/tools/glgen/src/JFunc.java
11355-p9 opengl/tools/glgen/src/JType.java
11355-p9 opengl/tools/glgen/src/JniCodeEmitter.java
11355-p9 opengl/tools/glgen/src/ParameterChecker.java
57236-p9 services/java/com/android/server/status/AnimatedImageView.java
66754-p9 services/java/com/android/server/status/CloseDragHandle.java
57188-p9 services/java/com/android/server/status/DateView.java
46928-p9 services/java/com/android/server/status/ExpandedView.java
70590-p9 services/java/com/android/server/status/FixedSizeDrawable.java
45968-p9 services/java/com/android/server/status/IconData.java
57470-p9 services/java/com/android/server/status/IconMerger.java
82719-p9 services/java/com/android/server/status/LatestItemView.java
45968-p9 services/java/com/android/server/status/NotificationData.java
66754-p9 services/java/com/android/server/status/NotificationLinearLayout.java
57458-p9 services/java/com/android/server/status/NotificationViewList.java
45968-p9 services/java/com/android/server/status/StatusBarException.java
45968-p9 services/java/com/android/server/status/StatusBarIcon.java
46130-p9 services/java/com/android/server/status/StatusBarNotification.java
45968-p9 services/java/com/android/server/status/StatusBarView.java
46199-p9 services/java/com/android/server/status/Ticker.java
62286-p9 services/java/com/android/server/status/TickerView.java
57188-p9 services/java/com/android/server/status/TrackingView.java
86041-p9 telephony/java/android/telephony/PhoneStateListener.java
87020-p9 telephony/java/com/android/internal/telephony/TelephonyIntents.java
136269-p9 telephony/java/com/android/internal/telephony/gsm/SpnOverride.java
34409-p9 tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
55717-p9 tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityLandscape.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/AutoCompleteTextViewActivityPortrait.java
129372-p9 tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollablePanScan.java
129372-p9 tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityNonScrollableResize.java
129372-p9 tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollablePanScan.java
129372-p9 tests/ImfTest/src/com/android/imftest/samples/BigEditTextActivityScrollableResize.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityPanScan.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/BottomEditTextActivityResize.java
127341-p9 tests/ImfTest/src/com/android/imftest/samples/ButtonActivity.java
129347-p9 tests/ImfTest/src/com/android/imftest/samples/DialogActivity.java
129372-p9 tests/ImfTest/src/com/android/imftest/samples/EditTextActivityDialog.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityNoScrollPanScan.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollPanScan.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/ManyEditTextActivityScrollResize.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivityNotSelected.java
128994-p9 tests/ImfTest/src/com/android/imftest/samples/OneEditTextActivitySelected.java
25959-p9 tests/framework-tests/src/android/test/FrameworkTests.java
46162-p9 tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java
77101-p9 tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
9788976b1465ce982b5ae7c741345edd0ecd9322 core/java/android/accounts/AuthenticatorDescription.java
53332883543868fb83e111a07306368b7772b340 core/java/android/app/UiModeManager.java
93e7e22ec91dbc641d10ca6d70423e1357a95bba core/java/android/app/FullBackupAgent.java
328c0e7986aa6bb7752ec6de3da9c999920bb55f core/java/android/content/CursorEntityIterator.java
307da1a46b4c9b711bafe8fbaaa6b98e8868c18e core/java/android/content/SyncQueue.java
307da1a46b4c9b711bafe8fbaaa6b98e8868c18e core/java/android/content/SyncOperation.java
eb034652c2037a47ebfd99779e8383bb8bb528af core/java/android/content/pm/LabeledIntent.java
49237345d83e62fdb9eb8d50b13ad086636a04fa core/java/android/content/pm/FeatureInfo.java
a2b6c3775ed6b8924232d6a01bae4a19740a15f8 core/java/android/content/pm/PackageInfoLite.java
3ecd5f437580e49d80beecd29489d5fb1f7a7db0 core/java/android/content/pm/RegisteredServicesCacheListener.java
5ebbb4a6b3e16f711735ae0615b9a9ea64faad38 core/java/android/content/pm/XmlSerializerAndParser.java
c4516a7b62de525e3d6d5e76851bdfaf12c11f05 core/java/android/database/sqlite/SQLiteTransactionListener.java
9bbc21a773cbdfbef2876a75c32bda5839647751 core/java/com/android/internal/backup/LocalTransport.java
21f1bd17b2dfe361acbb28453b3f3b1a110932fa core/java/com/android/internal/content/PackageMonitor.java
4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3 core/java/com/android/internal/view/BaseSurfaceHolder.java
4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3 core/java/com/android/internal/view/BaseIWindow.java
e540833fdff4d58e37c9ba859388e24e2945ed45 core/java/com/android/internal/os/SamplingProfilerIntegration.java
192ab903887bbb8e7c7b6da5c581573850e30f46 core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
1619367ab823150fa8856d419abe02ceb75886f1 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
27f8002e591b5c579f75b2580183b5d1c4219cd4 opengl/tools/glgen/stubs/gles11/glGetString.java
560814f6b11abe83ff0c4ed18cac015c276b3181 opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java
560814f6b11abe83ff0c4ed18cac015c276b3181 opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java
560814f6b11abe83ff0c4ed18cac015c276b3181 opengl/tools/glgen/stubs/gles11/glShaderSource.java
1c4907ee77392afb768c2f088e0dedbe4239f6fb opengl/tools/glgen/src/GenerateGLES.java
1c4907ee77392afb768c2f088e0dedbe4239f6fb opengl/tools/glgen/src/Jsr239CodeEmitter.java
1c4907ee77392afb768c2f088e0dedbe4239f6fb opengl/tools/glgen/src/GLESCodeEmitter.java
69e21f5f6e0d04539cd92848ea009dd615d88c2c opengl/tests/gldual/src/com/android/gldual/TriangleRenderer.java
c028be4f3b8c7476b46859f66c3f33d528adf181 packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
7c6efa13f129dbae5319f0981a430d4662f43354 tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
7c6efa13f129dbae5319f0981a430d4662f43354 tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java
7c6efa13f129dbae5319f0981a430d4662f43354 tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestRunner.java
df8a3f31d871db25e952972c2eb346a71186e9e3 tests/BrowserTestPlugin/src/com/android/testplugin/TestPlugin.java
cfaef699e1dfb3a75d5b51f3b15816f13670fd51 tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
cfaef699e1dfb3a75d5b51f3b15816f13670fd51 tests/permission/src/com/android/framework/permission/tests/ServiceManagerPermissionTests.java
cfaef699e1dfb3a75d5b51f3b15816f13670fd51 tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java

Copyright header moved to top in following file:

core/tests/coretests/src/android/widget/ListViewTest.java

Change-Id: I3c3198be5a0ba36e18679ed834170432bf0b8418
/frameworks/base/core/java/android/os/BatteryStats.java
21f1bd17b2dfe361acbb28453b3f3b1a110932fa 20-Feb-2010 Dianne Hackborn <hackbod@google.com> Fix issue #2438980: Implement package watcher for voice recognizer service setting

I am getting tired of writing package monitor code, realized this is missing in
a number of places, and at this point it has gotten complicated enough that I
don't think anyone actually does it 100% right so:

Introducing PackageMonitor.

Yes there are no Java docs. I am still playing around with just what this
thing is to figure out what makes sense and how people will use it. It is
being used to fix this bug for monitoring voice recognizers (integrating the
code from the settings provider for setting an initial value), to replace
the existing code for monitoring input methods (and fix the bug where we
wouldn't remove an input method from the enabled list when it got
uninstalled), to now monitor live wallpaper package changes (now allowing
us to avoid reverting back to the default live wallpaper when the current
one is updated!), and to monitor device admin changes.

Also includes a fix so you can't uninstall an .apk that is currently enabled
as a device admin.

Also includes a fix where the default time zone was not initialized early
enough which should fix issue #2455507 (Observed Google services frame work crash).

In addition, this finally introduces a mechanism to determine if the
"force stop" button should be enabled, with convenience in PackageMonitor
for system services to handle it. All services have been updated to support
this. There is also new infrastructure for reporting battery usage as an
applicatin error report.
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
3f7e35c2c7d3d7f08f50c1d93cd16b1f49354ccc 14-Jul-2009 Amith Yamasani <yamasani@google.com> Bluetooth at command tracking.
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
e84de8d702bd26fb1e5b55f3cfdd953d8a31ec22 03-Apr-2009 Evan Millar <> AI 144379: Make checkin batteryinfo dump more terse
BUG=1755458

Automated import of CL 144379
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.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/android/os/BatteryStats.java
22ac043ec139714644256cc5e2a9ff8d126ade00 31-Mar-2009 Evan Millar <> AI 143710: am: CL 143615 -Add more stats:
-total network sent/received
-total full/partial wakelock times.
-Format the network sent/received amounts to be more easily readable.
Original author: emillar
Merged from: //branches/cupcake/...

Automated import of CL 143710
/frameworks/base/core/java/android/os/BatteryStats.java
2a15f38ec2072141de086720a8e914c51056a69d 28-Mar-2009 Evan Millar <> AI 143207: am: CL 142996 Fix bug in human readable battery stats dumping code which caused the wifi lock times to be off by an order of magnitude.
Original author: emillar
Merged from: //branches/cupcake/...

Automated import of CL 143207
/frameworks/base/core/java/android/os/BatteryStats.java
627bba736d022c39696b7c582a6af5592d2b8c33 25-Mar-2009 Dianne Hackborn <> Automated import from //branches/donutburger/...@142347,142347
/frameworks/base/core/java/android/os/BatteryStats.java
d4c5f8919b0522bcaab41a5863c313fec52d3a79 25-Mar-2009 Eric Shienbrood <> Automated import from //branches/donutburger/...@140679,140679
/frameworks/base/core/java/android/os/BatteryStats.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/android/os/BatteryStats.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/BatteryStats.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/BatteryStats.java
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/core/java/android/os/BatteryStats.java
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/core/java/android/os/BatteryStats.java
3001a035439d8134a7d70d796376d1dfbff3cdcd 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/base/core/java/android/os/BatteryStats.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/android/os/BatteryStats.java
f1e484acb594a726fb57ad0ae4cfe902c7f35858 22-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127436
/frameworks/base/core/java/android/os/BatteryStats.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/os/BatteryStats.java