From 3486b9696d81da8873ef595daa35b2d39fc83146 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Mon, 27 Aug 2012 11:31:24 -0700 Subject: Fix drag bug. Previous assumption -- that the drag window was defined at time of DragState construction -- was false. The window, and hence the Display, is not known until performDrag. This change delays assigning DragState.mDisplayContent until the window/Display is known. Fixes bug 7028203. Change-Id: I5799005652c484ff0c45ab340ce3b9e4b784883e --- services/java/com/android/server/wm/DragState.java | 12 +++++------- services/java/com/android/server/wm/Session.java | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'services/java') diff --git a/services/java/com/android/server/wm/DragState.java b/services/java/com/android/server/wm/DragState.java index 26ea7c1c9f5e..3fcf6808c5df 100644 --- a/services/java/com/android/server/wm/DragState.java +++ b/services/java/com/android/server/wm/DragState.java @@ -71,12 +71,6 @@ class DragState { mFlags = flags; mLocalWin = localWin; mNotifiedWindows = new ArrayList(); - WindowState win = service.mWindowMap.get(token); - if (win != null) { - mDisplayContent = win.mDisplayContent; - } else { - Slog.e(WindowManagerService.TAG, "No window associated with token"); - } } void reset() { @@ -92,7 +86,11 @@ class DragState { mNotifiedWindows = null; } - void register() { + /** + * @param displayContent The display parameters associated with the window being dragged. + */ + void register(DisplayContent displayContent) { + mDisplayContent = displayContent; if (WindowManagerService.DEBUG_DRAG) Slog.d(WindowManagerService.TAG, "registering drag input channel"); if (mClientChannel != null) { Slog.e(WindowManagerService.TAG, "Duplicate register of drag input channel"); diff --git a/services/java/com/android/server/wm/Session.java b/services/java/com/android/server/wm/Session.java index d44b1701b54d..1ffbecc507cd 100644 --- a/services/java/com/android/server/wm/Session.java +++ b/services/java/com/android/server/wm/Session.java @@ -280,7 +280,7 @@ final class Session extends IWindowSession.Stub // !!! FIXME: put all this heavy stuff onto the mH looper, as well as // the actual drag event dispatch stuff in the dragstate - mService.mDragState.register(); + mService.mDragState.register(callingWin.mDisplayContent); mService.mInputMonitor.updateInputWindowsLw(true /*force*/); if (!mService.mInputManager.transferTouchFocus(callingWin.mInputChannel, mService.mDragState.mServerChannel)) { -- cgit v1.2.3-59-g8ed1b