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

Commit c743c46c authored by Aurélien Pomini's avatar Aurélien Pomini Committed by Automerger Merge Worker
Browse files

Merge "use new clearWallpaperLocked method everywhere" into udc-qpr-dev am:...

Merge "use new clearWallpaperLocked method everywhere" into udc-qpr-dev am: 4d11ed81 am: 2dbc585f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23728650



Change-Id: I30fd6cd6943f7d1fbe88459ae43e490608009002
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 34125b0b 2dbc585f
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -2038,7 +2038,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        WallpaperData data = null;
        synchronized (mLock) {
            if (mIsLockscreenLiveWallpaperEnabled) {
                clearWallpaperLocked(callingPackage, false, which, userId);
                clearWallpaperLocked(callingPackage, false, which, userId, null);
            } else {
                clearWallpaperLocked(false, which, userId, null);
            }
@@ -2059,7 +2059,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
    }

    private void clearWallpaperLocked(String callingPackage, boolean defaultFailed,
            int which, int userId) {
            int which, int userId, IRemoteCallback reply) {

        // Might need to bring it in the first time to establish our rewrite
        if (!mWallpaperMap.contains(userId)) {
@@ -2113,9 +2113,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        withCleanCallingIdentity(() -> clearWallpaperComponentLocked(wallpaper));
    }

    // TODO(b/266818039) remove this version of the method
    private void clearWallpaperLocked(boolean defaultFailed, int which, int userId,
            IRemoteCallback reply) {

        if (mIsLockscreenLiveWallpaperEnabled) {
            String callingPackage = mPackageManagerInternal.getNameForUid(getCallingUid());
            clearWallpaperLocked(callingPackage, defaultFailed, which, userId, reply);
            return;
        }

        if (which != FLAG_SYSTEM && which != FLAG_LOCK) {
            throw new IllegalArgumentException("Must specify exactly one kind of wallpaper to clear");
        }
@@ -3285,15 +3291,21 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
    boolean setWallpaperComponent(ComponentName name, String callingPackage,
            @SetWallpaperFlags int which, int userId) {
        if (mIsLockscreenLiveWallpaperEnabled) {
            return setWallpaperComponentInternal(name, callingPackage, which, userId);
            return setWallpaperComponentInternal(name, callingPackage, which, userId, null);
        } else {
            setWallpaperComponentInternalLegacy(name, callingPackage, which, userId);
            return true;
        }
    }

    private boolean setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which,
            int userId) {
        String callingPackage = mPackageManagerInternal.getNameForUid(getCallingUid());
        return setWallpaperComponentInternal(name, callingPackage, which, userId, null);
    }

    private boolean setWallpaperComponentInternal(ComponentName name, String callingPackage,
            @SetWallpaperFlags int which, int userIdIn) {
            @SetWallpaperFlags int which, int userIdIn, IRemoteCallback reply) {
        if (DEBUG) {
            Slog.v(TAG, "Setting new live wallpaper: which=" + which + ", component: " + name);
        }
@@ -3342,6 +3354,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            Slog.d(TAG, "publish system wallpaper changed!");
                        }
                        liveSync.complete();
                        if (reply != null) reply.sendResult(null);
                    }
                };