Fix recents animation flicker
The recents animation can sometimes start before launcher has started when started with 3-button mode. This causes the animation to start before the recents UI has been initialized by Launcher. Added a callback to properly synchronize launcher start and the recents animation.
Fixes: 229360539
Test: started the recents animation and checked logs (order of operations), when the recents animation or launcher started first
Change-Id: I5938bbba778a2886b4a1e4ee4844eaf28c6fac0e
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1c62ded..d55134e 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1280,13 +1280,16 @@
* @param info The data structure describing the shortcut.
*/
View createShortcut(WorkspaceItemInfo info) {
- return createShortcut((ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentPage()), info);
+ // This can be called before PagedView#pageScrollsInitialized returns true, so use the
+ // first page, which we always assume to be present.
+ return createShortcut((ViewGroup) mWorkspace.getChildAt(0), info);
}
/**
* Creates a view representing a shortcut inflated from the specified resource.
*
- * @param parent The group the shortcut belongs to.
+ * @param parent The group the shortcut belongs to. This is not necessarily the group where
+ * the shortcut should be added.
* @param info The data structure describing the shortcut.
* @return A View inflated from layoutResId.
*/