Merge "Revert^2 "Return to Launcher Home after wallpaper/grid apply"" into sc-dev
diff --git a/src/com/android/customization/model/themedicon/ThemedIconSwitchProvider.java b/src/com/android/customization/model/themedicon/ThemedIconSwitchProvider.java
index 1a57223..761e2fa 100644
--- a/src/com/android/customization/model/themedicon/ThemedIconSwitchProvider.java
+++ b/src/com/android/customization/model/themedicon/ThemedIconSwitchProvider.java
@@ -23,12 +23,11 @@
 import androidx.annotation.WorkerThread;
 
 /**
- * Retrieves the themed icon switch by {@link ContentResolver}
+ * Retrieves the themed icon switch by {@link ContentResolver} from the current launcher
  */
 public class ThemedIconSwitchProvider {
 
-    private static final String GET_ICON_THEMED = "get_icon_themed";
-    private static final String SET_ICON_THEMED = "set_icon_themed";
+    private static final String ICON_THEMED = "icon_themed";
     private static final int ENABLED = 1;
     private static final String COL_ICON_THEMED_VALUE = "boolean_value";
 
@@ -48,7 +47,7 @@
     protected boolean fetchThemedIconEnabled() {
         ContentResolver contentResolver = mContext.getContentResolver();
         try (Cursor cursor = contentResolver.query(
-                mThemedIconUtils.getUriForPath(GET_ICON_THEMED), /* projection= */
+                mThemedIconUtils.getUriForPath(ICON_THEMED), /* projection= */
                 null, /* selection= */ null, /* selectionArgs= */ null, /* sortOrder= */ null)) {
             if (cursor != null && cursor.moveToNext()) {
                 int themedIconEnabled = cursor.getInt(cursor.getColumnIndex(COL_ICON_THEMED_VALUE));
@@ -61,7 +60,8 @@
     protected int setThemedIconEnabled(boolean enabled) {
         ContentValues values = new ContentValues();
         values.put(COL_ICON_THEMED_VALUE, enabled);
-        return mContext.getContentResolver().update(mThemedIconUtils.getUriForPath(SET_ICON_THEMED),
-                values, /* where= */ null, /* selectionArgs= */ null);
+        return mContext.getContentResolver().update(
+                mThemedIconUtils.getUriForPath(ICON_THEMED), values,
+                /* where= */ null, /* selectionArgs= */ null);
     }
 }
diff --git a/src/com/android/customization/model/themedicon/ThemedIconUtils.java b/src/com/android/customization/model/themedicon/ThemedIconUtils.java
index 8f1bdee..c339c5a 100644
--- a/src/com/android/customization/model/themedicon/ThemedIconUtils.java
+++ b/src/com/android/customization/model/themedicon/ThemedIconUtils.java
@@ -36,7 +36,7 @@
 
     public ThemedIconUtils(Context context, String authorityMetaKey) {
         mContext = context;
-        Intent homeIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
+        Intent homeIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME);
         ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(homeIntent,
                 PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA);
 
diff --git a/src/com/android/customization/picker/grid/GridOptionPreviewer.java b/src/com/android/customization/picker/grid/GridOptionPreviewer.java
index 77fdc43..dac3d9b 100644
--- a/src/com/android/customization/picker/grid/GridOptionPreviewer.java
+++ b/src/com/android/customization/picker/grid/GridOptionPreviewer.java
@@ -62,6 +62,7 @@
         // Reattach SurfaceView to trigger #surfaceCreated to update preview for different option.
         mPreviewContainer.removeAllViews();
         if (mSurfaceCallback != null) {
+            mSurfaceCallback.cleanUp();
             mSurfaceCallback.resetLastSurface();
         }
         if (mGridOptionSurface == null) {