diff options
author | Dan Sandler <dsandler@android.com> | 2013-12-11 15:03:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-12-11 15:03:02 +0000 |
commit | a40916d534da1b3e05c905b5beb931e0140a353f (patch) | |
tree | 872d755d0c9303e6d322ed115d7cbde863da4430 /src/com/android | |
parent | 1f60653abcc349127014e4f32232261dfc28b309 (diff) | |
parent | 295ae18d0fa7c102c50cf95a2ea09e7f2e9b1539 (diff) | |
download | android_packages_apps_Trebuchet-a40916d534da1b3e05c905b5beb931e0140a353f.tar.gz android_packages_apps_Trebuchet-a40916d534da1b3e05c905b5beb931e0140a353f.tar.bz2 android_packages_apps_Trebuchet-a40916d534da1b3e05c905b5beb931e0140a353f.zip |
Merge "Size hotseat data structure appropriately." into jb-ub-now-kermit
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 13 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 24 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 9aaee5aaf..318066b56 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -4576,13 +4576,22 @@ public class Launcher extends Activity } public static void addDumpLog(String tag, String log, boolean debugLog) { + addDumpLog(tag, log, null, debugLog); + } + + public static void addDumpLog(String tag, String log, Exception e, boolean debugLog) { if (debugLog) { - Log.d(tag, log); + if (e != null) { + Log.d(tag, log, e); + } else { + Log.d(tag, log); + } } if (DEBUG_DUMP_LOG) { sDateStamp.setTime(System.currentTimeMillis()); synchronized (sDumpLogs) { - sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log); + sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log + + (e == null ? "" : (", Exception: " + e))); } } } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 03511a4a6..cb2d23b5f 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -1544,8 +1544,8 @@ public class LauncherModel extends BroadcastReceiver { AtomicBoolean deleteOnItemOverlap) { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); - int countX = (int) grid.numColumns; - int countY = (int) grid.numRows; + final int countX = (int) grid.numColumns; + final int countY = (int) grid.numRows; long containerIndex = item.screenId; if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { @@ -1553,21 +1553,29 @@ public class LauncherModel extends BroadcastReceiver { if (mCallbacks == null || mCallbacks.get().isAllAppsButtonRank((int) item.screenId)) { deleteOnItemOverlap.set(true); + Log.e(TAG, "Error loading shortcut into hotseat " + item + + " into position (" + item.screenId + ":" + item.cellX + "," + + item.cellY + ") occupied by all apps"); return false; } - if (occupied.containsKey(LauncherSettings.Favorites.CONTAINER_HOTSEAT)) { - if (occupied.get(LauncherSettings.Favorites.CONTAINER_HOTSEAT) - [(int) item.screenId][0] != null) { + final ItemInfo[][] hotseatItems = + occupied.get((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT); + + if (hotseatItems != null) { + if (hotseatItems[(int) item.screenId][0] != null) { Log.e(TAG, "Error loading shortcut into hotseat " + item + " into position (" + item.screenId + ":" + item.cellX + "," + item.cellY + ") occupied by " + occupied.get(LauncherSettings.Favorites.CONTAINER_HOTSEAT) [(int) item.screenId][0]); return false; + } else { + hotseatItems[(int) item.screenId][0] = item; + return true; } } else { - ItemInfo[][] items = new ItemInfo[countX + 1][countY + 1]; + final ItemInfo[][] items = new ItemInfo[(int) grid.numHotseatIcons + 1][1]; items[(int) item.screenId][0] = item; occupied.put((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT, items); return true; @@ -1582,7 +1590,7 @@ public class LauncherModel extends BroadcastReceiver { occupied.put(item.screenId, items); } - ItemInfo[][] screens = occupied.get(item.screenId); + final ItemInfo[][] screens = occupied.get(item.screenId); // Check if any workspace icons overlap with each other for (int x = item.cellX; x < (item.cellX+item.spanX); x++) { for (int y = item.cellY; y < (item.cellY+item.spanY); y++) { @@ -1913,7 +1921,7 @@ public class LauncherModel extends BroadcastReceiver { break; } } catch (Exception e) { - Launcher.addDumpLog(TAG, "Desktop items loading interrupted: " + e, true); + Launcher.addDumpLog(TAG, "Desktop items loading interrupted", e, true); } } } finally { |