From 518bc8ac7099e83ade1129184a9f53dcc3f55d10 Mon Sep 17 00:00:00 2001 From: Ching-Sung Li Date: Thu, 24 Jun 2021 09:53:42 +0800 Subject: [PATCH] Save one notifyColorListeners() call Do color extraction if needed then notify color listeners once. Bug: 191628465 Test: Build pass and then manually test Change-Id: Ief9c86f4c55377c78ce2550d3cbaa2af68ff03d5 --- .../server/wallpaper/WallpaperManagerService.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 782e18b0250c9..7713320717569 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -405,20 +405,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub needsExtraction = wallpaper.primaryColors == null; } - // Let's notify the current values, it's fine if it's null, it just means - // that we don't know yet. - notifyColorListeners(wallpaper.primaryColors, which, wallpaper.userId, displayId); - if (needsExtraction) { extractColors(wallpaper); - synchronized (mLock) { - // Don't need to notify if nothing changed. - if (wallpaper.primaryColors == null) { - return; - } - } - notifyColorListeners(wallpaper.primaryColors, which, wallpaper.userId, displayId); } + notifyColorListeners(wallpaper.primaryColors, which, wallpaper.userId, displayId); } private static boolean emptyCallbackList(RemoteCallbackList list) {