From bc423039676ed9d5255151489e27a054e8ed6899 Mon Sep 17 00:00:00 2001 From: Stefan Li Date: Fri, 12 Nov 2010 15:53:41 +0100 Subject: Fix for a Launcher crash. A forced close will occur in Launcher homescreen if you are holding the edge portion of the touch screen and slide close or open the touch screen. This is caused by the display changing configurations but the touch events are passed through the framework. So the coordinates will be wrong which causes a out of bounds exception. Added a bounds check for the pointer index on ACTION_UP. Change-Id: I67d7e428f55694969d43948c37b6acda2a5c6eb6 --- src/com/android/launcher2/Workspace.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index c337c3078..cba1a3bd7 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -732,10 +732,12 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag getLocationOnScreen(mTempCell); // Send a tap to the wallpaper if the last down was on empty space final int pointerIndex = ev.findPointerIndex(mActivePointerId); - mWallpaperManager.sendWallpaperCommand(getWindowToken(), - "android.wallpaper.tap", - mTempCell[0] + (int) ev.getX(pointerIndex), - mTempCell[1] + (int) ev.getY(pointerIndex), 0, null); + if (pointerIndex >= 0) { + mWallpaperManager.sendWallpaperCommand(getWindowToken(), + "android.wallpaper.tap", + mTempCell[0] + (int) ev.getX(pointerIndex), + mTempCell[1] + (int) ev.getY(pointerIndex), 0, null); + } } } -- cgit v1.2.3