From efcff6ceb61843f13e657a7263a7b4d29ac185fb Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Thu, 27 Apr 2023 21:26:59 +0000 Subject: [PATCH] Move Wallpaper RPC call to background thread. Bug: 251502424 Test: Used logs to time it. This was taking anywhere from 3ms to 19ms on my Pixel 7 Pro device. Change-Id: I4e9ce55c1269a31f15e910628153c3dfdfd26649 --- src/com/android/launcher3/BaseDraggingActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index 6f3e94829c..45b03c2816 100644 --- a/src/com/android/launcher3/BaseDraggingActivity.java +++ b/src/com/android/launcher3/BaseDraggingActivity.java @@ -18,6 +18,7 @@ package com.android.launcher3; import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; +import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR; import android.app.WallpaperColors; import android.app.WallpaperManager; @@ -76,8 +77,8 @@ public abstract class BaseDraggingActivity extends BaseActivity // Update theme if (Utilities.ATLEAST_P) { - getSystemService(WallpaperManager.class) - .addOnColorsChangedListener(this, MAIN_EXECUTOR.getHandler()); + THREAD_POOL_EXECUTOR.execute(() -> getSystemService(WallpaperManager.class) + .addOnColorsChangedListener(this, MAIN_EXECUTOR.getHandler())); } int themeRes = Themes.getActivityThemeRes(this); if (themeRes != mThemeRes) {