From ec07c2893044ceecb8adab439047ac4ef22ca75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pomini?= Date: Mon, 13 Mar 2023 14:59:55 +0000 Subject: [PATCH] Add a SysPropBooleanFlag for the lockscreen-lwp project. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in order to teamfood the flag and flip it more easily. The flag is SysProp since accessed from different reposĀ (mainly Frameworks/base and LivePicker) Bug: 273443374 Test: manual: flip the flag in the flippin app and observe the change Change-Id: Ic5b488a80b8e946069fd4eadbd895c2bb8e7f4bc --- core/java/android/app/IWallpaperManager.aidl | 7 +++ core/java/android/app/WallpaperManager.java | 21 ++++++--- core/res/res/values/config.xml | 4 -- core/res/res/values/symbols.xml | 1 - .../src/com/android/systemui/flags/Flags.kt | 5 +++ .../systemui/wallpapers/ImageWallpaper.java | 14 +++--- .../server/wallpaper/WallpaperDataParser.java | 27 +++++++----- .../wallpaper/WallpaperManagerService.java | 43 ++++++++++--------- .../server/wm/WallpaperController.java | 8 ++-- .../server/wm/WallpaperWindowToken.java | 2 +- 10 files changed, 78 insertions(+), 54 deletions(-) diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl index f4373a67a9672..ee242635bfb2f 100644 --- a/core/java/android/app/IWallpaperManager.aidl +++ b/core/java/android/app/IWallpaperManager.aidl @@ -243,4 +243,11 @@ interface IWallpaperManager { * @hide */ boolean lockScreenWallpaperExists(); + + /** + * Temporary method for project b/197814683. + * Return true if the lockscreen wallpaper always uses a WallpaperService, not a static image. + * @hide + */ + boolean isLockscreenLiveWallpaperEnabled(); } diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 4d55fee35506b..ebd525ec6508a 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -142,9 +142,6 @@ 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} */ @@ -306,6 +303,7 @@ public class WallpaperManager { private final Context mContext; private final boolean mWcgEnabled; private final ColorManagementProxy mCmProxy; + private Boolean mIsLockscreenLiveWallpaperEnabled = null; /** * Special drawable that draws a wallpaper as fast as possible. Assumes @@ -794,8 +792,6 @@ 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 @@ -803,7 +799,6 @@ public class WallpaperManager { mContext = null; mCmProxy = null; mWcgEnabled = false; - mLockscreenLiveWallpaper = false; } /** @@ -827,7 +822,19 @@ public class WallpaperManager { */ @TestApi public boolean isLockscreenLiveWallpaperEnabled() { - return mLockscreenLiveWallpaper; + if (sGlobals == null) { + mIsLockscreenLiveWallpaperEnabled = SystemProperties.getBoolean( + "persist.wm.debug.lockscreen_live_wallpaper", false); + } + if (mIsLockscreenLiveWallpaperEnabled == null) { + try { + mIsLockscreenLiveWallpaperEnabled = + sGlobals.mService.isLockscreenLiveWallpaperEnabled(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + return mIsLockscreenLiveWallpaperEnabled; } /** diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index ef19fc1f53601..baf19bb104600 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -6296,10 +6296,6 @@ --> -1 - - false -