History log of /frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5dad8068e251744ca38fd333c6543185f0c85b3c 06-Jun-2017 jackqdyulei <jackqdyulei@google.com> Copy smearing method to BatteryStatsHelper

This cl adds the following data in BatterySipper
1. screenPowerMah: power smeared by screen
2. proportionalSmearMah: power need to smeared proportionally
3. displayPowerMah: smeared power usage

This cl also copies bunch of methods from BatteryUtils to
BatteryStatsHelper with minor changes, so we could log smearing
logic in BatteryStatsHelper

Bug: 62300864
Test: runtest -x BatteryStatsHelperTest
Change-Id: I9f92f5c1ac5fa483d0c15a3d5daad570da68a7ff
Merged-In: I9f92f5c1ac5fa483d0c15a3d5daad570da68a7ff
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.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/com/android/internal/os/BatteryStatsHelper.java
76a267bc265340824a394b6b310289f37dae9437 20-Apr-2016 Adam Lesinski <adamlesinski@google.com> BatteryStatsHelper: Include screen on baseline power draw

Calculate the baseline power usage for the device when it is in suspend and idle.
The device is drawing POWER_CPU_IDLE power at its lowest power state.
The device is drawing POWER_CPU_IDLE + POWER_CPU_AWAKE power when a wakelock is held.
The device is drawing POWER_CPU_IDLE + POWER_CPU_AWAKE + POWER_SCREEN_ON when the screen is on.

Bug:27533512
Change-Id: Idcb587390bc8159fcbd6625cca4cb1aca19976d6
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
e9be5da68640507d4986ce4294398da0083b0df5 29-Feb-2016 Nimrod Gileadi <nimrod@google.com> Close InputStream in BatteryStatsHelper

Bug: 17760659
Bug: 27376093
Change-Id: I5e6471f73b3258067fb670a4b66ddc51be62b6ec
(cherry picked from commit e618b53081d9a173305b7c72cab4c2ed6ca2dcec)
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
6832f39416cbe2cc9655af4eabefe39c5d272254 06-Sep-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Better big-little CPU accounting

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

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

Bug:22773176
Change-Id: I9c794ae9756c782c0e971c7f5fcebbe70374b269
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
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/com/android/internal/os/BatteryStatsHelper.java
c691d3ccf4eb29376225bcbeb35bc532a3071ed1 29-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Use proper power calculator when energy data is received

We check for the presence of energy data when determining whether to use
the WiFiPowerCalculator or WiFiPowerEstimator. Since we can receive this data
later, we need to switch to the WiFiPowerCalculator if we weren't using it before.

We can't ask the hardware if it supports energy data because that would involve a call into
WiFiManagerService, which can cause a deadlock if we are holding the BatteryStatsService lock
while using this class.

Bug:22776010
Change-Id: Id685d487c56595eab1d382f49da9417a423bb517
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
8a83c614978e66e932de628b8f5e1559893dc3a0 22-Jul-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Use English locale for dump and checkin data

Dump and checkin data is read by tools that expect a consistent
locale.

Bug:22357316
Change-Id: I0d7e6e771c3512278efca7579fe9c4b79b560e28
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
43f222f02fcfb675460a2bbe8e4e8ab3efc1ede1 30-Jun-2015 Adam Lesinski <adamlesinski@google.com> BatteryStats: Account for remaining OS wakelock time at the end of processing all apps

Bug:18724932
Change-Id: I01cfd18acb3332ad35fd0d48d9c50bc37e5ccd08
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.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/com/android/internal/os/BatteryStatsHelper.java
8576cf941dc20b64d60b6b7f5d0879b823628393 09-Jun-2015 Adam Lesinski <adamlesinski@google.com> Fix calculation of power drain from BT and WiFi

Unit issue (mV vs V).

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

Bug: 11694505
Change-Id: Ieefa78a1d641851f4141fe666dae7b9fde394f09
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
ee36c2861a53e660c2f4c043aedba83163135960 14-May-2015 Adam Lesinski <adamlesinski@google.com> BatteryStatsHelper: Bluetooth wasn't being included in usage list

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

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

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

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

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

Also fixed an issue with Wifi scan power estimation.

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

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

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

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

b/19729960

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

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

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

This reverts commit b943fabfc8ddb581dc2fd7288f87428dcb5d27b7.

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

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

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

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

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

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

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

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

Change-Id: If1702d6b9bcf851704129f1811471e68ed576a5d
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
d7c9289f935992f4ae2fc032747f9e04bb86a7d0 28-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17289876: startActivityFromRecents appears to launch the wrong task

It would be good to actually bring the task to the front.

Also, make the flow when inTask is provided better match what happens when
we go looking for a task on our own.

And this includes another fix that was supposed to be part of a different
change but I forgot this class is part of the framework project now.

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

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

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

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

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

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

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

Change-Id: Ie108ac9b626846108a9bb858101ac2b93276ac16
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
fee756ff91ab4d8f0e09ddb050d22d88ebb66ae7 17-Jul-2014 Dianne Hackborn <hackbod@google.com> Implement issue #16330060: Inform ActivityManager about WebView...

...state changes.

Add a new API to tell the activity manager about a new dependency
one process has on another package. Start using it already for
when apps is Context.createPackageContext() to load code from another
app.

Also do some work on getting the monitoring of proc/uid states
in shape so it can be used by unundled code, along with an
AppImportanceMonitor class for doing so.

Some small fixes and additions to VoiceInteractionService.

Improve handling of unaccounted/overcounted battery use so that
they aren't shown to the user unless they are significant.

Change-Id: I22dd79a73f4e70103d3f8964494aebc8a31f971c
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
c3b07a0c9ce9b1a2af644112e678f3963226fad2 01-Jul-2014 Zoltan Szatmary-Ban <szatmz@google.com> BatteryStatsHelper.refreshStats for multiple users

Battery usage list is now populated for apps belonging to a list of users or profiles.

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

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

You'll see these in a checkin like this:

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

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

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

Not yet hooked up.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: Ifbdd0740132ed178033851c58f165adc0d50f716
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java
ae19a06e030e55b4db3cb20f1e564d49a78a395e 17-Jan-2014 Dianne Hackborn <hackbod@google.com> Whoops, we were counting everything twice in the totals. :(

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

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

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

Change-Id: I8ccf2c9789dc9ad34904917ef57050371a59dc28
/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java