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

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

Merge "Run liveSync/localSync.complete() earlier" into udc-qpr-dev

parents b2b6b910 30ead9a7
Loading
Loading
Loading
Loading
+10 −17
Original line number Diff line number Diff line
@@ -321,9 +321,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            if (DEBUG) {
                                Slog.d(TAG, "publish system wallpaper changed!");
                            }
                            if (localSync != null) {
                                localSync.complete();
                            }
                            notifyWallpaperChanged(wallpaper);
                        }
                    };
@@ -331,7 +328,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    // If this was the system wallpaper, rebind...
                    bindWallpaperComponentLocked(mImageWallpaper, true, false, wallpaper,
                            callback);
                    notifyColorsWhich |= FLAG_SYSTEM;
                    notifyColorsWhich |= wallpaper.mWhich;
                }

                if (lockWallpaperChanged) {
@@ -345,9 +342,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            if (DEBUG) {
                                Slog.d(TAG, "publish lock wallpaper changed!");
                            }
                            if (localSync != null) {
                                localSync.complete();
                            }
                            notifyWallpaperChanged(wallpaper);
                        }
                    };
@@ -372,9 +366,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                }

                saveSettingsLocked(wallpaper.userId);
                // Notify the client immediately if only lockscreen wallpaper changed.
                if (lockWallpaperChanged && !sysWallpaperChanged) {
                    notifyWallpaperChanged(wallpaper);
                if ((sysWallpaperChanged || lockWallpaperChanged) && localSync != null) {
                    localSync.complete();
                }
            }

@@ -1383,7 +1376,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            lockWp.connection.mWallpaper = lockWp;
                            mOriginalSystem.mWhich = FLAG_LOCK;
                            updateEngineFlags(mOriginalSystem);
                            notifyWallpaperColorsChanged(lockWp, FLAG_LOCK);
                        } else {
                            // Failed rename, use current system wp for both
                            if (DEBUG) {
@@ -1403,7 +1395,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                        updateEngineFlags(mOriginalSystem);
                        mLockWallpaperMap.put(mNewWallpaper.userId, mOriginalSystem);
                        mLastLockWallpaper = mOriginalSystem;
                        notifyWallpaperColorsChanged(mOriginalSystem, FLAG_LOCK);
                    }
                } else if (mNewWallpaper.mWhich == FLAG_LOCK) {
                    // New wp is lock only, so old system+lock is now system only
@@ -1417,10 +1408,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    }
                }
            }

            synchronized (mLock) {
            saveSettingsLocked(mNewWallpaper.userId);
            }

            if (DEBUG) {
                Slog.v(TAG, "--- wallpaper changed --");
@@ -3300,7 +3288,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                        if (DEBUG) {
                            Slog.d(TAG, "publish system wallpaper changed!");
                        }
                        liveSync.complete();
                    }
                };

@@ -3356,6 +3343,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                        }
                        mLockWallpaperMap.remove(newWallpaper.userId);
                    }
                    if (liveSync != null) liveSync.complete();
                }
            } finally {
                Binder.restoreCallingIdentity(ident);
@@ -3474,6 +3462,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        }
        // Has the component changed?
        if (!force && changingToSame(componentName, wallpaper)) {
            try {
                if (reply != null) reply.sendResult(null);
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to send callback", e);
            }
            return true;
        }