diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index 6ab2e106f5..48898fef6c 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -230,13 +230,6 @@ flag { bug: "300140279" } -flag { - name: "enable_smartspace_removal_toggle" - namespace: "launcher" - description: "Enables smartspace removal toggle" - bug: "303471576" -} - flag { name: "enabled_folders_in_all_apps" namespace: "launcher" diff --git a/quickstep/src/com/android/quickstep/logging/SettingsChangeLogger.java b/quickstep/src/com/android/quickstep/logging/SettingsChangeLogger.java index 1ef213c1ab..190eb5423c 100644 --- a/quickstep/src/com/android/quickstep/logging/SettingsChangeLogger.java +++ b/quickstep/src/com/android/quickstep/logging/SettingsChangeLogger.java @@ -18,7 +18,6 @@ package com.android.quickstep.logging; import static com.android.launcher3.LauncherPrefs.getDevicePrefs; import static com.android.launcher3.LauncherPrefs.getPrefs; -import static com.android.launcher3.graphics.ThemeManager.KEY_THEMED_ICONS; import static com.android.launcher3.graphics.ThemeManager.PREF_ICON_SHAPE; import static com.android.launcher3.graphics.ThemeManager.THEMED_ICONS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED; @@ -32,7 +31,6 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_DOT_ENABLED; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_THEMED_ICON_DISABLED; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_THEMED_ICON_ENABLED; -import static com.android.launcher3.model.DeviceGridState.KEY_WORKSPACE_SIZE; import static com.android.launcher3.model.PredictionUpdateTask.LAST_PREDICTION_ENABLED; import static com.android.launcher3.shapes.ShapesProvider.ARCH_KEY; import static com.android.launcher3.shapes.ShapesProvider.CIRCLE_KEY; @@ -50,6 +48,7 @@ import android.util.ArrayMap; import android.util.Log; import android.util.Xml; +import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.launcher3.Flags; @@ -98,9 +97,9 @@ public class SettingsChangeLogger implements private final ArrayMap mLoggablePrefs; private final StatsLogManager mStatsLogManager; + @NonNull private NavigationMode mNavMode; private LauncherEvent mNotificationDotsEvent; - private LauncherEvent mHomeScreenSuggestionEvent; private final SettingsCache.OnChangeListener mListener = this::onNotificationDotsChanged; @@ -202,19 +201,22 @@ public class SettingsChangeLogger implements @Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { - if (LAST_PREDICTION_ENABLED.getSharedPrefKey().equals(key) - || KEY_WORKSPACE_SIZE.equals(key) - || KEY_THEMED_ICONS.equals(key) - || mLoggablePrefs.containsKey(key)) { - - mHomeScreenSuggestionEvent = LauncherPrefs.get(mContext).get(LAST_PREDICTION_ENABLED) - ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED - : LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED; - - mStatsLogManager.logger().log(mHomeScreenSuggestionEvent); + LoggablePref loggablePref; + if (LAST_PREDICTION_ENABLED.getSharedPrefKey().equals(key)) { + logHomeScreenSuggestionEvent(mStatsLogManager.logger()); + } else if ((loggablePref = mLoggablePrefs.get(key)) != null) { + int eventId = prefs.getBoolean(key, loggablePref.defaultValue) + ? loggablePref.eventIdOn : loggablePref.eventIdOff; + mStatsLogManager.logger().log(() -> eventId); } } + private void logHomeScreenSuggestionEvent(StatsLogger logger) { + logger.log(LauncherPrefs.get(mContext).get(LAST_PREDICTION_ENABLED) + ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED + : LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED); + } + /** * Takes snapshot of all eligible launcher settings and log them with the provided instance ID. */ @@ -222,8 +224,8 @@ public class SettingsChangeLogger implements StatsLogger logger = mStatsLogManager.logger().withInstanceId(snapshotInstanceId); Optional.ofNullable(mNotificationDotsEvent).ifPresent(logger::log); - Optional.ofNullable(mNavMode).map(mode -> mode.launcherEvent).ifPresent(logger::log); - Optional.ofNullable(mHomeScreenSuggestionEvent).ifPresent(logger::log); + logger.log(mNavMode.launcherEvent); + logHomeScreenSuggestionEvent(logger); Optional.ofNullable(new DeviceGridState(mContext).getWorkspaceSizeEvent()).ifPresent( logger::log); diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/logging/SettingsChangeLoggerTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/logging/SettingsChangeLoggerTest.kt index 14570b54ec..08b1ffaf9a 100644 --- a/quickstep/tests/multivalentTests/src/com/android/quickstep/logging/SettingsChangeLoggerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/logging/SettingsChangeLoggerTest.kt @@ -119,7 +119,6 @@ class SettingsChangeLoggerTest { .isFalse() assertThat(systemUnderTest.loggingPrefs[ADD_ICON_PREFERENCE_KEY]!!.defaultValue).isTrue() assertThat(systemUnderTest.loggingPrefs[OVERVIEW_SUGGESTED_ACTIONS]!!.defaultValue).isTrue() - assertThat(systemUnderTest.loggingPrefs[SMARTSPACE_ON_HOME_SCREEN]!!.defaultValue).isTrue() assertThat(systemUnderTest.loggingPrefs[KEY_ENABLE_MINUS_ONE]!!.defaultValue).isTrue() } @@ -168,7 +167,6 @@ class SettingsChangeLoggerTest { companion object { private const val KEY_ENABLE_MINUS_ONE = "pref_enable_minus_one" private const val OVERVIEW_SUGGESTED_ACTIONS = "pref_overview_action_suggestions" - private const val SMARTSPACE_ON_HOME_SCREEN = "pref_smartspace_home_screen" private const val LAUNCHER_GOOGLE_APP_SWIPE_LEFT_ENABLED = 617 } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ec76fe5cdf..0f7ce97b77 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -28,7 +28,6 @@ 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.enableStrictMode; import static com.android.launcher3.Flags.enableWorkspaceInflation; import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY; @@ -1392,9 +1391,7 @@ public class Launcher extends StatefulActivity // 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 (!enableSmartspaceRemovalToggle()) { - mWorkspace.bindAndInitFirstWorkspaceScreen(); - } + mWorkspace.bindAndInitFirstWorkspaceScreen(); mDragController.addDragListener(mWorkspace); // Get the search/delete/uninstall bar @@ -2209,11 +2206,6 @@ public class Launcher extends StatefulActivity mModelCallbacks.startBinding(); } - @Override - public void setIsFirstPagePinnedItemEnabled(boolean isFirstPagePinnedItemEnabled) { - mModelCallbacks.setIsFirstPagePinnedItemEnabled(isFirstPagePinnedItemEnabled); - } - @Override public void bindScreens(IntArray orderedScreenIds) { mModelCallbacks.bindScreens(orderedScreenIds); @@ -3050,10 +3042,6 @@ public class Launcher extends StatefulActivity // Overridden } - public boolean getIsFirstPagePinnedItemEnabled() { - return mModelCallbacks.getIsFirstPagePinnedItemEnabled(); - } - /** * Returns the animation coordinator for playing one-off animations */ diff --git a/src/com/android/launcher3/ModelCallbacks.kt b/src/com/android/launcher3/ModelCallbacks.kt index a1df455ac5..0ea27db319 100644 --- a/src/com/android/launcher3/ModelCallbacks.kt +++ b/src/com/android/launcher3/ModelCallbacks.kt @@ -5,7 +5,6 @@ import android.os.Build import android.os.Trace import android.util.Log import androidx.annotation.UiThread -import com.android.launcher3.Flags.enableSmartspaceRemovalToggle import com.android.launcher3.LauncherConstants.TraceEvents import com.android.launcher3.LauncherSettings.Favorites.containerBelongsToWorkspace import com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET @@ -39,9 +38,6 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { var synchronouslyBoundPages = LIntSet() var pagesToBindSynchronously = LIntSet() - private var isFirstPagePinnedItemEnabled = - (BuildConfig.QSB_ON_FIRST_SCREEN && !enableSmartspaceRemovalToggle()) - var stringCache: StringCache? = null var pendingExecutor: ViewOnDrawExecutor? = null @@ -308,15 +304,12 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { ) val firstScreenPosition = 0 if ( - (isFirstPagePinnedItemEnabled && !SHOULD_SHOW_FIRST_PAGE_WIDGET) && + !SHOULD_SHOW_FIRST_PAGE_WIDGET && orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition ) { orderedScreenIds.removeValue(FIRST_SCREEN_ID) orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID) - } else if ( - (!isFirstPagePinnedItemEnabled || SHOULD_SHOW_FIRST_PAGE_WIDGET) && - orderedScreenIds.isEmpty - ) { + } else if (SHOULD_SHOW_FIRST_PAGE_WIDGET && orderedScreenIds.isEmpty) { // If there are no screens, we need to have an empty screen launcher.workspace.addExtraEmptyScreens() } @@ -371,9 +364,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { } orderedScreenIds .filterNot { screenId -> - isFirstPagePinnedItemEnabled && - !SHOULD_SHOW_FIRST_PAGE_WIDGET && - screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID + !SHOULD_SHOW_FIRST_PAGE_WIDGET && screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID } .forEach { screenId -> launcher.workspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId) @@ -398,17 +389,10 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { return screenIds.array } - override fun setIsFirstPagePinnedItemEnabled(isFirstPagePinnedItemEnabled: Boolean) { - this.isFirstPagePinnedItemEnabled = isFirstPagePinnedItemEnabled - launcher.workspace.bindAndInitFirstWorkspaceScreen() - } - override fun bindStringCache(cache: StringCache) { stringCache = cache launcher.appsView.updateWorkUI() } - fun getIsFirstPagePinnedItemEnabled(): Boolean = isFirstPagePinnedItemEnabled - override fun getItemInflater() = launcher.itemInflater } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 4622b142e9..ba3c6b102d 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -18,7 +18,6 @@ package com.android.launcher3; import static com.android.launcher3.AbstractFloatingView.TYPE_WIDGET_RESIZE_FRAME; 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; @@ -620,9 +619,7 @@ public class Workspace extends PagedView * Initializes and binds the first page */ public void bindAndInitFirstWorkspaceScreen() { - if ((!FeatureFlags.QSB_ON_FIRST_SCREEN - || !mLauncher.getIsFirstPagePinnedItemEnabled()) - || SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (!FeatureFlags.QSB_ON_FIRST_SCREEN || SHOULD_SHOW_FIRST_PAGE_WIDGET) { mFirstPagePinnedItem = null; return; } @@ -663,9 +660,7 @@ public class Workspace extends PagedView mWorkspaceScreens.clear(); // Ensure that the first page is always present - if (!enableSmartspaceRemovalToggle()) { - bindAndInitFirstWorkspaceScreen(); - } + bindAndInitFirstWorkspaceScreen(); // Re-enable the layout transitions enableLayoutTransitions(); @@ -827,12 +822,6 @@ public class Workspace extends PagedView for (int i = 0; i < finalScreens.size(); i++) { int screenId = finalScreens.keyAt(i); - // 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 (enableSmartspaceRemovalToggle() && screenId == FIRST_SCREEN_ID) { - continue; - } - CellLayout screen = finalScreens.get(screenId); mWorkspaceScreens.remove(screenId); diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 6438ddafbc..8034755303 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -95,13 +95,13 @@ import com.android.launcher3.model.LoaderTask.LoaderTaskFactory; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; -import com.android.launcher3.util.dagger.LauncherExecutorsModule; import com.android.launcher3.util.BaseContext; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.ItemInflater; import com.android.launcher3.util.SandboxContext; import com.android.launcher3.util.Themes; +import com.android.launcher3.util.dagger.LauncherExecutorsModule; import com.android.launcher3.util.window.WindowManagerProxy; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.BaseDragLayer; @@ -484,8 +484,7 @@ public class LauncherPreviewRenderer extends BaseContext // Add first page QSB - if (FeatureFlags.QSB_ON_FIRST_SCREEN && dataModel.isFirstPagePinnedItemEnabled - && !SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (FeatureFlags.QSB_ON_FIRST_SCREEN && !SHOULD_SHOW_FIRST_PAGE_WIDGET) { CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID); View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false); // TODO: set bgHandler on qsb when it is BaseTemplateCard, which requires API changes. diff --git a/src/com/android/launcher3/model/BaseLauncherBinder.java b/src/com/android/launcher3/model/BaseLauncherBinder.java index 5f1f457661..5b95e370ae 100644 --- a/src/com/android/launcher3/model/BaseLauncherBinder.java +++ b/src/com/android/launcher3/model/BaseLauncherBinder.java @@ -17,7 +17,6 @@ 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.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING; @@ -296,10 +295,6 @@ public class BaseLauncherBinder { executeCallbacksTask(c -> { c.clearPendingBinds(); c.startBinding(); - if (enableSmartspaceRemovalToggle()) { - c.setIsFirstPagePinnedItemEnabled( - mBgDataModel.isFirstPagePinnedItemEnabled); - } }, mUiExecutor); // Bind workspace screens diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java index ea15e344b6..6970ed3841 100644 --- a/src/com/android/launcher3/model/BgDataModel.java +++ b/src/com/android/launcher3/model/BgDataModel.java @@ -17,9 +17,7 @@ package com.android.launcher3.model; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY; -import static com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN; import static com.android.launcher3.BuildConfig.WIDGETS_ENABLED; -import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR; @@ -138,8 +136,6 @@ public class BgDataModel { * Load id for which the callbacks were successfully bound */ public int lastLoadId = -1; - public boolean isFirstPagePinnedItemEnabled = QSB_ON_FIRST_SCREEN - && !enableSmartspaceRemovalToggle(); @Inject public BgDataModel(WidgetsModel widgetsModel, Provider homeDataProvider) { @@ -459,7 +455,6 @@ public class BgDataModel { default void bindInflatedItems(@NonNull List> items) { } default void bindScreens(IntArray orderedScreenIds) { } - default void setIsFirstPagePinnedItemEnabled(boolean isFirstPagePinnedItemEnabled) { } default void finishBindingItems(IntSet pagesBoundFirst) { } default void bindAppsAdded(IntArray newScreens, ArrayList addNotAnimated, ArrayList addAnimated) { } diff --git a/src/com/android/launcher3/model/GridSizeMigrationDBController.java b/src/com/android/launcher3/model/GridSizeMigrationDBController.java index 12ba07de4e..4867d33f88 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationDBController.java +++ b/src/com/android/launcher3/model/GridSizeMigrationDBController.java @@ -16,7 +16,6 @@ package com.android.launcher3.model; -import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle; import static com.android.launcher3.GridType.GRID_TYPE_NON_ONE_GRID; import static com.android.launcher3.GridType.GRID_TYPE_ONE_GRID; import static com.android.launcher3.InvariantDeviceProfile.TYPE_TABLET; @@ -27,7 +26,6 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ROW_SHIFT_ONE_GRID_MIGRATION; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_STANDARD_GRID_MIGRATION; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_STANDARD_ONE_GRID_MIGRATION; -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; import static com.android.launcher3.provider.LauncherDbUtils.shiftWorkspaceByXCells; @@ -47,7 +45,6 @@ import androidx.annotation.VisibleForTesting; import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; @@ -403,8 +400,6 @@ public class GridSizeMigrationDBController { final Point trg = new Point(trgX, trgY); final Point next = new Point(0, screenId == 0 && (FeatureFlags.QSB_ON_FIRST_SCREEN - && (!enableSmartspaceRemovalToggle() || LauncherPrefs.getPrefs(destReader.mContext) - .getBoolean(SMARTSPACE_ON_HOME_SCREEN, true)) && !SHOULD_SHOW_FIRST_PAGE_WIDGET) ? 1 /* smartspace */ : 0); List existedEntries = destReader.mWorkspaceEntriesByScreenId.get(screenId); diff --git a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt index d88f6ccfc6..e8799b034d 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt +++ b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt @@ -23,7 +23,6 @@ import androidx.annotation.VisibleForTesting import com.android.launcher3.Flags import com.android.launcher3.LauncherPrefs import com.android.launcher3.LauncherPrefs.Companion.get -import com.android.launcher3.LauncherPrefs.Companion.getPrefs import com.android.launcher3.LauncherSettings import com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME import com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE @@ -505,11 +504,7 @@ class GridSizeMigrationLogic { val next: Point = if ( screenId == 0 && - (FeatureFlags.QSB_ON_FIRST_SCREEN && - (!Flags.enableSmartspaceRemovalToggle() || - getPrefs(context) - .getBoolean(LoaderTask.SMARTSPACE_ON_HOME_SCREEN, true)) && - !Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET) + (FeatureFlags.QSB_ON_FIRST_SCREEN && !Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET) ) { Point(0, 1 /* smartspace */) } else { diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java index f009f72b82..1e6d44986b 100644 --- a/src/com/android/launcher3/model/LoaderCursor.java +++ b/src/com/android/launcher3/model/LoaderCursor.java @@ -560,7 +560,7 @@ public class LoaderCursor extends CursorWrapper { // cause the item loading to get skipped ShortcutKey.fromItemInfo(info); } - if (checkItemPlacement(info, dataModel.isFirstPagePinnedItemEnabled)) { + if (checkItemPlacement(info)) { if (logger != null) { logger.addLog( Log.DEBUG, @@ -587,7 +587,7 @@ public class LoaderCursor extends CursorWrapper { /** * check & update map of what's occupied; used to discard overlapping/invalid items */ - protected boolean checkItemPlacement(ItemInfo item, boolean isFirstPagePinnedItemEnabled) { + protected boolean checkItemPlacement(ItemInfo item) { int containerIndex = item.screenId; if (item.container == Favorites.CONTAINER_HOTSEAT) { final GridOccupancy hotseatOccupancy = @@ -636,8 +636,7 @@ 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 - && !SHOULD_SHOW_FIRST_PAGE_WIDGET - && isFirstPagePinnedItemEnabled)) { + && !SHOULD_SHOW_FIRST_PAGE_WIDGET)) { // 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. diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index 26f9503dee..2c6583558a 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -19,7 +19,6 @@ 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.DESKTOP_ICON_FLAG; @@ -132,7 +131,6 @@ import javax.inject.Named; @SuppressWarnings("NewApi") public class LoaderTask implements Runnable { private static final String TAG = "LoaderTask"; - public static final String SMARTSPACE_ON_HOME_SCREEN = "pref_smartspace_home_screen"; private static final boolean DEBUG = true; @@ -435,10 +433,6 @@ public class LoaderTask implements Runnable { Trace.endSection(); } logASplit("loadWorkspace finished"); - - mBgDataModel.isFirstPagePinnedItemEnabled = FeatureFlags.QSB_ON_FIRST_SCREEN - && (!enableSmartspaceRemovalToggle() - || LauncherPrefs.getPrefs(mContext).getBoolean(SMARTSPACE_ON_HOME_SCREEN, true)); } private void loadWorkspaceImpl( diff --git a/src/com/android/launcher3/model/ModelInitializer.kt b/src/com/android/launcher3/model/ModelInitializer.kt index 735a52aac6..ebbcfeab74 100644 --- a/src/com/android/launcher3/model/ModelInitializer.kt +++ b/src/com/android/launcher3/model/ModelInitializer.kt @@ -19,7 +19,6 @@ package com.android.launcher3.model import android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED import android.content.ComponentName import android.content.Context -import android.content.SharedPreferences import android.content.pm.LauncherApps import android.content.pm.LauncherApps.ArchiveCompatibilityParams import com.android.launcher3.BuildConfig @@ -27,7 +26,6 @@ import com.android.launcher3.Flags import com.android.launcher3.InvariantDeviceProfile import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener import com.android.launcher3.LauncherModel -import com.android.launcher3.LauncherPrefs.Companion.getPrefs import com.android.launcher3.Utilities import com.android.launcher3.dagger.ApplicationContext import com.android.launcher3.graphics.ThemeManager @@ -137,18 +135,6 @@ constructor( settingsCache.unregister(NOTIFICATION_BADGING_URI, notificationChanges) } - // removable smartspace - if (Flags.enableSmartspaceRemovalToggle()) { - val smartSpacePrefChanges = - SharedPreferences.OnSharedPreferenceChangeListener { _, key -> - if (LoaderTask.SMARTSPACE_ON_HOME_SCREEN == key) model.forceReload() - } - getPrefs(context).registerOnSharedPreferenceChangeListener(smartSpacePrefChanges) - lifeCycle.addCloseable { - getPrefs(context).unregisterOnSharedPreferenceChangeListener(smartSpacePrefChanges) - } - } - // Custom widgets lifeCycle.addCloseable(customWidgetManager.addWidgetRefreshCallback(model::rebindCallbacks)) diff --git a/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java b/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java index 7790886a6e..5a43d6c2e4 100644 --- a/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java +++ b/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java @@ -208,7 +208,7 @@ public class LoaderCursorTest { // Item outside screen bounds are not placed assertFalse(mLoaderCursor.checkItemPlacement( - newItemInfo(4, 4, 1, 1, CONTAINER_DESKTOP, 1), true)); + newItemInfo(4, 4, 1, 1, CONTAINER_DESKTOP, 1))); } @Test @@ -219,22 +219,22 @@ public class LoaderCursorTest { // Overlapping mItems are not placed assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 1), true)); + newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 1))); assertFalse(mLoaderCursor.checkItemPlacement( - newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 1), true)); + newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 1))); assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 2), true)); + newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 2))); assertFalse(mLoaderCursor.checkItemPlacement( - newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 2), true)); + newItemInfo(0, 0, 1, 1, CONTAINER_DESKTOP, 2))); assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(1, 1, 1, 1, CONTAINER_DESKTOP, 1), true)); + newItemInfo(1, 1, 1, 1, CONTAINER_DESKTOP, 1))); assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(2, 2, 2, 2, CONTAINER_DESKTOP, 1), true)); + newItemInfo(2, 2, 2, 2, CONTAINER_DESKTOP, 1))); assertFalse(mLoaderCursor.checkItemPlacement( - newItemInfo(3, 2, 1, 2, CONTAINER_DESKTOP, 1), true)); + newItemInfo(3, 2, 1, 2, CONTAINER_DESKTOP, 1))); } @Test @@ -245,12 +245,12 @@ public class LoaderCursorTest { // Hotseat mItems are only placed based on screenId assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 1), true)); + newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 1))); assertTrue(mLoaderCursor.checkItemPlacement( - newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 2), true)); + newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 2))); assertFalse(mLoaderCursor.checkItemPlacement( - newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 3), true)); + newItemInfo(3, 3, 1, 1, CONTAINER_HOTSEAT, 3))); } @Test