Loading services/core/java/com/android/server/am/ActiveServices.java +11 −7 Original line number Diff line number Diff line Loading @@ -4987,14 +4987,16 @@ public final class ActiveServices { * - the first arg isn't the flattened component name of an existing service: * dump all services whose component contains the first arg as a substring */ protected boolean dumpService(FileDescriptor fd, PrintWriter pw, final String name, protected boolean dumpService(FileDescriptor fd, PrintWriter pw, String name, int[] users, String[] args, int opti, boolean dumpAll) { final ArrayList<ServiceRecord> services = new ArrayList<>(); final Predicate<ServiceRecord> filter = DumpUtils.filterRecord(name); synchronized (mAm) { int[] users = mAm.mUserController.getUsers(); if (users == null) { users = mAm.mUserController.getUsers(); } for (int user : users) { ServiceMap smap = mServiceMap.get(user); Loading Loading @@ -5042,8 +5044,10 @@ public final class ActiveServices { pw.print(r.shortInstanceName); pw.print(" "); pw.print(Integer.toHexString(System.identityHashCode(r))); pw.print(" pid="); if (r.app != null) pw.println(r.app.pid); else pw.println("(not running)"); if (r.app != null) { pw.print(r.app.pid); pw.print(" user="); pw.println(r.userId); } else pw.println("(not running)"); if (dumpAll) { r.dump(pw, innerPrefix); } Loading services/core/java/com/android/server/am/ActivityManagerService.java +14 −1 Original line number Diff line number Diff line Loading @@ -8664,17 +8664,30 @@ public class ActivityManagerService extends IActivityManager.Stub } else if ("service".equals(cmd)) { String[] newArgs; String name; int[] users = null; if (opti >= args.length) { name = null; newArgs = EMPTY_STRING_ARRAY; } else { name = args[opti]; opti++; if ("--user".equals(name) && opti < args.length) { int userId = UserHandle.parseUserArg(args[opti]); opti++; if (userId != UserHandle.USER_ALL) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUser().id; } users = new int[] { userId }; } name = args[opti]; opti++; } newArgs = new String[args.length - opti]; if (args.length > 2) System.arraycopy(args, opti, newArgs, 0, args.length - opti); } if (!mServices.dumpService(fd, pw, name, newArgs, 0, dumpAll)) { if (!mServices.dumpService(fd, pw, name, users, newArgs, 0, dumpAll)) { pw.println("No services match: " + name); pw.println("Use -h for help."); } Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +11 −7 Original line number Diff line number Diff line Loading @@ -4987,14 +4987,16 @@ public final class ActiveServices { * - the first arg isn't the flattened component name of an existing service: * dump all services whose component contains the first arg as a substring */ protected boolean dumpService(FileDescriptor fd, PrintWriter pw, final String name, protected boolean dumpService(FileDescriptor fd, PrintWriter pw, String name, int[] users, String[] args, int opti, boolean dumpAll) { final ArrayList<ServiceRecord> services = new ArrayList<>(); final Predicate<ServiceRecord> filter = DumpUtils.filterRecord(name); synchronized (mAm) { int[] users = mAm.mUserController.getUsers(); if (users == null) { users = mAm.mUserController.getUsers(); } for (int user : users) { ServiceMap smap = mServiceMap.get(user); Loading Loading @@ -5042,8 +5044,10 @@ public final class ActiveServices { pw.print(r.shortInstanceName); pw.print(" "); pw.print(Integer.toHexString(System.identityHashCode(r))); pw.print(" pid="); if (r.app != null) pw.println(r.app.pid); else pw.println("(not running)"); if (r.app != null) { pw.print(r.app.pid); pw.print(" user="); pw.println(r.userId); } else pw.println("(not running)"); if (dumpAll) { r.dump(pw, innerPrefix); } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +14 −1 Original line number Diff line number Diff line Loading @@ -8664,17 +8664,30 @@ public class ActivityManagerService extends IActivityManager.Stub } else if ("service".equals(cmd)) { String[] newArgs; String name; int[] users = null; if (opti >= args.length) { name = null; newArgs = EMPTY_STRING_ARRAY; } else { name = args[opti]; opti++; if ("--user".equals(name) && opti < args.length) { int userId = UserHandle.parseUserArg(args[opti]); opti++; if (userId != UserHandle.USER_ALL) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUser().id; } users = new int[] { userId }; } name = args[opti]; opti++; } newArgs = new String[args.length - opti]; if (args.length > 2) System.arraycopy(args, opti, newArgs, 0, args.length - opti); } if (!mServices.dumpService(fd, pw, name, newArgs, 0, dumpAll)) { if (!mServices.dumpService(fd, pw, name, users, newArgs, 0, dumpAll)) { pw.println("No services match: " + name); pw.println("Use -h for help."); } Loading