Merge "Add flag check for SMARTSPACE_AS_A_WIDGET to loadertask.java" into main

This commit is contained in:
Federico Baron
2023-10-04 19:14:13 +00:00
committed by Android (Google) Code Review
@@ -18,6 +18,7 @@ package com.android.launcher3.model;
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
import static com.android.launcher3.config.FeatureFlags.SMARTSPACE_AS_A_WIDGET;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_ENABLED;
@@ -298,7 +299,8 @@ public class LoaderTask implements Runnable {
logASplit("bindWidgets");
verifyNotStopped();
if (LauncherPrefs.get(mApp.getContext()).get(LauncherPrefs.SHOULD_SHOW_SMARTSPACE)) {
if (SMARTSPACE_AS_A_WIDGET.get() && LauncherPrefs.get(mApp.getContext())
.get(LauncherPrefs.SHOULD_SHOW_SMARTSPACE)) {
mLauncherBinder.bindSmartspaceWidget();
// Turn off pref.
LauncherPrefs.get(mApp.getContext()).putSync(
@@ -309,6 +311,16 @@ public class LoaderTask implements Runnable {
.to(false));
logASplit("bindSmartspaceWidget");
verifyNotStopped();
} else if (!SMARTSPACE_AS_A_WIDGET.get() && WIDGET_ON_FIRST_SCREEN
&& !LauncherPrefs.get(mApp.getContext())
.get(LauncherPrefs.SHOULD_SHOW_SMARTSPACE)) {
// Turn on pref.
LauncherPrefs.get(mApp.getContext()).putSync(
LauncherPrefs.backedUpItem(
LauncherPrefs.SHOULD_SHOW_SMARTSPACE_KEY,
WIDGET_ON_FIRST_SCREEN,
true)
.to(true));
}
if (FeatureFlags.CHANGE_MODEL_DELEGATE_LOADING_ORDER.get()) {