Merge "Store an empty theme object on first visit" into ub-launcher3-qt-dev
diff --git a/src/com/android/customization/model/theme/ThemeManager.java b/src/com/android/customization/model/theme/ThemeManager.java
index fab10d8..d873972 100644
--- a/src/com/android/customization/model/theme/ThemeManager.java
+++ b/src/com/android/customization/model/theme/ThemeManager.java
@@ -27,6 +27,7 @@
import android.graphics.Point;
import android.provider.Settings;
+import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
@@ -41,6 +42,7 @@
import com.android.wallpaper.module.WallpaperSetter;
import com.android.wallpaper.picker.SetWallpaperDialogFragment.Listener;
import com.android.wallpaper.util.WallpaperCropUtils;
+import org.json.JSONObject;
import java.util.HashSet;
import java.util.Map;
@@ -210,4 +212,17 @@
public ThemeBundle findThemeByPackages(ThemeBundle other) {
return mProvider.findEquivalent(other);
}
+
+ /**
+ * Store empty theme if no theme has been set yet. This will prevent Settings from showing the
+ * suggestion to select a theme
+ */
+ public void storeEmptyTheme() {
+ String themeSetting = Settings.Secure.getString(mActivity.getContentResolver(),
+ ResourceConstants.THEME_SETTING);
+ if (TextUtils.isEmpty(themeSetting)) {
+ Settings.Secure.putString(mActivity.getContentResolver(),
+ ResourceConstants.THEME_SETTING, new JSONObject().toString());
+ }
+ }
}
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index 985a566..c20b73f 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -228,6 +228,10 @@
if (!prefs.getTabVisited(name)) {
prefs.setTabVisited(name);
hideTipDot(item);
+
+ if (id == R.id.nav_theme) {
+ getThemeManager().storeEmptyTheme();
+ }
}
return true;
});