Add flag check for SMARTSPACE_AS_A_WIDGET to loadertask.java

Missing a flag check that is necessary in LoaderTask.java to prevent the code from running when the flag is off.

Bug: 300140279
Flag: SMARTSPACE_AS_A_WIDGET
Test: no test
Change-Id: Iaa89e8542475eb01f679f70734a61c13a3cde89f
This commit is contained in:
fbaron
2023-10-04 08:56:17 -07:00
parent b1122a4ad3
commit 22a9c3cb7f

View File

@@ -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()) {