From 7a332e02aae64841fc226a663f9d512e05e7ee9a Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 1 May 2025 15:57:28 -0700 Subject: [PATCH 1/7] Removing Smartspace as a widget flag Bug: 300140279 Flag: EXEMPT removing dead code Test: Presubmit Change-Id: If24db0b4c2c119f5cbe1153e3d77599d12ff80a6 --- aconfig/launcher.aconfig | 7 --- .../com/android/launcher3/BuildConfig.java | 5 -- res/values/config.xml | 3 -- src/com/android/launcher3/Launcher.java | 5 -- src/com/android/launcher3/LauncherPrefs.kt | 9 ---- src/com/android/launcher3/ModelCallbacks.kt | 46 ++----------------- src/com/android/launcher3/Utilities.java | 5 -- src/com/android/launcher3/Workspace.java | 9 ++-- .../launcher3/config/FeatureFlags.java | 8 ---- .../graphics/LauncherPreviewRenderer.java | 5 +- .../launcher3/model/BaseLauncherBinder.java | 10 ---- .../android/launcher3/model/BgDataModel.kt | 9 +--- .../launcher3/model/DatabaseHelper.java | 6 +-- .../model/GridSizeMigrationDBController.java | 9 ++-- .../launcher3/model/GridSizeMigrationLogic.kt | 8 +--- .../android/launcher3/model/LoaderCursor.java | 6 +-- .../android/launcher3/model/LoaderTask.java | 16 ------- .../model/WorkspaceItemSpaceFinder.java | 6 +-- .../launcher3/qsb/QsbContainerView.java | 7 +-- .../widget/custom/CustomWidgetManager.java | 20 -------- .../com/android/launcher3/BuildConfig.java | 5 -- 21 files changed, 23 insertions(+), 181 deletions(-) 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 */ From 1e52b704346313a25fae6a6f38c449bef1b9b205 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Thu, 1 May 2025 23:41:03 +0000 Subject: [PATCH 2/7] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I83194d37008b416e8b9ba57c72e68b13ad6b282e --- quickstep/res/values-ja/strings.xml | 2 +- quickstep/res/values-nl/strings.xml | 2 +- quickstep/res/values-te/strings.xml | 2 +- quickstep/res/values-zh-rCN/strings.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quickstep/res/values-ja/strings.xml b/quickstep/res/values-ja/strings.xml index 9e40f1a479..40ba03e459 100644 --- a/quickstep/res/values-ja/strings.xml +++ b/quickstep/res/values-ja/strings.xml @@ -96,7 +96,7 @@ "共有" "スクリーンショット" "分割" - "アプリのペア設定保存" + "アプリの組み合わせを保存" "分割画面を使用するには、他のアプリをタップします" "分割画面を使用するには別のアプリを選択してください" "キャンセル" diff --git a/quickstep/res/values-nl/strings.xml b/quickstep/res/values-nl/strings.xml index c58bc5f95b..34b069a0c0 100644 --- a/quickstep/res/values-nl/strings.xml +++ b/quickstep/res/values-nl/strings.xml @@ -78,7 +78,7 @@ "Je weet nu hoe je het gebaar Schakelen tussen apps maakt" "Swipe om tussen apps te schakelen" "Swipe omhoog vanaf de onderkant van het scherm, houd vast en laat los om tussen apps te schakelen." - "Schakelen tussen apps" + "Wisselen van app" "Swipe omhoog vanaf de onderkant van het scherm, houd je vinger op het scherm en laat dan los" "Goed bezig" "Klaar" diff --git a/quickstep/res/values-te/strings.xml b/quickstep/res/values-te/strings.xml index 546f1a15af..673cde7e4e 100644 --- a/quickstep/res/values-te/strings.xml +++ b/quickstep/res/values-te/strings.xml @@ -27,7 +27,7 @@ "డెస్క్‌టాప్" "ఇటీవలి ఐటెమ్‌లు ఏవీ లేవు" "యాప్ వినియోగ సెట్టింగ్‌లు" - "అన్నీ తీసివేయండి" + "అన్నీ క్లియర్ చేయండి" "ఇటీవలి యాప్‌లు" "%1$s, %2$s" "< 1 నిమిషం" diff --git a/quickstep/res/values-zh-rCN/strings.xml b/quickstep/res/values-zh-rCN/strings.xml index a16ecccc55..3680ebf805 100644 --- a/quickstep/res/values-zh-rCN/strings.xml +++ b/quickstep/res/values-zh-rCN/strings.xml @@ -96,7 +96,7 @@ "分享" "屏幕截图" "分屏" - "保存应用组合" + "保存应用对" "点按另一个应用即可使用分屏" "另外选择一个应用才可使用分屏模式" "取消" From ac48b8b3d37d8416eb76396debadfe2df2963d8f Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Thu, 1 May 2025 23:42:04 +0000 Subject: [PATCH 3/7] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I1eed4123bfdbcfc64712de5f3f6463381fac0ec8 --- res/values-fr-rCA/strings.xml | 4 ++-- res/values-lt/strings.xml | 2 +- res/values-my/strings.xml | 4 ++-- res/values-ne/strings.xml | 2 +- res/values-pt/strings.xml | 2 +- res/values-sw/strings.xml | 2 +- res/values-zh-rCN/strings.xml | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml index fedce3540e..2ec81d4ff8 100644 --- a/res/values-fr-rCA/strings.xml +++ b/res/values-fr-rCA/strings.xml @@ -61,7 +61,7 @@ "{count,plural, =1{# raccourci}one{# raccourci}other{# raccourcis}}" "%1$s, %2$s" "Widgets" - "Rechercher" + "Recherchez" "Effacer le texte dans le champ de recherche" "Aucun widget ou raccourci proposé" "Aucun widget ni raccourci trouvé" @@ -93,7 +93,7 @@ "Résultats de recherche" "Liste des applis personnelles" "Liste des applis professionnelles" - "Supprimer" + "Retirer" "Désinstaller" "Détails de l\'appli" "Installer dans privé" diff --git a/res/values-lt/strings.xml b/res/values-lt/strings.xml index 34ea2be134..ccf02fbb5a 100644 --- a/res/values-lt/strings.xml +++ b/res/values-lt/strings.xml @@ -47,7 +47,7 @@ "%1$d plotis ir %2$d aukštis" "%1$s valdiklis" "Valdiklis: %1$s; %2$d pločio ir %3$d aukščio" - "Paliesdami ir palaikydami valdiklį galite judėti pagrindiniame ekrane" + "Palietę ir palaikę valdiklį galėsite jį judinti pagrindiniame ekrane" "Pridėti prie pagrindinio ekrano" "Valdiklis „%1$s“ pridėtas prie pagrindinio ekrano" "Pasiūlymai" diff --git a/res/values-my/strings.xml b/res/values-my/strings.xml index aae88701cb..0048850543 100644 --- a/res/values-my/strings.xml +++ b/res/values-my/strings.xml @@ -94,10 +94,10 @@ "တစ်ကိုယ်ရေသုံး အက်ပ်စာရင်း" "အလုပ်သုံး အက်ပ်စာရင်း" "ဖယ်ရှားမည်" - "ဖယ်ရှားရန်" + "ဖြုတ်ရန်" "အက်ပ်အချက်အလက်" "သီးသန့်တွင် ထည့်သွင်းရန်" - "အက်ပ်ကို ဖယ်ရှားရန်" + "အက်ပ်ကို ဖြုတ်ရန်" "ထည့်သွင်းရန်" "အက်ပ်အကြံမပြုပါနှင့်" "ခန့်မှန်းချက်ကို ပင်ထိုးရန်" diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml index 7c8ff3173a..b84a603ee4 100644 --- a/res/values-ne/strings.xml +++ b/res/values-ne/strings.xml @@ -195,7 +195,7 @@ "कामसम्बन्धी" "\"व्यक्तिगत एपहरू\" ट्याब" "\"कामसम्बन्धी एपहरू\" ट्याब" - "कार्य प्रोफाइल" + "वर्क प्रोफाइल" "कामसम्बन्धी एपहरूमा ब्याज अङ्कित हुन्छ र तपाईंका IT एड्मिन ती एप हेर्न सक्छन्" "बुझेँ" "कामसम्बन्धी एपहरू पज गरिएका छन्" diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 6acb30499a..e95ffe8bc6 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -47,7 +47,7 @@ "%1$d de largura por %2$d de altura" "Widget %1$s" "Widget %1$s: %2$d de largura por %3$d de altura" - "Toque no widget e o pressione para definir a posição dele na tela inicial" + "Toque e segure o widget para mover sua posição na tela inicial" "Adicionar à tela inicial" "Widget %1$s adicionado à tela inicial" "Sugestões" diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml index 6b7d3b7a4c..e991fb5b80 100644 --- a/res/values-sw/strings.xml +++ b/res/values-sw/strings.xml @@ -94,7 +94,7 @@ "Orodha ya programu za binafsi" "Orodha ya programu za kazini" "Ondoa" - "Ondoa" + "Sakinusha" "Maelezo ya programu" "Sakinisha faraghani" "Ondoa programu" diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index cd48792c2e..e7c02152a1 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -34,10 +34,10 @@ "%1$s的使用设置" "新窗口" "管理窗口" - "保存应用组合" + "保存应用对" "%1$s | %2$s" "在该设备上无法使用此应用对" - "展开设备即可使用此应用组合" + "展开设备即可使用此应用对" "应用对不可用" "轻触并按住即可移动微件。" "点按两次并按住微件即可移动该微件或使用自定义操作。" From 05fdc49ef796a33816fef7169330934ad7119553 Mon Sep 17 00:00:00 2001 From: Daniel Andersson Date: Fri, 25 Apr 2025 16:32:04 -0700 Subject: [PATCH 4/7] desktop-exploded-view: Fix broken live tile when activating desk - Apply scrollOffset directly to tvs.recentsViewCroll, which already take orientationHandler into account - Apply gridTranslationY directly to taskSecondaryTranslation, which already take orientationHandler into account - This make sure both translations are applied after mTaskRectTransform - Also re-calculate tvs task size after updating orientationState rotations, as the orientationHandler might be changed and affect task position - Remove setTaskRectTranslation that is no longer used Flag: EXEMPT bugfix Test: manual with central/side task launching with portrait, fake landscape and 3p launcher Bug: 410628946 Change-Id: I8ef38d193328e8a449594515403c00f517e213b3 --- .../com/android/quickstep/TaskViewUtils.java | 10 +++---- .../quickstep/util/TaskViewSimulator.java | 27 +++++-------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 47edb05928..3c10effa00 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -229,8 +229,8 @@ public final class TaskViewUtils { boolean showAsGrid = dp.isTablet; boolean parallaxCenterAndAdjacentTask = !showAsGrid && taskIndex != recentsView.getCurrentPage(); - int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex); - int taskRectTranslationSecondary = showAsGrid ? (int) taskView.getGridTranslationY() : 0; + int scrollOffset = recentsView.getScrollOffset(taskIndex); + int gridTranslationY = showAsGrid ? (int) taskView.getGridTranslationY() : 0; RemoteTargetHandle[] topMostSimulators = null; @@ -244,15 +244,15 @@ public final class TaskViewUtils { // be stale. Use the display value instead. int displayRotation = DisplayController.INSTANCE.get(context).getInfo().rotation; tvsLocal.getOrientationState().update(displayRotation, displayRotation); + tvsLocal.calculateTaskSize(); tvsLocal.fullScreenProgress.value = 0; tvsLocal.recentsViewScale.value = 1; if (!enableGridOnlyOverview()) { tvsLocal.setIsGridTask(taskView.isGridTask()); } - tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal, - TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary, - taskRectTranslationSecondary); + tvsLocal.recentsViewScroll.value = scrollOffset; + tvsLocal.taskSecondaryTranslation.value = gridTranslationY; if (taskView instanceof DesktopTaskView) { targetHandle.getTransformParams().setTargetAlpha(1f); diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index f80d209444..7fbc7bd4e0 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -120,9 +120,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { private boolean mIsGridTask; private final boolean mIsDesktopTask; private boolean mIsAnimatingToCarousel = false; - private int mTaskRectTranslationX; - private int mTaskRectTranslationY; - private int mDesktopTaskIndex = 0; + private final int mDesktopTaskIndex; @Nullable private Matrix mTaskRectTransform = null; @@ -159,7 +157,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { calculateTaskSize(); } - private void calculateTaskSize() { + /** + * Updates the task size. + */ + public void calculateTaskSize() { if (mDp == null) { return; } @@ -211,7 +212,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { } else { mTaskRect.set(mFullTaskSize); } - mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } /** @@ -229,11 +229,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { if (mDp == null) { return 1; } - // Copy mFullTaskSize instead of updating it directly so it could be reused next time - // without recalculating - Rect scaleRect = new Rect(mIsAnimatingToCarousel ? mCarouselTaskSize : mFullTaskSize); - scaleRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); - float scale = mOrientationState.getFullScreenScaleAndPivot(scaleRect, mDp, mPivot); + float scale = mOrientationState.getFullScreenScaleAndPivot( + mIsAnimatingToCarousel ? mCarouselTaskSize : mFullTaskSize, mDp, mPivot); if (mPivotOverride != null) { mPivot.set(mPivotOverride); } @@ -314,16 +311,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mDrawAboveOtherApps = drawsAboveOtherApps; } - /** - * Apply translations on TaskRect's starting location. - */ - public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) { - mTaskRectTranslationX = taskRectTranslationX; - mTaskRectTranslationY = taskRectTranslationY; - // Re-calculate task size after changing translation - calculateTaskSize(); - } - /** * Override the pivot used to apply scale changes. */ From f7772b88afb5c198b4364be85ea7e0c6de04d928 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 30 Apr 2025 21:54:15 +0000 Subject: [PATCH 5/7] Return to BackgroundAppState when tapping gesture region in desktop If the end target is null, that means the gesture did not move enough to calculate an actual end target, and LAST_TASK is the default for that case. We probably don't need the desktop check specifically (could clean it up in a follow up) but since this bug is specifically for Desktop mode I left it in for now. Fixes: 359879541 Test: manual, tap Taskbar in Desktop and ensure no flicker Flag: EXEMPT bugfix Change-Id: Icc3e645819a22ed96d07a575cdccda30a5d800c1 --- .../quickstep/BaseActivityInterface.java | 33 ------------------- .../quickstep/BaseContainerInterface.java | 28 +++++++--------- 2 files changed, 11 insertions(+), 50 deletions(-) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 549c2f8e34..ec6762cfb2 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -20,7 +20,6 @@ import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; -import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_ATTACHED_ALPHA_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; @@ -40,7 +39,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.statehandlers.DepthController; -import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarUIController; @@ -71,37 +69,6 @@ public abstract class BaseActivityInterface Date: Fri, 2 May 2025 15:26:59 -0700 Subject: [PATCH 6/7] [Memory Leak] Fix leak of TIS from taskbar's pending intent Fix: 415321479 Flag: NONE - released code Test: manual Change-Id: I70e2201695cb3e8501315a5ae8fd86b150d57c35 --- .../launcher3/taskbar/TaskbarManagerImpl.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManagerImpl.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManagerImpl.java index cb59ec42c0..edba964794 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManagerImpl.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManagerImpl.java @@ -110,6 +110,7 @@ import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; import java.io.PrintWriter; +import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -1757,14 +1758,7 @@ public class TaskbarManagerImpl implements DisplayDecorationListener { /** Creates a {@link PendingIntent} for showing / hiding the all apps UI. */ public PendingIntent createAllAppsPendingIntent(Executor uiExecutor) { - return new PendingIntent(new IIntentSender.Stub() { - @Override - public void send(int code, Intent intent, String resolvedType, - IBinder allowlistToken, IIntentReceiver finishedReceiver, - String requiredPermission, Bundle options) { - uiExecutor.execute(TaskbarManagerImpl.this::toggleAllAppsSearch); - } - }); + return new PendingIntent(new AllAppsIntentSender(uiExecutor, this)); } /** @@ -1816,4 +1810,25 @@ public class TaskbarManagerImpl implements DisplayDecorationListener { private final DeviceProfile.OnDeviceProfileChangeListener mDebugActivityDeviceProfileChanged = dp -> debugPrimaryTaskbar("mActivity onDeviceProfileChanged", true); + /** Use weak reference to avoid leaking TIS via {@link TaskbarManagerImpl} */ + private static class AllAppsIntentSender extends IIntentSender.Stub { + + private final Executor mUiExecutor; + private final WeakReference mWeakTaskbarManager; + + AllAppsIntentSender(Executor uiExecutor, TaskbarManagerImpl taskbarManager) { + mUiExecutor = uiExecutor; + mWeakTaskbarManager = new WeakReference<>(taskbarManager); + } + + @Override + public void send(int i, Intent intent, String s, IBinder iBinder, + IIntentReceiver iIntentReceiver, String s1, Bundle bundle) { + TaskbarManagerImpl taskbarManager = mWeakTaskbarManager.get(); + if (taskbarManager == null) { + return; + } + mUiExecutor.execute(taskbarManager::toggleAllAppsSearch); + } + }; } From fc8537d5de075394e7ce607a3c997a2a66801611 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Mon, 28 Apr 2025 18:31:10 -0700 Subject: [PATCH 7/7] Creating NexusLauncherE2ETests test suite, this cl only adds the Launcher3 part The test don't run yet in presubmit, first I will have the NexusLauncherE2ETests target ready and then I will add it to the presubmit. Bug: 324261526 Flag: EXEMPT test only Test: atest NexusLauncherE2ETests Change-Id: I4daa204ec735456c481b0682ca518da381af7bb7 --- .../quickstep/AbstractQuickStepTest.java | 2 +- .../quickstep/AbstractTaplTestsTaskbar.java | 2 +- .../quickstep/FallbackRecentsTest.java | 12 ++-- .../quickstep/NavigationModeSwitchRule.java | 2 +- .../quickstep/TaplTestsLockedTaskbar.java | 2 +- .../quickstep/TaplTestsOverviewDesktop.kt | 2 +- .../android/quickstep/TaplTestsQuickstep.java | 2 +- .../android/quickstep/TaplTestsTaskbar.java | 2 +- .../android/quickstep/TaplTestsTrackpad.java | 2 +- .../quickstep/TaskbarModeSwitchRule.java | 2 +- .../quickstep/util/SplitScreenTestUtils.kt | 2 +- .../util/SplitSelectDataHolderTest.kt | 46 +++++++-------- tests/Android.bp | 12 +--- .../src/com/android/launcher3/Android.bp | 15 +++++ .../celllayout/board/TestWorkspaceBuilder.kt | 4 +- .../{ => util}/ui/TestViewHelpers.java | 2 +- .../workspace}/FavoriteItemsTransaction.java | 2 +- tests/src/com/android/launcher3/Android.bp | 59 +++++++++++++++++++ .../allapps/TaplAllAppsIconsWorkingTest.java | 4 +- .../allapps/TaplOpenCloseAllAppsTest.java | 4 +- .../{ui => allapps}/WorkProfileTest.java | 7 +-- .../appiconmenu/TaplAppIconMenuTest.java | 4 +- .../launcher3/dragging/TaplDragTest.java | 4 +- .../dragging/TaplUninstallRemoveTest.java | 4 +- .../IntegrationReorderWidgetsTest.kt | 2 +- .../DoubleShadowIconDrawableTest.kt | 8 +-- .../android/launcher3/model/LoaderTaskTest.kt | 2 +- .../launcher3/{ui => model}/ShadowInfoTest.kt | 4 +- .../launcher3/ui/TaplTestsLauncher3Test.java | 4 +- .../launcher3/util/ItemInflaterTest.kt | 2 +- .../launcher3/util/rule/FailureWatcher.java | 2 +- .../util/rule/TestIsolationRule.java | 2 +- .../{ => util}/ui/AbstractLauncherUiTest.java | 2 +- .../{ => util}/ui/BaseLauncherTaplTest.java | 4 +- .../ui/PortraitLandscapeRunner.java | 18 +++++- .../util/viewcapture_analysis/Android.bp | 10 ++++ .../{ui => }/widget/AddConfigWidgetTest.java | 11 ++-- .../{ui => }/widget/BindWidgetTest.java | 10 +--- .../{ui => }/widget/RequestPinItemTest.java | 4 +- .../{ui => }/widget/TaplAddWidgetTest.java | 11 ++-- .../picker}/WidgetPickerTest.java | 6 +- .../workspace/TaplTwoPanelWorkspaceTest.java | 8 +-- .../{ui => }/workspace/TaplWorkspaceTest.java | 4 +- .../{ui => }/workspace/ThemeIconsTest.java | 4 +- 44 files changed, 199 insertions(+), 118 deletions(-) create mode 100644 tests/multivalentTests/src/com/android/launcher3/Android.bp rename tests/multivalentTests/src/com/android/launcher3/{ => util}/ui/TestViewHelpers.java (98%) rename tests/multivalentTests/src/com/android/launcher3/{celllayout => util/workspace}/FavoriteItemsTransaction.java (98%) create mode 100644 tests/src/com/android/launcher3/Android.bp rename tests/src/com/android/launcher3/{ui => allapps}/WorkProfileTest.java (96%) rename tests/src/com/android/launcher3/{ui => model}/DoubleShadowIconDrawableTest.kt (97%) rename tests/src/com/android/launcher3/{ui => model}/ShadowInfoTest.kt (97%) rename tests/src/com/android/launcher3/{ => util}/ui/AbstractLauncherUiTest.java (99%) rename tests/src/com/android/launcher3/{ => util}/ui/BaseLauncherTaplTest.java (99%) rename tests/src/com/android/launcher3/{ => util}/ui/PortraitLandscapeRunner.java (87%) create mode 100644 tests/src/com/android/launcher3/util/viewcapture_analysis/Android.bp rename tests/src/com/android/launcher3/{ui => }/widget/AddConfigWidgetTest.java (94%) rename tests/src/com/android/launcher3/{ui => }/widget/BindWidgetTest.java (96%) rename tests/src/com/android/launcher3/{ui => }/widget/RequestPinItemTest.java (98%) rename tests/src/com/android/launcher3/{ui => }/widget/TaplAddWidgetTest.java (92%) rename tests/src/com/android/launcher3/{ui/widget => widget/picker}/WidgetPickerTest.java (93%) rename tests/src/com/android/launcher3/{ui => }/workspace/TaplTwoPanelWorkspaceTest.java (98%) rename tests/src/com/android/launcher3/{ui => }/workspace/TaplWorkspaceTest.java (98%) rename tests/src/com/android/launcher3/{ui => }/workspace/ThemeIconsTest.java (98%) diff --git a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java index 168355b1c0..86c439c1ee 100644 --- a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java +++ b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java @@ -29,10 +29,10 @@ import androidx.test.uiautomator.Until; import com.android.launcher3.LauncherState; import com.android.launcher3.tapl.LaunchedAppState; import com.android.launcher3.tapl.TestHelpers; -import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import com.android.quickstep.fallback.window.RecentsWindowFlags; import com.android.quickstep.fallback.window.RecentsWindowManager; import com.android.quickstep.views.RecentsView; diff --git a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java index 0ccc76b24e..a3a12bfba0 100644 --- a/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/AbstractTaplTestsTaskbar.java @@ -24,10 +24,10 @@ import android.content.Intent; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.Taskbar; -import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.TestUtil; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import org.junit.After; import org.junit.Assume; diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java index 6a28a974e4..c9d8860b28 100644 --- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java @@ -23,14 +23,14 @@ import static androidx.test.InstrumentationRegistry.getInstrumentation; import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS; import static com.android.launcher3.tapl.TestHelpers.getHomeIntentInPackage; import static com.android.launcher3.tapl.TestHelpers.getLauncherInMyProcess; -import static com.android.launcher3.ui.AbstractLauncherUiTest.DEFAULT_BROADCAST_TIMEOUT_SECS; -import static com.android.launcher3.ui.AbstractLauncherUiTest.resolveSystemApp; -import static com.android.launcher3.ui.AbstractLauncherUiTest.startAppFast; -import static com.android.launcher3.ui.AbstractLauncherUiTest.startTestActivity; -import static com.android.launcher3.ui.TaplTestsLauncher3Test.getAppPackageName; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.rule.ShellCommandRule.disableHeadsUpNotification; import static com.android.launcher3.util.rule.ShellCommandRule.getLauncherCommand; +import static com.android.launcher3.util.ui.AbstractLauncherUiTest.DEFAULT_BROADCAST_TIMEOUT_SECS; +import static com.android.launcher3.util.ui.AbstractLauncherUiTest.resolveSystemApp; +import static com.android.launcher3.util.ui.AbstractLauncherUiTest.startAppFast; +import static com.android.launcher3.util.ui.AbstractLauncherUiTest.startTestActivity; +import static com.android.launcher3.ui.TaplTestsLauncher3Test.getAppPackageName; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -55,7 +55,6 @@ import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.OverviewTask; import com.android.launcher3.tapl.TestHelpers; import com.android.launcher3.testcomponent.TestCommandReceiver; -import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.FailureWatcher; @@ -65,6 +64,7 @@ import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.TestIsolationRule; import com.android.launcher3.util.rule.TestStabilityRule; import com.android.launcher3.util.rule.ViewCaptureRule; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener; import com.android.quickstep.fallback.window.RecentsWindowFlags; import com.android.quickstep.fallback.window.RecentsWindowManager; diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index ef7183fc88..212f933798 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -33,10 +33,10 @@ import androidx.test.uiautomator.UiDevice; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.TestHelpers; -import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.FailureWatcher; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import com.android.systemui.shared.system.QuickStepContract; import org.junit.rules.TestRule; diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsLockedTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsLockedTaskbar.java index b2617dd803..1f0bf35f48 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsLockedTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsLockedTaskbar.java @@ -35,8 +35,8 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.tapl.HomeAllApps; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.rule.SetPropRule; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch; import com.android.window.flags.Flags; diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt index 8c02340ce0..d68a50e9e4 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt @@ -23,8 +23,8 @@ import androidx.test.uiautomator.Until import com.android.launcher3.BuildConfig import com.android.launcher3.tapl.LaunchedAppState import com.android.launcher3.tapl.OverviewTask -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape import com.android.launcher3.util.TestUtil +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape import com.google.common.truth.Truth.assertWithMessage import org.junit.Before import org.junit.Test diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 560a28c1f2..8c92f3ecda 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -47,10 +47,10 @@ import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; import com.android.launcher3.tapl.SelectModeButtons; import com.android.launcher3.tapl.Workspace; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.ScreenRecordRule; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch; import com.android.quickstep.views.RecentsView; diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java index ec245ee0f3..0d1d2bd16c 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java @@ -23,7 +23,7 @@ import static com.android.quickstep.TaplTestsTaskbar.TaskbarMode.TRANSIENT; import androidx.test.filters.LargeTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTrackpad.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTrackpad.java index 710ad6f6dc..8cb1c622df 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTrackpad.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTrackpad.java @@ -29,7 +29,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.tapl.LauncherInstrumentation.TrackpadGestureType; import com.android.launcher3.tapl.Workspace; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; import org.junit.After; diff --git a/quickstep/tests/src/com/android/quickstep/TaskbarModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/TaskbarModeSwitchRule.java index 84ceb332d9..87cda25c3c 100644 --- a/quickstep/tests/src/com/android/quickstep/TaskbarModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/TaskbarModeSwitchRule.java @@ -27,9 +27,9 @@ import android.util.Log; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.TestHelpers; -import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.rule.FailureWatcher; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import org.junit.rules.TestRule; import org.junit.runner.Description; diff --git a/quickstep/tests/src/com/android/quickstep/util/SplitScreenTestUtils.kt b/quickstep/tests/src/com/android/quickstep/util/SplitScreenTestUtils.kt index 99c74bec15..15fa84c6b1 100644 --- a/quickstep/tests/src/com/android/quickstep/util/SplitScreenTestUtils.kt +++ b/quickstep/tests/src/com/android/quickstep/util/SplitScreenTestUtils.kt @@ -20,7 +20,7 @@ import androidx.test.uiautomator.By import com.android.launcher3.tapl.LauncherInstrumentation import com.android.launcher3.tapl.Overview import com.android.launcher3.tapl.OverviewTask -import com.android.launcher3.ui.AbstractLauncherUiTest +import com.android.launcher3.util.ui.AbstractLauncherUiTest object SplitScreenTestUtils { diff --git a/quickstep/tests/src/com/android/quickstep/util/SplitSelectDataHolderTest.kt b/quickstep/tests/src/com/android/quickstep/util/SplitSelectDataHolderTest.kt index dfb48d1dca..faac190bec 100644 --- a/quickstep/tests/src/com/android/quickstep/util/SplitSelectDataHolderTest.kt +++ b/quickstep/tests/src/com/android/quickstep/util/SplitSelectDataHolderTest.kt @@ -27,8 +27,8 @@ import android.os.UserHandle import androidx.test.platform.app.InstrumentationRegistry import com.android.launcher3.model.data.ItemInfo import com.android.launcher3.shortcuts.ShortcutKey -import com.android.launcher3.ui.AbstractLauncherUiTest import com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT +import com.android.launcher3.util.ui.AbstractLauncherUiTest import com.android.quickstep.util.SplitSelectDataHolder.Companion.SPLIT_PENDINGINTENT_PENDINGINTENT import com.android.quickstep.util.SplitSelectDataHolder.Companion.SPLIT_PENDINGINTENT_TASK import com.android.quickstep.util.SplitSelectDataHolder.Companion.SPLIT_SHORTCUT_TASK @@ -85,7 +85,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, null, - null + null, ) assertTrue(splitSelectDataHolder.isSplitSelectActive()) } @@ -97,7 +97,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) assertTrue(splitSelectDataHolder.isSplitSelectActive()) } @@ -109,7 +109,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - sampleTaskId + sampleTaskId, ) assertTrue(splitSelectDataHolder.isSplitSelectActive()) } @@ -121,7 +121,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) assertTrue(splitSelectDataHolder.isSplitSelectActive()) } @@ -133,7 +133,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleTaskId, sampleItemInfo2) assertTrue(splitSelectDataHolder.isBothSplitAppsConfirmed()) @@ -145,7 +145,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, null, - null + null, ) splitSelectDataHolder.setSecondTask(sampleIntent, sampleUser, sampleItemInfo2) assertTrue(splitSelectDataHolder.isBothSplitAppsConfirmed()) @@ -158,7 +158,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleShortcut, sampleUser, sampleItemInfo2) assertTrue(splitSelectDataHolder.isBothSplitAppsConfirmed()) @@ -170,7 +170,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, - null + null, ) splitSelectDataHolder.setSecondTask(sampleTaskId2, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -194,7 +194,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, - null + null, ) splitSelectDataHolder.setSecondTask(sampleIntent, sampleUser, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -218,7 +218,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, - null + null, ) splitSelectDataHolder.setSecondTask(sampleShortcut, sampleUser, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -243,7 +243,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleTaskId, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -268,7 +268,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleTaskId, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -293,7 +293,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleIntent2, sampleUser, sampleItemInfo2) val launchData = splitSelectDataHolder.getSplitLaunchData() @@ -317,7 +317,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, - null + null, ) val launchData = splitSelectDataHolder.getFullscreenLaunchData() @@ -341,7 +341,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) val launchData = splitSelectDataHolder.getFullscreenLaunchData() @@ -365,7 +365,7 @@ class SplitSelectDataHolderTest { STAGE_POSITION_TOP_OR_LEFT, sampleItemInfo, null, - INVALID_TASK_ID + INVALID_TASK_ID, ) val launchData = splitSelectDataHolder.getFullscreenLaunchData() @@ -388,7 +388,7 @@ class SplitSelectDataHolderTest { sampleTaskInfo, STAGE_POSITION_TOP_OR_LEFT, null, - null + null, ) splitSelectDataHolder.setSecondTask(sampleIntent, sampleUser, sampleItemInfo2) splitSelectDataHolder.resetState() @@ -398,11 +398,11 @@ class SplitSelectDataHolderTest { @Test fun clearState_intent() { splitSelectDataHolder.setInitialTaskSelect( - sampleIntent, - STAGE_POSITION_TOP_OR_LEFT, - sampleItemInfo, - null, - INVALID_TASK_ID + sampleIntent, + STAGE_POSITION_TOP_OR_LEFT, + sampleItemInfo, + null, + INVALID_TASK_ID, ) splitSelectDataHolder.setSecondTask(sampleIntent, sampleUser, sampleItemInfo2) splitSelectDataHolder.resetState() diff --git a/tests/Android.bp b/tests/Android.bp index fc08e86284..e2698dab21 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -57,13 +57,7 @@ filegroup { name: "launcher-oop-tests-src", srcs: [ ":launcher-testing-helpers", - "src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java", - "src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java", - "src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java", - "src/com/android/launcher3/dragging/TaplDragTest.java", - "src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java", - "src/com/android/launcher3/ui/TaplTestsLauncher3Test.java", - "src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java", + ":launcher-oop-tests-only", ], } @@ -158,8 +152,8 @@ filegroup { "src/**/*.kt", "multivalentTests/src/**/*.java", "multivalentTests/src/**/*.kt", - "src/com/android/launcher3/ui/AbstractLauncherUiTest.java", - "src/com/android/launcher3/ui/BaseLauncherTaplTest.java", + "src/com/android/launcher3/util/ui/AbstractLauncherUiTest.java", + "src/com/android/launcher3/util/ui/BaseLauncherTaplTest.java", "tapl/com/android/launcher3/tapl/*.java", "tapl/com/android/launcher3/tapl/*.kt", ], diff --git a/tests/multivalentTests/src/com/android/launcher3/Android.bp b/tests/multivalentTests/src/com/android/launcher3/Android.bp new file mode 100644 index 0000000000..189ec96bb8 --- /dev/null +++ b/tests/multivalentTests/src/com/android/launcher3/Android.bp @@ -0,0 +1,15 @@ +filegroup { + name: "launcher-shared-tests-utils", + srcs: [ + "testcomponent/AppWidgetDynamicColors.java", + "testcomponent/AppWidgetHidden.java", + "testcomponent/AppWidgetNoConfig.java", + "testcomponent/AppWidgetWithConfig.java", + "testcomponent/TouchEventGenerator.java", + "util/ModelTestExtensions.kt", + "util/rule/TestStabilityRule.java", + "util/TestUtil.java", + "util/ui/TestViewHelpers.java", + "util/workspace/FavoriteItemsTransaction.java", + ], +} diff --git a/tests/multivalentTests/src/com/android/launcher3/celllayout/board/TestWorkspaceBuilder.kt b/tests/multivalentTests/src/com/android/launcher3/celllayout/board/TestWorkspaceBuilder.kt index 3405cae355..f58fd468eb 100644 --- a/tests/multivalentTests/src/com/android/launcher3/celllayout/board/TestWorkspaceBuilder.kt +++ b/tests/multivalentTests/src/com/android/launcher3/celllayout/board/TestWorkspaceBuilder.kt @@ -25,13 +25,13 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.platform.app.InstrumentationRegistry import com.android.launcher3.InvariantDeviceProfile import com.android.launcher3.LauncherSettings -import com.android.launcher3.celllayout.FavoriteItemsTransaction import com.android.launcher3.model.data.AppInfo import com.android.launcher3.model.data.FolderInfo import com.android.launcher3.model.data.ItemInfo import com.android.launcher3.model.data.WorkspaceItemInfo -import com.android.launcher3.ui.TestViewHelpers import com.android.launcher3.util.WidgetUtils +import com.android.launcher3.util.ui.TestViewHelpers +import com.android.launcher3.util.workspace.FavoriteItemsTransaction import java.util.function.Supplier class TestWorkspaceBuilder(private val mContext: Context) { diff --git a/tests/multivalentTests/src/com/android/launcher3/ui/TestViewHelpers.java b/tests/multivalentTests/src/com/android/launcher3/util/ui/TestViewHelpers.java similarity index 98% rename from tests/multivalentTests/src/com/android/launcher3/ui/TestViewHelpers.java rename to tests/multivalentTests/src/com/android/launcher3/util/ui/TestViewHelpers.java index 4b2bade452..c7c2cd7ef0 100644 --- a/tests/multivalentTests/src/com/android/launcher3/ui/TestViewHelpers.java +++ b/tests/multivalentTests/src/com/android/launcher3/util/ui/TestViewHelpers.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.android.launcher3.ui; +package com.android.launcher3.util.ui; import static android.os.Process.myUserHandle; diff --git a/tests/multivalentTests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java b/tests/multivalentTests/src/com/android/launcher3/util/workspace/FavoriteItemsTransaction.java similarity index 98% rename from tests/multivalentTests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java rename to tests/multivalentTests/src/com/android/launcher3/util/workspace/FavoriteItemsTransaction.java index f7723392d4..c4e0624e3a 100644 --- a/tests/multivalentTests/src/com/android/launcher3/celllayout/FavoriteItemsTransaction.java +++ b/tests/multivalentTests/src/com/android/launcher3/util/workspace/FavoriteItemsTransaction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.celllayout; +package com.android.launcher3.util.workspace; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; diff --git a/tests/src/com/android/launcher3/Android.bp b/tests/src/com/android/launcher3/Android.bp new file mode 100644 index 0000000000..f40c027ba4 --- /dev/null +++ b/tests/src/com/android/launcher3/Android.bp @@ -0,0 +1,59 @@ +// Should only contain test files, no utility classes +filegroup { + name: "launcher-e2e-tests-only", + srcs: [ + "allapps/TaplAllAppsIconsWorkingTest.java", + "allapps/TaplOpenCloseAllAppsTest.java", + "appiconmenu/TaplAppIconMenuTest.java", + "dragging/TaplDragTest.java", + "dragging/TaplUninstallRemoveTest.java", + "tapl/TaplUtilityTest.java", + "widget/TaplAddWidgetTest.java", + "ui/TaplTestsLauncher3Test.java", + "workspace/TaplTwoPanelWorkspaceTest.java", + "workspace/TaplWorkspaceTest.java", + ], +} + +filegroup { + name: "launcher-e2e-tests-utils", + srcs: [ + "testcomponent/TestCommandReceiver.java", + "util/TestConstants.java", + "util/Wait.kt", + "util/rule/FailureWatcher.java", + "util/rule/MutualExclusionRule.java", + "util/rule/SamplerRule.java", + "util/rule/ScreenRecordRule.java", + "util/rule/ShellCommandRule.java", + "util/rule/ViewCaptureRule.kt", + "util/rule/TestIsolationRule.java", + "util/ui/AbstractLauncherUiTest.java", + "util/ui/BaseLauncherTaplTest.java", + "util/ui/PortraitLandscapeRunner.java", + ], +} + +// Combination of tests and utils in the launcher3 package +filegroup { + name: "launcher-e2e-tests", + srcs: [ + ":launcher-e2e-tests-only", + ":launcher-e2e-tests-utils", + ":launcher-viewcapture-analysis", + ], +} + +// TODO(b/324261526) After the bug is completed this file group should not exists anymore +filegroup { + name: "launcher-oop-tests-only", + srcs: [ + "allapps/TaplAllAppsIconsWorkingTest.java", + "allapps/TaplOpenCloseAllAppsTest.java", + "appiconmenu/TaplAppIconMenuTest.java", + "dragging/TaplDragTest.java", + "dragging/TaplUninstallRemoveTest.java", + "ui/TaplTestsLauncher3Test.java", + "workspace/TaplWorkspaceTest.java", + ], +} diff --git a/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java b/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java index 1b2b8dcc9d..6be4850c46 100644 --- a/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java +++ b/tests/src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java @@ -24,8 +24,8 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.tapl.AppIcon; import com.android.launcher3.tapl.HomeAllApps; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java b/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java index 5274631845..4bc7138e28 100644 --- a/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java +++ b/tests/src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java @@ -31,8 +31,8 @@ import androidx.test.platform.app.InstrumentationRegistry; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.tapl.AllApps; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/allapps/WorkProfileTest.java similarity index 96% rename from tests/src/com/android/launcher3/ui/WorkProfileTest.java rename to tests/src/com/android/launcher3/allapps/WorkProfileTest.java index c191760f5d..b625e6d2cb 100644 --- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java +++ b/tests/src/com/android/launcher3/allapps/WorkProfileTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.ui; +package com.android.launcher3.allapps; import static com.android.launcher3.LauncherPrefs.WORK_EDU_STEP; import static com.android.launcher3.LauncherState.ALL_APPS; @@ -37,11 +37,6 @@ import androidx.test.filters.LargeTest; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; -import com.android.launcher3.allapps.ActivityAllAppsContainerView; -import com.android.launcher3.allapps.AllAppsPagedView; -import com.android.launcher3.allapps.WorkEduCard; -import com.android.launcher3.allapps.WorkPausedCard; -import com.android.launcher3.allapps.WorkProfileManager; import com.android.launcher3.util.BaseLauncherActivityTest; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ScreenRecordRule; diff --git a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java index bd573820dc..3a7232ca9d 100644 --- a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java +++ b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java @@ -29,8 +29,8 @@ import com.android.launcher3.tapl.AllApps; import com.android.launcher3.tapl.AppIconMenu; import com.android.launcher3.tapl.AppIconMenuItem; import com.android.launcher3.tapl.HomeAllApps; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java index bf47026760..d7ce08acd4 100644 --- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java +++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java @@ -38,10 +38,10 @@ import com.android.launcher3.tapl.HomeAllApps; import com.android.launcher3.tapl.HomeAppIcon; import com.android.launcher3.tapl.HomeAppIconMenuItem; import com.android.launcher3.tapl.Workspace; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ScreenRecordRule; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java index 459db73650..7443a9a46e 100644 --- a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java +++ b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java @@ -34,10 +34,10 @@ import com.android.launcher3.Launcher; import com.android.launcher3.tapl.HomeAllApps; import com.android.launcher3.tapl.HomeAppIcon; import com.android.launcher3.tapl.Workspace; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/integration/celllayout/IntegrationReorderWidgetsTest.kt b/tests/src/com/android/launcher3/integration/celllayout/IntegrationReorderWidgetsTest.kt index b5f4fa26a8..813225ccad 100644 --- a/tests/src/com/android/launcher3/integration/celllayout/IntegrationReorderWidgetsTest.kt +++ b/tests/src/com/android/launcher3/integration/celllayout/IntegrationReorderWidgetsTest.kt @@ -33,7 +33,6 @@ import com.android.launcher3.celllayout.CellLayoutTestCaseReader import com.android.launcher3.celllayout.CellLayoutTestCaseReader.Board import com.android.launcher3.celllayout.CellLayoutTestCaseReader.TestSection import com.android.launcher3.celllayout.CellLayoutTestUtils -import com.android.launcher3.celllayout.FavoriteItemsTransaction import com.android.launcher3.celllayout.ReorderTestCase import com.android.launcher3.celllayout.board.CellLayoutBoard import com.android.launcher3.celllayout.board.TestWorkspaceBuilder @@ -53,6 +52,7 @@ import com.android.launcher3.util.ModelTestExtensions.clearModelDb import com.android.launcher3.util.rule.ScreenRecordRule import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord import com.android.launcher3.util.rule.ShellCommandRule +import com.android.launcher3.util.workspace.FavoriteItemsTransaction import com.android.launcher3.widget.LauncherAppWidgetHostView import kotlin.math.abs import kotlin.math.roundToInt diff --git a/tests/src/com/android/launcher3/ui/DoubleShadowIconDrawableTest.kt b/tests/src/com/android/launcher3/model/DoubleShadowIconDrawableTest.kt similarity index 97% rename from tests/src/com/android/launcher3/ui/DoubleShadowIconDrawableTest.kt rename to tests/src/com/android/launcher3/model/DoubleShadowIconDrawableTest.kt index 1cee71c219..45fef14a9c 100644 --- a/tests/src/com/android/launcher3/ui/DoubleShadowIconDrawableTest.kt +++ b/tests/src/com/android/launcher3/model/DoubleShadowIconDrawableTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3.ui +package com.android.launcher3.model import android.graphics.Color import android.graphics.drawable.Drawable @@ -58,7 +58,7 @@ class DoubleShadowIconDrawableTest { keyShadowBlur = 3f, keyShadowOffsetX = 4f, keyShadowOffsetY = 5f, - keyShadowColor = 6 + keyShadowColor = 6, ) val originalDrawable: Drawable = mock() val iconSize = 2 @@ -73,14 +73,14 @@ class DoubleShadowIconDrawableTest { shadowInfo.ambientShadowBlur, 0f, 0f, - Color.alpha(shadowInfo.ambientShadowColor).toFloat() + Color.alpha(shadowInfo.ambientShadowColor).toFloat(), ) verify(shadowDrawableUnderTest) .createShadowRenderEffect( shadowInfo.keyShadowBlur, shadowInfo.keyShadowOffsetX, shadowInfo.keyShadowOffsetY, - Color.alpha(shadowInfo.keyShadowColor).toFloat() + Color.alpha(shadowInfo.keyShadowColor).toFloat(), ) } } diff --git a/tests/src/com/android/launcher3/model/LoaderTaskTest.kt b/tests/src/com/android/launcher3/model/LoaderTaskTest.kt index f8516cc04b..4bed473750 100644 --- a/tests/src/com/android/launcher3/model/LoaderTaskTest.kt +++ b/tests/src/com/android/launcher3/model/LoaderTaskTest.kt @@ -39,7 +39,6 @@ import com.android.launcher3.model.data.IconRequestInfo import com.android.launcher3.model.data.WorkspaceItemInfo import com.android.launcher3.pm.UserCache import com.android.launcher3.provider.RestoreDbTask -import com.android.launcher3.ui.TestViewHelpers import com.android.launcher3.util.AllModulesForTest import com.android.launcher3.util.Executors.MODEL_EXECUTOR import com.android.launcher3.util.LooperIdleLock @@ -47,6 +46,7 @@ import com.android.launcher3.util.ModelTestExtensions import com.android.launcher3.util.SandboxApplication import com.android.launcher3.util.TestUtil import com.android.launcher3.util.UserIconInfo +import com.android.launcher3.util.ui.TestViewHelpers import com.google.common.truth.Truth.assertThat import dagger.BindsInstance import dagger.Component diff --git a/tests/src/com/android/launcher3/ui/ShadowInfoTest.kt b/tests/src/com/android/launcher3/model/ShadowInfoTest.kt similarity index 97% rename from tests/src/com/android/launcher3/ui/ShadowInfoTest.kt rename to tests/src/com/android/launcher3/model/ShadowInfoTest.kt index ef4dc1a8e7..faa0427295 100644 --- a/tests/src/com/android/launcher3/ui/ShadowInfoTest.kt +++ b/tests/src/com/android/launcher3/model/ShadowInfoTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3.ui +package com.android.launcher3.model import android.content.Context import android.content.res.TypedArray @@ -47,7 +47,7 @@ class ShadowInfoTest { keyShadowBlur = 3f, keyShadowOffsetX = 4f, keyShadowOffsetY = 5f, - keyShadowColor = 6 + keyShadowColor = 6, ) doReturn(styledAttrs) .whenever(mockContext) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java index 46a79526ff..699224e887 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,12 @@ import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.Launcher; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import org.junit.Test; import org.junit.runner.RunWith; +// TODO(415813575) - Remove this test. @LargeTest @RunWith(AndroidJUnit4.class) public class TaplTestsLauncher3Test extends AbstractLauncherUiTest { diff --git a/tests/src/com/android/launcher3/util/ItemInflaterTest.kt b/tests/src/com/android/launcher3/util/ItemInflaterTest.kt index a1dfc538dc..4f01a21573 100644 --- a/tests/src/com/android/launcher3/util/ItemInflaterTest.kt +++ b/tests/src/com/android/launcher3/util/ItemInflaterTest.kt @@ -42,10 +42,10 @@ import com.android.launcher3.model.data.LauncherAppWidgetInfo import com.android.launcher3.model.data.LauncherAppWidgetInfo.FLAG_ID_NOT_VALID import com.android.launcher3.model.data.LauncherAppWidgetInfo.FLAG_UI_NOT_READY import com.android.launcher3.model.data.LauncherAppWidgetInfo.RESTORE_COMPLETED -import com.android.launcher3.ui.TestViewHelpers import com.android.launcher3.util.Executors.MAIN_EXECUTOR import com.android.launcher3.util.Executors.VIEW_PREINFLATION_EXECUTOR import com.android.launcher3.util.rule.ShellCommandRule +import com.android.launcher3.util.ui.TestViewHelpers import com.android.launcher3.widget.LauncherAppWidgetHostView import com.android.launcher3.widget.LauncherWidgetHolder import com.android.launcher3.widget.PendingAppWidgetHostView diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java index 3b8530984c..32d8a0def5 100644 --- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java +++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java @@ -12,7 +12,7 @@ import androidx.test.uiautomator.UiDevice; import com.android.app.viewcapture.data.ExportedData; import com.android.launcher3.tapl.LauncherInstrumentation; -import com.android.launcher3.ui.BaseLauncherTaplTest; +import com.android.launcher3.util.ui.BaseLauncherTaplTest; import org.junit.rules.TestWatcher; import org.junit.runner.Description; diff --git a/tests/src/com/android/launcher3/util/rule/TestIsolationRule.java b/tests/src/com/android/launcher3/util/rule/TestIsolationRule.java index 2b45902813..9b8ee29caf 100644 --- a/tests/src/com/android/launcher3/util/rule/TestIsolationRule.java +++ b/tests/src/com/android/launcher3/util/rule/TestIsolationRule.java @@ -20,7 +20,7 @@ import androidx.test.InstrumentationRegistry; import androidx.test.uiautomator.UiDevice; import com.android.launcher3.tapl.LauncherInstrumentation; -import com.android.launcher3.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; import org.junit.rules.TestRule; import org.junit.runner.Description; diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/util/ui/AbstractLauncherUiTest.java similarity index 99% rename from tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java rename to tests/src/com/android/launcher3/util/ui/AbstractLauncherUiTest.java index 6e46fe583a..7a8d6e788e 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/util/ui/AbstractLauncherUiTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.android.launcher3.ui; +package com.android.launcher3.util.ui; import static androidx.test.InstrumentationRegistry.getInstrumentation; diff --git a/tests/src/com/android/launcher3/ui/BaseLauncherTaplTest.java b/tests/src/com/android/launcher3/util/ui/BaseLauncherTaplTest.java similarity index 99% rename from tests/src/com/android/launcher3/ui/BaseLauncherTaplTest.java rename to tests/src/com/android/launcher3/util/ui/BaseLauncherTaplTest.java index 59800ecf6f..b743f575fb 100644 --- a/tests/src/com/android/launcher3/ui/BaseLauncherTaplTest.java +++ b/tests/src/com/android/launcher3/util/ui/BaseLauncherTaplTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3.ui; +package com.android.launcher3.util.ui; import static android.os.Process.myUserHandle; import static android.platform.test.flag.junit.SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT; @@ -51,7 +51,6 @@ import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.Until; -import com.android.launcher3.celllayout.FavoriteItemsTransaction; import com.android.launcher3.tapl.HomeAllApps; import com.android.launcher3.tapl.HomeAppIcon; import com.android.launcher3.tapl.LauncherInstrumentation; @@ -65,6 +64,7 @@ import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.TestIsolationRule; import com.android.launcher3.util.rule.TestStabilityRule; +import com.android.launcher3.util.workspace.FavoriteItemsTransaction; import org.junit.After; import org.junit.Assert; diff --git a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java b/tests/src/com/android/launcher3/util/ui/PortraitLandscapeRunner.java similarity index 87% rename from tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java rename to tests/src/com/android/launcher3/util/ui/PortraitLandscapeRunner.java index 7784c03431..e5b45b9277 100644 --- a/tests/src/com/android/launcher3/ui/PortraitLandscapeRunner.java +++ b/tests/src/com/android/launcher3/util/ui/PortraitLandscapeRunner.java @@ -1,4 +1,20 @@ -package com.android.launcher3.ui; +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.util.ui; import static com.android.launcher3.LauncherPrefs.FIXED_LANDSCAPE_MODE; diff --git a/tests/src/com/android/launcher3/util/viewcapture_analysis/Android.bp b/tests/src/com/android/launcher3/util/viewcapture_analysis/Android.bp new file mode 100644 index 0000000000..6e749e6d37 --- /dev/null +++ b/tests/src/com/android/launcher3/util/viewcapture_analysis/Android.bp @@ -0,0 +1,10 @@ +filegroup { + name: "launcher-viewcapture-analysis", + srcs: [ + "FlashDetector.java", + "AlphaJumpDetector.java", + "AnomalyDetector.java", + "PositionJumpDetector.java", + "ViewCaptureAnalyzer.java", + ], +} diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/widget/AddConfigWidgetTest.java similarity index 94% rename from tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java rename to tests/src/com/android/launcher3/widget/AddConfigWidgetTest.java index f777049f0a..cde9d80381 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java +++ b/tests/src/com/android/launcher3/widget/AddConfigWidgetTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.ui.widget; +package com.android.launcher3.widget; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; @@ -34,21 +34,18 @@ import androidx.test.filters.LargeTest; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; -import com.android.launcher3.celllayout.FavoriteItemsTransaction; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.testcomponent.WidgetConfigActivity; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; -import com.android.launcher3.ui.TestViewHelpers; import com.android.launcher3.util.BaseLauncherActivityTest; import com.android.launcher3.util.BlockingBroadcastReceiver; import com.android.launcher3.util.PackageUserKey; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.ShellCommandRule; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.TestViewHelpers; +import com.android.launcher3.util.workspace.FavoriteItemsTransaction; import com.android.launcher3.views.OptionsPopupView; -import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; -import com.android.launcher3.widget.PendingAddWidgetInfo; -import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.picker.WidgetsFullSheet; import com.android.launcher3.widget.picker.WidgetsListAdapter; import com.android.launcher3.widget.picker.WidgetsRecyclerView; diff --git a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java b/tests/src/com/android/launcher3/widget/BindWidgetTest.java similarity index 96% rename from tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java rename to tests/src/com/android/launcher3/widget/BindWidgetTest.java index d17f5a95dd..1bfd5a9a34 100644 --- a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java +++ b/tests/src/com/android/launcher3/widget/BindWidgetTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.ui.widget; +package com.android.launcher3.widget; import static com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID; import static com.android.launcher3.model.data.LauncherAppWidgetInfo.FLAG_ID_NOT_VALID; @@ -46,16 +46,12 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; -import com.android.launcher3.celllayout.FavoriteItemsTransaction; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.pm.InstallSessionHelper; -import com.android.launcher3.ui.TestViewHelpers; import com.android.launcher3.util.BaseLauncherActivityTest; import com.android.launcher3.util.rule.ShellCommandRule; -import com.android.launcher3.widget.LauncherAppWidgetHostView; -import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; -import com.android.launcher3.widget.PendingAppWidgetHostView; -import com.android.launcher3.widget.WidgetManagerHelper; +import com.android.launcher3.util.ui.TestViewHelpers; +import com.android.launcher3.util.workspace.FavoriteItemsTransaction; import org.junit.After; import org.junit.Before; diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/widget/RequestPinItemTest.java similarity index 98% rename from tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java rename to tests/src/com/android/launcher3/widget/RequestPinItemTest.java index 91ad341440..393dc56f63 100644 --- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java +++ b/tests/src/com/android/launcher3/widget/RequestPinItemTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.ui.widget; +package com.android.launcher3.widget; import static android.app.PendingIntent.FLAG_MUTABLE; import static android.app.PendingIntent.FLAG_ONE_SHOT; @@ -39,7 +39,6 @@ import androidx.test.uiautomator.BySelector; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings.Favorites; -import com.android.launcher3.celllayout.FavoriteItemsTransaction; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -53,6 +52,7 @@ import com.android.launcher3.util.LauncherBindableItemsContainer.ItemOperator; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.ShellCommandRule; +import com.android.launcher3.util.workspace.FavoriteItemsTransaction; import org.junit.Before; import org.junit.Rule; diff --git a/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java b/tests/src/com/android/launcher3/widget/TaplAddWidgetTest.java similarity index 92% rename from tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java rename to tests/src/com/android/launcher3/widget/TaplAddWidgetTest.java index fda4f7cb55..b18b6497e3 100644 --- a/tests/src/com/android/launcher3/ui/widget/TaplAddWidgetTest.java +++ b/tests/src/com/android/launcher3/widget/TaplAddWidgetTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.android.launcher3.ui.widget; +package com.android.launcher3.widget; import static org.junit.Assert.assertNotNull; @@ -24,15 +24,14 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import com.android.launcher3.Launcher; -import com.android.launcher3.celllayout.FavoriteItemsTransaction; import com.android.launcher3.tapl.Widget; import com.android.launcher3.tapl.WidgetResizeFrame; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; -import com.android.launcher3.ui.TestViewHelpers; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ShellCommandRule; -import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; +import com.android.launcher3.util.ui.TestViewHelpers; +import com.android.launcher3.util.workspace.FavoriteItemsTransaction; import org.junit.Assume; import org.junit.Rule; diff --git a/tests/src/com/android/launcher3/ui/widget/WidgetPickerTest.java b/tests/src/com/android/launcher3/widget/picker/WidgetPickerTest.java similarity index 93% rename from tests/src/com/android/launcher3/ui/widget/WidgetPickerTest.java rename to tests/src/com/android/launcher3/widget/picker/WidgetPickerTest.java index 7d9843a22f..9adc95c7bc 100644 --- a/tests/src/com/android/launcher3/ui/widget/WidgetPickerTest.java +++ b/tests/src/com/android/launcher3/widget/picker/WidgetPickerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.launcher3.ui.widget; +package com.android.launcher3.widget.picker; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -24,13 +24,11 @@ import androidx.test.filters.MediumTest; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.BaseLauncherActivityTest; import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.views.OptionsPopupView; -import com.android.launcher3.widget.picker.WidgetsFullSheet; -import com.android.launcher3.widget.picker.WidgetsRecyclerView; import org.junit.Rule; import org.junit.Test; diff --git a/tests/src/com/android/launcher3/ui/workspace/TaplTwoPanelWorkspaceTest.java b/tests/src/com/android/launcher3/workspace/TaplTwoPanelWorkspaceTest.java similarity index 98% rename from tests/src/com/android/launcher3/ui/workspace/TaplTwoPanelWorkspaceTest.java rename to tests/src/com/android/launcher3/workspace/TaplTwoPanelWorkspaceTest.java index 7081768b70..bac2e41007 100644 --- a/tests/src/com/android/launcher3/ui/workspace/TaplTwoPanelWorkspaceTest.java +++ b/tests/src/com/android/launcher3/workspace/TaplTwoPanelWorkspaceTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.launcher3.ui.workspace; +package com.android.launcher3.workspace; import static com.android.launcher3.util.TestConstants.AppNames.CHROME_APP_NAME; import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME; @@ -35,10 +35,10 @@ import com.android.launcher3.CellLayout; import com.android.launcher3.Launcher; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.tapl.Workspace; -import com.android.launcher3.ui.AbstractLauncherUiTest; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.TestUtil; +import com.android.launcher3.util.ui.AbstractLauncherUiTest; +import com.android.launcher3.util.ui.PortraitLandscapeRunner.PortraitLandscape; import org.junit.After; import org.junit.Before; @@ -372,4 +372,4 @@ public class TaplTwoPanelWorkspaceTest extends AbstractLauncherUiTest