Fix exception caused by system app setting wallpaper

It will cause NullPointerException if the system app set the wallpaper
before the third-party app set the wallpaper.

Change-Id: I7e68cf3f89b690c7b114fa087d1fd1203d8eb4d6
This commit is contained in:
Ge Tianxiong
2022-09-08 17:26:14 +08:00
committed by Jia Jia
parent 3312d073cb
commit 00b7871466

View File

@@ -2713,6 +2713,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
checkPermission(android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT);
synchronized (mLock) {
WallpaperData data = mWallpaperMap.get(mCurrentUserId);
if (data == null) {
data = mWallpaperMap.get(UserHandle.USER_SYSTEM);
if (data == null) {
Slog.e(TAG, "getWallpaperDimAmount: wallpaperData is null");
return 0.0f;
}
}
return data.mWallpaperDimAmount;
}
}