Call onInputConnectionClosed synchronously
This ensures that, when switching focus from one view to another, HandwritingInitiator will receive the onInputConnectionClosed callback for the first view before receiving the onInputConnectionCreated for the second view. Bug: 275598091 Test: atest android.view.inputmethod.cts.StylusHandwritingTest Change-Id: Ifafb9c3adbdd32a307de1ea65cc2d7384f4d8a71
This commit is contained in:
@@ -405,21 +405,15 @@ final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub {
|
||||
}
|
||||
if (handler.getLooper().isCurrentThread()) {
|
||||
servedView.onInputConnectionClosedInternal();
|
||||
final ViewRootImpl viewRoot = servedView.getViewRootImpl();
|
||||
if (viewRoot != null) {
|
||||
viewRoot.getHandwritingInitiator().onInputConnectionClosed(servedView);
|
||||
}
|
||||
} else {
|
||||
handler.post(servedView::onInputConnectionClosedInternal);
|
||||
handler.post(() -> {
|
||||
final ViewRootImpl viewRoot = servedView.getViewRootImpl();
|
||||
if (viewRoot != null) {
|
||||
viewRoot.getHandwritingInitiator()
|
||||
.onInputConnectionClosed(servedView);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
final ViewRootImpl viewRoot = servedView.getViewRootImpl();
|
||||
if (viewRoot != null) {
|
||||
viewRoot.getHandwritingInitiator().onInputConnectionClosed(servedView);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user