summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2014-01-13 14:30:14 -0500
committerDan Sandler <dsandler@android.com>2014-01-14 11:12:38 -0500
commite26d09484575f9b1855e5bc42d4fa05a5342f054 (patch)
tree3ab2be5c34286bcf11244a5163601509140241e2
parentc83d136ce4a7bde768cbea4d4b263ab6e4eaa9f1 (diff)
downloadandroid_packages_apps_Trebuchet-e26d09484575f9b1855e5bc42d4fa05a5342f054.tar.gz
android_packages_apps_Trebuchet-e26d09484575f9b1855e5bc42d4fa05a5342f054.tar.bz2
android_packages_apps_Trebuchet-e26d09484575f9b1855e5bc42d4fa05a5342f054.zip
Fix longpress crash.
The AllApps button doesn't usually accept longpresses, but you can trick it into trying by holding one finger on it and another on another icon in the hotseat. This patch defends against that and bails out if the longpressed item has the all apps rank (position in hotseat). Bug: 11740833 Change-Id: I99785ccbc9e6dc6be2a9e56289b3cc0275fbb65c
-rw-r--r--src/com/android/launcher3/Launcher.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 765fca499..aadcd8799 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2781,7 +2781,8 @@ public class Launcher extends Activity
// The hotseat touch handling does not go through Workspace, and we always allow long press
// on hotseat items.
final View itemUnderLongClick = longClickCellInfo.cell;
- boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress();
+ final boolean inHotseat = isHotseatLayout(v);
+ boolean allowLongPress = inHotseat || mWorkspace.allowLongPress();
if (allowLongPress && !mDragController.isDragging()) {
if (itemUnderLongClick == null) {
// User long pressed on empty space
@@ -2794,7 +2795,11 @@ public class Launcher extends Activity
mWorkspace.enterOverviewMode();
}
} else {
- if (!(itemUnderLongClick instanceof Folder)) {
+ final boolean isAllAppsButton = inHotseat && isAllAppsButtonRank(
+ mHotseat.getOrderInHotseat(
+ longClickCellInfo.cellX,
+ longClickCellInfo.cellY));
+ if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
// User long pressed on an item
mWorkspace.startDrag(longClickCellInfo);
}