Merge "Don't crash if a drag recipient throws an uncaught exception"

This commit is contained in:
Christopher Tate
2011-08-16 17:03:24 -07:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 10 deletions

View File

@@ -3196,10 +3196,12 @@ void InputDispatcher::setInputWindows(const Vector<sp<InputWindowHandle> >& inpu
LOGD("Focus left window: %s", LOGD("Focus left window: %s",
mFocusedWindowHandle->name.string()); mFocusedWindowHandle->name.string());
#endif #endif
CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, if (mFocusedWindowHandle->inputChannel != NULL) {
"focus left window"); CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS,
synthesizeCancelationEventsForInputChannelLocked( "focus left window");
mFocusedWindowHandle->inputChannel, options); synthesizeCancelationEventsForInputChannelLocked(
mFocusedWindowHandle->inputChannel, options);
}
} }
if (newFocusedWindowHandle != NULL) { if (newFocusedWindowHandle != NULL) {
#if DEBUG_FOCUS #if DEBUG_FOCUS
@@ -3216,10 +3218,12 @@ void InputDispatcher::setInputWindows(const Vector<sp<InputWindowHandle> >& inpu
#if DEBUG_FOCUS #if DEBUG_FOCUS
LOGD("Touched window was removed: %s", touchedWindow.windowHandle->name.string()); LOGD("Touched window was removed: %s", touchedWindow.windowHandle->name.string());
#endif #endif
CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, if (touchedWindow.windowHandle->inputChannel != NULL) {
"touched window was removed"); CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS,
synthesizeCancelationEventsForInputChannelLocked( "touched window was removed");
touchedWindow.windowHandle->inputChannel, options); synthesizeCancelationEventsForInputChannelLocked(
touchedWindow.windowHandle->inputChannel, options);
}
mTouchState.windows.removeAt(i--); mTouchState.windows.removeAt(i--);
} }
} }

View File

@@ -6573,8 +6573,10 @@ public class WindowManagerService extends IWindowManager.Stub
} }
synchronized (mWindowMap) { synchronized (mWindowMap) {
// !!! TODO: ANR the drag-receiving app // !!! TODO: ANR the drag-receiving app
mDragState.mDragResult = false; if (mDragState != null) {
mDragState.endDragLw(); mDragState.mDragResult = false;
mDragState.endDragLw();
}
} }
break; break;
} }