Fix bug where app pair icons were appearing empty

Using similar logic as other BubbleTextViews, checks for PlaceholderIconDrawables and redraws the icons if needed.

Fixes: 316041983
Test: Manual and presubmit tested
Flag: ACONFIG com.android.wm.shell.enable_app_pairs TEAMFOOD
Change-Id: I017f1d5597fd28d37ca9a8a5758f33468e46f384
diff --git a/src/com/android/launcher3/apppairs/AppPairIconGraphic.kt b/src/com/android/launcher3/apppairs/AppPairIconGraphic.kt
index fa840ed..c1307ab 100644
--- a/src/com/android/launcher3/apppairs/AppPairIconGraphic.kt
+++ b/src/com/android/launcher3/apppairs/AppPairIconGraphic.kt
@@ -25,6 +25,7 @@
 import android.view.Gravity
 import android.widget.FrameLayout
 import com.android.launcher3.DeviceProfile
+import com.android.launcher3.icons.PlaceHolderIconDrawable
 import com.android.launcher3.model.data.WorkspaceItemInfo
 
 /**
@@ -94,8 +95,16 @@
             return
         }
 
-        appIcon1 = parentIcon.info.contents[0].newIcon(context)
-        appIcon2 = parentIcon.info.contents[1].newIcon(context)
+        // Generate new icons
+        val newIcon1 = parentIcon.info.contents[0].newIcon(context)
+        val newIcon2 = parentIcon.info.contents[1].newIcon(context)
+
+        // If app icons did not draw fully last time, animate to full icon
+        (appIcon1 as? PlaceHolderIconDrawable)?.animateIconUpdate(newIcon1)
+        (appIcon2 as? PlaceHolderIconDrawable)?.animateIconUpdate(newIcon2)
+
+        appIcon1 = newIcon1
+        appIcon2 = newIcon2
         appIcon1?.setBounds(0, 0, memberIconSize.toInt(), memberIconSize.toInt())
         appIcon2?.setBounds(0, 0, memberIconSize.toInt(), memberIconSize.toInt())
     }
@@ -126,6 +135,16 @@
         // Draw background
         appPairBackground.draw(canvas)
 
+        // Make sure icons are loaded
+        if (
+            appIcon1 == null ||
+                appIcon2 == null ||
+                appIcon1 is PlaceHolderIconDrawable ||
+                appIcon2 is PlaceHolderIconDrawable
+        ) {
+            applyIcons(parentIcon.info.contents)
+        }
+
         // Draw first icon
         canvas.save()
         // The app icons are placed differently depending on device orientation.