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

Commit 4de11add authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Remove lockscreen lwp flag

Bug: 273443374
Test: atest WallpaperManagerTest

Change-Id: Iee7b24f087cadfec9b08b0d6a9bd5d6f22543af8
parent fb0b1e0f
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -161,12 +161,6 @@ interface IWallpaperManager {
     */
    boolean isWallpaperBackupEligible(int which, int userId);

    /*
     * Keyguard: register a callback for being notified that lock-state relevant
     * wallpaper content has changed.
     */
    boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);

    /**
     * Returns the colors used by the lock screen or system wallpaper.
     *
@@ -252,13 +246,6 @@ interface IWallpaperManager {
     */
    boolean isStaticWallpaper(int which);

    /**
     * Temporary method for project b/197814683.
     * Return true if the lockscreen wallpaper always uses a WallpaperService, not a static image.
     * @hide
     */
     boolean isLockscreenLiveWallpaperEnabled();

    /**
     * Temporary method for project b/270726737.
     * Return true if the wallpaper supports different crops for different display dimensions.
+11 −68
Original line number Diff line number Diff line
@@ -313,7 +313,6 @@ public class WallpaperManager {
    private final Context mContext;
    private final boolean mWcgEnabled;
    private final ColorManagementProxy mCmProxy;
    private static Boolean sIsLockscreenLiveWallpaperEnabled = null;
    private static Boolean sIsMultiCropEnabled = null;

    /**
@@ -841,29 +840,14 @@ public class WallpaperManager {
    }

    /**
     * TODO (b/305908217) remove
     * Temporary method for project b/197814683.
     * @return true if the lockscreen wallpaper always uses a wallpaperService, not a static image
     * @hide
     */
    @TestApi
    public boolean isLockscreenLiveWallpaperEnabled() {
        return isLockscreenLiveWallpaperEnabledHelper();
    }

    private static boolean isLockscreenLiveWallpaperEnabledHelper() {
        if (sGlobals == null) {
            sIsLockscreenLiveWallpaperEnabled = SystemProperties.getBoolean(
                    "persist.wm.debug.lockscreen_live_wallpaper", true);
        }
        if (sIsLockscreenLiveWallpaperEnabled == null) {
            try {
                sIsLockscreenLiveWallpaperEnabled =
                        sGlobals.mService.isLockscreenLiveWallpaperEnabled();
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
        return sIsLockscreenLiveWallpaperEnabled;
        return true;
    }

    /**
@@ -2446,12 +2430,7 @@ public class WallpaperManager {
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public void clearWallpaper() {
        if (isLockscreenLiveWallpaperEnabled()) {
        clearWallpaper(FLAG_LOCK | FLAG_SYSTEM, mContext.getUserId());
            return;
        }
        clearWallpaper(FLAG_LOCK, mContext.getUserId());
        clearWallpaper(FLAG_SYSTEM, mContext.getUserId());
    }

    /**
@@ -2787,11 +2766,7 @@ public class WallpaperManager {
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public void clear() throws IOException {
        if (isLockscreenLiveWallpaperEnabled()) {
        clear(FLAG_SYSTEM | FLAG_LOCK);
            return;
        }
        setStream(openDefaultWallpaper(mContext, FLAG_SYSTEM), null, false);
    }

    /**
@@ -2816,16 +2791,7 @@ public class WallpaperManager {
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public void clear(@SetWallpaperFlags int which) throws IOException {
        if (isLockscreenLiveWallpaperEnabled()) {
        clearWallpaper(which, mContext.getUserId());
            return;
        }
        if ((which & FLAG_SYSTEM) != 0) {
            clear();
        }
        if ((which & FLAG_LOCK) != 0) {
            clearWallpaper(FLAG_LOCK, mContext.getUserId());
        }
    }

    /**
@@ -2840,16 +2806,12 @@ public class WallpaperManager {
    public static InputStream openDefaultWallpaper(Context context, @SetWallpaperFlags int which) {
        final String whichProp;
        final int defaultResId;
        if (which == FLAG_LOCK && !isLockscreenLiveWallpaperEnabledHelper()) {
            /* Factory-default lock wallpapers are not yet supported
            whichProp = PROP_LOCK_WALLPAPER;
            defaultResId = com.android.internal.R.drawable.default_lock_wallpaper;
        /* Factory-default lock wallpapers are not yet supported.
        whichProp = which == FLAG_LOCK ? PROP_LOCK_WALLPAPER : PROP_WALLPAPER;
        defaultResId = which == FLAG_LOCK ? R.drawable.default_lock_wallpaper :  ....
        */
            return null;
        } else {
        whichProp = PROP_WALLPAPER;
            defaultResId = com.android.internal.R.drawable.default_wallpaper;
        }
        defaultResId = R.drawable.default_wallpaper;
        final String path = SystemProperties.get(whichProp);
        final InputStream wallpaperInputStream = getWallpaperInputStream(path);
        if (wallpaperInputStream != null) {
@@ -2987,25 +2949,6 @@ public class WallpaperManager {
        return true;
    }

    /**
     * Register a callback for lock wallpaper observation. Only the OS may use this.
     *
     * @return true on success; false on error.
     * @hide
     */
    public boolean setLockWallpaperCallback(IWallpaperManagerCallback callback) {
        if (sGlobals.mService == null) {
            Log.w(TAG, "WallpaperService not running");
            throw new RuntimeException(new DeadSystemException());
        }

        try {
            return sGlobals.mService.setLockWallpaperCallback(callback);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Is the current system wallpaper eligible for backup?
     *
+0 −18
Original line number Diff line number Diff line
@@ -26,24 +26,6 @@
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <com.android.systemui.statusbar.BackDropView
        android:id="@+id/backdrop"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        sysui:ignoreRightInset="true"
    >
        <ImageView android:id="@+id/backdrop_back"
                   android:layout_width="match_parent"
                   android:scaleType="centerCrop"
                   android:layout_height="match_parent" />
        <ImageView android:id="@+id/backdrop_front"
                   android:layout_width="match_parent"
                   android:layout_height="match_parent"
                   android:scaleType="centerCrop"
                   android:visibility="invisible" />
    </com.android.systemui.statusbar.BackDropView>

    <com.android.systemui.scrim.ScrimView
        android:id="@+id/scrim_behind"
        android:layout_width="match_parent"
+1 −24
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.colorextraction;
import android.app.WallpaperColors;
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Color;
import android.os.UserHandle;

import com.android.internal.annotations.VisibleForTesting;
@@ -47,9 +46,7 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
        ConfigurationController.ConfigurationListener {
    private static final String TAG = "SysuiColorExtractor";
    private final Tonal mTonal;
    private boolean mHasMediaArtwork;
    private final GradientColors mNeutralColorsLock;
    private final GradientColors mBackdropColors;
    private Lazy<SelectedUserInteractor> mUserInteractor;

    @Inject
@@ -82,9 +79,6 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
        mNeutralColorsLock = new GradientColors();
        configurationController.addCallback(this);
        dumpManager.registerDumpable(getClass().getSimpleName(), this);

        mBackdropColors = new GradientColors();
        mBackdropColors.setMainColor(Color.BLACK);
        mUserInteractor = userInteractor;

        // Listen to all users instead of only the current one.
@@ -123,14 +117,6 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
        triggerColorsChanged(WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK);
    }

    @Override
    public GradientColors getColors(int which, int type) {
        if (mHasMediaArtwork && (which & WallpaperManager.FLAG_LOCK) != 0) {
            return mBackdropColors;
        }
        return super.getColors(which, type);
    }

    /**
     * Colors that should be using for scrims.
     *
@@ -140,14 +126,7 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
     * - Black otherwise
     */
    public GradientColors getNeutralColors() {
        return mHasMediaArtwork ? mBackdropColors : mNeutralColorsLock;
    }

    public void setHasMediaArtwork(boolean hasBackdrop) {
        if (mHasMediaArtwork != hasBackdrop) {
            mHasMediaArtwork = hasBackdrop;
            triggerColorsChanged(WallpaperManager.FLAG_LOCK);
        }
        return mNeutralColorsLock;
    }

    @Override
@@ -164,7 +143,5 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
        pw.println("    system: " + Arrays.toString(system));
        pw.println("    lock: " + Arrays.toString(lock));
        pw.println("  Neutral colors: " + mNeutralColorsLock);
        pw.println("  Has media backdrop: " + mHasMediaArtwork);

    }
}
+0 −6
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ import com.android.systemui.statusbar.ImmersiveModeConfirmation
import com.android.systemui.statusbar.gesture.GesturePointerEventListener
import com.android.systemui.statusbar.notification.InstantAppNotifier
import com.android.systemui.statusbar.phone.KeyguardLiftController
import com.android.systemui.statusbar.phone.LockscreenWallpaper
import com.android.systemui.statusbar.phone.ScrimController
import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener
import com.android.systemui.stylus.StylusUsiPowerStartable
@@ -342,11 +341,6 @@ abstract class SystemUICoreStartableModule {
    @ClassKey(KeyguardViewConfigurator::class)
    abstract fun bindKeyguardViewConfigurator(impl: KeyguardViewConfigurator): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(LockscreenWallpaper::class)
    abstract fun bindLockscreenWallpaper(impl: LockscreenWallpaper): CoreStartable

    @Binds
    @IntoMap
    @ClassKey(ScrimController::class)
Loading