Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ca222f6 authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Store an empty theme object on first visit

Bug: 126230901
Change-Id: Id6a6a6125f82d52c364be04fc63d4c3cd3702a4e
parent 6b9e38ec
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.customization.model.ResourceConstants.SYSUI_PACKAGE;
import android.graphics.Point;
import android.provider.Settings;

import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;

@@ -43,6 +44,7 @@ import com.android.wallpaper.module.WallpaperPersister.SetWallpaperCallback;
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;
@@ -242,4 +244,17 @@ public class ThemeManager implements CustomizationManager<ThemeBundle> {
    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());
        }
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.customization.picker;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
@@ -227,6 +226,10 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
            if (!prefs.getTabVisited(name)) {
                prefs.setTabVisited(name);
                hideTipDot(item);

                if (id == R.id.nav_theme) {
                    getThemeManager().storeEmptyTheme();
                }
            }
            return true;
        });