Merge "Deleting workspace items from db which have an invalid placement" into ub-now-queens
This commit is contained in:
@@ -1721,8 +1721,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
// 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 @@ public class LauncherModel extends BroadcastReceiver
|
||||
// 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 @@ public class LauncherModel extends BroadcastReceiver
|
||||
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 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
// 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 @@ public class LauncherModel extends BroadcastReceiver
|
||||
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 @@ public class LauncherModel extends BroadcastReceiver
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user