From ef70a07753b4ac2bc0e9315cf46452f8df1ced3c Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Fri, 22 Oct 2010 19:10:34 -0700 Subject: Fix error recovery when a drag can't be started Also make sure to properly dispose *both* ends of the drag input channel when we're done. That was being tidied up after, but was also making the system work harder and was provoking a bit of debug logging. Change-Id: I1ff3100bc4c441f1609c57242864d5744ff1aaa2 --- services/java/com/android/server/WindowManagerService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'services') diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 7258729..9bc24d2 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -552,6 +552,7 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.unregisterInputChannel(mServerChannel); InputQueue.unregisterInputChannel(mClientChannel); mClientChannel.dispose(); + mServerChannel.dispose(); mClientChannel = null; mServerChannel = null; } @@ -624,7 +625,7 @@ public class WindowManagerService extends IWindowManager.Stub } } if (DEBUG_DRAG) { - Slog.d(TAG, "sending DRAG_STARTED to new window " + newWin); + Slog.d(TAG, "need to send DRAG_STARTED to new window " + newWin); } sendDragStartedLw(newWin, mCurrentX, mCurrentY, mDataDescription); } @@ -6242,8 +6243,14 @@ public class WindowManagerService extends IWindowManager.Stub mDragState.register(); mInputMonitor.updateInputWindowsLw(); - mInputManager.transferTouchFocus(callingWin.mInputChannel, - mDragState.mServerChannel); + if (!mInputManager.transferTouchFocus(callingWin.mInputChannel, + mDragState.mServerChannel)) { + Slog.e(TAG, "Unable to transfer touch focus"); + mDragState.unregister(); + mDragState = null; + mInputMonitor.updateInputWindowsLw(); + return false; + } mDragState.mData = data; mDragState.mCurrentX = touchX; -- cgit v1.1