Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 257ecd25 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 0d29f424
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment