diff options
author | Adam Cohen <adamcohen@google.com> | 2013-11-27 11:55:48 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:20 -0700 |
commit | 88eb58f2f75c42451b565876d29f23a61db983ce (patch) | |
tree | d1eabef8c12831a8ff3e541d6f670163895762fd /src | |
parent | 2a3aeaa8567480df683cedaebaa6964b9a5a1d84 (diff) | |
download | android_packages_apps_Trebuchet-88eb58f2f75c42451b565876d29f23a61db983ce.tar.gz android_packages_apps_Trebuchet-88eb58f2f75c42451b565876d29f23a61db983ce.tar.bz2 android_packages_apps_Trebuchet-88eb58f2f75c42451b565876d29f23a61db983ce.zip |
Fix binding problem with no screens (issue 11768766)
Change-Id: I0a296892d4964913f38bf6d7bd2c2b17e1e0e8e0
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 4a57c7390..516cd1f5d 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -2125,12 +2125,6 @@ public class LauncherModel extends BroadcastReceiver { } } - // If we aren't filtering on a screen, then the set of items to load is the full set of - // items given. - if (currentScreenId < 0) { - throw new RuntimeException("Unexpected screen id"); - } - // Order the set of items by their containers first, this allows use to walk through the // list sequentially, build up a list of containers that are in the specified screen, // as well as all items in those containers. @@ -2168,11 +2162,6 @@ public class LauncherModel extends BroadcastReceiver { ArrayList<LauncherAppWidgetInfo> appWidgets, ArrayList<LauncherAppWidgetInfo> currentScreenWidgets, ArrayList<LauncherAppWidgetInfo> otherScreenWidgets) { - // If we aren't filtering on a screen, then the set of items to load is the full set of - // widgets given. - if (currentScreenId < 0) { - throw new RuntimeException("Unexpected screen id"); - } for (LauncherAppWidgetInfo widget : appWidgets) { if (widget == null) continue; @@ -2191,11 +2180,6 @@ public class LauncherModel extends BroadcastReceiver { HashMap<Long, FolderInfo> folders, HashMap<Long, FolderInfo> currentScreenFolders, HashMap<Long, FolderInfo> otherScreenFolders) { - // If we aren't filtering on a screen, then the set of items to load is the full set of - // widgets given. - if (currentScreenId < 0) { - throw new RuntimeException("Unexpected screen id"); - } for (long id : folders.keySet()) { ItemInfo info = itemsIdMap.get(id); @@ -2433,13 +2417,15 @@ public class LauncherModel extends BroadcastReceiver { } final boolean isLoadingSynchronously = (synchronizeBindPage > -1); - final int currentScreen = isLoadingSynchronously ? synchronizeBindPage : + int currScreen = isLoadingSynchronously ? synchronizeBindPage : oldCallbacks.getCurrentWorkspaceScreen(); - if (currentScreen >= orderedScreenIds.size()) { - Log.w(TAG, "Invalid screen id to synchronously load"); - return; + if (currScreen >= orderedScreenIds.size()) { + // There may be no workspace screens (just hotseat items and an empty page). + currScreen = -1; } - final long currentScreenId = orderedScreenIds.get(currentScreen); + final int currentScreen = currScreen; + final long currentScreenId = + currentScreen < 0 ? -1 : orderedScreenIds.get(currentScreen); // Load all the items that are on the current page first (and in the process, unbind // all the existing workspace items before we call startBinding() below. |