Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,21 @@ public InputConnection getLastInputConnection() {
return lastInputConnection;
}

/**
* Clears a platform view text input client if it is the current input target.
*
* This is called when a platform view is disposed to make sure we're not hanging to a stale input
* connection.
*/
public void clearPlatformViewClient(int platformViewId) {
if (inputTarget.type == InputTarget.Type.PLATFORM_VIEW && inputTarget.id == platformViewId) {
inputTarget = new InputTarget(InputTarget.Type.NO_TARGET, 0);
hideTextInput(mView);
mImm.restartInput(mView);
mRestartInputPending = false;
}
}

private void showTextInput(View view) {
view.requestFocus();
mImm.showSoftInput(view, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ public void disposePlatformView(int viewId) {
+ viewId);
}

contextToPlatformView.remove(vdController.getView().getContext());
if (textInputPlugin != null) {
textInputPlugin.clearPlatformViewClient(viewId);
}

contextToPlatformView.remove(vdController.getView().getContext());
vdController.dispose();
vdControllers.remove(viewId);
}
Expand Down