Fix '-u <user id>' handling in 'adb ime enable' and 'adb ime set'
This is a follow up CL to my previous CLs [1][2], which added
'-u <user id>' option to
adb shell ime enable <ime id>
and
adb shell ime set <ime id>
respectively.
Those CL had a bug that was introduced during the last round of the
code review when I was addressing a review comment. As a result,
those two commands simply fail if '-u' or '--user' option is
specified. With this CL, those we can finally start specifying the
user ID for those two commands.
This CL also fixes a bug that output for
adb shell ime set -u all <ime id>
are not correctly formatted.
Note that this CL only fixes a bug in debug shell commands. There
should be no user-visible behavior change in end-user use cases.
[1]: Ia0f873e4589a9fc3f549469e3d1d966640dc2df5
e177170f6432631d54788a37f4fb468a02468ed0
[2]: I397cf0fb418a395dcafc0ab0d8d4e553b0f2eaab
099f80ce9762e8b20998759fd6082bdcd6291103
Bug: 120784635
Test: Manually tested as follows:
1. Build aosp_blueline-userdebug and flash it
2. make -j SoftKeyboard
3. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
4. adb shell pm create-user test
5. adb shell am switch-user 10
6. adb shell ime disable -u 0 com.example.android.softkeyboard/.SoftKeyboard
-> Input method com.example.android.softkeyboard/.SoftKeyboard: now disabled for user #0
7. adb shell ime enable -u 0 com.example.android.softkeyboard/.SoftKeyboard
-> Input method com.example.android.softkeyboard/.SoftKeyboard: now enabled for user #0
8. adb shell ime set -u 0 com.example.android.softkeyboard/.SoftKeyboard
-> Input method com.example.android.softkeyboard/.SoftKeyboard selected for user #0
Test: Manually tested as follows.
1. Build aosp_blueline-userdebug and flash it
2. adb shell pm create-user test
3. adb shell pm create-user restricted_test
4. adb root
5. adb shell pm set-user-restriction --user 11 no_debugging_features 1
6. adb shell am switch-user 10
7. adb shell am switch-user 11
8. adb shell am switch-user 0
9. adb shell ime set -u all com.android.inputmethod.latin/.LatinIME
-> Input method com.android.inputmethod.latin/.LatinIME selected for user #0
Input method com.android.inputmethod.latin/.LatinIME selected for user #10
User #11 is restricted with DISALLOW_DEBUGGING_FEATURES.
10. adb shell ime disable -u all com.android.inputmethod.latin/.LatinIME
-> Input method com.android.inputmethod.latin/.LatinIME: now disabled for user #0
Input method com.android.inputmethod.latin/.LatinIME: now disabled for user #10
User #11 is restricted with DISALLOW_DEBUGGING_FEATURES.
Change-Id: I4e396519400c0ccd17322fe085b45456621714e7
1 file changed