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

Commit 36308147 authored by Eric Rahm's avatar Eric Rahm Committed by Android (Google) Code Review
Browse files

Merge changes I723cd3f0,I73a4516b into main

* changes:
  Improve comparison of default wallpapers
  Move verbose wallpaper update log
parents e6bd2e30 09af2b3b
Loading
Loading
Loading
Loading
+28 −16
Original line number Diff line number Diff line
@@ -256,6 +256,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    || event != CLOSE_WRITE // includes the MOVED_TO case
                    || wallpaper.imageWallpaperPending;

            if (isMigration) {
                // When separate lock screen engine is supported, migration will be handled by
                // WallpaperDestinationChangeHandler.
                return;
            }
            if (!(sysWallpaperChanged || lockWallpaperChanged)) {
                return;
            }

            if (DEBUG) {
                Slog.v(TAG, "Wallpaper file change: evt=" + event
                        + " path=" + path
@@ -270,15 +279,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                        + " needsUpdate=" + needsUpdate);
            }

            if (isMigration) {
                // When separate lock screen engine is supported, migration will be handled by
                // WallpaperDestinationChangeHandler.
                return;
            }
            if (!(sysWallpaperChanged || lockWallpaperChanged)) {
                return;
            }

            int notifyColorsWhich = 0;
            synchronized (mLock) {
                notifyCallbacksLocked(wallpaper);
@@ -3494,15 +3494,24 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        }
    }

    /**
     * Determines if the given component name is the default component. Note: a null name can be
     * used to represent the default component.
     * @param name The component name to check.
     * @return True if the component name matches the default wallpaper component.
     */
    private boolean isDefaultComponent(ComponentName name) {
        return name == null || name.equals(mDefaultWallpaperComponent);
    }

    private boolean changingToSame(ComponentName componentName, WallpaperData wallpaper) {
        if (wallpaper.connection != null) {
            if (wallpaper.wallpaperComponent == null) {
                if (componentName == null) {
            final ComponentName wallpaperName = wallpaper.wallpaperComponent;
            if (isDefaultComponent(componentName) && isDefaultComponent(wallpaperName)) {
                if (DEBUG) Slog.v(TAG, "changingToSame: still using default");
                // Still using default wallpaper.
                return true;
                }
            } else if (wallpaper.wallpaperComponent.equals(componentName)) {
            } else if (wallpaperName != null && wallpaperName.equals(componentName)) {
                // Changing to same wallpaper.
                if (DEBUG) Slog.v(TAG, "same wallpaper");
                return true;
@@ -3519,6 +3528,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        // Has the component changed?
        if (!force && changingToSame(componentName, wallpaper)) {
            try {
                if (DEBUG_LIVE) {
                    Slog.v(TAG, "Changing to the same component, ignoring");
                }
                if (reply != null) reply.sendResult(null);
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to send callback", e);