Pre-inflate BubbleTextViews into Launcher/TaskBar All Apps RV

This CL ensures no inflation of BubbleTextView happens while binding applications, and reduces jank on slow device.

1. Let active/inactive all apps RVs share the same AllAppsRecyclerViewPool
2. Use worker thread to pre-inflate BubbleTextViews and add them to shared view pool on main thread

Bug: 287523421
Test: See before/after screenshot/video/trace attached in bug
Change-Id: I00213407be2c7c2d329997552785d0aa56c4d057
This commit is contained in:
Fengjiang Li
2023-06-15 12:28:42 -07:00
parent 1acda93e26
commit 1519c168da
6 changed files with 141 additions and 5 deletions
@@ -21,6 +21,7 @@ import android.os.Process;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
@@ -58,6 +59,11 @@ public class Executors {
new LooperExecutor(
createAndStartNewLooper("UiThreadHelper", Process.THREAD_PRIORITY_FOREGROUND));
/** A background executor to preinflate views. */
public static final ExecutorService VIEW_PREINFLATION_EXECUTOR =
java.util.concurrent.Executors.newSingleThreadExecutor();
/**
* Utility method to get a started handler thread statically
*/