Skip to content
Commit 4a011f69 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Let "ime enable/set" return exit code 255 when failed

This is a follow up CL to my previous CL [1], which added

  -u <user id>

option to "adb shell ime set <IME ID>" command.

As noted in its commit message, that CL made specifying non existent
IME ID a graceful success rather than a hard failure.  However, such a
change made it quite difficult to diagnose race conditions when the
specified IME is not yet recognized by InputMethodManagerService.
This is especially annoying when diagnosing CTS failures happening
only on reporters' devices.

With this CL, "adb shell ime set <IME ID>" at least returns 255 as its
exit code when the specified IME ID cannot be recognized by the
InputMethodManagerService (yet).

If the multiple users are involved (e.g. by adding "-u all" option),
then 255 will be returned if the specified IME ID is invalid to at
least one user.

This CL also does the same thing for

  adb shell ime enable <IME ID>

command.

Also, those two shell commands now show error messages in logcat when
they failed for better debugability.

Other than exit code and logcat messages from those shell commands,
there should be no behavior change in this CL.

 [1]: I397cf0fb418a395dcafc0ab0d8d4e553b0f2eaab
      099f80ce

Bug: 186526091
Fix: 188094681
Test: Manually verified as follows:
 1. adb shell ime enable com.example.android.nonexistentime/.Ime
 2. echo $?  # confirm this is 255
 3. adb logcat -s InputMethodManagerService:*  # Confirm the msg.
 4. adb shell ime set com.example.android.nonexistentime/.Ime
 5. echo $?  # confirm this is 255
 6. adb logcat -s InputMethodManagerService:*  # Confirm the msg.
 7. adb shell ime disable com.example.android.nonexistentime/.Ime
 8. echo $?  # confirm this is 0
 9. adb logcat -s InputMethodManagerService:*  # Confirm no msg.
Change-Id: I3a544eb79c068ea692200b2e25484b56a628ceb0
parent d59fb76b
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