Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75c52789 authored by Aurélien Pomini's avatar Aurélien Pomini Committed by Android (Google) Code Review
Browse files

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

parents 6f0bcaf4 fa746386
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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();
}
+21 −0
Original line number Diff line number Diff line
@@ -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>
+7 −0
Original line number Diff line number Diff line
@@ -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
+9 −0
Original line number Diff line number Diff line
@@ -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) {