summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/am/BatteryStatsService.java
AgeCommit message (Collapse)Author
2013-12-19Move some system services to separate directoriesAmith Yamasani
Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
2013-11-06Add BatteryStats for Wifi Batched Scanning.Robert Greenwalt
bug:10690989 Change-Id: Ia39b715ee6d5733970095bc76de0ed40ff8208c0
2013-09-04Fix issue #10422349: Limit/change the battery history data in batterystatsDianne Hackborn
Don't include history in real checkins; have a new compact option for bug reports. Change-Id: I077f9218b365154f6bae9cc685c2c6b378e0283a
2013-06-14More work on process tracking.Dianne Hackborn
Re-arranged code to be more flexible, now track state of services, dump ordered list of running processes while memory was critical and low. Also rename battery stats service from "batteryinfo" to "batterystats". Change-Id: I0f4f0c8d443c49d255cb84d0fc917e8ec18b152e
2013-06-11Add new API to retrieve a dumpsys of a single package.Dianne Hackborn
Adds a platform API, and pm command. Fixes some issues with dumping per-package data in package manager, makes battery stats able to dump per-package state. Change-Id: I76ee6d059f0ba17f7a7061886792b1b716d46d2d
2013-06-06Accumulate network statistics based on deltas.Jeff Sharkey
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
2013-04-30Better --unplugged support when dumping battery.Jeff Sharkey
Also fixes logBatteryStatsLocked() to output valid dump data, instead of just a usage message. Bug: 8708665 Change-Id: Ie0d8d90e1a470b7e1e902643333309c2cf7bdb72
2013-01-09New "app ops" service.Dianne Hackborn
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
2012-06-15Include WIFI scan's in Battery Stats.Nick Pelly
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
2011-10-09Move battery stats to xt_qtaguid for data stats.Jeff Sharkey
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
2011-09-29Add DUMP permission checks to servicesKenny Root
Some services have info that is not readily available any other way. Add a permission check to those services. Bug: 5389201 Change-Id: I5a9724ec89e1c11ef7813eeb52a6a05b3ea92af5
2011-08-16dumpsys: fix problems with -a option in battery and batteryinfo servicesMike Lockwood
Now the dumpsys battery output will show up in bugreports again. Change-Id: Id36e87d27e9d3c06dcc17671c81aa1d3fe260d1e Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-28Fix battery history management.Dianne Hackborn
When rebooting the history time offset was not being handled correctly, causing garbage data. Change-Id: Ieca5a72c4c7c374bfe7f8673eed87354af148ef0
2011-04-14Rewrite battery history storage.Dianne Hackborn
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
2010-12-13resolved conflicts for merge of 78e9f4cb to masterDianne Hackborn
Change-Id: I1135361e6d66f524c3f349e2bf1f31bd4191c634
2010-12-13Fix issue #3154576: battery stats checkin should include UID -> packages+ mapDianne Hackborn
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
2010-09-28Update code for new BT APIs.Jaikumar Ganesh
Change-Id: I53aa17b6c2a5ee50d47df91960a7f997eb7b1107
2010-09-17Improve power tracking of WIFI use.Dianne Hackborn
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
2010-09-13Track client requests through location manager.Dianne Hackborn
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
2010-08-13Various battery info things:Dianne Hackborn
- 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
2010-06-16Various improvements to battery stats collectionDianne Hackborn
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
2010-06-11Adjust activity manager process OOM adj.Dianne Hackborn
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
2010-03-19Use atomic++ rather than lock/++/unlock in the input dispatch code pathChristopher Tate
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
2010-03-01Switch the services library to using the new SlogJoe Onorato
2009-11-05Fix for 2221718: Hang in BatteryStatsService.noteBluetoothOnAmith Yamasani
This should remove the deadlock. I'm not absolutely positive that it fixes it, as it's not easy to reproduce.
2009-10-19Proper fix for zero signal strength and no_service. Fixes #2176141Amith Yamasani
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.
2009-09-20Track CPU speed stepping to get more accurate CPU cost per app.Amith Yamasani
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()
2009-08-18Get At command count from Bluetooth headset.Amith Yamasani
Pass in the BT headset object when available to the BatteryStats.
2009-07-20Bluetooth at command tracking.Amith Yamasani
2009-06-24Track native processes and airplane mode.Amith Yamasani
Turn signal strengths on/off when toggling airplane mode.
2009-05-22Initial checkin for App Fuel Gauge infrastructure.Amith Yamasani
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.
2009-05-18Teleca 2b changesWink Saville
2009-05-13Add wifi multicast filter api (enable/disable).Robert Greenwalt
Fixes 1833432. Automatically re-disables any request when the app exits/crashes. Also hooked into Battery Stats for power managment analysis.
2009-05-08Improve shutdown process to send broadcast for applications.Dianne Hackborn
This introduces a new class in the base platform for performing a clean shutdown (which was copied from the classes in the policies). It includes new features to send a shutdown broadcast for applications to do cleanup, and ot have the activity manager pause the current activity before proceeding with the shutdown. These facilities are also use to write at the most recent stat files for sync, battery and user activity.
2009-04-22More optimization of dumpsys output.Dianne Hackborn
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).
2009-04-07Fix issue #1769910 (Track activity launch times)Dianne Hackborn
The usage stats service now collects per-activity launch time stats. There are a number of fixes and improvements to its statistics management and collection; it now operates its calendar in GMT and ensures that for checkin purposes it always reports one day and only one complete day to the checkin service. Also change the checkin option from "-c" to "--checkin" since it is really a special thing.
2009-04-02AI 144333: Change the way the battery level tracking code works in ↵Evan Millar
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
2009-03-31AI 143800: am: CL 143748 Fix issue #1743326 (More battery stats)Dianne Hackborn
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
2009-03-24Automated import from //branches/donutburger/...@142347,142347Dianne Hackborn
2009-03-24Automated import from //branches/donutburger/...@140679,140679Eric Shienbrood
2009-03-18auto import from //branches/cupcake_rel/...@140373The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@132589The Android Open Source Project
2009-03-02auto import from //depot/cupcake/@137055The Android Open Source Project
2009-02-19auto import from //branches/cupcake/...@132276The Android Open Source Project
2009-02-10auto import from //branches/cupcake/...@130745The Android Open Source Project
2008-12-17Code drop from //branches/cupcake/...@124589The Android Open Source Project