Also call IMM#checkFocus() in IMM#hideSoftInputFromView()
This is a follow up CL to our previous CLs [1][2], which introduced @hide InputMethodManager#hideSoftInputFromView() to convert the following boilerplate code we used to see in the Framework code var imm = view.getSystemService(InputMethodManager.class); if (imm != null && imm.isActive(view)) { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } into the following code. imm.hideSoftInputFromView(view, 0); In Bug 332912075, we however noticed that certain apps had already relied on IMM#checkFocus(), which is internally called in isActive(), and our CL [1] broke such apps. To make such apps work again, this CL introduces IMM#checkFocus() into IMM#hideSoftInputFromView() as we do so everywhere. There could be other approaches, but how now being consistent with other methods probably would be the best way to avoid confusions for both app developers and futuer maintainer of InputMethodManager.java. Hope we can come up with a better architecture in the future. As for the minimum repro code, see the corresponding test case [3]. [1]: I01e5a29c0f82d068751774a2c58a1bd7b7b7f91a 2a757ef4 [2]: I7b305a93a7957ba5caebf49d55562fcf23f26766 fee50a4c [3]: Ibc28a3b5c3ce987672f31a4125ab9204750dc530 Bug: 296466613 Fix: 332912075 Test: test CtsInputMethodTestCases:EditTextImeSupportTest#testDisableImeAfterFocusChange Change-Id: I8dc003a38e7b95978fec83d055e44980163b70fb
Loading
Please register or sign in to comment