summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-07-26Save space in small width screensFabian Kozynski
In order to leave more space for carrier names in QS, do the following: * Remove enterprise icon from QQS/QS icons * If screen is less than 390dp wide, don't show battery estimate and instead show percentage. Test: manual, multiple densities and landscape Fixes: 189413614 Change-Id: I4758d3822dc07e42b254b8b48c9905231748165a
2021-04-08Move ActivityLaunchAnimator in its own lib. (1/n)Jordan Demeulenaere
Bug: 184121838 Test: Manual Change-Id: Ib979fed2f59d9dbf5f0696edb5fcb4956600e6e0
2021-03-23Add null check to batterymeterview in case the percent view becomes nullEvan Laird
Seems like this can only happen if we have a successful battery reading and then immediately the conditions change causing us to remove the precent view. Test: atest SystemUITests Fixes: 180019511 Change-Id: I4bf8508a9cef18ade62863b07086254e39897059
2021-02-19Add missing null check for mBatteryPercentView.Peter Collingbourne
On an emulated device without a battery we've observed a NullPointerException coming from a call to setText() on a null mBatteryPercentView: FATAL EXCEPTION: main Process: com.android.systemui, PID: 4234 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at com.android.systemui.BatteryMeterView.setPercentTextAtCurrentLevel(BatteryMeterView.java:380) at com.android.systemui.BatteryMeterView.lambda$updatePercentText$0(BatteryMeterView.java:366) at com.android.systemui.BatteryMeterView.lambda$updatePercentText$0$BatteryMeterView(Unknown Source:0) at com.android.systemui.-$$Lambda$BatteryMeterView$tE-TUFngFnD6fsDmUpqJf1miV_U.onBatteryRemainingEstimateRetrieved(Unknown Source:2) at com.android.systemui.statusbar.policy.BatteryControllerImpl.notifyEstimateFetchCallbacks(BatteryControllerImpl.java:308) at com.android.systemui.statusbar.policy.BatteryControllerImpl.lambda$0VzGTjPGwGKStizyJuiiH2rMVVk(Unknown Source:0) at com.android.systemui.statusbar.policy.-$$Lambda$BatteryControllerImpl$0VzGTjPGwGKStizyJuiiH2rMVVk.run(Unknown Source:2) It seems that it's possible for the battery meter to enter the hidden percentage state in between the check in updatePercentText() and the lambda callback. Guard against that possibility with a null check in the lambda. Bug: 178231152 Change-Id: Ia805a1a8497d4ad4f99c2864e17a88d46690d471
2021-02-10Read battery and icon colors from themeLucas Dupin
QuickStatusBarHeader doesn't listen for dark events, so it should be reading text colors from the default theme instead. Test: change to dark theme, change to light theme Test: change battery level via adb Fixes: 179685319 Change-Id: I35f59af58c501c6b6f204be31750b10d73158b71
2020-10-19Listen for EXTRA_PRESENT changesEvan Laird
ACTION_BATTERY_CHANGED can pass a boolean EXTRA_PRESENT which would alert listeners that a battery may or may not be present. SystemUI now wants to show an error battery state instead of a potentially misleading status in this situation. Bug: 169935148 Test: adb shell cmd battery set present 1 Change-Id: I7d576248bb9931059100facb67ca6b46e81e554e
2020-07-29Update language to comply with Android’s inclusive language guidanceJulia Tuttle
See https://source.android.com/setup/contribute/respectful-code for reference #inclusivefixit Bug: 161896447 Test: still builds! let's see what presubmit says. Change-Id: Ia0aac0b80511076f77a64a9eee6eff9376ed906f
2020-06-26StatusBar icons are GONE when status bar is hiddenBeverly
Explicitly disable status bar icons when the status bar isn't in view. This is to ensure the status bar won't unnecessarily make calls to draw. Also consolidates status bar disabling logic to CollpasedStatusBarFragment (removed from BatteryMeterView + StatusBarIconController). Test: manual test that battery icon updates don't redraw when the status bar isn't visible to the user in fullscreen/immersive modes 1. Enable Developer Option "Show surface updates" 2. Open fullscreen app 3. adb shell cmd battery unplug/reset Observe: status bar doesn't redraw Test: manually open a hierarchy viewer when the status bar is hidden in a fullscreen/immersive app. observe the icons are GONE Fixes: 120483410 Change-Id: I182559199b0a1f01122f0163836b7e2824f2acba
2020-01-16Updated StatusBarIconController and StatusBarSignalPolicy to check iconJianYang Liu
blacklist from config value, config_statusBarIconBlacklist. Bug: 118675475 Test: Manual Change-Id: I44dd1d007d3f7b9b435eceb273ecf333aef7cef4
2019-12-12Re-enable BatteryMeterView checking the icon_blacklistEvan Laird
This line accidentally went missing in Q Fixes: 145964765 Test: manual Change-Id: Ib3fcd06cf90fb4de8d07fa8851ce47b9fcd07d5e
2019-11-04Finish migrating to BroadcastDispatcherFabian Kozynski
This CL migrates most of the remaining classes to use BroadcastDispatcher. Some classes left are Views or created before the BroadcastDispatcher can be injected. Adds docs for instructions on using the BroadcastDispatcher. Using the broadcast dispatcher, the time system_server spends dispatching common intents to SystemUI like SCREEN_OFF and SCREEN_ON can be seen to decrease from ~70-150ms (in a Q build) to ~2-4ms. Additionally, once a broadcast is received by the dispatcher, time until it is fully dispatched inside SystemUI is not impacted greatly. Most broadcasts are fully dispatched after ~20ms with a few of them taking ~100ms. Test: atest SystemUITests no regressions Test: build and boot Test: tried some random broadcasts and they are properly dispatched Test: BroadcastDispatch dump Test: adb shell dumpsys activity broadcasts Bug: 134566046 Change-Id: I26a592be66b053f25669b5481b58bf7f07bfd0da
2019-11-01Remove all calls to getComponent(CommandQueue.class).Dave Mankoff
Makes AuthController, GlobalActionsComponent, InstantAppNotifier, SizeCompatModeActivityController, and TvStatusBar all injectable. Prior to this CL, CommandQueue contained within it a SystemUI object that it used to start itself up and add itself to components. With this change, the SystemUI object is no longer necessary, as Dagger will ensure that a CommandQueue is available to those who need it. Bug: 143702229 Test: atest SystemUITests Change-Id: I2763a6d918b41fe27a2370fdd820da476654e14f
2019-08-26IPC StrictModeLucas Dupin
This CL introduces a way of blocking IPCs on the main thread. This is enforced by StrictMode, and enabled on tests and eng builds. All current blocking IPCs were whitelisted and bugs will be filed, in order to fix them for R. Bug: 139360025 Test: adb logcat Test: atest SystemUITests Change-Id: I45af2619605ee36b6bae83ef080272c62754b654
2019-06-14Fix battery content description when there is no percent modeEvan Laird
Fixes: 135157243 Test: can focus on status bar battery when talkback is on Change-Id: I413ba6664bc651ddc378ae344fa42a17d460bfa5
2019-05-31Update battery content description.Amin Shaikh
Ensure "battery" and "percent" are included. Bug: 134035327 Test: make; enable talkback Change-Id: I4c8a0a2c53333bc24b7075f19ca9ec4f9203167e
2019-05-29Add battery estimate to content description.Amin Shaikh
Fixes: 128892060 Test: mp sysuig Change-Id: Ic8563fc3681d695fdacc94ca03e96df898b40e0c
2019-04-25Merge "Fix colors in QS Header" into qt-devFabian Kozynski
2019-04-25Fix colors in QS HeaderFabian Kozynski
Fixes icon and text colors in QS Header to be darker in Light mode. Also, makes sure that all colors in the icons match. Does this by implementing the following: * A new theme that overrides darkIconTheme in Theme.SystemUI by one with darker colors. * QuickStatusBarHeader applies that theme and passes is onto its children, in particular StatusIconContainer/StatusBarMobileView and BatteryMeterView. * StatusBarMobileView and BatteryMeterView retrieve the colors from the theme and apply them accordingly. * Also applies to QSCarrierGroup * Additionally, the single color is used for the other icons. Also invalidates SignalDrawable after setColors is called if at least one of the colors changed. This is a real issue. For more info: * Text and icons set to 70% black on light mode, white in dark mode. * Dual tone set for background overlaid with fill match single tone. Test: visual Fixes: 124466915 Change-Id: Ia6cb28fca90a07c8936726334502e7accf534df6
2019-04-24Update SysUI to use system cache for battery estimatesSalvador Martinez
This should help prevent Settings and SysUI from getting out of sync with each other. Test: manual by adjusting battery levels with adb Bug: 124030091 Change-Id: I8eaba920a10e045c4c983406873de66208c22fb7
2019-04-15Merge "Fix tinting of battery percentage" into qt-devFabian Kozynski
2019-04-15DO NOT MERGE Turn off LAYER_TYPE_SOFTWARE on BatteryMeterViewEvan Laird
We still need to save a layer for the BlendMode.CLEAR paint to do the right thing. But with this we can save just the layer needed to draw the battery instead of the whole battery meter view. Test: visual Bug: 130536257 Change-Id: I9d5844440250ccd9174e6c001e051c9adf62a2d0 (cherry picked from commit b4c703b8e30e50fa451171be563c556704db5ef4)
2019-04-12Fix tinting of battery percentageFabian Kozynski
The wallpaper aware tinting was being overwritten by the style. Changed order to fix. Fixes: 130408545 Test: manual, enabling and disabling percentage, also dark mode Change-Id: I551f335f34fb8e9c5894901041e9229ec181e1c6
2019-04-08Visual changes to QS headerFabian Kozynski
Change TextAppearance in QS header. Also, reduce size of QS tile background. Removed extra padding in the bottom of QSIconViewImpl that was not needed. Test: visual Bug: 124466915 Change-Id: I0b8db6edad7f8527caff76f9419c42a8016a6bda
2019-03-12Fixed battery percentage not animating when showing/hidingshawnlin
Add layout transition animation Fixed: 123362236 Test: manual - turn on/off show battery percentage in settings and go to AOD Change-Id: Ie98434e565d23461d82729d582f8ff4e63d8ac88
2019-03-06Always show time remaining estimate string in QSEvan Laird
QS will always show the time remaining estimate string, unless charging or the estimate is unavailable Test: visual Fixes: 127519046 Change-Id: Iaa268ce631d3196967748b7f562d26e19ddeb465
2019-02-26Create a battery icon that loads pathsEvan Laird
Create a new battery drawable that will load enough resources from frameworks/base/core/res/res/ to allow for theming overlays. The current things are overlayable: - Perimeter path: the outer shape of the battery (including the terminal) - Fill mask: path defining the shape of the fill - Bolt path: charging bolt path. draws with appropriate protection for visibilty - Powersave path: path of the plus sign that draws when in powersave mode. also draws with protection Test: visual; sysui demo mode Bug: 123705805 Change-Id: I2bb15fd10e3fec63cb115a8f216794933b717404
2019-01-12Merge "Move battery % down in QS, fix a lot of things"TreeHugger Robot
2019-01-11Move battery % down in QS, fix a lot of thingsEvan Laird
- Move the battery percentage next to the system icons in quick settings - Always show the percentage, and optionally show the estimate text based on battery settings - Move the estimate text into the BatteryMeterView - Move the fetching of the estimate off of the main thread Test: visual Change-Id: Ie37952079b2394c67464f69eb8a2f0089b08875d Fixes: 119799219 - padding Fixes: 120996084 - moving estimate fetch off main thread Bug: 116481529
2019-01-11remove status bar icon logsChris Wren
partial revert of Ife5ce988 Bug: 122451213 Test: runtest systemui Change-Id: I026217ea8e95ba0805b05e62a5d527c8c3a1d9ce
2019-01-02Make DarkIconDispatcher visible to pluginsBeverly
Test: manual Bug: 115322193 Change-Id: I6204d771e476c504e9070ebc88dd8fd44b268635
2018-12-19Lockscreen changes font on Overlay changeFabian Kozynski
Change-Id: I96ed7f3a0ce8bd9fb8ce8c05280a2950d0efac5f Test: Manual (using HotDogOverlay) Bug: 121124205
2018-12-06Bring lifecycle to sysuiJason Monk
- Add a method to observe callbacks based on lifecycle - Add 2 examples of this in real code (one for a view, one for a fragment Test: runtest systemui Change-Id: I9e1e4a617a63e702602472b2079a477e373ff1e9
2018-12-05Fix battery icon showing in QQS when it shouldn'tEvan Laird
BatteryMeterView was listening to sysui tuner for its visibility, but in QQS we want to control it via settings Test: visual Change-Id: I52f1e389b82e7a75c30e66c1d4547e5b4875a37e
2018-11-13Add estimated time remaining text to QSEvan Laird
- Add an API to BatteryController to get an estimated time remaining string. - BatteryController will now check up to once per minute what the estimated time will be and builds the string using PowerUtil. - If the "show percentage" setting is on, the estimated time remaining string (and battery icon) will show next to the system icons in QS - Also make the battery percent in QS obey the setting Test: visual Bug: 116481529 Change-Id: Iaafa00127c8b8baae40956254a1237c8b7ac079b
2018-08-23Fix color resolution on status barLucas Dupin
Test: visual Change-Id: I306d6ffe0cc0b861d17bc26784b6e2c1db2ee2c2 Fixes: 112823374
2018-07-30Merge "Fix battery percent multi-user"TreeHugger Robot
2018-07-23Fix battery percent multi-userEvan Laird
Test: visual Change-Id: I41b2c72c9910d8756b218a6d1a4ef7b84c6e2cee Fixes: 110210915
2018-06-21Merge "Add config to disallow the battery % option" into pi-dev am: a063da83f1Evan Laird
am: 2272f08724 Change-Id: I4de78fe137ed23012f13447d9460bfe19916df33
2018-06-13Add config to disallow the battery % optionEvan Laird
This config will be respected and override the value found in Settings if a user restores from a device which had SHOW_BATTERY_PERCENTAGE set to true. It is also respceted on the keyguard where we would typically show the battery percent if the device is charging. Percentage is still shown above QS though. Test: visual Change-Id: I1f59b68097ffcbb7dda9d2ec99ea0ba9062c6dff Bug: 80129194
2018-06-12Dump keyguard status bar stateLucas Dupin
We didn't have KeyguardStatusBarView dumps in our dumpsys, adding more info will make our lives easier in the future. Test: adb shell dumpsys activity service com.android.systemui Change-Id: I07af14922501889cc15005f01463674f0651dfde Fixes: 109899206
2018-05-21Merge "Status bar icons 15 dp" into pi-dev am: 97abc762ccEvan Laird
am: 4811db16a5 Change-Id: I75f145a1cd7445674964e0e7b1127290df3bad87
2018-05-18Status bar icons 15 dpEvan Laird
Shrink all status bar icons by 2dp. This means setting a scale factor on anything that is a StatusBarIconView, and manually scaling down wifi and mobile data groups. Also fix the padding between the mobile data view and the battery Also snuck in a fix for the battery saver icon clipping on QS Change-Id: I5f5430d9e9c66f5c2794dcf4974cf18aa3bff061 Test: visual Fixes: 74985733 Fixes: 79967193 Bug: 77822905
2018-04-11[SettingsLib] Update Utils APIs usageJason Chang
Update Utils.getColorAttr and similar methods in Utils to return a ColorStateList instead of a color Bug: 74872054 Test: Force to display different color items then manually test Change-Id: I92697a597b532ba95f29a886baa114ed6d0ac632
2018-04-04[QS] Update landscape UIRohan Shah
Rolling forward the landscape UI changes (To not break taimen with a notch this time!). OG CL: ag/3717677 Shorten status bar height in landscape and update colors to use wallpaperTextColor when in landscape mode. Additionally modified scrim opacity for the QS panel to provide more contrast/focus on content. Test: Visually Bug: 73808887 Change-Id: I249579d2898b9915868bb584661864d10ed88de2
2018-03-29Revert "[QS] Update landscape UI"Rohan Shah
This reverts commit bc204efbe5602e130fbe666d6ea2b5185d42b0c4. Reason for revert: Causes crash on rotation due to something with config.xml overriding. Reverting as it's blocking daily build Bug: 77217078 Test: Ran build, checked rotation Change-Id: I79e94fb1703f888ac167cdae20142e130a2e80b3
2018-03-26[QS] Update landscape UIRohan Shah
Shorten status bar height in landscape and update colors to use wallpaperTextColor when in landscape mode. Additionally modified scrim opacity for the QS panel to provide more contrast/focus on content. Test: Visually Bug: 73808887 Change-Id: I74713587ca426020cb15960800a4d2b6ac5f6466
2018-01-29Fix battery background color in QSEvan Laird
Battery was only getting a foreground color, not background. Fix by using the SystemUI context so it finds the correct light colors for both foregorund and background. Test: visual with light wallpaper Change-Id: I6e18ce9331a5e78241d8c24ba96a8b843c646813 Fixes: 72431673
2018-01-18Initial support for camera cutout in CollapsedStatusBarEvan Laird
- Display a space view exactly covering where the display cutout is - Custom layout for system_icons because this view needs to now layout right-to-left, and hide icons that don't fit. Similar to notification icon container but in the other direction. Still needs dots and to limit the # of icons - When in landscape/seascape, the cutout space disappears and instead the status bar insets itself by the same amount that the window is letterboxed - Moved battery percent back to the right of the battery because the time is no longer on that side Test: adb shell cmd overlay enable com.android.internal.display.cutout.emulation && adb shell stop && adb shell start # to start emulation Bug: 63772836 Change-Id: I8071bfb4983a9d9306df1487cdac956494e80c28
2017-09-25StatusBar: add DISABLE2_SYSTEM_ICONS flagCharles He
Add a StatusBarManager flag to control the visibility of system icons such as connectivity info, battery, etc. Note that the clock is controlled separately through DISABLE_CLOCK. Also note that this flag differs from DISABLE_SYSTEM_INFO, which controls the system icons and the clock as a whole, but only works for the collapsed status bar (CollapsedStatusBarFragment). Bug: 65813398 Test: runtest systemui Test: manual, by using a modified version of TestDPC and DevicePolicyManagerService Change-Id: Icb61c7bb1a625edd818be7a66d7f15c3e812237b