History log of /frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fa97fcf7b9b9999102bc0c6b298114375b27a1c3 14-May-2016 Ruchi Kandoi <kandoiruchi@google.com> network: Adds the functionality to parse uid in netlink messages.

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

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

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

Bug:27174034
Change-Id: Ib5cc1ee1c5c191336a3e1f18dbb12c38e833f8d0
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
926969b411ca52eeefd6b01c0c7970d8a65ee526 29-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStats: Keep track of coulomb counter

Bug:27174034
Change-Id: Ica66817faa20b9788536f28f0e593483f033904b
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
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/com/android/internal/app/IBatteryStats.aidl
713fec85b8612256211f09c62b8958a99fe5b9db 04-Mar-2016 Joe Onorato <joeo@google.com> Add an API for apps to get their System Health / Battery Stats data.

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

Distribute the power used by apps scanning with BLE.

Bug:22718669
Change-Id: I626d8a459fc28fdd7dac682c9ac7c8434945109d
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
6771d629b5ad0b9296f0febaa2300fdaf1f90515 16-Jan-2016 Adam Lesinski <adamlesinski@google.com> Add WorkSource to BLE scanning API

This will allow apps that do work on behalf of others to correctly blame
those apps for the power implications of BLE scanning.
Bug:22718669

Change-Id: Ib64af0b6a5d37721a6067ac4e5c39c01f921b56b
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
08c47a5dece977a55d250d98bda9e2a8df8b6ed0 15-Oct-2015 Dianne Hackborn <hackbod@google.com> Initial implementation of light-weight idle mode.

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

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

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

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

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

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

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

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

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

Change-Id: I667e56cb1f80508d054da004db667efbcc22e971
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
b6683c428698105f715985a96066192aa62e9f53 19-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #20494208: Go out of device idle when headset button is pressed

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

Change-Id: Ie58de60e63036a4142881283835961fbcceec892
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
6d2c363fd59af805380622ff7a3ce4c34975aab2 27-May-2015 Ruben Brunk <rubenbrunk@google.com> Track camera and flashlight usage in battery stats.

Bug: 15986092

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

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

Also fixed an issue with Wifi scan power estimation.

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

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

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

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

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

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

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

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

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

Also some other small cleanup here and there.

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

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

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

This reverts commit b943fabfc8ddb581dc2fd7288f87428dcb5d27b7.

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

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

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

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

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

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

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

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

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

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

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

Change-Id: I0c01186446034cf6c3fb97d45f5e3b5c69a0438a
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
2f1993ec460166413e7887f151630f6708077c0f 26-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17671802: "content" command always prints...

..."uid 2000 does not have android.permission.UPDATE_DEVICE_STATS"

Make sure to clear calling identity before getting into the guts
of the activity manager. Also fix the places the activity manager
calls in to battery stats to not require a permission check, anyway.

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

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

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

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

Change-Id: Iba0eaba2a9a186355c24d392f16118982c5331ed
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
f3d00e4e0a313fc76790a2b2d3f6569911b4094d 22-Jul-2014 Chong Zhang <chz@google.com> update battery stats for audio/video

Bug: 12979595

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

But wait, there's more!

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

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

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

You'll see these in a checkin like this:

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

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

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

Not yet hooked up.

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

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

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

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

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

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

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

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

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

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

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

Removed noteInputEvent() since it is unused.

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

Also include charge/discharge information in dumpsys.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
a1f1a3c573acd91024fda0ceb3b921c73b186963 25-Feb-2014 Dianne Hackborn <hackbod@google.com> More battery stats.

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

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

Add battery stats tracking of wifi state.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: Ifbdd0740132ed178033851c58f165adc0d50f716
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
d528d48e5d8444de0730d62b9f621b9cc2df5fbd 08-Nov-2013 Robert Greenwalt <rgreenwalt@google.com> resolved conflicts for merge of c3eef190 to master

Change-Id: I36fd3c7fcbb13e47e27ffc340484c03b5a553bb1
a029ea131836725b050e1a7550aa171b68171522 26-Sep-2013 Robert Greenwalt <rgreenwalt@google.com> Add BatteryStats for Wifi Batched Scanning.

bug:10690989
Change-Id: Ia39b715ee6d5733970095bc76de0ed40ff8208c0
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
488bb0ed6a6765b5a7c9ee73747ebc9333097267 25-Sep-2013 Mike Lockwood <lockwood@google.com> Cleanup Binder interface between sensorservice and BatteryStats

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

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

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

Bug: 5543387
Change-Id: I642004dc530113c27ef79f2abbae51d8af30117f
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
32123fde1b82fc7f5d04f35e2b972364d4352ec9 23-Jul-2010 Mathias Agopian <mathias@google.com> Report sensor events to BatteryStats service

Change-Id: I9b83aa709887aa658bc474391573f2d45b6c4eb2
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
e9b06d754af03faf27012fbed1e7559ec1ba7c79 19-May-2009 Wink Saville <wink@google.com> Teleca 2b changes
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
627bba736d022c39696b7c582a6af5592d2b8c33 25-Mar-2009 Dianne Hackborn <> Automated import from //branches/donutburger/...@142347,142347
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
d4c5f8919b0522bcaab41a5863c313fec52d3a79 25-Mar-2009 Eric Shienbrood <> Automated import from //branches/donutburger/...@140679,140679
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
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/app/IBatteryStats.aidl
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/com/android/internal/app/IBatteryStats.aidl