Merge "Add a SysPropBooleanFlag: wallpaper cropping for foldables" into udc-dev

This commit is contained in:
Aurélien Pomini
2023-05-11 10:02:25 +00:00
committed by Android (Google) Code Review
4 changed files with 44 additions and 0 deletions

View File

@@ -258,4 +258,11 @@ interface IWallpaperManager {
* @hide
*/
boolean isLockscreenLiveWallpaperEnabled();
/**
* Temporary method for project b/270726737.
* Return true if the wallpaper supports different crops for different display dimensions.
* @hide
*/
boolean isMultiCropEnabled();
}

View File

@@ -314,6 +314,7 @@ public class WallpaperManager {
private final boolean mWcgEnabled;
private final ColorManagementProxy mCmProxy;
private static Boolean sIsLockscreenLiveWallpaperEnabled = null;
private static Boolean sIsMultiCropEnabled = null;
/**
* Special drawable that draws a wallpaper as fast as possible. Assumes
@@ -865,6 +866,26 @@ public class WallpaperManager {
return sIsLockscreenLiveWallpaperEnabled;
}
/**
* Temporary method for project b/270726737
* @return true if the wallpaper supports different crops for different display dimensions
* @hide
*/
public static boolean isMultiCropEnabled() {
if (sGlobals == null) {
sIsMultiCropEnabled = SystemProperties.getBoolean(
"persist.wm.debug.wallpaper_multi_crop", false);
}
if (sIsMultiCropEnabled == null) {
try {
sIsMultiCropEnabled = sGlobals.mService.isMultiCropEnabled();
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
}
return sIsMultiCropEnabled;
}
/**
* Indicate whether wcg (Wide Color Gamut) should be enabled.
* <p>

View File

@@ -524,6 +524,13 @@ object Flags {
@JvmField val LOCKSCREEN_LIVE_WALLPAPER =
sysPropBooleanFlag(1117, "persist.wm.debug.lockscreen_live_wallpaper", default = false)
// TODO(b/281648899): Tracking bug
@Keep
@JvmField
val WALLPAPER_MULTI_CROP =
sysPropBooleanFlag(1118, "persist.wm.debug.wallpaper_multi_crop", default = false)
// 1200 - predictive back
@Keep
@JvmField

View File

@@ -181,6 +181,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
private final Object mLock = new Object();
/** True to enable a second engine for lock screen wallpaper when different from system wp. */
private final boolean mIsLockscreenLiveWallpaperEnabled;
/** True to support different crops for different display dimensions */
private final boolean mIsMultiCropEnabled;
/** Tracks wallpaper being migrated from system+lock to lock when setting static wp. */
WallpaperDestinationChangeHandler mPendingMigrationViaStatic;
@@ -1602,6 +1604,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
mIsLockscreenLiveWallpaperEnabled =
SystemProperties.getBoolean("persist.wm.debug.lockscreen_live_wallpaper", false);
mIsMultiCropEnabled =
SystemProperties.getBoolean("persist.wm.debug.wallpaper_multi_crop", false);
LocalServices.addService(WallpaperManagerInternal.class, new LocalService());
}
@@ -3723,6 +3727,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
return mIsLockscreenLiveWallpaperEnabled;
}
@Override
public boolean isMultiCropEnabled() {
return mIsMultiCropEnabled;
}
private void onDisplayReadyInternal(int displayId) {
synchronized (mLock) {
if (mLastWallpaper == null) {