summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2012-03-26 15:57:31 +0200
committerDanny Baumann <dannybaumann@web.de>2012-03-26 16:36:24 +0200
commit93ca6aca74c6224df945c26498e34c618e695e53 (patch)
tree8d0221420a0d93578da958f1ac6219f811ccfe39
parent30d805950f2daac1c6bb5419542a797d75a601fe (diff)
downloadframeworks_base-93ca6aca74c6224df945c26498e34c618e695e53.zip
frameworks_base-93ca6aca74c6224df945c26498e34c618e695e53.tar.gz
frameworks_base-93ca6aca74c6224df945c26498e34c618e695e53.tar.bz2
Sanity check item for being non-null.
This normally shouldn't happen, but experience has shown that there are some rare corner cases where it indeed happens. The exact conditions are unclear, but it's likely related to an ACTION_CANCEL event being sent out before the ACTION_UP event. In order to not crash in weird, hard-to-debug corner cases, just check whether we actually have an item to process. This fixes http://code.google.com/p/cyanogenmod/issues/detail?id=4985.
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ItemTouchDispatcher.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ItemTouchDispatcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/ItemTouchDispatcher.java
index ad8bc1d..ab487ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ItemTouchDispatcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ItemTouchDispatcher.java
@@ -47,14 +47,16 @@ public class ItemTouchDispatcher {
minDistance + " vX " + vX + " vY " + vY);
}
- if (distance > minDistance && Math.abs(vX) > Math.abs(vY)) {
- mItem.finishSwipe(vX > 0);
- result = true;
- } else {
- mItem.stopSwipe();
+ if (mItem != null) {
+ if (distance > minDistance && Math.abs(vX) > Math.abs(vY)) {
+ mItem.finishSwipe(vX > 0);
+ result = true;
+ } else {
+ mItem.stopSwipe();
+ }
+ mItem = null;
}
- mItem = null;
return result;
}
});