summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/BatteryService.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-12-12Introduce a Lifecycle for system servicesAdam Lesinski
Provide an abstract class for system services to extend from, similar to the android.app.Service. This will allow services to receive events in a uniform way, and will allow services to be created and started in the correct order regardless of whether or not a particular service exists. Similar to android.app.Service, services are meant to implement Binder interfaces as inner classes. This prevents services from having incestuous access to each other and makes them use the public API. Change-Id: Iaacfee8d5f080a28d7cc606761f4624673ed390f
2013-08-07batteryservice: add battery current now and charge counter dataTodd Poynor
Available for retrieval via future APIs if desired. Dumped by dumpsys. Not added to batterystats or ACTION_BATTERY_CHANGED intents at this point. Also fixes a formatting problem in the existing dumpsys output for voltage. Change-Id: I5320b19035914256fb872c13095c09c648dd522a
2013-07-30BatteryService use IBatteryProperties interfaces, drop JNITodd Poynor
IBatteryPropertiesListener binder interface to deliver notifications of changed battery/power status from healthd system health daemon. healthd watches uevents from power_supply. Change-Id: I1ab38622baf28356a6627fe2354b77e2ef99d838
2013-07-12Reduce some event log noise:Dianne Hackborn
- Only log battery levels on level changes, not voltage or temp. - Reduce the text in the start service log to only the suffix of the service component, and a uid field. Change-Id: I6d65e6700e021b3b005dccc90d64f36c1f97137f
2013-06-26Work on issue #9586838: Crash after waking up Hammerhead deviceDianne Hackborn
I made the power manager more rigid, not allowing different uids to use the same wake lock. This never should happen. I would guess there is somewhere that the activity manager is acquiring the wake lock without clearing the calling identity... but it is hard to follow all the paths this may happen in. So here we add some checks when acquiring/releasing the wake lock to make sure it is being done as the system uid. Also: - Protect the new activity stack calls with a permission, and make sure to clear the calling uid once past that. - Collect uid data from process stats so we can correctly associate CPU use with a uid even if we don't know about the pid for some reason. - Fix battery stats dump commands to clear calling uid before executing so they aren't broken. Change-Id: I0030d4f7b614e3270d794ecfc3669139a5703ce9
2013-06-24Use FastPrintWriter... everywhere.Dianne Hackborn
One problem this turned up is, because FastPrintWriter does its own buffering, a lot of code that used to use PrintWriter would fail -- if it pointed to a StringWriter, there was no buffering, so it could just immediately get the result. Now you need to first flush the FastPrintWriter. Also added some new constructors to specify the size of buffer that FastPrintWriter should use. Change-Id: If48cd28d7be0b6b3278bbb69a8357e6ce88cf54a
2013-05-06am b0675df8: am faa47b52: Merge "Idle maintenance scheduling broken." into ↵Svetoslav
jb-mr2-dev * commit 'b0675df8fd377230edc392e02ba0eba275b57992': Idle maintenance scheduling broken.
2013-05-03Idle maintenance scheduling broken.Svetoslav
1. The scheduling was relying on receiving battery level broadcasts which however are not sent if the device is asleep. The maintenance window was not bound and we could miss a frame if the user did not interact the device longer than the min time between two maintenance windows. 2. Hide the idle maintenance intents since this will be rewritten to user services. bug:8688454 Change-Id: I17b421b09823cb46ec218cabda19e02432d94f8c
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
2012-10-05Fix a deadlock involving BatteryService.Jeff Brown
The PowerManager may call into the BatteryService while holding its locks. We need to be careful that the BatteryService doesn't call into other services, particularly the ActivityManager while holding its own locks. Bug: 7298218 Change-Id: Ibf8ab13224f204a9857825265e864f93583bce8e
2012-10-03Fix issue #7267494, issue #7212347Dianne Hackborn
7267494 Calendar is not syncing Check for whether a content provider is dead before returning it. This is kind-of a band-aid, but probably the right thing to do; I'm just not sure exactly the full details of why this problem is happening. Hopefully this "fixes" it, though I don't have a way to repro to tell. 7212347 System power off dialog is only visible to user 0 Make it visible. Also turn on some battery debugging stuff and clean it up so we can just keep it. Change-Id: I5add25bf2a763c8dfe1df23bc5c753a9ea5d157a
2012-10-02Implement screen on hack for wireless chargers.Jeff Brown
We can't accurately detect whether the device is resting on a wireless charger unless it is actually charging. So we need to tweak the screen on when plugged / unplugged policy accordingly to avoid spurious wakeups. Bug: 7234284 Change-Id: I624b559e2e92b8813b12090bc20eca5f5158997e
2012-10-02Fix some synchronization issues in BatteryService.Jeff Brown
Some of the BatteryService state was being locked sometimes and it wasn't at all consistent. Bug: 7158734 Change-Id: I46e75f66fde92c5a577a80a6bd99c9573066f3c1
2012-09-27Migrate more Secure settings to Global.Jeff Sharkey
Migrate networking, storage, battery, DropBox, and PackageManager related Secure settings to Global table. Bug: 7232014, 7231331, 7231198 Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
2012-09-04Make battery shutdown temperature configurableBrian Muramatsu
Bug 7079455 Change-Id: I448f21231bf0548ef975f99482576acb24a1a70e
2012-08-30Improve multi-user broadcasts.Dianne Hackborn
You can now use ALL and CURRENT when sending broadcasts, to specify where the broadcast goes. Sticky broadcasts are now correctly separated per user, and registered receivers are filtered based on the requested target user. New Context APIs for more kinds of sending broadcasts as users. Updating a bunch of system code that sends broadcasts to explicitly specify which user the broadcast goes to. Made a single version of the code for interpreting the requested target user ID that all entries to activity manager (start activity, send broadcast, start service) use. Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
2012-08-23Disable screensavers if below first battery warning level.John Spurlock
Don't activate on sleep if below the threshold, and quit any currently running dream when the threshold is reached. Bug:6999949 Change-Id: I961b350d24ee6f95e502228aaa57312b0ffbadc1
2012-08-20add wireless charger supportBrian Muramatsu
bug: 6879638 - add new enum value BATTERY_PLUGGED_WIRELESS - check for sys online file with contents "Wireless" Change-Id: I22dc3c40f50573c98643e7b5cbcb237d0216530d
2012-06-18Move power manager to a new package.Jeff Brown
Change-Id: I5f5a6435e64354b7d6535e8e9a63934ba7a3f448
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-04-06less loggingJoe Onorato
Change-Id: I4011db5c2a610e741a09e4e8fee68a86175769cc
2010-11-21new battery assetsJoe Onorato
Change-Id: I61331a6eb237f8883bf604c0767623b08c2fa41b
2010-10-27Implement reminder power dialog and invalid charger dialog.Joe Onorato
Bug: 2510318 Bug: 2974431 Change-Id: I92eb419eeffb657e5572a35a490735a96b303d6b
2010-10-27Move the battery LED code over to the battery service from the notification ↵Joe Onorato
service (!) Change-Id: I12d7994ae245a36b8b2c3272fcbe173881caebd0
2010-10-18am 13e46665: am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to ↵Dianne Hackborn
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.
2010-10-15Work on issue #3101415: Crespo apps seem to have their UID changed over time.Dianne Hackborn
fsync! Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
2010-09-04Add extra to ACTION_BATTERY_CHANGED to indicate an invalid charger is attached.Mike Lockwood
Change-Id: I24a24a49d2e3ddee8fbce590ef75ea323b3be97b Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-08-31am d3e803ae: Revert "Shutdown when capacity is 0% and no charging or when ↵Jean-Baptiste Queru
battery is dead" Merge commit 'd3e803ae28c369996f9acf6036ea99af5561949c' into gingerbread-plus-aosp * commit 'd3e803ae28c369996f9acf6036ea99af5561949c': Revert "Shutdown when capacity is 0% and no charging or when battery is dead"
2010-08-31Revert "Shutdown when capacity is 0% and no charging or when battery is dead"Jean-Baptiste Queru
This reverts commit fd04143a47770256dabcfa4d8447127b3ec8b2bf. This break most automated tests because with this change, if the device is fully charged, it will simply turn off the screen, regardless if USB is connected to hsot PC or not; so for our tests, most of them are always connected to host PC, and fully charged 99% of the time, as soon as the screen turns off, the front-end test Activity will be suspended. Change-Id: I1e6590611af43812f1bac223dd31570d1d90cfc5
2010-08-30am fd04143a: Shutdown when capacity is 0% and no charging or when battery is ↵Imre Sunyi
dead Merge commit 'fd04143a47770256dabcfa4d8447127b3ec8b2bf' into gingerbread-plus-aosp * commit 'fd04143a47770256dabcfa4d8447127b3ec8b2bf': Shutdown when capacity is 0% and no charging or when battery is dead
2010-08-26Shutdown when capacity is 0% and no charging or when battery is deadImre Sunyi
Android framework does not shutdown when battery capacity is 0% and a charger is attached (USB or AC). This handling is incomplete since a charger might very well be attached but charging has stopped because USB suspended or the charging algorithm has stopped because of battery safety handling. Also shutdown when battery is reported 'dead'. This might happen although charging is present. Change-Id: If328260ebf4d38f912e4d2fad204431cbb19c993
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-03-31Add thermal shutdown. If battery temp >= 68C.Eric Olsen
Change-Id: I625fa47939d8ecc532457b5c6e13f91d83bfbcc5
2010-03-01Switch the services library to using the new SlogJoe Onorato
2010-02-11Eliminate dependencies on Checkin, replacing checkin events with EventLogDan Egnor
events (and in one case, a DropBox entry). Add a simple intent that triggers master-clear (and toggle EFS), given the right permissions. Bug: 2264596 Bug: 2350452 Bug: 2264596
2010-01-07move some system services from gservices to secure settingsDoug Zongker
Change-Id: Ie2dfb99a2b42b2cc9310b858c044d8684e3493fa
2009-12-14Implement API to have new broadcasts replace existing broadcasts.Dianne Hackborn
Use this in various places where it should serve no purpose to deliver both broadcasts. This is intended to reduce somewhat the flurry of broadcasts that we churn through during boot.
2009-12-04move event log tags used by system server into this packageDoug Zongker
We can now locate event log tag definitions in individual packages (and java constants for the tag numbers get auto-generated), so move all the tags used by the system server into the package.
2009-09-27BatteryService: Specify low battery levels in resources.Mike Lockwood
Also trigger low battery when battery reaches the specified level rather than when it drops below the level. Fixes bug b/1788656 Change-Id: I81f5cbb9892fc6574320d92e153211f83c69f415 Signed-off-by: Mike Lockwood <lockwood@android.com>
2009-09-22Dock screen on config can now select AC or USB.Dianne Hackborn
Change-Id: Ifae9af4eb0295ba8e46c65879440b0da543b18e6
2009-09-19Add better APIs for the battery status, and other cleanup.Dianne Hackborn
Also add new configs for keeping screen on while docked, which will be used elsewhere. Change-Id: Ifaa1118f14fd850ac809895f9a5c9e8c413259b8
2009-08-12BatteryService: Fix problems shutting down when the battery is dead:Mike Lockwood
Wait until system is booted before attempting to display the shutdown dialog. Use ShutdownActivity rather than attempting to run ShutdownThread in the battery service. Fix logic error (check !isPowered() instead of isPowered()) Signed-off-by: Mike Lockwood <lockwood@android.com>
2009-07-28Fix bug 1982892 - batteryservice turns off device even while plugged inJoe Onorato
Also, make the battery service do it, not some keyguard thing.
2009-07-16Send all battery broadcasts with REGISTERED_ONLY_BEFORE_BOOTChristopher Tate
The "low" and "okay" broadcasts were not being sent with this flag, so that if the device had booted in a low battery state, the battery service would crash due to an illegal-state exception. This fixes bug b/1985606
2009-07-01Merge commit '1dac277f' into manualmergeDianne Hackborn
Required rewriting the okay battery broadcast stuff. Conflicts: services/java/com/android/server/status/StatusBarPolicy.java
2009-05-15If battery status is unknown don't send BATTERY_LOW intentRebecca Schultz Zavin
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-05-07Move ACTION_BATTERY_LOW logic to BatteryService (bug 1630733).Mihai Preda
2009-04-09Integrate new power connnect/disconnect broadcastsChristopher Tate
Two new broadcasts, Intent.ACTION_POWER_CONNECTED and Intent.ACTION_POWER_CONNECTED, that are issued when the device is plugged and unplugged from USB or AC power. This pulls two changes from the open-source Gerrit repo into the internal Donut codeline: 1241 fda6fae Added broadcasts for external power events. 9491 37f8ca1 Fix system service crash when booting while on battery power The current.xml API description has also been updated to include the new Intent fields; the new API was approved in the original OSS change.
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.