Fix WallpaperManagerInternal NPE

Some targets don't have a WallpaperManager, thus this null check is
necessary to avoid crashes. A crash was detected in Android auto
emulator.

Fixes: 280883891
Test: build completed successfully
Change-Id: Ie475e9ba1999f109572252303e4103e5f977b4bd
This commit is contained in:
Aurélien Pomini
2023-05-05 12:19:30 +00:00
parent b26be926b0
commit c206441b06

View File

@@ -3555,7 +3555,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
mRootWindowContainer.forAllDisplays(displayContent -> {
mKeyguardController.keyguardGoingAway(displayContent.getDisplayId(), flags);
});
getWallpaperManagerInternal().onKeyguardGoingAway();
WallpaperManagerInternal wallpaperManagerInternal = getWallpaperManagerInternal();
if (wallpaperManagerInternal != null) {
wallpaperManagerInternal.onKeyguardGoingAway();
}
}
} finally {
Binder.restoreCallingIdentity(token);