diff options
| author | 2024-07-29 14:10:20 -0700 | |
|---|---|---|
| committer | 2024-08-05 17:27:49 -0700 | |
| commit | 28616ea86ffb6424aff52c1a754514bc7e8f39e5 (patch) | |
| tree | d79fa382856adb0e9a30ebc547c8ed239d725758 | |
| parent | e799f714656407f6e0011f9af7844ac67a6b2d34 (diff) | |
Check for wallpaper support before using APIs
Wallpaper support is not guaranteed and use of WallpaperManager's APIs
need to be guarded behind a WallpaperManager#isWallpaperSupported check
to avoid system service exceptions.
Bug: 355307617
Test: SysUI no longer crashing due to inappropriate access of disabled
wallpaper APIs. When wallpaper support is disabled.
Flag: EXEMPT bugfix
Change-Id: I8fe43c16ff8ece6565951eb423c13e6e4eece1d3
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 3a3b05bdd71d..ddfc5626d7ab 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -2273,7 +2273,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { // applying the dimming effect twice. mUiBgExecutor.execute(() -> { float dimAmount = 0f; - if (mWallpaperManager.lockScreenWallpaperExists()) { + // Note that access to WallpaperManager APIs should be guarded by a check into + // WallpaperManager#isWallpaperSupported. Form factors that do not use wallpaper + // may crash SysUI during improper access. ref: b/355307617 + if (!mWallpaperSupported || mWallpaperManager.lockScreenWallpaperExists()) { dimAmount = mWallpaperManager.getWallpaperDimAmount(); } final float scrimDimAmount = dimAmount; |