Skip to content

Commit 05e9c65

Browse files
author
Christopher Tate
committed
Don't inappropriately kill ANRing drop recipients
If an app takes the 5-second ANR timeout before responding to a drop, but then recovers, we were inappropriately throwing an exception back at it for having acknowledged the drop after we'd abandoned the operation out from under it. Now we let such responses slide without taking any punitive action: the app is still okay, and the drag/drop operation was cleanly terminated already anyway. Bug 5045618 Change-Id: I0b7e76c61f0f8c97e41280b542a470a7d3c8d86f
1 parent ee00c05 commit 05e9c65

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,15 @@ public void reportDropResult(IWindow window, boolean consumed) {
306306
synchronized (mService.mWindowMap) {
307307
long ident = Binder.clearCallingIdentity();
308308
try {
309-
if (mService.mDragState == null || mService.mDragState.mToken != token) {
309+
if (mService.mDragState == null) {
310+
// Most likely the drop recipient ANRed and we ended the drag
311+
// out from under it. Log the issue and move on.
312+
Slog.w(WindowManagerService.TAG, "Drop result given but no drag in progress");
313+
return;
314+
}
315+
316+
if (mService.mDragState.mToken != token) {
317+
// We're in a drag, but the wrong window has responded.
310318
Slog.w(WindowManagerService.TAG, "Invalid drop-result claim by " + window);
311319
throw new IllegalStateException("reportDropResult() by non-recipient");
312320
}

0 commit comments

Comments
 (0)