diff options
author | Xin Li <delphij@google.com> | 2024-01-18 13:56:04 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2024-01-18 13:56:04 -0800 |
commit | 6810c1964607b9e75893c6af2efe82df87625653 (patch) | |
tree | 8acf8209b0a1a7899151b491f5894ad57bb88411 /src/com/android/launcher3/model/GridSizeMigrationUtil.java | |
parent | 507cccdb174d25c7d3b5f802741e50041f6e5929 (diff) | |
parent | b7a5eb9ef418c9dce6f597244d2fb5b9b491610d (diff) | |
download | Launcher3-6810c1964607b9e75893c6af2efe82df87625653.tar.gz |
Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I0708bf3c060ba84089722d0bd9480a4f4bd2b8e2
Change-Id: I31bb7f6aa8f71244f6e44903927f67e9d3a85642
Diffstat (limited to 'src/com/android/launcher3/model/GridSizeMigrationUtil.java')
-rw-r--r-- | src/com/android/launcher3/model/GridSizeMigrationUtil.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/com/android/launcher3/model/GridSizeMigrationUtil.java b/src/com/android/launcher3/model/GridSizeMigrationUtil.java index c233872cc5..efd5574519 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationUtil.java +++ b/src/com/android/launcher3/model/GridSizeMigrationUtil.java @@ -18,6 +18,9 @@ package com.android.launcher3.model; import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME; import static com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE; +import static com.android.launcher3.config.FeatureFlags.ENABLE_SMARTSPACE_REMOVAL; +import static com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget; +import static com.android.launcher3.model.LoaderTask.SMARTSPACE_ON_HOME_SCREEN; import static com.android.launcher3.provider.LauncherDbUtils.copyTable; import static com.android.launcher3.provider.LauncherDbUtils.dropTable; @@ -37,6 +40,7 @@ import android.util.Log; import androidx.annotation.NonNull; import com.android.launcher3.InvariantDeviceProfile; +import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; @@ -327,7 +331,11 @@ public class GridSizeMigrationUtil { @NonNull final List<DbEntry> sortedItemsToPlace, final boolean matchingScreenIdOnly) { 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 + final Point next = new Point(0, screenId == 0 + && (FeatureFlags.QSB_ON_FIRST_SCREEN + && (!ENABLE_SMARTSPACE_REMOVAL.get() || LauncherPrefs.getPrefs(destReader.mContext) + .getBoolean(SMARTSPACE_ON_HOME_SCREEN, true)) + && !shouldShowFirstPageWidget()) ? 1 /* smartspace */ : 0); List<DbEntry> existedEntries = destReader.mWorkspaceEntriesByScreenId.get(screenId); if (existedEntries != null) { @@ -465,6 +473,13 @@ public class GridSizeMigrationUtil { } break; } + case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR: { + int total = getFolderItemsCount(entry); + if (total != 2) { + throw new Exception("App pair contains fewer or more than 2 items"); + } + break; + } default: throw new Exception("Invalid item type"); } @@ -539,8 +554,8 @@ public class GridSizeMigrationUtil { verifyPackage(cn.getPackageName()); int widgetId = c.getInt(indexAppWidgetId); - LauncherAppWidgetProviderInfo pInfo = - widgetManagerHelper.getLauncherAppWidgetInfo(widgetId); + LauncherAppWidgetProviderInfo pInfo = widgetManagerHelper + .getLauncherAppWidgetInfo(widgetId, cn); Point spans = null; if (pInfo != null) { spans = pInfo.getMinSpans(); @@ -562,6 +577,13 @@ public class GridSizeMigrationUtil { } break; } + case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR: { + int total = getFolderItemsCount(entry); + if (total != 2) { + throw new Exception("App pair contains fewer or more than 2 items"); + } + break; + } default: throw new Exception("Invalid item type"); } @@ -679,6 +701,7 @@ public class GridSizeMigrationUtil { public String getEntryMigrationId() { switch (itemType) { case LauncherSettings.Favorites.ITEM_TYPE_FOLDER: + case LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR: return getFolderMigrationId(); case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: return mProvider; |