Skip to content
Snippets Groups Projects
Commit 561415d9 authored by Kweku Adams's avatar Kweku Adams
Browse files

Support custom user strings.

Use UserHandle.parseUserArg() when parsing adb command flags to enable
parsing "cur" and other special user strings.

Bug: 282063891
Test: atest CtsJobSchedulerTestCases
Test: `adb shell cmd jobscheduler run --user cur com.android.settings 2131427352`
Change-Id: Ibe06f536f1de760a5604d067b6c1894f756a17c6
parent 8943b729
No related branches found
No related tags found
No related merge requests found
......@@ -180,7 +180,7 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler {
case "-u":
case "--user":
userId = Integer.parseInt(getNextArgRequired());
userId = UserHandle.parseUserArg(getNextArgRequired());
break;
case "-n":
......@@ -199,6 +199,10 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler {
return -1;
}
if (userId == UserHandle.USER_CURRENT) {
userId = ActivityManager.getCurrentUser();
}
final String pkgName = getNextArgRequired();
final int jobId = Integer.parseInt(getNextArgRequired());
......
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