mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Migrate smartspace as a widget and smartspace removal toggle flags to aconfig
Bug: 336823684, 336823681 Test: none Flag: ACONFIG enable_smartspace_as_a_widget DISABLED Flag: ACONFIG enable_smartspace_removal_toggle DISABLED Change-Id: I4cba42e09f58365f761ab866b15a494817e6bb0f
This commit is contained in:
@@ -253,3 +253,17 @@ flag {
|
||||
description: "Enables fallback recents opening inside of a window instead of an activity."
|
||||
bug: "292269949"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_smartspace_as_a_widget"
|
||||
namespace: "launcher"
|
||||
description: "Enables smartspace as a widget"
|
||||
bug: "300140279"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_smartspace_removal_toggle"
|
||||
namespace: "launcher"
|
||||
description: "Enables smartspace removal toggle"
|
||||
bug: "303471576"
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
|
||||
import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.Flags.enableAddAppWidgetViaConfigActivityV2;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.Flags.enableWorkspaceInflation;
|
||||
import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WIDGET_TRANSITION;
|
||||
@@ -66,7 +67,6 @@ import static com.android.launcher3.LauncherState.NO_OFFSET;
|
||||
import static com.android.launcher3.LauncherState.NO_SCALE;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
|
||||
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.HIDE;
|
||||
@@ -1361,7 +1361,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
// Until the workspace is bound, ensure that we keep the wallpaper offset locked to the
|
||||
// default state, otherwise we will update to the wrong offsets in RTL
|
||||
mWorkspace.lockWallpaperToDefaultPage();
|
||||
if (!ENABLE_SMARTSPACE_REMOVAL.get()) {
|
||||
if (!enableSmartspaceRemovalToggle()) {
|
||||
mWorkspace.bindAndInitFirstWorkspaceScreen();
|
||||
}
|
||||
mDragController.addDragListener(mWorkspace);
|
||||
|
||||
@@ -19,9 +19,9 @@ package com.android.launcher3;
|
||||
import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED;
|
||||
import static android.content.Context.RECEIVER_EXPORTED;
|
||||
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.LauncherPrefs.ICON_STATE;
|
||||
import static com.android.launcher3.LauncherPrefs.THEMED_ICONS;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.model.LoaderTask.SMARTSPACE_ON_HOME_SCREEN;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
import static com.android.launcher3.util.SettingsCache.NOTIFICATION_BADGING_URI;
|
||||
@@ -126,7 +126,7 @@ public class LauncherAppState implements SafeCloseable {
|
||||
.addUserEventListener(mModel::onUserEvent);
|
||||
mOnTerminateCallback.add(userChangeListener::close);
|
||||
|
||||
if (ENABLE_SMARTSPACE_REMOVAL.get()) {
|
||||
if (enableSmartspaceRemovalToggle()) {
|
||||
OnSharedPreferenceChangeListener firstPagePinnedItemListener =
|
||||
new OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
|
||||
@@ -4,11 +4,12 @@ import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
import android.os.Trace
|
||||
import androidx.annotation.UiThread
|
||||
import com.android.launcher3.Flags.enableSmartspaceRemovalToggle
|
||||
import com.android.launcher3.LauncherConstants.TraceEvents
|
||||
import com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET
|
||||
import com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID
|
||||
import com.android.launcher3.allapps.AllAppsStore
|
||||
import com.android.launcher3.config.FeatureFlags
|
||||
import com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget
|
||||
import com.android.launcher3.model.BgDataModel
|
||||
import com.android.launcher3.model.StringCache
|
||||
import com.android.launcher3.model.data.AppInfo
|
||||
@@ -34,7 +35,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
|
||||
var pagesToBindSynchronously = LIntSet()
|
||||
|
||||
private var isFirstPagePinnedItemEnabled =
|
||||
(BuildConfig.QSB_ON_FIRST_SCREEN && !FeatureFlags.ENABLE_SMARTSPACE_REMOVAL.get())
|
||||
(BuildConfig.QSB_ON_FIRST_SCREEN && !enableSmartspaceRemovalToggle())
|
||||
|
||||
var stringCache: StringCache? = null
|
||||
|
||||
@@ -314,16 +315,16 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
|
||||
)
|
||||
val firstScreenPosition = 0
|
||||
if (
|
||||
(FeatureFlags.QSB_ON_FIRST_SCREEN &&
|
||||
isFirstPagePinnedItemEnabled &&
|
||||
!shouldShowFirstPageWidget()) &&
|
||||
(isFirstPagePinnedItemEnabled &&
|
||||
!SHOULD_SHOW_FIRST_PAGE_WIDGET) &&
|
||||
orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition
|
||||
) {
|
||||
orderedScreenIds.removeValue(FIRST_SCREEN_ID)
|
||||
orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID)
|
||||
} else if (
|
||||
(!FeatureFlags.QSB_ON_FIRST_SCREEN && !isFirstPagePinnedItemEnabled ||
|
||||
shouldShowFirstPageWidget()) && orderedScreenIds.isEmpty
|
||||
(!isFirstPagePinnedItemEnabled ||
|
||||
SHOULD_SHOW_FIRST_PAGE_WIDGET)
|
||||
&& orderedScreenIds.isEmpty
|
||||
) {
|
||||
// If there are no screens, we need to have an empty screen
|
||||
launcher.workspace.addExtraEmptyScreens()
|
||||
@@ -379,9 +380,8 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
|
||||
}
|
||||
orderedScreenIds
|
||||
.filterNot { screenId ->
|
||||
FeatureFlags.QSB_ON_FIRST_SCREEN &&
|
||||
isFirstPagePinnedItemEnabled &&
|
||||
!FeatureFlags.shouldShowFirstPageWidget() &&
|
||||
!SHOULD_SHOW_FIRST_PAGE_WIDGET &&
|
||||
screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID
|
||||
}
|
||||
.forEach { screenId ->
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.launcher3;
|
||||
|
||||
import static android.graphics.drawable.AdaptiveIconDrawable.getExtraInsetFraction;
|
||||
|
||||
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceAsAWidget;
|
||||
import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
@@ -148,6 +150,9 @@ public final class Utilities {
|
||||
public static final int TRANSLATE_LEFT = 2;
|
||||
public static final int TRANSLATE_RIGHT = 3;
|
||||
|
||||
public static final boolean SHOULD_SHOW_FIRST_PAGE_WIDGET =
|
||||
enableSmartspaceAsAWidget() && WIDGET_ON_FIRST_SCREEN;
|
||||
|
||||
@IntDef({TRANSLATE_UP, TRANSLATE_DOWN, TRANSLATE_LEFT, TRANSLATE_RIGHT})
|
||||
public @interface AdjustmentDirection{}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_FOLDER;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
@@ -28,10 +29,9 @@ import static com.android.launcher3.LauncherState.HINT_STATE;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT;
|
||||
@@ -600,7 +600,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
public void bindAndInitFirstWorkspaceScreen() {
|
||||
if ((!FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
|| !mLauncher.getIsFirstPagePinnedItemEnabled())
|
||||
|| shouldShowFirstPageWidget()) {
|
||||
|| SHOULD_SHOW_FIRST_PAGE_WIDGET) {
|
||||
mFirstPagePinnedItem = null;
|
||||
return;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
mWorkspaceScreens.clear();
|
||||
|
||||
// Ensure that the first page is always present
|
||||
if (!ENABLE_SMARTSPACE_REMOVAL.get()) {
|
||||
if (!enableSmartspaceRemovalToggle()) {
|
||||
bindAndInitFirstWorkspaceScreen();
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
|
||||
// We don't want to remove the first screen even if it's empty because that's where
|
||||
// first page pinned item would go if it gets turned back on.
|
||||
if (ENABLE_SMARTSPACE_REMOVAL.get() && screenId == FIRST_SCREEN_ID) {
|
||||
if (enableSmartspaceRemovalToggle() && screenId == FIRST_SCREEN_ID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
CellLayout cl = mWorkspaceScreens.valueAt(i);
|
||||
// FIRST_SCREEN_ID can never be removed.
|
||||
if (((!FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
|| shouldShowFirstPageWidget())
|
||||
|| SHOULD_SHOW_FIRST_PAGE_WIDGET)
|
||||
|| id > FIRST_SCREEN_ID)
|
||||
&& cl.getShortcutsAndWidgets().getChildCount() == 0) {
|
||||
removeScreens.add(id);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.launcher3.config;
|
||||
|
||||
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.config.FeatureFlags.BooleanFlag.DISABLED;
|
||||
import static com.android.launcher3.config.FeatureFlags.BooleanFlag.ENABLED;
|
||||
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
|
||||
@@ -135,17 +134,6 @@ public final class FeatureFlags {
|
||||
"MULTI_SELECT_EDIT_MODE", DISABLED, "Enable new multi-select edit mode "
|
||||
+ "for home screen");
|
||||
|
||||
public static final BooleanFlag SMARTSPACE_AS_A_WIDGET = getDebugFlag(299181941,
|
||||
"SMARTSPACE_AS_A_WIDGET", DISABLED, "Enable SmartSpace as a widget");
|
||||
|
||||
public static boolean shouldShowFirstPageWidget() {
|
||||
return SMARTSPACE_AS_A_WIDGET.get() && WIDGET_ON_FIRST_SCREEN;
|
||||
}
|
||||
|
||||
public static final BooleanFlag ENABLE_SMARTSPACE_REMOVAL = getDebugFlag(290799975,
|
||||
"ENABLE_SMARTSPACE_REMOVAL", DISABLED, "Enable SmartSpace removal for "
|
||||
+ "home screen");
|
||||
|
||||
// TODO(Block 11): Clean up flags
|
||||
public static final BooleanFlag FOLDABLE_SINGLE_PAGE = getDebugFlag(270395274,
|
||||
"FOLDABLE_SINGLE_PAGE", DISABLED, "Use a single page for the workspace");
|
||||
|
||||
@@ -24,7 +24,7 @@ import static com.android.launcher3.BubbleTextView.DISPLAY_TASKBAR;
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_WORKSPACE;
|
||||
import static com.android.launcher3.DeviceProfile.DEFAULT_SCALE;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
|
||||
import static com.android.launcher3.model.ModelUtils.getMissingHotseatRanks;
|
||||
|
||||
@@ -538,7 +538,7 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
|
||||
// Add first page QSB
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN && dataModel.isFirstPagePinnedItemEnabled
|
||||
&& !shouldShowFirstPageWidget()) {
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET) {
|
||||
CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);
|
||||
View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false);
|
||||
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.BuildConfig.WIDGETS_ENABLED;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.Flags.enableWorkspaceInflation;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING;
|
||||
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
@@ -327,7 +327,7 @@ public class BaseLauncherBinder {
|
||||
executeCallbacksTask(c -> {
|
||||
c.clearPendingBinds();
|
||||
c.startBinding();
|
||||
if (ENABLE_SMARTSPACE_REMOVAL.get()) {
|
||||
if (enableSmartspaceRemovalToggle()) {
|
||||
c.setIsFirstPagePinnedItemEnabled(
|
||||
mBgDataModel.isFirstPagePinnedItemEnabled);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_GET_KEY_FIELDS_
|
||||
|
||||
import static com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.BuildConfig.WIDGETS_ENABLED;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.shortcuts.ShortcutRequest.PINNED;
|
||||
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
@@ -138,7 +138,7 @@ public class BgDataModel {
|
||||
*/
|
||||
public int lastLoadId = -1;
|
||||
public boolean isFirstPagePinnedItemEnabled = QSB_ON_FIRST_SCREEN
|
||||
&& !ENABLE_SMARTSPACE_REMOVAL.get();
|
||||
&& !enableSmartspaceRemovalToggle();
|
||||
|
||||
/**
|
||||
* Clears all the data
|
||||
@@ -163,7 +163,7 @@ public class BgDataModel {
|
||||
}
|
||||
}
|
||||
if ((FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& !shouldShowFirstPageWidget())
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET)
|
||||
|| screenSet.isEmpty()) {
|
||||
screenSet.add(Workspace.FIRST_SCREEN_ID);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.addTableToDb;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.provider.LauncherDbUtils.dropTable;
|
||||
|
||||
import android.content.ContentValues;
|
||||
@@ -259,7 +259,7 @@ public class DatabaseHelper extends NoLocaleSQLiteHelper implements
|
||||
}
|
||||
case 30: {
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& !shouldShowFirstPageWidget()) {
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET) {
|
||||
// Clean up first row in screen 0 as it might contain junk data.
|
||||
Log.d(TAG, "Cleaning up first row");
|
||||
db.delete(Favorites.TABLE_NAME,
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.model.LoaderTask.SMARTSPACE_ON_HOME_SCREEN;
|
||||
import static com.android.launcher3.provider.LauncherDbUtils.copyTable;
|
||||
import static com.android.launcher3.provider.LauncherDbUtils.dropTable;
|
||||
@@ -348,9 +348,9 @@ public class GridSizeMigrationUtil {
|
||||
final Point trg = new Point(trgX, trgY);
|
||||
final Point next = new Point(0, screenId == 0
|
||||
&& (FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& (!ENABLE_SMARTSPACE_REMOVAL.get() || LauncherPrefs.getPrefs(destReader.mContext)
|
||||
&& (!enableSmartspaceRemovalToggle() || LauncherPrefs.getPrefs(destReader.mContext)
|
||||
.getBoolean(SMARTSPACE_ON_HOME_SCREEN, true))
|
||||
&& !shouldShowFirstPageWidget())
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET)
|
||||
? 1 /* smartspace */ : 0);
|
||||
List<DbEntry> existedEntries = destReader.mWorkspaceEntriesByScreenId.get(screenId);
|
||||
if (existedEntries != null) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentValues;
|
||||
@@ -550,7 +550,8 @@ public class LoaderCursor extends CursorWrapper {
|
||||
if (!mOccupied.containsKey(item.screenId)) {
|
||||
GridOccupancy screen = new GridOccupancy(countX + 1, countY + 1);
|
||||
if (item.screenId == Workspace.FIRST_SCREEN_ID && (FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& !shouldShowFirstPageWidget() && isFirstPagePinnedItemEnabled)) {
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET
|
||||
&& isFirstPagePinnedItemEnabled)) {
|
||||
// Mark the first X columns (X is width of the search container) in the first row as
|
||||
// occupied (if the feature is enabled) in order to account for the search
|
||||
// container.
|
||||
|
||||
@@ -18,11 +18,11 @@ package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
|
||||
import static com.android.launcher3.Flags.enableLauncherBrMetricsFixed;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceAsAWidget;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.LauncherPrefs.IS_FIRST_LOAD_AFTER_RESTORE;
|
||||
import static com.android.launcher3.LauncherPrefs.SHOULD_SHOW_SMARTSPACE;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL;
|
||||
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_PRIVATE_PROFILE_QUIET_MODE_ENABLED;
|
||||
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
|
||||
@@ -322,13 +322,13 @@ public class LoaderTask implements Runnable {
|
||||
verifyNotStopped();
|
||||
LauncherPrefs prefs = LauncherPrefs.get(mApp.getContext());
|
||||
|
||||
if (SMARTSPACE_AS_A_WIDGET.get() && prefs.get(SHOULD_SHOW_SMARTSPACE)) {
|
||||
if (enableSmartspaceAsAWidget() && prefs.get(SHOULD_SHOW_SMARTSPACE)) {
|
||||
mLauncherBinder.bindSmartspaceWidget();
|
||||
// Turn off pref.
|
||||
prefs.putSync(SHOULD_SHOW_SMARTSPACE.to(false));
|
||||
logASplit("bindSmartspaceWidget");
|
||||
verifyNotStopped();
|
||||
} else if (!SMARTSPACE_AS_A_WIDGET.get() && WIDGET_ON_FIRST_SCREEN
|
||||
} else if (!enableSmartspaceAsAWidget() && WIDGET_ON_FIRST_SCREEN
|
||||
&& !prefs.get(LauncherPrefs.SHOULD_SHOW_SMARTSPACE)) {
|
||||
// Turn on pref.
|
||||
prefs.putSync(SHOULD_SHOW_SMARTSPACE.to(true));
|
||||
@@ -399,7 +399,7 @@ public class LoaderTask implements Runnable {
|
||||
logASplit("workspaceDelegateItems");
|
||||
}
|
||||
mBgDataModel.isFirstPagePinnedItemEnabled = FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& (!ENABLE_SMARTSPACE_REMOVAL.get() || LauncherPrefs.getPrefs(
|
||||
&& (!enableSmartspaceRemovalToggle() || LauncherPrefs.getPrefs(
|
||||
mApp.getContext()).getBoolean(SMARTSPACE_ON_HOME_SCREEN, true));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
import static com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID;
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
|
||||
import android.util.LongSparseArray;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class WorkspaceItemSpaceFinder {
|
||||
// First check the preferred screen.
|
||||
IntSet screensToExclude = new IntSet();
|
||||
if (FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& !shouldShowFirstPageWidget()) {
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET) {
|
||||
screensToExclude.add(FIRST_SCREEN_ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import static android.appwidget.AppWidgetManager.ACTION_APPWIDGET_BIND;
|
||||
import static android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID;
|
||||
import static android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_PROVIDER;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget;
|
||||
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
@@ -292,7 +292,8 @@ public class QsbContainerView extends FrameLayout {
|
||||
}
|
||||
|
||||
public boolean isQsbEnabled() {
|
||||
return FeatureFlags.QSB_ON_FIRST_SCREEN && !shouldShowFirstPageWidget();
|
||||
return FeatureFlags.QSB_ON_FIRST_SCREEN
|
||||
&& !SHOULD_SHOW_FIRST_PAGE_WIDGET;
|
||||
}
|
||||
|
||||
protected Bundle createBindOptions() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.launcher3.widget.custom;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.SMARTSPACE_AS_A_WIDGET;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceAsAWidget;
|
||||
import static com.android.launcher3.model.data.LauncherAppWidgetInfo.CUSTOM_WIDGET_ID;
|
||||
import static com.android.launcher3.widget.LauncherAppWidgetProviderInfo.CLS_CUSTOM_WIDGET_PREFIX;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CustomWidgetManager implements PluginListener<CustomWidgetPlugin>,
|
||||
PluginManagerWrapper.INSTANCE.get(context)
|
||||
.addPluginListener(this, CustomWidgetPlugin.class, true);
|
||||
|
||||
if (SMARTSPACE_AS_A_WIDGET.get()) {
|
||||
if (enableSmartspaceAsAWidget()) {
|
||||
for (String s: context.getResources()
|
||||
.getStringArray(R.array.custom_widget_providers)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user