summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Divya Dubey <divya.a.dubey@sony.com> 2023-06-13 11:35:10 +0900
committer Mattias Nilsson <mattias.nilsson@sony.com> 2024-05-14 14:15:46 +0200
commit5d602200a4a17678f064e45f6a07682bd29d9543 (patch)
tree07342d517576a19b59189be6b3ff1af6a8bc8095
parent24ea590c058699f9c4dc8aee38cd2fab1a4d0c5c (diff)
Do not overwrite user set or live wallpapers
WallpaperUpdateReceiver unconditionally updates the wallpaper to the default_wallpaper when DEVICE_CUSTOMIZATION_READY is received. This overwrites live wallpapers and user set wallpapers. Just clear the wallpaper when there is no live wallpaper to avoid this from happening. Test: set a wallpaper and run adb shell am broadcast \ -a android.intent.action.DEVICE_CUSTOMIZATION_READY \ -f 0x01000000 Bug: 159673283 Change-Id: I385c28be84b9146e8620910258495f5d71b9c04e
-rw-r--r--services/core/java/com/android/server/WallpaperUpdateReceiver.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/WallpaperUpdateReceiver.java b/services/core/java/com/android/server/WallpaperUpdateReceiver.java
index 2812233815a6..42391a55fed6 100644
--- a/services/core/java/com/android/server/WallpaperUpdateReceiver.java
+++ b/services/core/java/com/android/server/WallpaperUpdateReceiver.java
@@ -24,7 +24,6 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.ParcelFileDescriptor;
import android.util.Slog;
@@ -59,10 +58,10 @@ public class WallpaperUpdateReceiver extends BroadcastReceiver {
return;
}
if (DEBUG) Slog.d(TAG, "Set customized default_wallpaper.");
- Bitmap blank = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8);
- // set a blank wallpaper to force a redraw of default_wallpaper
- wallpaperManager.setBitmap(blank);
- wallpaperManager.setResource(com.android.internal.R.drawable.default_wallpaper);
+ // Check if it is not a live wallpaper set
+ if (wallpaperManager.getWallpaperInfo() == null) {
+ wallpaperManager.clearWallpaper();
+ }
} catch (Exception e) {
Slog.w(TAG, "Failed to customize system wallpaper." + e);
}