From dc5ca62c0d6dffd88d2f8de0aa8f9d27d2de31a3 Mon Sep 17 00:00:00 2001 From: chaviw Date: Fri, 28 Jun 2019 15:04:32 -0700 Subject: [PATCH] Call syncInputWindows after calling transferTouchFocus Since transferTouchFocus is invoked through SurfaceFlinger in a transaction, it may not send the request to InputDispatcher until after the input channel is removed. This was happening when the window was getting removed right after the drag was started, causing the transferTouchFocus to fail. By calling syncInputWindows, it ensures that the transferTouchFocus is sent to InputDispatcher before the channel could be destroyed. Fixes: 133472746 Test: Steps in bug Change-Id: I01d5e18a3fdddd8a1cc571e5df8101eec368838f --- services/core/java/com/android/server/wm/DragState.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java index 6127303141f41..553b0ffa6999c 100644 --- a/services/core/java/com/android/server/wm/DragState.java +++ b/services/core/java/com/android/server/wm/DragState.java @@ -176,6 +176,8 @@ class DragState { mTransaction.transferTouchFocus(mTransferTouchFromToken, h.token); mTransferTouchFromToken = null; + // syncInputWindows here to ensure the input channel isn't removed before the transfer. + mTransaction.syncInputWindows(); mTransaction.apply(); }