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

Commit 9c0d4785 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove unnecessary workaround for IME switcher

This is a logical revert of an old workaround CL [1], which should no
longer is necessary now.

When the original CL [1] was written, Keyguard was always calling the
following two APIs, which were always returning the current user's IME
list at that time.

 * InputMethodManager#getEnabledInputMethodList()
 * InputMethodManager#getEnabledInputMethodSubtypeList()

This is why a 500ms delay was needed in before Keyguard's calling
these APIs at that time.

Since then, during the work of per-profile IME project, we have
already upgraded Keyguard to use

 * InputMethodManager#getEnabledInputMethodListAsUser()
 * InputMethodManager#getEnabledInputMethodSubtypeListAsUser()

instead with an explicit user ID [2], which in theory can never have
this kind of race condition.

There must be no user observable behavior change.

 [1]: I93ea71d73540c31fbbe1cc4bd6747871f957dcc6
      982a94c5
 [2]: I6e7d7353c2b5b1da5d460ae005fb2585f85fb1c4
      1fb13c59

Bug: 30640917
Test: atest SystemUiRoboTests
Test: Manually verified that Bug 30640917 remains to be fixed.
  1. Build aosp_bluejay-trunk_staging-userdebug and flash it
  2. make -j SoftKeyboard
  3. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
  4. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
  5. adb shell locksettings set-password aaaa
  6. adb shell pm create-user test_user
  7. adb shell am switch-user 10
  8. adb shell am switch-user 0
  9. Make sure that the IME switcher icon is shown
Test: Manually verified that Bug 123904896 remains to be fixed.
  1. Build aosp_bluejay-trunk_staging-userdebug and flash it
  2. make -j SoftKeyboard
  3. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
  4. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
  5. adb shell pm create-user test_user
  6. adb shell am switch-user 10
  7. adb shell locksettings set-password aaaa
  8. adb shell wm dismiss-keyguard
  9. Make sure that the IME switcher icon is not shown
Change-Id: I37c8fe76e2a7daf322a86f5eb6c6986d988d4f93
parent bb756a05
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ import java.util.List;
public class KeyguardPasswordViewController
        extends KeyguardAbsKeyInputViewController<KeyguardPasswordView> {

    private static final int DELAY_MILLIS_TO_REEVALUATE_IME_SWITCH_ICON = 500;  // 500ms
    private final KeyguardSecurityCallback mKeyguardSecurityCallback;
    private final DevicePostureController mPostureController;
    private final DevicePostureController.Callback mPostureCallback = posture ->
@@ -164,13 +163,6 @@ public class KeyguardPasswordViewController

        // If there's more than one IME, enable the IME switcher button
        updateSwitchImeButton();

        // When we the current user is switching, InputMethodManagerService sometimes has not
        // switched internal state yet here. As a quick workaround, we check the keyboard state
        // again.
        // TODO: Remove this workaround by ensuring such a race condition never happens.
        mMainExecutor.executeDelayed(
                this::updateSwitchImeButton, DELAY_MILLIS_TO_REEVALUATE_IME_SWITCH_ICON);
    }

    @Override