From 28616ea86ffb6424aff52c1a754514bc7e8f39e5 Mon Sep 17 00:00:00 2001 From: Gen Date: Mon, 29 Jul 2024 14:10:20 -0700 Subject: 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 --- .../com/android/systemui/statusbar/phone/CentralSurfacesImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-59-g8ed1b