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
This commit is contained in:
Aurélien Pomini
2022-12-20 19:13:58 +00:00
parent 7c3628fcf4
commit c44d33accb

View File

@@ -115,6 +115,9 @@ public class WallpaperManager {
private static final @NonNull RectF LOCAL_COLOR_BOUNDS = private static final @NonNull RectF LOCAL_COLOR_BOUNDS =
new RectF(0, 0, 1, 1); new RectF(0, 0, 1, 1);
/** Temporary feature flag for project b/197814683 */
private final boolean mLockscreenLiveWallpaper;
/** {@hide} */ /** {@hide} */
private static final String PROP_WALLPAPER = "ro.config.wallpaper"; private static final String PROP_WALLPAPER = "ro.config.wallpaper";
/** {@hide} */ /** {@hide} */
@@ -750,6 +753,8 @@ public class WallpaperManager {
mWcgEnabled = context.getResources().getConfiguration().isScreenWideColorGamut() mWcgEnabled = context.getResources().getConfiguration().isScreenWideColorGamut()
&& context.getResources().getBoolean(R.bool.config_enableWcgMode); && context.getResources().getBoolean(R.bool.config_enableWcgMode);
mCmProxy = new ColorManagementProxy(context); mCmProxy = new ColorManagementProxy(context);
mLockscreenLiveWallpaper = context.getResources()
.getBoolean(R.bool.config_independentLockscreenLiveWallpaper);
} }
// no-op constructor called just by DisabledWallpaperManager // no-op constructor called just by DisabledWallpaperManager
@@ -757,6 +762,7 @@ public class WallpaperManager {
mContext = null; mContext = null;
mCmProxy = null; mCmProxy = null;
mWcgEnabled = false; mWcgEnabled = false;
mLockscreenLiveWallpaper = false;
} }
/** /**
@@ -773,6 +779,15 @@ public class WallpaperManager {
return sGlobals.mService; 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. * Indicate whether wcg (Wide Color Gamut) should be enabled.
* <p> * <p>