summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/BatteryService.java
Commit message (Collapse)AuthorAgeFilesLines
* Move some system services to separate directoriesAmith Yamasani2013-12-191-753/+0
| | | | | | | | 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
* Introduce a Lifecycle for system servicesAdam Lesinski2013-12-121-15/+18
| | | | | | | | | | | | | | | | | 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
* batteryservice: add battery current now and charge counter dataTodd Poynor2013-08-071-1/+12
| | | | | | | | | 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
* BatteryService use IBatteryProperties interfaces, drop JNITodd Poynor2013-07-301-126/+117
| | | | | | | | 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
* Reduce some event log noise:Dianne Hackborn2013-07-121-3/+3
| | | | | | | | - 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
* Work on issue #9586838: Crash after waking up Hammerhead deviceDianne Hackborn2013-06-261-4/+14
| | | | | | | | | | | | | | | | | | | | | | 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
* Use FastPrintWriter... everywhere.Dianne Hackborn2013-06-241-3/+3
| | | | | | | | | | | | | 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
* am b0675df8: am faa47b52: Merge "Idle maintenance scheduling broken." into ↵Svetoslav2013-05-061-0/+9
|\ | | | | | | | | | | | | jb-mr2-dev * commit 'b0675df8fd377230edc392e02ba0eba275b57992': Idle maintenance scheduling broken.
| * Idle maintenance scheduling broken.Svetoslav2013-05-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Better --unplugged support when dumping battery.Jeff Sharkey2013-04-301-1/+1
|/ | | | | | | | Also fixes logBatteryStatsLocked() to output valid dump data, instead of just a usage message. Bug: 8708665 Change-Id: Ie0d8d90e1a470b7e1e902643333309c2cf7bdb72
* Fix a deadlock involving BatteryService.Jeff Brown2012-10-051-24/+74
| | | | | | | | | | 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
* Fix issue #7267494, issue #7212347Dianne Hackborn2012-10-031-33/+46
| | | | | | | | | | | | | | | 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
* Implement screen on hack for wireless chargers.Jeff Brown2012-10-021-0/+9
| | | | | | | | | | 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
* Fix some synchronization issues in BatteryService.Jeff Brown2012-10-021-137/+167
| | | | | | | | Some of the BatteryService state was being locked sometimes and it wasn't at all consistent. Bug: 7158734 Change-Id: I46e75f66fde92c5a577a80a6bd99c9573066f3c1
* Migrate more Secure settings to Global.Jeff Sharkey2012-09-271-4/+4
| | | | | | | | Migrate networking, storage, battery, DropBox, and PackageManager related Secure settings to Global table. Bug: 7232014, 7231331, 7231198 Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
* Make battery shutdown temperature configurableBrian Muramatsu2012-09-041-5/+10
| | | | | | Bug 7079455 Change-Id: I448f21231bf0548ef975f99482576acb24a1a70e
* Improve multi-user broadcasts.Dianne Hackborn2012-08-301-5/+6
| | | | | | | | | | | | | | | | | | | 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
* Disable screensavers if below first battery warning level.John Spurlock2012-08-231-0/+5
| | | | | | | | 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
* add wireless charger supportBrian Muramatsu2012-08-201-2/+12
| | | | | | | | | bug: 6879638 - add new enum value BATTERY_PLUGGED_WIRELESS - check for sys online file with contents "Wireless" Change-Id: I22dc3c40f50573c98643e7b5cbcb237d0216530d
* Move power manager to a new package.Jeff Brown2012-06-181-5/+5
| | | | Change-Id: I5f5a6435e64354b7d6535e8e9a63934ba7a3f448
* dumpsys: fix problems with -a option in battery and batteryinfo servicesMike Lockwood2011-08-161-1/+1
| | | | | | | Now the dumpsys battery output will show up in bugreports again. Change-Id: Id36e87d27e9d3c06dcc17671c81aa1d3fe260d1e Signed-off-by: Mike Lockwood <lockwood@android.com>
* less loggingJoe Onorato2011-04-061-1/+1
| | | | Change-Id: I4011db5c2a610e741a09e4e8fee68a86175769cc
* new battery assetsJoe Onorato2010-11-211-3/+8
| | | | Change-Id: I61331a6eb237f8883bf604c0767623b08c2fa41b
* Implement reminder power dialog and invalid charger dialog.Joe Onorato2010-10-271-19/+54
| | | | | | Bug: 2510318 Bug: 2974431 Change-Id: I92eb419eeffb657e5572a35a490735a96b303d6b
* Move the battery LED code over to the battery service from the notification ↵Joe Onorato2010-10-271-4/+72
| | | | | | service (!) Change-Id: I12d7994ae245a36b8b2c3272fcbe173881caebd0
* am 13e46665: am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to ↵Dianne Hackborn2010-10-181-1/+2
|\ | | | | | | | | | | | | | | | | 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.
| * Work on issue #3101415: Crespo apps seem to have their UID changed over time.Dianne Hackborn2010-10-151-1/+2
| | | | | | | | | | | | fsync! Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
* | Add extra to ACTION_BATTERY_CHANGED to indicate an invalid charger is attached.Mike Lockwood2010-09-041-4/+25
| | | | | | | | | | Change-Id: I24a24a49d2e3ddee8fbce590ef75ea323b3be97b Signed-off-by: Mike Lockwood <lockwood@android.com>
* | am d3e803ae: Revert "Shutdown when capacity is 0% and no charging or when ↵Jean-Baptiste Queru2010-08-311-16/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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"
| * | Revert "Shutdown when capacity is 0% and no charging or when battery is dead"Jean-Baptiste Queru2010-08-311-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | am fd04143a: Shutdown when capacity is 0% and no charging or when battery is ↵Imre Sunyi2010-08-301-4/+16
|\| | | |/ |/| | | | | | | | | | | | | dead Merge commit 'fd04143a47770256dabcfa4d8447127b3ec8b2bf' into gingerbread-plus-aosp * commit 'fd04143a47770256dabcfa4d8447127b3ec8b2bf': Shutdown when capacity is 0% and no charging or when battery is dead
| * Shutdown when capacity is 0% and no charging or when battery is deadImre Sunyi2010-08-261-4/+16
| | | | | | | | | | | | | | | | | | | | | | 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
* | Various improvements to battery stats collectionDianne Hackborn2010-06-161-18/+13
|/ | | | | | | | | | | | | | | | | | | 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
* Add thermal shutdown. If battery temp >= 68C.Eric Olsen2010-03-311-0/+13
| | | | Change-Id: I625fa47939d8ecc532457b5c6e13f91d83bfbcc5
* Switch the services library to using the new SlogJoe Onorato2010-03-011-9/+9
|
* Eliminate dependencies on Checkin, replacing checkin events with EventLogDan Egnor2010-02-111-43/+32
| | | | | | | | | | | 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
* move some system services from gservices to secure settingsDoug Zongker2010-01-071-4/+4
| | | | Change-Id: Ie2dfb99a2b42b2cc9310b858c044d8684e3493fa
* Implement API to have new broadcasts replace existing broadcasts.Dianne Hackborn2009-12-141-1/+2
| | | | | | 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.
* move event log tags used by system server into this packageDoug Zongker2009-12-041-39/+35
| | | | | | 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.
* BatteryService: Specify low battery levels in resources.Mike Lockwood2009-09-271-9/+16
| | | | | | | | | | 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>
* Dock screen on config can now select AC or USB.Dianne Hackborn2009-09-221-22/+23
| | | | Change-Id: Ifae9af4eb0295ba8e46c65879440b0da543b18e6
* Add better APIs for the battery status, and other cleanup.Dianne Hackborn2009-09-191-11/+10
| | | | | | | Also add new configs for keeping screen on while docked, which will be used elsewhere. Change-Id: Ifaa1118f14fd850ac809895f9a5c9e8c413259b8
* BatteryService: Fix problems shutting down when the battery is dead:Mike Lockwood2009-08-121-7/+18
| | | | | | | | 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>
* Fix bug 1982892 - batteryservice turns off device even while plugged inJoe Onorato2009-07-281-0/+6
| | | | Also, make the battery service do it, not some keyguard thing.
* Send all battery broadcasts with REGISTERED_ONLY_BEFORE_BOOTChristopher Tate2009-07-161-8/+10
| | | | | | | | 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
* Merge commit '1dac277f' into manualmergeDianne Hackborn2009-07-011-0/+6
|\ | | | | | | | | | | | | Required rewriting the okay battery broadcast stuff. Conflicts: services/java/com/android/server/status/StatusBarPolicy.java
* | If battery status is unknown don't send BATTERY_LOW intentRebecca Schultz Zavin2009-05-151-0/+1
| | | | | | | | Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
* | Move ACTION_BATTERY_LOW logic to BatteryService (bug 1630733).Mihai Preda2009-05-071-1/+17
|/
* Integrate new power connnect/disconnect broadcastsChristopher Tate2009-04-091-0/+14
| | | | | | | | | | | | | 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.
* Fix issue #1769910 (Track activity launch times)Dianne Hackborn2009-04-071-1/+1
| | | | | | 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.