Adding support for async view inflation
Bug: 318539160
Test: atest AsyncBindingTest; atest ItemInflaterTest
Flag: aconfig enable_workspace_inflation DEVELOPMENT
Change-Id: I77a373db7a5805f68f4b8cbfa9b586b5674252de
diff --git a/src/com/android/launcher3/ModelCallbacks.kt b/src/com/android/launcher3/ModelCallbacks.kt
index 9867556..9b65a31 100644
--- a/src/com/android/launcher3/ModelCallbacks.kt
+++ b/src/com/android/launcher3/ModelCallbacks.kt
@@ -72,6 +72,7 @@
override fun onInitialBindComplete(
boundPages: LIntSet,
pendingTasks: RunnableList,
+ onCompleteSignal: RunnableList,
workspaceItemCount: Int,
isBindSync: Boolean
) {
@@ -99,7 +100,14 @@
}
}
pendingExecutor = executor
- executor.attachTo(launcher)
+
+ if (Flags.enableWorkspaceInflation()) {
+ // Finish the executor as soon as the pending inflation is completed
+ onCompleteSignal.add(executor::markCompleted)
+ } else {
+ // Pending executor is already completed, wait until first draw to run the tasks
+ executor.attachTo(launcher)
+ }
launcher.bindComplete(workspaceItemCount, isBindSync)
}
@@ -409,4 +417,6 @@
}
fun getIsFirstPagePinnedItemEnabled(): Boolean = isFirstPagePinnedItemEnabled
+
+ override fun getItemInflater() = launcher.itemInflater
}