OSDN Git Service

Fix possible incorrect output from 'adb shell ime reset'
authorYohei Yukawa <yukawa@google.com>
Tue, 5 Feb 2019 06:25:24 +0000 (22:25 -0800)
committerYohei Yukawa <yukawa@google.com>
Tue, 5 Feb 2019 06:25:24 +0000 (22:25 -0800)
commit9cd0c8a6c62af2c8badbfd482b2944616dfc3c69
treea7efed281cee6beed101cbf08bd5d3c11714da48
parenta927c5915555872650fa14052388089d93520e18
Fix possible incorrect output from 'adb shell ime reset'

This is a follow up CL to my previous CL [1], which enabled
InputMethodManager#getEnabledInputMethodList() to return the result
based on the caller's user ID, not based on the current IME user,
which is mSettings.getCurrentUserId().

Since InputMethodManagerService#handleShellCommandSetInputMethod()
always runs as user 0, we cannot actually simply call
IMMS#getEnabledInputMethodList() any more from that method.  Instead,
we should use mSettings.getEnabledInputMethodListLocked() so that the
right user's result should be shown on the console.

This is a minor fix for the output message of a debug command.  There
should be no visible behavior change for production use cases.

 [1]: I192a0f5a1375170d17a4c08af94f23966dbaea8b
      7f8ee4b9ddd31ad36a12c5278b27990dc76011cc

Bug: 122164939
Fix: 123906510
Test: Manually verified as follows.
  1. Build aosp_taimen-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 ime reset
     -> Confirm that the output is
          Reset current and enabled IMEs
          Newly selected IME:
            com.android.inputmethod.latin/.LatinIME
          Newly enabled IMEs:
            com.android.inputmethod.latin/.LatinIME
Change-Id: I4c29ade9373b0fa5ab77f5a349017389ff1fb827
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java