Skip to content

Commit 3486b96

Browse files
author
Craig Mautner
committed
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
1 parent 71d7c3c commit 3486b96

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

services/java/com/android/server/wm/DragState.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ class DragState {
7171
mFlags = flags;
7272
mLocalWin = localWin;
7373
mNotifiedWindows = new ArrayList<WindowState>();
74-
WindowState win = service.mWindowMap.get(token);
75-
if (win != null) {
76-
mDisplayContent = win.mDisplayContent;
77-
} else {
78-
Slog.e(WindowManagerService.TAG, "No window associated with token");
79-
}
8074
}
8175

8276
void reset() {
@@ -92,7 +86,11 @@ void reset() {
9286
mNotifiedWindows = null;
9387
}
9488

95-
void register() {
89+
/**
90+
* @param displayContent The display parameters associated with the window being dragged.
91+
*/
92+
void register(DisplayContent displayContent) {
93+
mDisplayContent = displayContent;
9694
if (WindowManagerService.DEBUG_DRAG) Slog.d(WindowManagerService.TAG, "registering drag input channel");
9795
if (mClientChannel != null) {
9896
Slog.e(WindowManagerService.TAG, "Duplicate register of drag input channel");

services/java/com/android/server/wm/Session.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public boolean performDrag(IWindow window, IBinder dragToken,
280280
// !!! FIXME: put all this heavy stuff onto the mH looper, as well as
281281
// the actual drag event dispatch stuff in the dragstate
282282

283-
mService.mDragState.register();
283+
mService.mDragState.register(callingWin.mDisplayContent);
284284
mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
285285
if (!mService.mInputManager.transferTouchFocus(callingWin.mInputChannel,
286286
mService.mDragState.mServerChannel)) {

0 commit comments

Comments
 (0)