summaryrefslogtreecommitdiff
path: root/core/java/android/os/PowerManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r35' of ↵George Zacharia2023-04-031-3/+70
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into t13.0 Android 13.0.0 release 35 Change-Id: I709958b2f015d1774b2ece25894467c3a279f93c
| * Add additional PowerManager wakeup reasonsBeverly2022-12-201-3/+30
| | | | | | | | | | | | | | | | Test: manual (builds) Bug: 263155290 Bug: 242628816 Change-Id: I2b445e545427bd3411ac1f3b33359d51b1bdbad0 Merged-In: I2b445e545427bd3411ac1f3b33359d51b1bdbad0
| * Sleep softly on device close.Michael Wright2022-12-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Add a new flag GO_TO_SLEEP_FLAG_SOFT_SLEEP. When set, this sleeps the device only if its user activity keeping it awake. If its otherwise staying awake because an application is holding a wakelock, then the device continues to stay awake. Bug: 260705307 Test: atest PowerManagerServiceTest Test: manual Change-Id: I08b6dacf418d927b4f86816b1b6d19965e68556a
| * Sync BatteryStats user activity types with PowerManager ones.Philip Junker2022-10-071-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | Add more logs when entering doze. Bug: 243518837 Test: atest BatteryStatsTests Test: atest PowerManagerServiceTest Test: manually observe logs using logcat / adb bugreport Change-Id: I234a999cf41da0346ce4d9f05663cae116b095a3 Merged-In: I234a999cf41da0346ce4d9f05663cae116b095a3
| * Revert "Remove BatteryStats user activity types and use PowerManager ones ↵Neha Jain2022-08-251-38/+0
| | | | | | | | | | | | | | | | | | | | | | instead." This reverts commit 79e517c3d45ce704ff43f068fbb63d24ab4693c6. Reason for revert: b/243434675 Change-Id: Ie2476f23715ed933064470ee2f50d550e92d46b8 Merged-In: I5cfdd6a7c21ed322f50d7605fdd470b41726f4cf
| * Remove BatteryStats user activity types and use PowerManager ones instead.Philip Junker2022-08-231-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add millisSinceLastUserActivity and lastUserActivityEvent to PowerGroup log when dozing. Add timeout to PMS log when dozing. Bug: 243518837 Test: atest BatteryStatsTests Test: atest PowerManagerServiceTest Test: manually observe logs using logcat / adb bugreport NoNonSdkCheck: USER_ACTIVITY_TYPES is only accessed indirectly by apps through dumpLocked() method. Change-Id: I835992a08bd4a07350e36ef671c6273c8fee43a0 (cherry picked from commit bf794e45858ea052524719e7222b961da9ce8a77) Merged-In: I835992a08bd4a07350e36ef671c6273c8fee43a0
* | PowerManager: Add proximity check on wakeBruno Martins2022-11-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a squash of the following commits, forward-ported to Oreo and adapted to the Lineage SDK: Author: Danesh M <daneshm90@gmail.com> Date: Wed Jun 25 21:31:49 2014 -0700 ProximityWake : Add support for checking proximity when waking device Change-Id: Ia5ff446d88435773acccc7467e66009000dc20cb Author: Schubi <schubi@erlangen.ccc.de> Date: Tue Jul 29 02:10:16 2014 +0200 Be sure to shutdown the proximity sensor after display wake This fixes: http://review.cyanogenmod.org/#/c/66657/ Change-Id: I1768f13cb48c3e056d0e137642690fc3d650c4ab Author: Danesh M <daneshm90@gmail.com> Date: Mon Aug 4 20:18:18 2014 -0700 PowerManager : Make proximity check opt-in Change-Id: I7cf64a82530da2e655018e43683ba7a5584d54f8 Author: Danesh M <daneshm90@gmail.com> Date: Fri Jul 25 19:02:26 2014 -0700 Framework : Fix proximity wakeup reference Change-Id: Ia40ca6fbf6e37fbb3996f2384f725c30b88c2131 Author: dankoman <dankoman30@gmail.com> Date: Thu Feb 5 15:12:13 2015 +0100 [1/2] Frameworks: let InCallUI handle proximity sensor for incoming calls Fixes "while 'prevent accidental wake-up' is on, proximity sensor doesn't control screen state on incoming call. Must manually turn on screen to see who's calling." Change-Id: I738b3bbd328992c8a8010a0c8d9aa1e444cfa9f9 Author: Steve Kondik <steve@cyngn.com> Date: Thu May 21 13:10:54 2015 -0700 power: Fix locking for wakeup proximity check * Often I'm noticing high power consumption due to the proximity sensor never turning off. Add synchronization around this code to ensure ordering. Change-Id: I8ccf3152166cd896e0ce2551c01b8ac8f501d782 Author: Scott Mertz <scott@cyngn.com> Date: Fri Aug 21 13:47:51 2015 -0700 add config for proximity check on screen on default value Change-Id: I7e6ae08e23ee147a37986aa6aa9b3176b301a09e Author: Danesh M <daneshm90@gmail.com> Date: Mon Aug 4 18:09:06 2014 -0700 Services : Ensure proximity check is taken into consideration Only do the proximity check if explicitly being asked to do so. This is a patch that was never ported from cm-11.0 : 2293e60c7de011782e59486605c04b9f67a1e24f issue-id: CYNGNOS-1223 Change-Id: Id1be619e638de6a45252d8390eab6e38bd5de5a7 Author: Erica Chang <echang@cyngn.com> Date: Tue Jun 9 15:01:12 2015 -0700 services: button brightness should check proximity Change-Id: I10a72fa6d8b520e86cfef3d7ded489fd7fa936d2 Author: Steve Kondik <steve@cyngn.com> Date: Mon Oct 26 03:07:26 2015 -0700 powermanager: Initialize SensorManager in systemReady() * Service startup ordering is different on M and the sensor service is not ready during construction of the PowerManager. This was causing a hang on boot. Move it to systemReady instead. Change-Id: I9e0293484e1aaaf9f82f9c75680bec558607c54d Author: Adnan Begovic <adnan@cyngn.com> Date: Mon Nov 9 17:59:13 2015 -0800 fw: Move proximitycheck to CMSettings. Change-Id: Ie80166c990363d3846925b189a1f7001a7fd56f8 Author: Pat Erley <perley@cyngn.com> Date: Thu Dec 10 17:00:53 2015 -0800 PowerManagerService: Log when proximity blocks wake There is currently no indication when the proximity sensor is allowed to prevent the system from waking up. This can make it hard to debug weird failed wakes. Add a log to facilitate debugging wakup problems. Change-Id: I7df34e13b1268a4e7211fb06ccd88f2053c0af0a Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Fri Feb 19 11:53:15 2016 -0500 base: Fix proximity check on power key To test, enable "Settings >> Display >> Prevent accidental wakeup", hold your hand over the proximity sensor and turn your phone on. Prior to this change, it will wake up the phone and after the change it will not. Change-Id: Ied300108cebb31dedf228e85510abebb3e8a4152 Author: vm03 <vasy@vasy.ru> Date: Sat Feb 27 17:16:02 2016 +0300 base: Fix proximity check on non power key To test, enable "Settings >> Display >> Prevent accidental wake-up" and "Settings >> Buttons >> Home button Wake up device", hold your hand over the proximity sensor and turn your phone on by home key. Prior to this change, it will wake up the phone and after the change it will not. Change-Id: Ifd14ff2ad9cd2cbc64209b9cf19e3c0ee0b6f40f Author: Roman Birg <roman@cyngn.com> Date: Tue Apr 26 16:39:47 2016 -0700 only use proximity checks on wakeup keys The power button should always wake the screen regardless of the proximity; only check proximity when the wake up key code is WAKEUP. Ticket: CYNGNOS-2579 Change-Id: I686ad22d513a3d939be3a0a5c3b752339b2383d3 Signed-off-by: Roman Birg <roman@cyngn.com> Author: LuK1337 <priv.luk@gmail.com> Date: Sat May 21 11:48:13 2016 +0200 Disable proximity check on power key properly Change-Id: If1ca0fa02805ce2fbe5a9ac1ab56a5e62beca4e1 Author: Han Wang <416810799@qq.com> Date: Tue May 5 05:45:43 2020 +0200 PowerManager: Move custom API definition to end of AIDL * Corrects IPowerManager.h transaction IDs that are currently out sequence. As a bonus, we don't need to update IPowerManager.h anymore when adding our own methods. Change-Id: Ifb84f999909317bd8281c896a68a8565173392c6 Change-Id: Ia5ff446d88435773acccc7467e66009000dc20cb
* | fwb: Re-introduce keyboard backlight brightness controlBruno Martins2022-11-071-1/+20
| | | | | | | | | | | | | | Picked remaining support from commit bbd00b7 and lid state handling from commit 68771fe. Change-Id: I310dfd026b2dc5e7bc47dd4a2c1ae029d58a1e8e
* | PowerManager: Allow to distinguish different keypressesCorinna Vinschen2022-11-071-0/+9
| | | | | | | | | | | | | | | | | | * Use keypress info to exclude pressing volume keys from illuminating HW buttons in config_buttonLightOnKeypressOnly mode. Change-Id: I6bfc7ddd075e12e1ad10c3663a63e80c8d7f983d Signed-off-by: Corinna Vinschen <xda@vinschen.de>
* | fw/b: Button backlight brightnessRicardo Cerqueira2022-11-071-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squash of: Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org> Date: Fri Nov 23 14:23:16 2012 +0000 Reintroduce button-backlight (and respective inactivity timeout) The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7 completely removed support for control of the button backlights, which makes all capacitive buttons out there stay dark. The commit message in that change mentions it hasn't been implemented _yet_, so this fix should be temporary until upstream does their own implementation Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a Author: Danny Baumann <dannybaumann@web.de> Date: Thu Aug 22 08:53:24 2013 +0200 Add PowerManager integration for button and keyboard backlight. Allows setting button and keyboard backlight brightness as well as button timeout. Change-Id: I550cccafc0a8f90d6347de9261adb26b75955cc4 Author: Steve Kondik <steve@cyngn.com> Date: Sat Jan 3 05:13:26 2015 -0800 power: Disable keyboard/button lights while dozing/dreaming * With hardkeys and doze mode enabled, entering suspend results in an epic battle over the lights. It's a bad situation. Disable them when we're sleepy. Change-Id: I7f1fc35a1573717d1ea101a07c4171d6f66d1553 Author: nadlabak <pavel@doshaska.net> Date: Sun Jun 7 02:01:05 2015 +0200 PowerManagerService: Fix updating of mUserActivitySummary I7f1fc35a1573717d1ea101a07c4171d6f66d1553 missed the fact that the primary purpose of the affected condition block was to update mUserActivitySummary and the button/keyboard light handling was just appended to it later. This fixes the waking from dream/screensaver by user activity. I30c5c8c9c09e3d57ace18cac72b783510b9b3bf3 is removed here as well as it was just a band aid. jira: NIGHTLIES-1285 Change-Id: I6b2f6c58e73110787d62e86d4d2ef538638cf491 Author: Bruno Martins <bgcngm@gmail.com> Date: Tue Dec 26 17:15:05 2017 +0000 Forward-port button brightness implementation to O * Reworked for the new handler interface, restoring also removed methods (partial revert of commit 86c39f9edee88baa912c694061010483c7da9daf). * Keyboard backlight brightness support left out for now. Change-Id: I53f031fa2da394e95a2b29a01eb3c6a8f8132507 Change-Id: I5176a2028c18408c17bac7f25e62b5612fd6c227
* | Powermenu: advanced reboot toggle - android 13ezio842022-10-261-0/+28
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | base: PowerMenu advanced reboot toggle Now R already provides an additional dialog when there are more than the max allowed buttons in the first row (3 by default), to put there both Power and Restart button. We can use that existing logic to put together Restart and our custom buttons (recovery-bootloader-systemui), without breaking the possibility for Power to be moved there if needed. Q reference: https://github.com/ezio84/abc_frameworks_base/commit/749ba7b9e0821d755d8775b018af266083569ffc Change-Id: I8273ecf9ecf2ee7e8bbdc035f33479e3dac80577 Update power menu icons Change-Id: I42a9a6ac88ec4bac052a409c1c8b6385d22092f3 Power menu: don't allow device trees to override the config Advanced power: fix Power showing twice if lockdown button is available base: expose advancedReboot for OpenDelta Change-Id: I5cb73f76bc04edaa8ec59177e0a270cb5b651eda Co-authored-by: Alex Crux <du.alexcruz@gmail.com> Co-authored-by: maxwen <max.weninger@gmail.com>
* Check sleep reason and time before cancelling vibrationsLais Andrade2022-05-131-19/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a method PowerManagerInternal.getLastGoToSleep(), similar to existing method getLastWakeup(), to retrieve global values for last go to sleep events, including system uptime and reason. Retrieve this data in VibratorManagerService before cancelling ongoing vibrations by the broadcast of ACTION_SCREEN_OFF intents to indicate that the screen was turned of when the vibration was still playing. This new logic allows vibrations to continue in the following cases: - the broadcasted event was triggered before the vibration started; - there is already a wakeup event triggered by the time the screen off broadcast is being processed by the vibrator service; - the screen off reason is in allowlist, indicating it's an automatically triggered event (screen timeout or user inattentive); This should handle the following scenarios: - delayed broadcasts of screen off events, that should not cancel vibrations that started when the screen was already off (e.g. notification or ringtone that are allowed to vibrate in that state); - race conditions when the screen automatically turns off right after a ringtone/notification vibration starts, before the notification acquires a screen lock; Fix: 219849350 Test: VibrationSettingsTest Change-Id: I358327192196989a7d4fc49a96b2ab92ec677302
* Don't poke user activity when dream endsRobert Horvath2022-03-301-1/+9
| | | | | | | | | | | | | | The dream may end for various reasons, including some that do not represent user activity, such as app crashes or the app being updated. In these cases, the user activity should not be poked, as this would reset the inattentive sleep timer. Bug: 215559033 Test: atest PowerManagerServiceTest Test: Kill dream app, observe `dumpsys power` lastUserActivityTime Test: Kill dream app, verify inattentive sleep timer not affected Change-Id: If9b61cab3d5e21b89f3c0ab7fe541d46bc865f97 Merged-In: If9b61cab3d5e21b89f3c0ab7fe541d46bc865f97
* Deprecate ACQUIRE_CAUSES_WAKEUP flag.Philip Junker2022-02-211-6/+10
| | | | | | Bug: 216114297 Test: javadocs only, no tests were run Change-Id: Iba8521e47151b84e4a59f32884041ea13f82e36b
* Add WakeLock.setStateListener() API.Hui Yu2022-01-281-1/+59
| | | | | | | | | | | | | | | | WakeLock uses this API to add listener of type WakelockStateListener, whenever framework enable/disable this wake lock, the onStateChanged() callback on this listener is called. This API can be called before or afte acquiring the wakelock. It can be called multiple times to change to another listener. Add test cases testNotifyWakeLockCallback() and testNotifyWakeLockCallbackChange() in PowerManagerServiceTest.java. Bug: 213925462 Test: atest cts/tests/tests/os/src/android/os/cts/PowerManager_WakeLockTest.java. Change-Id: Ic59303c59e53eb974e2765e3036002ac97ce8aa5
* Add API to configure LPS maintenance mode behaviorRobert Horvath2022-01-271-0/+21
| | | | | | | | Allow Low Power Standby to be active during doze maintenance modes. Bug: 190822356 Test: atest LowPowerStandbyControllerTest Change-Id: I6db6e1a37f48d63d618245f308ea1053c45fb64b
* Add TestApi to force Low Power Standby to be activeRobert Horvath2022-01-271-0/+20
| | | | | | | | | | | Since Low Power Standby depends on multiple factors to activate, including the private device configuration for the delay after the device becomes non-interactive, having this TestApi makes testing faster and more reliable. Bug: 190822356 Test: atest LowPowerStandbyTest Change-Id: I5a16083f996bd7421197b08c6632655c8c3d8c29
* Add TestApi wakelock flag to have system acquire wakelockRobert Horvath2022-01-271-0/+11
| | | | | | | | | Allows CTS tests to test power restrictions that disable wakelocks without the system suspending (since system-wakelocks are exempt). Bug: 190822356 Test: atest LowPowerStandbyTest Change-Id: I91f44ae93480be992151d845175606fb66ecb127
* Introduce Low Power Standby API and wakelock restrictionsRobert Horvath2022-01-271-0/+68
| | | | | | | | | | | | | | | | | | | | | In Low Power Standby, additional restrictions are placed on apps that are in a process state of FOREGROUND_SERVICE or less important during standby (while the device is non-interactive): - Wakelocks are disabled - Network access is blocked During doze maintenance windows the restrictions are lifted temporarily. This change introduces the APIs for Low Power Standby, as well as the wakelock restrictions. This feature is targeting TVs. To prevent Low Power Standby from being enabled on other devices, the feature is guarded by the config flag config_lowPowerStandbySupported. Bug: 190822356 Test: atest LowPowerStandbyControllerTest PowerManagerServiceTest Ignore-AOSP-First: New permission only added internally for now. Change-Id: Ia40f8a0fc4b366860af58ad76c988f93a5d41936
* Merge "Update PowerManager class docs."TreeHugger Robot2022-01-261-13/+6
|\
| * Update PowerManager class docs.Michael Wright2022-01-261-13/+6
| | | | | | | | | | | | | | | | | | They generally refer to the Wakelock API, but PowerManager controls more than that these days. Bug: 216373630 Test: compiles Change-Id: I117460292b0da8563fbc249e7e2e27671eaf0da5
* | Merge "Move logic from dreamDisplayGroupNoUpdateLocked into PowerGroup."Philip Junker2022-01-261-0/+15
|\ \
| * | Move logic from dreamDisplayGroupNoUpdateLocked into PowerGroup.Philip Junker2022-01-261-0/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add onWakefulnessChangedCallback which is called whenever the wakefulness of a PowerGroup changes. Set the wakefulness for a new PowerGroup to WAKEFULNESS_AWAKE instead of the current global wakefulness. This way the newly added PowerGroup will not directly go to sleep if the device happens to be asleep. Introduce per power group lastWakeTime and lastSleepTime. Rename setGlobalWakefulnessLocked() to updateGlobalWakefulnessLocked(), getGlobalWakefulnessLocked() to recalculateGlobalWakefulnessLocked() and getWakefulnessLocked() to getGlobalWakefulnessLocked(). Rename dreamDisplayGroupNoUpdateLocked() to dreamPowerGroupLocked(). Rename sleepDisplayGroupNoUpdateLocked() to dozePowerGroupLocked(). Rename reallySleepDisplayGroupNoUpdateLocked() to sleepPowerGroupLocked(). Rename wakeDisplayGroupNoUpdateLocked() to wakePowerGroupLocked(). Test: atest FrameworksServicesTests:PowerManagerServiceTest Bug: 200653844 Change-Id: Ic90f3b0c116e8e9db7df730f1500c0e8b99fe677
* / Clean-up some warnings and docs bugs in PowerManagerMichael Wright2022-01-141-29/+29
|/ | | | | | Bug: 214018230 Test: Build Change-Id: I660bcbdc3bd4d8894704356bb140306759fea765
* Merge "Treat changes in device-state as user-activity."Santos Cordon2022-01-111-0/+6
|\
| * Treat changes in device-state as user-activity.Santos Cordon2022-01-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | PowerManager will now treat changes in the device state from DeviceStateManager as user-activity for the purposes of calculating idle timeouts. Bug: 199993642 Test: Check logs to verify that user-activity is updated when changing device states. Test: atest PowerManagerServiceMockingTest Change-Id: Ib5e543dd502d6b9b8ef1fef7e1b0f8a188f3cf1e
* | Prepare PropertyInvalidatedCache for SystemApiLee Shombert2022-01-041-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 152453213 Tag: #refactor This commit prepares PropertyInvalidatedCache to function as a system api. Specifically, the methods recompute() and bypass() which may be overridden by clients are now public (instead of protected). This forces an update to all existing clients, to accommodate the change in method visibility. Two small changes have been made as cleanup: 1. The awkwardly named debugCompareQueryResults() is now resultEquals(), which is more or less consistent with how other equality tests are named in Android. This name change affects two clients. 2. PackageManager has changed to use resultEquals() instead of maybeCheckConsistency(). This provides a simpler and more consistent use of the APIs. maybeCheckConsistency() has been made private. Test: atest PropertyInvalidatedCacheTests Change-Id: I4110f8e887a4fd8c784141e8892557a9d1b80a94
* Go to sleep on fold for foldable devices.Santos Cordon2021-11-101-2/+10
| | | | | | | | | Allow configuration of foldable states to indicate the device should sleep when entering certain states. Test: Check that device still wakes up on unfold, and sleeps on fold. Bug: 180154690 Change-Id: I179d93ec506deee7e9da7d9190934c52a0bc188f
* Update light idle API naming.Kweku Adams2021-10-151-6/+33
| | | | | | | Bug: 196018606 Test: atest DeviceIdleTest Test: atest FrameworksMockingServicesTests:DeviceIdleControllerTest Change-Id: If5743bab8715ec203d4c83051fadd4eff276bc78
* Merge "Wake foldable device when device unfolds." into sc-v2-dev am: ↵TreeHugger Robot2021-09-271-0/+8
|\ | | | | | | | | | | | | | | d92c7d85d7 am: fea04ba9e9 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15379072 Change-Id: Ie2322844b66a91ef7d99a8c22a6c046f91942ecd
| * Wake foldable device when device unfolds.Santos Cordon2021-09-241-0/+8
| | | | | | | | | | | | | | | | | | Trigger a wake from within the display-layout transition for the device-state specified in the config.xml file. Bug: 190593710 Test: Manually verify that the device wakes when opening Change-Id: I28419ce93a5df6caa7a116860d891814118c7bc2
* | Open up PM.isLightDeviceIdleMode().Kweku Adams2021-07-301-4/+0
|/ | | | | | | | Bug: 159413914 Bug: 170611680 Test: atest DeviceIdleTest Test: atest FrameworksMockingServicesTests:DeviceIdleControllerTest Change-Id: Ie4f4148350fde8a8372433271bf00f8e1b804d52
* Clarify what ignoring battery optimizations means.Kweku Adams2021-05-271-0/+2
| | | | | | | | Add some more definition to what it means to be on the power allowlist. Bug: 173547576 Test: N/A Change-Id: I6c6bd3248dc39877e560656e787ef02adf7d279f
* Update Wakelocks to be per-DisplayGroupSean Stout2021-03-251-11/+31
| | | | | | Bug: 168210495 Test: atest PowerManagerServiceTest Change-Id: Ic23301a8dcdfc97f3a83c74d61ad4108a187e52d
* Merge "Document intents triggering CEC power control messages" into sc-devNathalie Le Clair2021-03-171-0/+10
|\
| * Document intents triggering CEC power control messagesNathalie Le Clair2021-03-161-0/+10
| | | | | | | | | | | | | | | | | | Specific to Android TV playback devices sending power control messages to the HDMI-connected TV. Bug: 170097638 Test: make Change-Id: I97907d9d6a4522425306ad2cc9d10aef1f4c8869
* | Fix dim duration on flip to screen off.bquezada2021-03-111-0/+7
| | | | | | | | | | | | | | | | | | Timeouts are calculated from mLastUserActivityTime, so just calling updatePowerStateLocked will go to locked with almost no dim duration. Test: Tested with local device. Bug: 164517126 Change-Id: I084c13fada7613bd745ceb1dc2f7038097d70686
* | Pass Display ID when reporting user activity from JavaSean Stout2021-03-021-1/+1
|/ | | | | | | | | Display ID information will be used to implement per-DisplayGroup timeouts. Test: manual - ensure Display ID is passed Bug: 175764389 Change-Id: Id6881e10408eef26458359e1bb0a7356a8d70e62
* Merge "Remove unnecessary permission check." into sc-devKweku Adams2021-02-221-1/+4
|\
| * Remove unnecessary permission check.Kweku Adams2021-02-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason for getPowerSaveModeTrigger to require the POWER_SAVER permission. The API is only marked as a SystemApi because it was designed for a specific use case and 3rd party apps don't need to know the information, but there's no problem if they get the value. All the value tells you is whether the device will turn on battery saver automatically based on the percentage level or if it'll turn on automatically based on a different dynamic signal. Bug: 174241855 Test: atest android.os.cts.PowerManagerTest Test: atest android.permission.cts.PowerManagerServicePermissionTest Test: atest CtsPermission2TestCases Test: atest SettingsProviderTest Change-Id: I3146a681d9c5da9c68a7e6b38b50314b293dc924
* | Merge "Document behaviour of "quiescent" reboot reason" into sc-devRobert Horvath2021-02-191-0/+6
|\ \ | |/ |/|
| * Document behaviour of "quiescent" reboot reasonRobert Horvath2021-02-021-0/+6
| | | | | | | | | | | | | | | | | | On Android TV, adding ",quiescent" to the reboot reason performs a quiescent boot, during which the screen stays off. Bug: 178802099 Test: Still compiles Change-Id: Ib593ba863a718f869bbd04ff24593d0e0a384d99
* | Introduce BATTERY_PREDICTION permission.Kweku Adams2021-02-161-2/+6
|/ | | | | | | | | | | | | DEVICE_POWER is very powerful, so introduce the BATTERY_PREDICTION permission to allow privileged apps with the permission to provide the system with battery predictions. Bug: 139413884 Test: atest android.os.cts.PowerManagerTest Test: atest android.permission.cts.PowerManagerServicePermissionTest Test: atest CtsPermission2TestCases Test: atest SettingsProviderTest Change-Id: Ib52f20b5145785a5fc363601757ad9c57f40e254
* Update docs for PowerManagerSean Stout2021-02-011-10/+70
| | | | | | | | Additionally, new "go to sleep" and "wake up" reasons have been added. Bug: 138328918 Test: make Change-Id: If3e8488264d461a7b1635bd80afac6bfd45ec778
* add full battery saver runtime modification APINicholas Ambur2021-01-251-0/+59
| | | | | | | | | | | | | | | | New system API added for privledged clients to modify the full battery saver mode policy. This API is used to override static settings at runtime, and any overridden settings are cleared when exiting full battery saver mode. Bug: 172294448 Test: atest PowerManagerTest Test: atest PowerManagerServiceTest Test: atest BatterySaverPolicyTest Test: build and boot ensuring SoundTrigger service behavior is not changed Change-Id: I41f968799b184a5dac702553379294795614be0a
* add SoundTrigger service modes in battery saverNicholas Ambur2021-01-221-0/+59
| | | | | | | | | | | | | | | | | Control over the SoundTrigger service behavior in battery saver mode is expanded to from a boolean to multiple modes. Modes include enabled, disabled, and privileged. Adding the privedged mode allows for the SoundTrigger service to selectively control clients which are deemed esential to the Android system. Bug: 172294448 Test: atest BatterySaverPolicyTest Test: atest CtsBatterySavingTestCases Test: atest PowerManagerTest Test: build and verify backward compatibility with SoundTrigger system service behavior Change-Id: Ib701963b07b205e5902ef265198b390a9850cb88
* Merge "Revert "PM#goToSleep and PM#wakeUp only affects default display group""Kelvin Zhang2021-01-221-70/+10
|\
| * Revert "PM#goToSleep and PM#wakeUp only affects default display group"Kelvin Zhang2021-01-221-70/+10
| | | | | | | | | | | | | | | | This reverts commit e2f209d2600864c447362f7c71341c8e5564b41f. Reason for revert: b/178215050 Change-Id: Ie2de678eda2cc633a5f18cc14b155c56b8c633ca
* | Merge "PM#goToSleep and PM#wakeUp only affects default display group"Sean Stout2021-01-211-10/+70
|\|
| * PM#goToSleep and PM#wakeUp only affects default display groupSean Stout2021-01-211-10/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL changes the behavior of PM#goToSleep to instead turn off the power for the default display group. PM#wakeUp turns on the default display group. If all display groups are turned off, the device will go to sleep. If any display group is on, the device will remain interactive. This results in no behavior change if there is a single display group. However if there are multiple display groups then it will be possible to interact with ones that are on while others are off. Bug: 138328918 Bug: 170935083 Bug: 175919649 Test: atest PowerManagerServiceTest Change-Id: I8b475c38886eda3e43d6e8da7e68102a25da1584