From 01732bb37a09f4d2146185ab3f61fa248283b97d Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 17 Nov 2021 15:22:34 -0800 Subject: [PATCH] Use IMM#invalidateInput() in EditText#setText() With this CL, EditText#setText() actually starts using InputMethodManger#invalidateInput(), which does not block the UI thread. See the previous CL [1] about how that API actually works. There should be no observable changes from the viewpoing of IMEs. [1]: I3161755779080f98bcef0e47dd0c5247d8a3a256 Bug: 203086369 Test: atest CtsInputMethodTestCases:EditTextImeSupportTest Change-Id: I8d2e0be22454b106ded15c78c876b55dc6e60a13 --- core/java/android/widget/Editor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 62585c1a40d18..a8bf50e76a653 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -1848,7 +1848,7 @@ public class Editor { if (mHasPendingRestartInputForSetText) { final InputMethodManager imm = getInputMethodManager(); if (imm != null) { - imm.restartInput(mTextView); + imm.invalidateInput(mTextView); } mHasPendingRestartInputForSetText = false; }