Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9dc54454 authored by Nicholas Sauer's avatar Nicholas Sauer Committed by Android (Google) Code Review
Browse files

Merge "Handle "--user current" and other valid users in the AccountManagerServiceShellCommand."

parents 1dc6ec5b 1f8a1028
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -78,7 +78,18 @@ final class AccountManagerServiceShellCommand extends ShellCommand {
        final String option = getNextOption();
        if (option != null) {
            if (option.equals("--user")) {
                return UserHandle.parseUserArg(getNextArgRequired());
                int userId = UserHandle.parseUserArg(getNextArgRequired());
                if (userId == UserHandle.USER_CURRENT) {
                    return ActivityManager.getCurrentUser();
                } else if (userId == UserHandle.USER_ALL) {
                    getErrPrintWriter().println("USER_ALL not supported. Specify a user.");
                    return null;
                } else if (userId < 0) {
                    getErrPrintWriter().println("Invalid user: " + userId);
                    return null;
                } else {
                    return userId;
                }
            } else {
                getErrPrintWriter().println("Unknown option: " + option);
                return null;