From e26d09484575f9b1855e5bc42d4fa05a5342f054 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Mon, 13 Jan 2014 14:30:14 -0500 Subject: [PATCH] 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 --- src/com/android/launcher3/Launcher.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 765fca4993..aadcd8799b 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); }