Fix '-u <user id>' handling in 'adb ime enable' and 'adb ime set'
am: 3403f2d85e
Change-Id: I78dda9e117a873bb2f02a6fad9fdf4ea4df6b546
This commit is contained in:
@@ -4710,10 +4710,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
@ShellCommandResult
|
@ShellCommandResult
|
||||||
private int handleShellCommandEnableDisableInputMethod(
|
private int handleShellCommandEnableDisableInputMethod(
|
||||||
@NonNull ShellCommand shellCommand, boolean enabled) {
|
@NonNull ShellCommand shellCommand, boolean enabled) {
|
||||||
|
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
|
||||||
final String imeId = shellCommand.getNextArgRequired();
|
final String imeId = shellCommand.getNextArgRequired();
|
||||||
final PrintWriter out = shellCommand.getOutPrintWriter();
|
final PrintWriter out = shellCommand.getOutPrintWriter();
|
||||||
final PrintWriter error = shellCommand.getErrPrintWriter();
|
final PrintWriter error = shellCommand.getErrPrintWriter();
|
||||||
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
|
|
||||||
synchronized (mMethodMap) {
|
synchronized (mMethodMap) {
|
||||||
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
|
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
|
||||||
mSettings.getCurrentUserId(), shellCommand.getErrPrintWriter());
|
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>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.
|
* @param shellCommand {@link ShellCommand} from which options should be obtained.
|
||||||
* @return User ID to be resolved. {@link UserHandle#CURRENT} if not specified.
|
* @return User ID to be resolved. {@link UserHandle#CURRENT} if not specified.
|
||||||
*/
|
*/
|
||||||
@@ -4819,10 +4823,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
@BinderThread
|
@BinderThread
|
||||||
@ShellCommandResult
|
@ShellCommandResult
|
||||||
private int handleShellCommandSetInputMethod(@NonNull ShellCommand shellCommand) {
|
private int handleShellCommandSetInputMethod(@NonNull ShellCommand shellCommand) {
|
||||||
|
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
|
||||||
final String imeId = shellCommand.getNextArgRequired();
|
final String imeId = shellCommand.getNextArgRequired();
|
||||||
final PrintWriter out = shellCommand.getOutPrintWriter();
|
final PrintWriter out = shellCommand.getOutPrintWriter();
|
||||||
final PrintWriter error = shellCommand.getErrPrintWriter();
|
final PrintWriter error = shellCommand.getErrPrintWriter();
|
||||||
final int userIdToBeResolved = handleOptionsForCommandsThatOnlyHaveUserOption(shellCommand);
|
|
||||||
synchronized (mMethodMap) {
|
synchronized (mMethodMap) {
|
||||||
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
|
final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved,
|
||||||
mSettings.getCurrentUserId(), shellCommand.getErrPrintWriter());
|
mSettings.getCurrentUserId(), shellCommand.getErrPrintWriter());
|
||||||
@@ -4864,7 +4868,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
out.print("Input method ");
|
out.print("Input method ");
|
||||||
out.print(imeId);
|
out.print(imeId);
|
||||||
out.print(" selected for user #");
|
out.print(" selected for user #");
|
||||||
error.println(userId);
|
out.println(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user