summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r35' of ↵George Zacharia2023-04-031-13/+37
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into t13.0 Android 13.0.0 release 35 Change-Id: I709958b2f015d1774b2ece25894467c3a279f93c
| * Replace ACTION_USER_SWITCHED with UserTrackerAlex Stetson2022-11-161-4/+16
| | | | | | | | | | | | | | | | | | | | | | ACTION_USER_SWITCHED only applies to the foreground user and will not trigger for concurrent secondary users. By replacing this with UserTracker, the switching logic can be modify to track what is relevant for a given display/user. Bug: 249831072 Test: atest SystemUIUnitTests Change-Id: I6f5d482072ae92d7dda5e1753901b3f5dc521312
| * Merge "Replace screen broadcast receivers with binder cb" into tm-qpr-devTreeHugger Robot2022-10-151-6/+17
| |\
| | * Replace screen broadcast receivers with binder cbPeter Kalauskas2022-10-141-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the following broadcast receivers: - Intent.ACTION_SCREEN_ON with IKeyguardService.onStartedWakingUp() - Intent.ACTION_SCREEN_OFF with IKeyguardService.onFinishedGoingToSleep() Bug: 250084671 Test: manual, turn screen off and on Test: SystemUITests Change-Id: I9401c41c17de3be2c705ba41db2297f6eff7560d
| * | Make CoreStartable an Interface.Dave Mankoff2022-10-131-3/+4
| |/ | | | | | | | | | | | | | | | | Context is no longer passed in as a constructor arg. Bug: 229228871 Test: manual Change-Id: I3dd5e593f209d120eb36faf33ba629a2066ad3f5 Merged-In: I3dd5e593f209d120eb36faf33ba629a2066ad3f5
* / PowerUI: Mute logcat spam.spezi772022-10-211-4/+6
|/ | | | | | | | | | | https://katb.in/kat9848 I'm not 100% sure, but I believe that this was the reason for a SystemUI hang, which was responsible for the fact that the screen could not be switched on for several seconds and just remained black. Change-Id: I6ba156b35da4fe5725e5c69119967096e3a586cd (cherry picked from commit 80c9cbe2dd35a67cfcc4b30f6854342546676cbd)
* Remove EnhancedEstimates isHybird flag from trigger conditionWesley Wang2022-05-201-5/+1
| | | | | | | | | | | | - In some rare cases, EnhancedEstimates will not provide isHybird as true(means EnhancedEstimates can not provide data to us), it will makes low battery warning logic back to the previous trigger flow, remove isHybird condition to make sure we always use the new trigger condition. - Although BatteryStateSnapshot will be created by different EnhancedEstimates data, but we already remove the usage of remaining time as our trigger condition(which provided by EnhancedEstimates) so we are safe to always use new trigger condition with or without EnhancedEstimates data. we should think about refactor the class here in the future. - Use current battery level as notifications string content instead of a fixed value. Bug: 232663250 Bug: 232686016 Bug: 232712770 Test: atest SystemUITests Change-Id: I412be50763db39d364757ae3afc2927467451118
* Disable battery saver notification based on predicted time leftWesley Wang2022-04-271-6/+3
| | | | | | | | | | - Adjust the condition to not rely on the remaining time, this will makes the battery saver notification only be trigger by the fixed battery level Bug: 229198413 Test: atest SystemUITests Change-Id: I1f27c4b37fb7c80f451bd4339640ef8dcfbe456b
* Remove FileDescriptor from systemui.Dumpable.Dave Mankoff2022-04-051-2/+1
| | | | | | | | | | This is the first step in moving over to the new public android.util.Dumpable api. Bug: 217567642 Test: m SystemUI Merged-In: Ibaebcfb2c6c5326d0c45b8c72d868c76655d89a0 Change-Id: Ibaebcfb2c6c5326d0c45b8c72d868c76655d89a0
* Adjust low battery notificationWesley Wang2022-03-041-2/+0
| | | | | | | | | | | - Make low battery notification as ongoing notification and remove the delete intent since ongoing notification can not been remove - Remove unused attr Screenshot: https://screenshot.googleplex.com/gj5xYDik5Ct2WQb.png Bug: 207470943 Test: atest SystemUITests Change-Id: I9cfdc8deb455bb5f6707c08ffff3ff3405e99f2b
* Merge "Update low battery notification mechanism" into tm-devTreeHugger Robot2022-03-011-17/+9
|\
| * Update low battery notification mechanismWesley Wang2022-02-281-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Update warning and severe trigger percentage - Update low battery notification trigger condition to fixed value instead of remaining time - Update low battery notification text - Update start saver confirmation notification text - Use severe low battery dialog if available Screenshot: https://screenshot.googleplex.com/iZt43YU6fHQPNpy.png Bug: 207470943 Bug: 209932572 Test: atest SystemUITests Change-Id: I851e635e748a5315f9780a1344c2068cda14d95e
* | [Status Bar] Re-name StatusBar.java -> CentralSurfaces.java.Caitlin Cassidy2022-02-281-6/+8
|/ | | | | | | | | | | Also add some javadoc to CentralSurfaces.java to make its purpose slightly clearer. Bug: 197137564 Test: compiles Test: atest SystemUITests Change-Id: Id06e7ba7641d6d2bc276cce57101c9c7236bc758 Merged-In: Id06e7ba7641d6d2bc276cce57101c9c7236bc758
* More low-hanging Dependency#get calls.Dave Mankoff2022-01-251-8/+9
| | | | | | Bug: 138786270 Test: manual Change-Id: I147dbf27bfdaa2e4f78ac18e8dbf2713da0fdd73
* Rename SystemUI class to CoreStartableDave Mankoff2021-11-091-2/+2
| | | | | | Bug: 205725937 Test: manual Change-Id: I045a8b4b21cae0f4a6e61502384e2b1a607bc1c6
* Make StatusBar purely optionalTadashi G. Takaoka2021-07-151-4/+6
| | | | | | | | | | | | | | | To be able to inject Optional.empty() to Optional<StatusBar>, this CL - removes raw StatusBar references and replaces it with Optional<StatusBar> - replaces Optional<Lazy<StatusBar>> to Lazy<Optional<StatusBar>> Bug: 144309772 Bug: 138625582 Bug: 187111275 Bug: 187111293 Test: atest SystemUITests Change-Id: I07b63e417dd4cc75a17951619065ba0f234bc2aa Merged-In: I07b63e417dd4cc75a17951619065ba0f234bc2aa
* 6/N Move everything into SysUIComponent.Dave Mankoff2020-08-161-2/+2
| | | | | | | | | | | | | | | It is far easier to move _everything_ into SysUIComponent, and then selectively promote things back to GlobalScope and/or WMScope than it is to try to do it one at a time. With this change, though lots of files are touched, very little actually changes structurally. After this change goes in, folks should stop using @Singleton quite so freely. Most things should live in @SysuiSingleton. @Singleton is due to quickly be replaced by @GlobalScope. Bug: 162923491 Test: atest SystemUITests && manual Change-Id: Idc31d3d83b030581fb1fa869f7fafc4f2d3a8828
* Initialize values from sticy ACTION_BATTERY_CHANGEDFabian Kozynski2020-06-261-0/+14
| | | | | | | | | | | | | ACTION_BATTERY_CHANGED is sent as a sticky, so classes in SystemUI need to retrieve the last value as part of initialization. As there is no API to retrieve this, the only solution is get the last sticky for now. Test: atest KeyguardUpdateMonitorTest BatteryControllerTest Test: manual, restart and observe battery icon Fixes: 159679049 Change-Id: I9e4ea67a34f9166b863abc8f99b687e542128f8b
* Fix NullPointerException on estimate objectMill Chen2020-06-061-5/+10
| | | | | | | | | | | | | | The severe low battery warning notification isn't working if a device which uses time based estimates doesn't connect to Wi-Fi or mobile data. This is caused by a null estimate object which is obtained from EnhancedEstimates. This change is to make EnhancedEstimates return an unknown estimate and add checking time remaining condition to see if time remaining is valid. AOSP behavior is unchanged and this only affects devices which use time based estimates. Bug: 152880156 Test: atest SystemUITests Change-Id: I8f8ac67ebe66ffd748d958d34f9b31324c52f681
* BroadcastDispatcher can use Executors nowFabian Kozynski2020-01-091-1/+1
| | | | | | | | registerReceiver takes an optional Executor parameter. The old registerReceiver that takes a Handler has been renamed and @Deprecated Test: SystemUITests Change-Id: I43b97f720b2b153d1019ed3cf19e1533558e380f
* Move InattentiveSleepWarningController callbacks to PowerUIRobert Horvath2019-11-191-2/+23
| | | | | | | | | | | | | The inattentive sleep warnings are related to the power state of the deivce, and by keeping the inattentive sleep warning callbacks inside PowerUI, we reduce the number of components that have to be configured across the different SystemUI packages. Bug: 137633812 Test: adb shell settings put secure attentive_timeout 32000 Check overlay appears Change-Id: I7896c395a26eb5bdd67bb3ab48fc590beef8cec3
* Remove call to getComponent(StatusBar) from PowerUI.Dave Mankoff2019-10-231-3/+9
| | | | | | Bug: 143224715 Test: atest SystemUITests Change-Id: Iad2caf359ff2d19b4b43a8859ee4d49b14ad4f59
* Pass context into the constructor of SystemUI objects.Dave Mankoff2019-10-101-1/+2
| | | | | | | | | The next step is to remove `components` from the SystemUI objects and replace them with Dagger injection. Bug: 138786270 Test: atest SystemUITests Change-Id: I27415a8fa8ba0378599356426d849c9cfb9879d2
* Convert all SCREEN_OFF receivers to BroadcastDispatcherFabian Kozynski2019-09-251-1/+10
| | | | | | | | | | | | | | | | | | | All broadcast receivers that filter for ACTION_SCREEN_OFF have been converted to register with BroadcastDispatcher instead of Context. In many cases this involves other Intents being covered by BroadcastDispatcher. Additionally, UserBroadcastDispatcher propagates the PendingResult so the individual receivers can access it (mostly to query getSendingUser). Test: enable logging of BroadcastQueue for ACTION_SCREEN_OFF only shows 2 receivers (user 0 and user -1) Test: Dump of BroadcastDispatcher shows all the classes registered to it Test: enable logging of UserBroadcastDispatcher Test: atest PowerUITest StatusBarTest VolumeDialogControllerImplTest SystemUIDialogTest NavigationBarFragmentTest Bug: 134566046 Change-Id: I0caa2a6b53f3f6b360bf2e8598dde29c45f1d4e3
* Only show the thermal shutdown warning when thermal rebootSherry Huang2019-08-051-5/+20
| | | | | | | | | | | | | | showThermalShutdownWarning() is on the path where systemui starts and restarts. Previously, we just checked the boot reason in determining whether to show the warning, which makes it unexpectedly seen when systemui restarts from crashes. This CL caches the last boot count and compares with the current one to ensure that there is a thermal reboot before the warning is shown. Test: atest PowerUITest Bug: 138089094 Change-Id: I0a51d00703d291ba10a6ab4f348308a14000a20e
* Merge "SystemUI: overheat warning enhancements and bug fixes." into qt-devSherry Huang2019-05-101-43/+99
|\
| * SystemUI: overheat warning enhancements and bug fixes.Sherry Huang2019-05-101-43/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Add support of dynamically enabling/disabling overheat warning upon Settings change at runtime. 2) Rename related classes, methods, and variables to improve the readability. 3) Fix an issue where skin overheat warning fails to show when previous dismissal is triggered by intent ACTION_DISMISSED_TEMP_WARNING or ACTION_CLICKED_TEMP_WARNING. Test: atest SystemUITests Test: enable/disable overheat warning via adb command and trigger the warning with emulated temperature. Bug: 126326427 Bug: 129043751 Change-Id: I844f75a042651bdd433715fedfc190b8fbff0fd4
* | Make Settings and SysUI estimates use same data classSalvador Martinez2019-04-191-1/+4
|/ | | | | | | | | | | This moves everything over to using a shared data class for Estimates in SettingsLib which will facilitate a cl that will help ensure greater consistency across surfaces where battery estimates are shown. Test: Tests pass Bug: 124030091 Change-Id: I0b7f1f3a806255ff4804a00e6d90a7846c484484
* Fix mixed up variable in triggering logicSalvador Martinez2019-04-041-2/+3
| | | | | | | | | | | | | When this code got refactored the check for severe warnings accidentally had the time remaining being compared against the percentage value of the severe warning threshold. Unfortunately this meant that it was impossible to mark the severe level warning as shown and could result in multiple triggerings. This change makes it so everything is compared with the appropriate type of value again. Test: PowerUI Tests pass Bug: 129730217 Change-Id: Ic8bdabf1c70e49d117210bb80f1ca0a0d7684617
* Remove the 3 hour warningSalvador Martinez2019-03-271-4/+6
| | | | | | | | | | | | Now that we have early warning to notify users if they won't make their next charge time, the 3 hours warning isn't really necessary since it will trigger a few hours later anyways. The severe warning (1 hour/5%) is unchanged. AOSP behavior is unchanged, this only affects devices which use time based estimates. Test: sysUI tests pass Bug: 120030285 Change-Id: Iedbcb7e2a357a0125523bf950818259fb59aefab
* Refactor battery warning code to make it easier to readSalvador Martinez2019-03-041-91/+172
| | | | | | | | | | | | Currently the logic for the hybrid warning and the legacy warning is all mixed together and it makes it hard to understand what is going on. This CL seperates that logic and also adds a immutable data type to be used when evaluating whether a warning should be shown rather than checking global variables. Test: sysUI tests pass Bug: 126149098 Change-Id: I3a781a4361b0d6a7e8a09e454fcf89a99c3fa175
* Remove HardwarePropertiesManager usageWei Wang2019-02-221-4/+0
| | | | | | | | Bug: 116866524 Bug: 77790357 Test: Build Test: atest PowerUITest Change-Id: I5b5c9c56c9123872a3626fdb55508d1594bf3878
* Implement USB-C overheat warningSherry Huang2019-02-211-125/+80
| | | | | | | | | | | | | | | When device USB-C port is susceptible to short circuits and overheating, pop up a warning dialog and keep showing until user clicks OK button or see care steps. Test: manually set the emulated temperature to trigger warning Test: atest SystemUITests Change-Id: I4f6080187196a9716f12a9817dc10d3265dc202b Bug: 110134720 Bug: 116866524 Bug: 77790357 Bug: 117178820
* Remove potential duplicate runnable + add loggingSalvador Martinez2019-02-111-5/+23
| | | | | | | | | | This CL removes an existing runnable for showing the low battery warning if it hasn't finished. Additionally, it adds some logging to the trigger method to make it possible to debug issues. Test: PowerUITests still pass Bug: 111374781 Change-Id: Iaaf6fa8233cc23f2e608a7968dac617eab0d5ce3
* PowerUI: poll thermal sensor in handlerWei Wang2018-11-271-11/+4
| | | | | | | Fixes: 120037422 Bug: 116866524 Test: adb logcat |grep SystemUIBootTiming Change-Id: I2b76aa43bb093a884080809ef0f984de65ce4729
* Add mock thermal service in PowerUI testWei Wang2018-11-211-2/+2
| | | | | | | | Thermal event might interfere with unit test. Bug: 119873861 Test: atest frameworks/base/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java Change-Id: If610d53355bf4e2c29b807acce887096489f62c8
* Add thermal service into system_serverWei Wang2018-11-071-3/+3
| | | | | | | | | | | | | | | | This system service will listen to ThermalHAL for throttling events and take actions accordingly, e.g. shutdown device and/or sending notification to registered listeners to IThermalSerivce. Bug: 79443945 Bug: 118510237 Bug: 111086696 Bug: 116541003 Test: Boot and test callback on ThermalHAL 1.1 Test: Boot and test callback on ThermalHAL 2.0 Test: Kill ThermalHAL process Test: Change device threshold to trigger shutdown Change-Id: I1f4066c9f1cf9ab46c1738a0a4435802512e4339
* Update triggering to not double trigger at severe thresholdSalvador Martinez2018-10-011-2/+3
| | | | | | | | | | | If the low threshold is not shown for any reason and we reach the severe threshold and it does show it will double trigger. This CL just makes it so both are marked as "shown" if the severe warning is shown regardless of whether the low warning was shown or not. Test: runtest systemui Bug: 116716293 Change-Id: I7fff2d7beba7b37312b9a4c4951a68c3d1f1ba3f
* Update severe (5%/1 hour) warning to send through battery saverSalvador Martinez2018-08-081-5/+6
| | | | | | | | | | | | | | | | Now that battery saver is sticky this notification never shows and we are getting reports from people that the notification they were expecting never showed up. It turns out that a lot of these were due to people not realizing battery saver was on. To remedy the worst case situation (your phone is about to die soon but no 15%/3 hour notification came up) we should always show the severe warning even if battery saver is on. This only affects the hybrid warning, not the legacy percentage based version. Test: unit tests Bug: 111596093 Change-Id: I92453b68b6ee8aad8f862147c877f4e789afc55c
* Only query for estimate on battery level changeSalvador Martinez2018-07-101-4/+10
| | | | | | | | | | SysUI is querying for an estimate too much, this change gates it on being the first estimate or the battery level having changed so that we don't waste system resources. Test: atest PowerUITest Bug: 110259498 Change-Id: I6fb5c08d6388e463d6216de41b3fd49bbc489b81
* Dismiss low battery warning on toggling saver.Amin Shaikh2018-04-161-3/+12
| | | | | | Change-Id: If6988a67ce0e97c2c9df93648169b9c9b85da7ce Fixes: 66987022 Test: runtest systemui
* Update triggering logic for hybrid notificationSalvador Martinez2018-03-291-30/+46
| | | | | | | | | | | | | | Currently in the worst case a user can receive 4 battery notifications if the time estimates and percentages line up right. This CL makes it so a user can at MOST receive one "low" battery warning and one "critical" battery warning per charge cycle. A charge cycle is restarted when a user charges to at least 45% battery AND has 6 hours remaining. This does not affect the behavior of the non-hybrid notification. Test: robotests Bug: 76203825 Change-Id: Ib3c7fe589f1ce4c0cdb821e1f21d1139a56fad62
* Implement new BS warning / notification flow (1/2)Makoto Onuki2018-03-211-17/+2
| | | | | | | | | | | | | - Show the battery saver confirmation dialog only for the first time. - Start counting # of manual activations, which will be used in a follow-up CL. Bug: 74120126 Test: Manual tests with ./vendor/google_experimental/users/omakoto/android-battery-tester Test: m -j ROBOTEST_FILTER=BatterySaverUtilsTest RunSettingsLibRoboTests Test: cd frameworks/base/packages/SystemUI/tests && \ atest src/com/android/systemui/power/PowerUITest.java src/com/android/systemui/power/PowerNotificationWarningsTest.java Change-Id: If6a081a6222e6a87c4cd332364c89856e7648a36
* Update time based triggering logic to guard against spamSalvador Martinez2018-02-081-16/+40
| | | | | | | | | | | | Since the time based estimate takes recent usage into account we could get a situation where the notification could trigger many times. This CL makes it so the notification can only trigger at most twice per charge cycle. The percentage based triggering remains unaffected. Test: SysUI Tests Bug: 27567513 Change-Id: I81e29f96ac97b0d1a177e923c16d5f2800da404a
* Merge "Update the comment on LOW_POWER_MODE_TRIGGER_LEVEL in PowerUI"Makoto Onuki2018-02-021-2/+6
|\
| * Update the comment on LOW_POWER_MODE_TRIGGER_LEVEL in PowerUIMakoto Onuki2018-02-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I originally envisioned to keep this logic and the one in the battery service (which decides when to send a LOW_BATTERY broadcast) in sync. However, because this PowerUI logic decides when to show the "battery low" notification, and showing the notification when the battery level is still 50% doesn't really make sense even when the battery saver starts at 50%, so let's only cap the value in PowerUI. So if LOW_POWER_MODE_TRIGGER_LEVEL is 50, - Battery saver kicks in at battery level 50% - LOW_BATTERY broadcast is also sent at 50% - But we don't show the "battery low" notification until 15% still. (I'll talk with the PM and we might tweak the details.) Bug: 71707409 Test: build & boot Change-Id: I162dc722a6f634e5844ed81385a8463797634a02
* | Move showing notification to background threadSalvador Martinez2018-01-311-1/+4
|/ | | | | | | | | | The new notification logic can result in an IPC so to avoid doing this on the main thread we should just handle all the battery warning logic in the background. Test: SysUI tests still pass Bug: 72622147 Change-Id: I0c1ad9ebde2ea8d0404d9f6fd019e8620419e61d
* Add flag to SysUI for Hybrid notificationSalvador Martinez2018-01-241-2/+5
| | | | | | | | | This CL adds some configurable flags to the logic for showing the hybrid notification. Test: Tests still pass Bug: 72122935 Change-Id: I8b13346167a79691ecc3cb21e45b42f8ae99e7b8
* Merge "Refactor code to support overridden low battery warning"Salvador Martinez2018-01-161-17/+69
|\
| * Refactor code to support overridden low battery warningSalvador Martinez2018-01-111-17/+69
| | | | | | | | | | | | | | | | | | This adds support for enabling the hybrid notification using data from Device Health Services. Test: SystemUITests Bug: 27567513 Change-Id: I5fae3d85f2d4956210bb067ff7c8b14146c8c89c