diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index 466e791b64..d770082eb6 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -209,13 +209,6 @@ flag { bug: "292269949" } -flag { - name: "enable_smartspace_as_a_widget" - namespace: "launcher" - description: "Enables smartspace as a widget" - bug: "300140279" -} - flag { name: "enabled_folders_in_all_apps" namespace: "launcher" diff --git a/go/quickstep/src/com/android/launcher3/BuildConfig.java b/go/quickstep/src/com/android/launcher3/BuildConfig.java index cfcda39e01..53ccbd30c7 100644 --- a/go/quickstep/src/com/android/launcher3/BuildConfig.java +++ b/go/quickstep/src/com/android/launcher3/BuildConfig.java @@ -26,11 +26,6 @@ public final class BuildConfig { */ public static final boolean QSB_ON_FIRST_SCREEN = true; - /** - * Flag to state if the widget on the top of the first screen should be shown. - */ - public static final boolean WIDGET_ON_FIRST_SCREEN = false; - /** * Flag to control various developer centric features */ diff --git a/res/values/config.xml b/res/values/config.xml index d63d742c32..5c183f7606 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -203,9 +203,6 @@ 8sp - - - 0.5 720 diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 70c30cb491..9456a8ca2d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2488,11 +2488,6 @@ public class Launcher extends StatefulActivity mModelCallbacks.bindAllWidgets(allWidgets); } - @Override - public void bindSmartspaceWidget() { - mModelCallbacks.bindSmartspaceWidget(); - } - @Override public void bindStringCache(StringCache cache) { mModelCallbacks.bindStringCache(cache); diff --git a/src/com/android/launcher3/LauncherPrefs.kt b/src/com/android/launcher3/LauncherPrefs.kt index 30c4529613..47ed6b99c7 100644 --- a/src/com/android/launcher3/LauncherPrefs.kt +++ b/src/com/android/launcher3/LauncherPrefs.kt @@ -19,7 +19,6 @@ import android.content.Context import android.content.Context.MODE_PRIVATE import android.content.SharedPreferences import androidx.annotation.VisibleForTesting -import com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN import com.android.launcher3.GridType.Companion.GRID_TYPE_ANY import com.android.launcher3.InvariantDeviceProfile.GRID_NAME_PREFS_KEY import com.android.launcher3.InvariantDeviceProfile.NON_FIXED_LANDSCAPE_GRID_NAME_PREFS_KEY @@ -238,7 +237,6 @@ constructor(@ApplicationContext private val encryptedContext: Context) { const val TASKBAR_PINNING_KEY = "TASKBAR_PINNING_KEY" const val TASKBAR_PINNING_DESKTOP_MODE_KEY = "TASKBAR_PINNING_DESKTOP_MODE_KEY" - const val SHOULD_SHOW_SMARTSPACE_KEY = "SHOULD_SHOW_SMARTSPACE_KEY" @JvmField val ENABLE_TWOLINE_ALLAPPS_TOGGLE = backedUpItem("pref_enable_two_line_toggle", false) @@ -270,13 +268,6 @@ constructor(@ApplicationContext private val encryptedContext: Context) { val GRID_TYPE = backedUpItem(DeviceGridState.KEY_GRID_TYPE, GRID_TYPE_ANY, EncryptionType.ENCRYPTED) @JvmField - val SHOULD_SHOW_SMARTSPACE = - backedUpItem( - SHOULD_SHOW_SMARTSPACE_KEY, - WIDGET_ON_FIRST_SCREEN, - EncryptionType.DEVICE_PROTECTED, - ) - @JvmField val RESTORE_DEVICE = backedUpItem( RestoreDbTask.RESTORED_DEVICE_TYPE, diff --git a/src/com/android/launcher3/ModelCallbacks.kt b/src/com/android/launcher3/ModelCallbacks.kt index cedbe54c25..3a68afe48c 100644 --- a/src/com/android/launcher3/ModelCallbacks.kt +++ b/src/com/android/launcher3/ModelCallbacks.kt @@ -12,7 +12,6 @@ import com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN import com.android.launcher3.LauncherConstants.TraceEvents import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT -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 @@ -40,7 +39,6 @@ import com.android.launcher3.util.Preconditions import com.android.launcher3.util.RunnableList import com.android.launcher3.util.TraceHelper import com.android.launcher3.util.ViewOnDrawExecutor -import com.android.launcher3.widget.PendingAddWidgetInfo import com.android.launcher3.widget.model.WidgetsListBaseEntry import java.util.concurrent.Executor import java.util.concurrent.atomic.AtomicReference @@ -285,49 +283,16 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { return result } - override fun bindSmartspaceWidget() { - val cl: CellLayout? = - launcher.workspace.getScreenWithId(WorkspaceLayoutManager.FIRST_SCREEN_ID) - val spanX = InvariantDeviceProfile.INSTANCE.get(launcher).numSearchContainerColumns - - if (cl?.isRegionVacant(0, 0, spanX, 1) != true) { - return - } - - val widgetsListBaseEntry: WidgetsListBaseEntry = - launcher.widgetPickerDataProvider.get().allWidgets.firstOrNull { - item: WidgetsListBaseEntry -> - item.mPkgItem.packageName == BuildConfig.APPLICATION_ID - } ?: return - - val info = - PendingAddWidgetInfo( - widgetsListBaseEntry.mWidgets[0].widgetInfo, - LauncherSettings.Favorites.CONTAINER_DESKTOP, - ) - launcher.addPendingItem( - info, - info.container, - WorkspaceLayoutManager.FIRST_SCREEN_ID, - intArrayOf(0, 0), - info.spanX, - info.spanY, - ) - } - private fun bindScreens(orderedScreenIds: LIntArray) { launcher.workspace.pageIndicator.setPauseScroll( /*pause=*/ true, launcher.deviceProfile.isTwoPanels, ) val firstScreenPosition = 0 - if ( - !SHOULD_SHOW_FIRST_PAGE_WIDGET && - orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition - ) { + if (orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition) { orderedScreenIds.removeValue(FIRST_SCREEN_ID) orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID) - } else if (SHOULD_SHOW_FIRST_PAGE_WIDGET && orderedScreenIds.isEmpty) { + } else if (orderedScreenIds.isEmpty) { // If there are no screens, we need to have an empty screen launcher.workspace.addExtraEmptyScreens() } @@ -393,9 +358,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { } } orderedScreenIds - .filterNot { screenId -> - !SHOULD_SHOW_FIRST_PAGE_WIDGET && screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID - } + .filter { screenId -> screenId != FIRST_SCREEN_ID } .forEach { screenId -> launcher.workspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId) } @@ -486,8 +449,7 @@ class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks { IntSet() .apply { itemIdMap.forEach { if (it.container == CONTAINER_DESKTOP) add(it.screenId) } - if ((QSB_ON_FIRST_SCREEN && !SHOULD_SHOW_FIRST_PAGE_WIDGET) || isEmpty) - add(Workspace.FIRST_SCREEN_ID) + if (QSB_ON_FIRST_SCREEN || isEmpty) add(Workspace.FIRST_SCREEN_ID) } .array val currentScreenIds = getPagesToBindSynchronously(orderedScreenIds) diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index c392772da9..ba7f1c9698 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -16,9 +16,7 @@ package com.android.launcher3; -import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN; import static com.android.launcher3.Flags.enableMouseInteractionChanges; -import static com.android.launcher3.Flags.enableSmartspaceAsAWidget; import static com.android.launcher3.graphics.ShapeDelegate.DEFAULT_PATH_SIZE; import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; @@ -147,9 +145,6 @@ 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{} diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3d08154912..9e07bb74b7 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -19,10 +19,10 @@ 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.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION; 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.CONTAINER_HOTSEAT_PREDICTION; -import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APPS_PREDICTION; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.EDIT_MODE; import static com.android.launcher3.LauncherState.FLAG_MULTI_PAGE; @@ -32,7 +32,6 @@ 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.FOLDABLE_SINGLE_PAGE; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; @@ -623,7 +622,7 @@ public class Workspace extends PagedView * Initializes and binds the first page */ public void bindAndInitFirstWorkspaceScreen() { - if (!FeatureFlags.QSB_ON_FIRST_SCREEN || SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (!BuildConfig.QSB_ON_FIRST_SCREEN) { mFirstPagePinnedItem = null; return; } @@ -1053,9 +1052,7 @@ public class Workspace extends PagedView int id = mWorkspaceScreens.keyAt(i); CellLayout cl = mWorkspaceScreens.valueAt(i); // FIRST_SCREEN_ID can never be removed. - if (((!FeatureFlags.QSB_ON_FIRST_SCREEN - || SHOULD_SHOW_FIRST_PAGE_WIDGET) - || id > FIRST_SCREEN_ID) + if ((!BuildConfig.QSB_ON_FIRST_SCREEN || id > FIRST_SCREEN_ID) && cl.getShortcutsAndWidgets().getChildCount() == 0) { removeScreens.add(id); } diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index d987841410..e10c41ba4a 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -44,14 +44,6 @@ public final class FeatureFlags { @Deprecated public static final boolean IS_STUDIO_BUILD = BuildConfig.IS_STUDIO_BUILD; - /** - * Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature - * and should be modified at a project level. - * @deprecated Use {@link BuildConfig#QSB_ON_FIRST_SCREEN} directly - */ - @Deprecated - public static final boolean QSB_ON_FIRST_SCREEN = BuildConfig.QSB_ON_FIRST_SCREEN; - /** * Feature flag to handle define config changes dynamically instead of killing the process. *

diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 4655783884..630c1fa14f 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -25,7 +25,6 @@ import static com.android.launcher3.Hotseat.ALPHA_CHANNEL_PREVIEW_RENDERER; import static com.android.launcher3.LauncherPrefs.FIXED_LANDSCAPE_MODE; import static com.android.launcher3.LauncherPrefs.GRID_NAME; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION; -import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET; import static com.android.launcher3.graphics.ThemeManager.PREF_ICON_SHAPE; import static com.android.launcher3.graphics.ThemeManager.THEMED_ICONS; import static com.android.launcher3.model.ModelUtils.currentScreenContentFilter; @@ -60,6 +59,7 @@ import androidx.annotation.Nullable; import androidx.lifecycle.DefaultLifecycleObserver; import androidx.lifecycle.LifecycleOwner; +import com.android.launcher3.BuildConfig; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Hotseat; @@ -73,7 +73,6 @@ import com.android.launcher3.WorkspaceLayoutManager; import com.android.launcher3.celllayout.CellLayoutLayoutParams; import com.android.launcher3.celllayout.CellPosMapper; import com.android.launcher3.concurrent.ExecutorsModule; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dagger.ApiWrapperModule; import com.android.launcher3.dagger.AppModule; import com.android.launcher3.dagger.LauncherAppComponent; @@ -463,7 +462,7 @@ public class LauncherPreviewRenderer extends BaseContext // Add first page QSB - if (FeatureFlags.QSB_ON_FIRST_SCREEN && !SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (BuildConfig.QSB_ON_FIRST_SCREEN) { 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 dc4b6f02da..aa70f65ad2 100644 --- a/src/com/android/launcher3/model/BaseLauncherBinder.java +++ b/src/com/android/launcher3/model/BaseLauncherBinder.java @@ -154,16 +154,6 @@ public class BaseLauncherBinder { executeCallbacksTask(c -> c.bindAllWidgets(widgets), mUiExecutor); } - /** - * bindWidgets is abstract because it is a no-op for the go launcher. - */ - public void bindSmartspaceWidget() { - if (!WIDGETS_ENABLED) { - return; - } - executeCallbacksTask(c -> c.bindSmartspaceWidget(), mUiExecutor); - } - protected void executeCallbacksTask(CallbackTask task, Executor executor) { executor.execute(() -> { if (mMyBindingId != mBgDataModel.lastBindId) { diff --git a/src/com/android/launcher3/model/BgDataModel.kt b/src/com/android/launcher3/model/BgDataModel.kt index 719aa8d37e..f14c6c5eae 100644 --- a/src/com/android/launcher3/model/BgDataModel.kt +++ b/src/com/android/launcher3/model/BgDataModel.kt @@ -22,7 +22,6 @@ import android.content.pm.ShortcutInfo import android.os.UserHandle import android.util.Log import androidx.annotation.AnyThread -import androidx.core.util.size import com.android.launcher3.BuildConfig import com.android.launcher3.Flags import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP @@ -30,7 +29,6 @@ import com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT import com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_FOLDER -import com.android.launcher3.Utilities import com.android.launcher3.Workspace import com.android.launcher3.dagger.LauncherAppSingleton import com.android.launcher3.logging.DumpManager @@ -119,10 +117,7 @@ constructor( val screenSet = IntSet() itemsIdMap.forEach { if (it.container == CONTAINER_DESKTOP) screenSet.add(it.screenId) } - if ( - (BuildConfig.QSB_ON_FIRST_SCREEN && !Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET) || - screenSet.isEmpty - ) { + if (BuildConfig.QSB_ON_FIRST_SCREEN || screenSet.isEmpty) { screenSet.add(Workspace.FIRST_SCREEN_ID) } return screenSet.array @@ -404,8 +399,6 @@ constructor( /** Binds the app widgets to the providers that share widgets with the UI. */ fun bindAllWidgets(widgets: List<@JvmSuppressWildcards WidgetsListBaseEntry>) {} - fun bindSmartspaceWidget() {} - fun bindDeepShortcutMap(deepShortcutMap: HashMap) {} /** Binds extra item provided any external source */ diff --git a/src/com/android/launcher3/model/DatabaseHelper.java b/src/com/android/launcher3/model/DatabaseHelper.java index ed4f492a80..44470df831 100644 --- a/src/com/android/launcher3/model/DatabaseHelper.java +++ b/src/com/android/launcher3/model/DatabaseHelper.java @@ -16,7 +16,6 @@ package com.android.launcher3.model; import static com.android.launcher3.LauncherSettings.Favorites.addTableToDb; -import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET; import static com.android.launcher3.provider.LauncherDbUtils.dropTable; import android.content.ContentValues; @@ -37,10 +36,10 @@ import androidx.annotation.NonNull; import com.android.launcher3.AutoInstallsLayout; import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback; +import com.android.launcher3.BuildConfig; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Utilities; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.FileLog; import com.android.launcher3.pm.UserCache; import com.android.launcher3.provider.LauncherDbUtils; @@ -257,8 +256,7 @@ public class DatabaseHelper extends NoLocaleSQLiteHelper implements Favorites.SCREEN, IntArray.wrap(-777, -778)), null); } case 30: { - if (FeatureFlags.QSB_ON_FIRST_SCREEN - && !SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (BuildConfig.QSB_ON_FIRST_SCREEN) { // 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, diff --git a/src/com/android/launcher3/model/GridSizeMigrationDBController.java b/src/com/android/launcher3/model/GridSizeMigrationDBController.java index 4867d33f88..3d56010a2d 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationDBController.java +++ b/src/com/android/launcher3/model/GridSizeMigrationDBController.java @@ -16,12 +16,12 @@ package com.android.launcher3.model; +import static com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN; 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; import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME; import static com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE; -import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ROW_SHIFT_GRID_MIGRATION; 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; @@ -47,7 +47,6 @@ import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; import com.android.launcher3.util.GridOccupancy; @@ -398,10 +397,8 @@ public class GridSizeMigrationDBController { @NonNull final List sortedItemsToPlace, List idsInUse) { final GridOccupancy occupied = new GridOccupancy(trgX, trgY); final Point trg = new Point(trgX, trgY); - final Point next = new Point(0, screenId == 0 - && (FeatureFlags.QSB_ON_FIRST_SCREEN - && !SHOULD_SHOW_FIRST_PAGE_WIDGET) - ? 1 /* smartspace */ : 0); + final Point next = new Point(0, + screenId == 0 && QSB_ON_FIRST_SCREEN ? 1 /* smartspace */ : 0); List existedEntries = destReader.mWorkspaceEntriesByScreenId.get(screenId); if (existedEntries != null) { for (DbEntry entry : existedEntries) { diff --git a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt index e8799b034d..8c0a90733f 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt +++ b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt @@ -20,14 +20,13 @@ import android.database.sqlite.SQLiteDatabase import android.graphics.Point import android.util.Log import androidx.annotation.VisibleForTesting +import com.android.launcher3.BuildConfig import com.android.launcher3.Flags import com.android.launcher3.LauncherPrefs import com.android.launcher3.LauncherPrefs.Companion.get import com.android.launcher3.LauncherSettings import com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME import com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE -import com.android.launcher3.Utilities -import com.android.launcher3.config.FeatureFlags import com.android.launcher3.logging.FileLog import com.android.launcher3.logging.StatsLogManager import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ROW_SHIFT_GRID_MIGRATION @@ -502,10 +501,7 @@ class GridSizeMigrationLogic { val occupied = GridOccupancy(trgX, trgY) val trg = Point(trgX, trgY) val next: Point = - if ( - screenId == 0 && - (FeatureFlags.QSB_ON_FIRST_SCREEN && !Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET) - ) { + if (screenId == 0 && BuildConfig.QSB_ON_FIRST_SCREEN) { Point(0, 1 /* smartspace */) } else { Point(0, 0) diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java index 1e6d44986b..392383839a 100644 --- a/src/com/android/launcher3/model/LoaderCursor.java +++ b/src/com/android/launcher3/model/LoaderCursor.java @@ -22,7 +22,6 @@ import static com.android.launcher3.LauncherSettings.Favorites.DESKTOP_ICON_FLAG import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; -import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET; import static com.android.launcher3.icons.cache.CacheLookupFlag.DEFAULT_LOOKUP_FLAG; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ARCHIVED; @@ -43,6 +42,7 @@ import android.util.LongSparseArray; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import com.android.launcher3.BuildConfig; import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherModel; @@ -52,7 +52,6 @@ import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.backuprestore.LauncherRestoreEventLogger; import com.android.launcher3.backuprestore.LauncherRestoreEventLogger.RestoreError; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.icons.IconCache; import com.android.launcher3.logging.FileLog; @@ -635,8 +634,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)) { + if (item.screenId == Workspace.FIRST_SCREEN_ID && BuildConfig.QSB_ON_FIRST_SCREEN) { // 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 5067a8fbbe..51434b6e70 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -16,11 +16,8 @@ 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.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; import static com.android.launcher3.icons.CacheableShortcutInfo.convertShortcutsToCacheableShortcuts; import static com.android.launcher3.icons.cache.CacheLookupFlag.DEFAULT_LOOKUP_FLAG; @@ -370,19 +367,6 @@ public class LoaderTask implements Runnable { mLauncherBinder.bindWidgets(); logASplit("bindWidgets finished"); verifyNotStopped(); - LauncherPrefs prefs = LauncherPrefs.get(mContext); - - if (enableSmartspaceAsAWidget() && prefs.get(SHOULD_SHOW_SMARTSPACE)) { - mLauncherBinder.bindSmartspaceWidget(); - // Turn off pref. - prefs.putSync(SHOULD_SHOW_SMARTSPACE.to(false)); - logASplit("bindSmartspaceWidget finished"); - verifyNotStopped(); - } else if (!enableSmartspaceAsAWidget() && WIDGET_ON_FIRST_SCREEN - && !prefs.get(LauncherPrefs.SHOULD_SHOW_SMARTSPACE)) { - // Turn on pref. - prefs.putSync(SHOULD_SHOW_SMARTSPACE.to(true)); - } logASplit("saving all widgets in icon cache"); updateHandler.updateIcons(allWidgetsList, diff --git a/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java b/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java index 17f1615d8d..ae481736fd 100644 --- a/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java +++ b/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java @@ -15,15 +15,14 @@ */ 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 android.util.LongSparseArray; +import com.android.launcher3.BuildConfig; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.IntArray; @@ -81,8 +80,7 @@ public class WorkspaceItemSpaceFinder { int screenCount = workspaceScreens.size(); // First check the preferred screen. IntSet screensToExclude = new IntSet(); - if (FeatureFlags.QSB_ON_FIRST_SCREEN - && !SHOULD_SHOW_FIRST_PAGE_WIDGET) { + if (BuildConfig.QSB_ON_FIRST_SCREEN) { screensToExclude.add(FIRST_SCREEN_ID); } diff --git a/src/com/android/launcher3/qsb/QsbContainerView.java b/src/com/android/launcher3/qsb/QsbContainerView.java index d6b41b06a3..a787fb4363 100644 --- a/src/com/android/launcher3/qsb/QsbContainerView.java +++ b/src/com/android/launcher3/qsb/QsbContainerView.java @@ -20,8 +20,6 @@ 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.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET; - import android.app.Activity; import android.app.Fragment; import android.app.SearchManager; @@ -44,11 +42,11 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; +import com.android.launcher3.BuildConfig; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.FragmentWithPreview; import com.android.launcher3.widget.util.WidgetSizes; @@ -292,8 +290,7 @@ public class QsbContainerView extends FrameLayout { } public boolean isQsbEnabled() { - return FeatureFlags.QSB_ON_FIRST_SCREEN - && !SHOULD_SHOW_FIRST_PAGE_WIDGET; + return BuildConfig.QSB_ON_FIRST_SCREEN; } protected Bundle createBindOptions() { diff --git a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java index 20cce8fc2d..f153570d9b 100644 --- a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java +++ b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java @@ -16,7 +16,6 @@ package com.android.launcher3.widget.custom; -import static com.android.launcher3.Flags.enableSmartspaceAsAWidget; import static com.android.launcher3.model.data.LauncherAppWidgetInfo.CUSTOM_WIDGET_ID; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.widget.LauncherAppWidgetProviderInfo.CLS_CUSTOM_WIDGET_PREFIX; @@ -27,13 +26,11 @@ import android.content.ComponentName; import android.content.Context; import android.os.Parcel; import android.os.Process; -import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import com.android.launcher3.R; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppSingleton; import com.android.launcher3.dagger.LauncherBaseAppComponent; @@ -46,7 +43,6 @@ import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; import com.android.systemui.plugins.CustomWidgetPlugin; import com.android.systemui.plugins.PluginListener; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -90,22 +86,6 @@ public class CustomWidgetManager implements PluginListener { mCustomWidgets = new ArrayList<>(); pluginManager.addPluginListener(this, CustomWidgetPlugin.class, true); - if (enableSmartspaceAsAWidget()) { - for (String s: context.getResources() - .getStringArray(R.array.custom_widget_providers)) { - try { - Class cls = Class.forName(s); - CustomWidgetPlugin plugin = (CustomWidgetPlugin) - cls.getDeclaredConstructor(Context.class).newInstance(context); - MAIN_EXECUTOR.execute(() -> onPluginConnected(plugin, context)); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException - | ClassCastException | NoSuchMethodException - | InvocationTargetException e) { - Log.e(TAG, "Exception found when trying to add custom widgets: " + e); - } - } - } tracker.addCloseable(() -> pluginManager.removePluginListener(this)); } diff --git a/src_build_config/com/android/launcher3/BuildConfig.java b/src_build_config/com/android/launcher3/BuildConfig.java index 6d4f56d655..3d39c37b6e 100644 --- a/src_build_config/com/android/launcher3/BuildConfig.java +++ b/src_build_config/com/android/launcher3/BuildConfig.java @@ -26,11 +26,6 @@ public final class BuildConfig { */ public static final boolean QSB_ON_FIRST_SCREEN = true; - /** - * Flag to state if the widget on the top of the first screen should be shown. - */ - public static final boolean WIDGET_ON_FIRST_SCREEN = false; - /** * Flag to control various developer centric features */