From c44d33accb0f2a8a4a5b3b95ee8b705d09c9d505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pomini?= Date: Tue, 20 Dec 2022 19:13:58 +0000 Subject: [PATCH] Add method in WallpaperManager to get config_independentLockscreenLiveWallpaper LockscreenWallpaper.java (and potentially other files) have access to a WallpaperManager instance, but no instance of context/resources. To minimise changes, a hidden method boolean isLockscreenLiveWallpaperEnabled() has been added to WallpaperManager to get the config flag. Other classes can use this flag and implement the new wallpaper logic when it is true. Bug: 197814683 Test: treehugger (low-risk, no logic changes) Change-Id: I791ba72f571f996906d2c23f97bba7b88b2fe21f --- core/java/android/app/WallpaperManager.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 84b404de98605..71e79d3b30115 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -115,6 +115,9 @@ public class WallpaperManager { private static final @NonNull RectF LOCAL_COLOR_BOUNDS = new RectF(0, 0, 1, 1); + /** Temporary feature flag for project b/197814683 */ + private final boolean mLockscreenLiveWallpaper; + /** {@hide} */ private static final String PROP_WALLPAPER = "ro.config.wallpaper"; /** {@hide} */ @@ -750,6 +753,8 @@ public class WallpaperManager { mWcgEnabled = context.getResources().getConfiguration().isScreenWideColorGamut() && context.getResources().getBoolean(R.bool.config_enableWcgMode); mCmProxy = new ColorManagementProxy(context); + mLockscreenLiveWallpaper = context.getResources() + .getBoolean(R.bool.config_independentLockscreenLiveWallpaper); } // no-op constructor called just by DisabledWallpaperManager @@ -757,6 +762,7 @@ public class WallpaperManager { mContext = null; mCmProxy = null; mWcgEnabled = false; + mLockscreenLiveWallpaper = false; } /** @@ -773,6 +779,15 @@ public class WallpaperManager { return sGlobals.mService; } + /** + * Temporary method for project b/197814683. + * @return true if the lockscreen wallpaper always uses a wallpaperService, not a static image + * @hide + */ + public boolean isLockscreenLiveWallpaperEnabled() { + return mLockscreenLiveWallpaper; + } + /** * Indicate whether wcg (Wide Color Gamut) should be enabled. *