History log of /frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
51797ed706e6e30cddfc0c1e3a9865064f8cdd6e 04-Jun-2013 Jeff Sharkey <jsharkey@android.com> Create missing Uids when recording network stats.

Bug: 5543387
Change-Id: I138c8d2f84e6fd737f2f6ef0945e75ca31256e3d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
af17baa27196e785989e99b0ecbe7f1c98a1f0cb 10-May-2013 Dianne Hackborn <hackbod@google.com> Help on issue #8863955: Google Services keeping phone awake...

...because of Google Play Services

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

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

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

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

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

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

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

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

But hey, it's a start!

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

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

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

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

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

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

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

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

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

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

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

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

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

Add SSID support to NetworkIdentity to fix policy tests.

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

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

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

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

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

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

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

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

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

No longer use the old history code.

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

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

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

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

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

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

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

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

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

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

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

The old code is still there temporarily for validation.

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

...addHistoryRecordLocked(BatteryStatsImpl.java:1210)

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

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

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

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

Implement issue #3326435: Battery stats improvements

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

Checkin looks like:

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

The last four numbers are, from left:

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

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

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

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

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

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

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

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

Checkin looks like:

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

The last four numbers are, from left:

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

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

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

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

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

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

Output of package info looks like this:

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

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

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

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

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

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

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

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

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

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

Merge commit '153bf6c8d7579abca63909424a8602a0f3b8bcd4'

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

Merge commit 'e9e23405833a5fedb6a1c2dcec87d84e39d1d13d' into gingerbread-plus-aosp

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

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

Merge commit '13e46665ff69c1a37880762d7d611aacdf02dac7'

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

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

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

fsync!

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

Merge commit 'd5423321b920be10c00fbcbc5a702f15e00693a5'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also improve the documentation for Activity.onRetainNonInstanceState().

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Merge commit 'a4ce31f5e080eae6c97e6f37040db0c7f0fc78f2' into gingerbread-plus-aosp

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

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

Merge commit 'ee455f5a9572bc0d23c3328f6c22da91dc109a50' into gingerbread-plus-aosp

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

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

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

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

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

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

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

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

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

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

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

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

Also improve debug printing of various times.

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

Merge commit 'a8d9291d7f93d1aa0d24d71d65c7de2894812177' into gingerbread-plus-aosp

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

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

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

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

Merge commit 'ce3ac5f02970fcab91e16ecb573931d209b1985c' into gingerbread-plus-aosp

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Look for corrupted bytes and replace with ?

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

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

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

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

Fixes bug #2530346

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

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

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

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

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

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

2366174: defaults not cleared when they should be

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

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

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

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

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

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

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

2284190: Cannot call a phone number using adb

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

There are three major classes of changes here:

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

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

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

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