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

Commit 2560c0df authored by Jason Chiu's avatar Jason Chiu
Browse files

Do not init dashboard categories when SetupWizard isn't finished yet

The generated category cache during SetupWizard flow is invalid.

Bug: 261885832
Test: manual
Change-Id: Id2108b2cc4ab557b086c4dbbd5dc7722c73e74d3
parent a171a9d4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import com.android.settingslib.drawer.ProviderTile;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.drawer.TileUtils;

import com.google.android.setupcompat.util.WizardManagerHelper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -79,6 +81,9 @@ public class CategoryManager {
    }

    public synchronized List<DashboardCategory> getCategories(Context context) {
        if (!WizardManagerHelper.isUserSetupComplete(context)) {
            return new ArrayList<>();
        }
        tryInitCategories(context);
        return mCategories;
    }
@@ -142,6 +147,10 @@ public class CategoryManager {
    }

    private synchronized void tryInitCategories(Context context, boolean forceClearCache) {
        if (!WizardManagerHelper.isUserSetupComplete(context)) {
            // Don't init while setup wizard is still running.
            return;
        }
        if (mCategories == null) {
            final boolean firstLoading = mCategoryByKeyMap.isEmpty();
            if (forceClearCache) {