Fix '-u <user id>' handling in 'adb ime enable' and 'adb ime set'

am: 3403f2d85e

Change-Id: I78dda9e117a873bb2f02a6fad9fdf4ea4df6b546
This commit is contained in:
Yohei Yukawa
2019-04-15 08:36:41 -07:00
committed by android-build-merger

View File

@@ -4710,10 +4710,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
@ShellCommandResult
private int handleShellCommandEnableDisableInputMethod(
@NonNull ShellCommand shellCommand, boolean enabled) {
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
final String imeId = shellCommand.getNextArgRequired();
final PrintWriter out = shellCommand.getOutPrintWriter();
final PrintWriter error = shellCommand.getErrPrintWriter();
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
synchronized (mMethodMap) {
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
mSettings.getCurrentUserId(), shellCommand.getErrPrintWriter());
@@ -4733,6 +4733,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
*
* <p>You cannot use this helper method if the command has other options.</p>
*
* <p>CAVEAT: This method must be called only once before any other
* {@link ShellCommand#getNextArg()} and {@link ShellCommand#getNextArgRequired()} for the
* main arguments.</p>
*
* @param shellCommand {@link ShellCommand} from which options should be obtained.
* @return User ID to be resolved. {@link UserHandle#CURRENT} if not specified.
*/
@@ -4819,10 +4823,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
@BinderThread
@ShellCommandResult
private int handleShellCommandSetInputMethod(@NonNull ShellCommand shellCommand) {
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
final String imeId = shellCommand.getNextArgRequired();
final PrintWriter out = shellCommand.getOutPrintWriter();
final PrintWriter error = shellCommand.getErrPrintWriter();
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
synchronized (mMethodMap) {
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
mSettings.getCurrentUserId(), shellCommand.getErrPrintWriter());
@@ -4864,7 +4868,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
out.print("Input method ");
out.print(imeId);
out.print(" selected for user #");
error.println(userId);
out.println(userId);
}
}
}