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

Commit 96e2ff40 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Release lock before color extraction on dim changes

notifyWallpaperColorsChanged should always be called outside the lock
since it may trigger heavy color computations.

This is necessary in order to remove the old code paths of
clearWallpaperLocked without causing boot time regressions.

Flag: lockscreen live wallpaper
Bug: 273443374
Test: atest WallpaperManagerTest
Change-Id: Ib2b6dde8b65058874d2a4c014fa7de47320e6457
parent 00f62acc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2895,6 +2895,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        checkPermission(android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT);
        final long ident = Binder.clearCallingIdentity();
        try {
            List<WallpaperData> pendingColorExtraction = new ArrayList<>();
            synchronized (mLock) {
                WallpaperData wallpaper = mWallpaperMap.get(mCurrentUserId);
                WallpaperData lockWallpaper = mLockWallpaperMap.get(mCurrentUserId);
@@ -2930,7 +2931,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            // Need to extract colors again to re-calculate dark hints after
                            // applying dimming.
                            wp.mIsColorExtractedFromDim = true;
                            notifyWallpaperColorsChanged(wp, wp.mWhich);
                            pendingColorExtraction.add(wp);
                            changed = true;
                        }
                    }
@@ -2962,6 +2963,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    }
                }
            }
            for (WallpaperData wp: pendingColorExtraction) {
                notifyWallpaperColorsChanged(wp, wp.mWhich);
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }