Merge "Deleting workspace items from db which have an invalid placement" into ub-now-queens
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 17670d2..b04fc3f 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1721,8 +1721,7 @@
}
// check & update map of what's occupied; used to discard overlapping/invalid items
- private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item,
- AtomicBoolean deleteOnInvalidPlacement) {
+ private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
final int countX = (int) grid.numColumns;
@@ -1733,7 +1732,6 @@
// Return early if we detect that an item is under the hotseat button
if (mCallbacks == null ||
mCallbacks.get().isAllAppsButtonRank((int) item.screenId)) {
- deleteOnInvalidPlacement.set(true);
Log.e(TAG, "Error loading shortcut into hotseat " + item
+ " into position (" + item.screenId + ":" + item.cellX + ","
+ item.cellY + ") occupied by all apps");
@@ -1930,7 +1928,6 @@
UserHandleCompat user;
while (!mStopped && c.moveToNext()) {
- AtomicBoolean deleteOnInvalidPlacement = new AtomicBoolean(false);
try {
int itemType = c.getInt(itemTypeIndex);
boolean restored = 0 != c.getInt(restoredIndex);
@@ -2108,11 +2105,8 @@
}
// check & update map of what's occupied
- deleteOnInvalidPlacement.set(false);
- if (!checkItemPlacement(occupied, info, deleteOnInvalidPlacement)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, info)) {
+ itemsToRemove.add(id);
break;
}
@@ -2153,12 +2147,8 @@
folderInfo.spanY = 1;
// check & update map of what's occupied
- deleteOnInvalidPlacement.set(false);
- if (!checkItemPlacement(occupied, folderInfo,
- deleteOnInvalidPlacement)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, folderInfo)) {
+ itemsToRemove.add(id);
break;
}
@@ -2266,12 +2256,8 @@
appWidgetInfo.container = c.getInt(containerIndex);
// check & update map of what's occupied
- deleteOnInvalidPlacement.set(false);
- if (!checkItemPlacement(occupied, appWidgetInfo,
- deleteOnInvalidPlacement)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, appWidgetInfo)) {
+ itemsToRemove.add(id);
break;
}