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

This commit is contained in:
Jason Chiu
2023-06-02 08:05:32 +00:00
committed by Gerrit Code Review

View File

@@ -33,6 +33,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;
@@ -77,6 +79,9 @@ public class CategoryManager {
}
public synchronized List<DashboardCategory> getCategories(Context context) {
if (!WizardManagerHelper.isUserSetupComplete(context)) {
return new ArrayList<>();
}
tryInitCategories(context);
return mCategories;
}
@@ -140,6 +145,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) {