Fixing potential ANR when fetching for wallpaper info

Bug: 214581894
Test: Manual
Change-Id: I616b34b0ce6c96ed360073b2e8ff4eed81190add
diff --git a/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java b/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java
index 8a7cae9..f1276dd 100644
--- a/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java
+++ b/src/com/android/launcher3/util/WallpaperOffsetInterpolator.java
@@ -14,6 +14,8 @@
 import android.util.Log;
 import android.view.animation.Interpolator;
 
+import androidx.annotation.AnyThread;
+
 import com.android.launcher3.Utilities;
 import com.android.launcher3.Workspace;
 import com.android.launcher3.anim.Interpolators;
@@ -182,6 +184,7 @@
         }
     }
 
+    @AnyThread
     private void updateOffset() {
         Message.obtain(mHandler, MSG_SET_NUM_PARALLAX, getNumPagesForWallpaperParallax(), 0,
                 mWindowToken).sendToTarget();
@@ -206,9 +209,12 @@
 
     @Override
     public void onReceive(Context context, Intent intent) {
-        mWallpaperIsLiveWallpaper =
-                WallpaperManager.getInstance(mWorkspace.getContext()).getWallpaperInfo() != null;
-        updateOffset();
+        UI_HELPER_EXECUTOR.execute(() -> {
+            // Updating the boolean on a background thread is fine as the assignments are atomic
+            mWallpaperIsLiveWallpaper =
+                    WallpaperManager.getInstance(context).getWallpaperInfo() != null;
+            updateOffset();
+        });
     }
 
     private static final int MSG_START_ANIMATION = 1;