diff options
author | cretin45 <cretin45@gmail.com> | 2016-01-13 14:20:31 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-01-13 14:21:05 -0800 |
commit | 5b044565f7e509069b5bdff4e71fd11281dc171f (patch) | |
tree | c775f1bcd90564e04f4360d678032f8c99cd3654 /src/com/android/launcher3 | |
parent | 4eaa0a55f486892baa328d2d7bedf9a486e34043 (diff) | |
download | android_packages_apps_Trebuchet-5b044565f7e509069b5bdff4e71fd11281dc171f.tar.gz android_packages_apps_Trebuchet-5b044565f7e509069b5bdff4e71fd11281dc171f.tar.bz2 android_packages_apps_Trebuchet-5b044565f7e509069b5bdff4e71fd11281dc171f.zip |
Trebuchet: Fix some monkey test race condition bugs
Issue-id: CYNGNOS-1587
Change-Id: I45ead8cfbd7fab3a9ae62f878a160a696c411e75
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 32 | ||||
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 15 |
2 files changed, 28 insertions, 19 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 36fab7c62..e140e2fab 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -658,27 +658,27 @@ public class LauncherModel extends BroadcastReceiver modelShortcut.spanX == shortcut.spanX && modelShortcut.spanY == shortcut.spanY && ((modelShortcut.dropPos == null && shortcut.dropPos == null) || - (modelShortcut.dropPos != null && - shortcut.dropPos != null && - modelShortcut.dropPos[0] == shortcut.dropPos[0] && - modelShortcut.dropPos[1] == shortcut.dropPos[1]))) { + (modelShortcut.dropPos != null && + shortcut.dropPos != null && + modelShortcut.dropPos[0] == shortcut.dropPos[0] && + modelShortcut.dropPos[1] == shortcut.dropPos[1]))) { // For all intents and purposes, this is the same object return; } - } - // the modelItem needs to match up perfectly with item if our model is - // to be consistent with the database-- for now, just require - // modelItem == item or the equality check above - String msg = "item: " + ((item != null) ? item.toString() : "null") + - "modelItem: " + - ((modelItem != null) ? modelItem.toString() : "null") + - "Error: ItemInfo passed to checkItemInfo doesn't match original"; - RuntimeException e = new RuntimeException(msg); - if (stackTrace != null) { - e.setStackTrace(stackTrace); + // the modelItem needs to match up perfectly with item if our model is + // to be consistent with the database-- for now, just require + // modelItem == item or the equality check above + String msg = "item: " + ((item != null) ? item.toString() : "null") + + "modelItem: " + + ((modelItem != null) ? modelItem.toString() : "null") + + "Error: ItemInfo passed to checkItemInfo doesn't match original"; + RuntimeException e = new RuntimeException(msg); + if (stackTrace != null) { + e.setStackTrace(stackTrace); + } + throw e; } - throw e; } } diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 05f0a0553..786822c49 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1238,15 +1238,24 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc public void addFocusables(ArrayList<View> views, int direction, int focusableMode) { // XXX-RTL: This will be fixed in a future CL if (mCurrentPage >= 0 && mCurrentPage < getPageCount()) { - getPageAt(mCurrentPage).addFocusables(views, direction, focusableMode); + View page = getPageAt(mCurrentPage); + if (page != null) { + page.addFocusables(views, direction, focusableMode); + } } if (direction == View.FOCUS_LEFT) { if (mCurrentPage > 0) { - getPageAt(mCurrentPage - 1).addFocusables(views, direction, focusableMode); + View page = getPageAt(mCurrentPage - 1); + if (page != null) { + page.addFocusables(views, direction, focusableMode); + } } } else if (direction == View.FOCUS_RIGHT){ if (mCurrentPage < getPageCount() - 1) { - getPageAt(mCurrentPage + 1).addFocusables(views, direction, focusableMode); + View page = getPageAt(mCurrentPage + 1); + if (page != null) { + page.addFocusables(views, direction, focusableMode); + } } } } |