summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-10-16 19:18:37 (GMT)
committerDanesh M <daneshm90@gmail.com>2015-09-27 22:59:56 (GMT)
commit60d6078af498127f64d28b6b0412bde40b0d8853 (patch)
tree2323143e478e8bb86617a65c6fff3f44c4f000f0
parentdc81d701ac61384ab2ab9226cd546475e992368e (diff)
downloadandroid_packages_apps_Trebuchet-60d6078af498127f64d28b6b0412bde40b0d8853.zip
android_packages_apps_Trebuchet-60d6078af498127f64d28b6b0412bde40b0d8853.tar.gz
android_packages_apps_Trebuchet-60d6078af498127f64d28b6b0412bde40b0d8853.tar.bz2
Deleting workspace items from db which have an invalid placement
Change-Id: I1d616e8cd533acd6ecd334d85e6468163f31f6a4
-rw-r--r--src/com/android/launcher3/LauncherModel.java28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 76edb56..7f7dbc9 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1826,7 +1826,6 @@ 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,
boolean shouldResizeAndUpdateDB) {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
@@ -1838,7 +1837,6 @@ public class LauncherModel extends BroadcastReceiver
// Return early if we detect that an item is under the hotseat button
if (mCallbacks == null || mCallbacks.get() == 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");
@@ -1904,7 +1902,6 @@ public class LauncherModel extends BroadcastReceiver
} else {
// see if widget can be shrunk to fit a screen, if not, just remove it
if (item.minSpanX > countX || item.minSpanY > countY) {
- deleteOnInvalidPlacement.set(true);
return false;
}
// if the widget is larger than the grid, shrink it down
@@ -2136,7 +2133,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);
@@ -2321,12 +2317,8 @@ public class LauncherModel extends BroadcastReceiver
}
// check & update map of what's occupied
- deleteOnInvalidPlacement.set(false);
- if (!checkItemPlacement(occupied, info,
- deleteOnInvalidPlacement, shouldResize)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, info, shouldResize)) {
+ itemsToRemove.add(id);
break;
}
@@ -2368,12 +2360,8 @@ public class LauncherModel extends BroadcastReceiver
folderInfo.hidden = c.getInt(hiddenIndex) > 0;
// check & update map of what's occupied
- deleteOnInvalidPlacement.set(false);
- if (!checkItemPlacement(occupied, folderInfo,
- deleteOnInvalidPlacement, shouldResize)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, folderInfo, shouldResize)) {
+ itemsToRemove.add(id);
break;
}
@@ -2481,12 +2469,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, shouldResize)) {
- if (deleteOnInvalidPlacement.get()) {
- itemsToRemove.add(id);
- }
+ if (!checkItemPlacement(occupied, appWidgetInfo, shouldResize)) {
+ itemsToRemove.add(id);
break;
}