Fixes crash due to incorrect live wallpaper handling
Fixes: 272421363
Test: manual with lock screen live wallpaper disabled in T
Test: manual with lock screen live wallpaper disabled and enabled in U
Change-Id: I6317f0c269eb7552cd59f5b1b165c2830e2b7066
diff --git a/src/com/android/wallpaper/module/DefaultCurrentWallpaperInfoFactory.java b/src/com/android/wallpaper/module/DefaultCurrentWallpaperInfoFactory.java
index b8c1388..c9f9b26 100755
--- a/src/com/android/wallpaper/module/DefaultCurrentWallpaperInfoFactory.java
+++ b/src/com/android/wallpaper/module/DefaultCurrentWallpaperInfoFactory.java
@@ -88,8 +88,8 @@
WallpaperInfo lockWallpaper = null;
if (lockWallpaperMetadata != null) {
- if (lockWallpaperMetadata instanceof LiveWallpaperMetadata
- && mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
+
+ if (lockWallpaperMetadata instanceof LiveWallpaperMetadata) {
lockWallpaper = mLiveWallpaperInfoFactory.getLiveWallpaperInfo(
lockWallpaperMetadata.getWallpaperComponent());
} else {
diff --git a/src/com/android/wallpaper/module/DefaultWallpaperRefresher.java b/src/com/android/wallpaper/module/DefaultWallpaperRefresher.java
index 3c2be7a..3c87028 100755
--- a/src/com/android/wallpaper/module/DefaultWallpaperRefresher.java
+++ b/src/com/android/wallpaper/module/DefaultWallpaperRefresher.java
@@ -139,7 +139,8 @@
setFallbackLockScreenWallpaperMetadata();
}
- if (mWallpaperManager.getWallpaperInfo(FLAG_LOCK) == null) {
+ if (mWallpaperManager.getWallpaperInfo(FLAG_LOCK) == null
+ || !mWallpaperManager.isLockscreenLiveWallpaperEnabled()) {
wallpaperMetadatas.add(new WallpaperMetadata(
mWallpaperPreferences.getLockWallpaperAttributions(),
mWallpaperPreferences.getLockWallpaperActionUrl(),