Fix blank bottom action bar when setting Grid after unlock screen

Post the wallpaper preview setup to message queue of UI thread to
prevent race condition in layout of Grid fragment's bottom action bar.

Bug: 170795716
Test: Manual
Change-Id: I5b94ac71424aebf6bf7a1833ed00de22ad91b2d6
(cherry picked from commit 7cb9ee86d352c4bee290d3484019ae3946019976)
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index 21ec51d..50010c5 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -148,34 +148,36 @@
     private void setUpWallpaperPreview() {
         ImageView homeImageWallpaper = mWallpaperSurfaceCallback.getHomeImageWallpaper();
         if (mWallpaper != null && homeImageWallpaper != null) {
-            boolean renderInImageWallpaperSurface = !(mWallpaper instanceof LiveWallpaperInfo);
-            mWallpaper.getThumbAsset(mActivity.getApplicationContext())
-                    .loadPreviewImage(mActivity,
-                            renderInImageWallpaperSurface ? homeImageWallpaper : mHomePreview,
-                            mActivity.getResources().getColor(R.color.secondary_color));
-            LiveTileOverlay.INSTANCE.detach(mHomePreview.getOverlay());
-            if (mWallpaper instanceof LiveWallpaperInfo) {
+            homeImageWallpaper.post(() -> {
+                boolean renderInImageWallpaperSurface = !(mWallpaper instanceof LiveWallpaperInfo);
                 mWallpaper.getThumbAsset(mActivity.getApplicationContext())
-                        .loadPreviewImage(
-                                mActivity,
-                                homeImageWallpaper,
-                                mActivity.getColor(R.color.secondary_color));
-                setUpLiveWallpaperPreview(mWallpaper);
-            } else {
-                // Ensure live wallpaper connection is disconnected.
-                if (mWallpaperConnection != null) {
-                    mWallpaperConnection.disconnect();
-                    mWallpaperConnection = null;
-                }
+                        .loadPreviewImage(mActivity,
+                                renderInImageWallpaperSurface ? homeImageWallpaper : mHomePreview,
+                                mActivity.getResources().getColor(R.color.secondary_color));
+                LiveTileOverlay.INSTANCE.detach(mHomePreview.getOverlay());
+                if (mWallpaper instanceof LiveWallpaperInfo) {
+                    mWallpaper.getThumbAsset(mActivity.getApplicationContext())
+                            .loadPreviewImage(
+                                    mActivity,
+                                    homeImageWallpaper,
+                                    mActivity.getColor(R.color.secondary_color));
+                    setUpLiveWallpaperPreview(mWallpaper);
+                } else {
+                    // Ensure live wallpaper connection is disconnected.
+                    if (mWallpaperConnection != null) {
+                        mWallpaperConnection.disconnect();
+                        mWallpaperConnection = null;
+                    }
 
-                // Load wallpaper color for static wallpaper.
-                if (mWallpaperColorsListener != null) {
-                    WallpaperColorsLoader.getWallpaperColors(
-                            mActivity,
-                            mWallpaper.getThumbAsset(mActivity),
-                            mWallpaperColorsListener::onWallpaperColorsChanged);
+                    // Load wallpaper color for static wallpaper.
+                    if (mWallpaperColorsListener != null) {
+                        WallpaperColorsLoader.getWallpaperColors(
+                                mActivity,
+                                mWallpaper.getThumbAsset(mActivity),
+                                mWallpaperColorsListener::onWallpaperColorsChanged);
+                    }
                 }
-            }
+            });
         }
     }