summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-10-12 10:44:47 -0700
committerJeff Sharkey <jsharkey@android.com>2012-10-12 10:46:01 -0700
commit4c76ea6b88fad2b0147c050c02c6fd3d886d6743 (patch)
tree044338379cdef31e7c0316da597da35a81b258c0 /cmds
parente6d3ccc99270aaf62808adc7475a25d96664f0fb (diff)
downloadframeworks_base-4c76ea6b88fad2b0147c050c02c6fd3d886d6743.zip
frameworks_base-4c76ea6b88fad2b0147c050c02c6fd3d886d6743.tar.gz
frameworks_base-4c76ea6b88fad2b0147c050c02c6fd3d886d6743.tar.bz2
Pm command to get maximum users.
Used to drive CTS tests. Also print success message when removing a user. Bug: 7334718 Change-Id: Ia3886ddf860cd000ce567b0fed2ef0a4e2a2295c
Diffstat (limited to 'cmds')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index 463a18c..16d4ad6 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -43,6 +43,7 @@ import android.os.IUserManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.os.UserManager;
import java.io.File;
import java.lang.reflect.Field;
@@ -174,6 +175,11 @@ public final class Pm {
return;
}
+ if ("get-max-users".equals(op)) {
+ runGetMaxUsers();
+ return;
+ }
+
try {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("-l")) {
@@ -1017,8 +1023,10 @@ public final class Pm {
return;
}
try {
- if (!mUm.removeUser(userId)) {
- System.err.println("Error: couldn't remove user #" + userId + ".");
+ if (mUm.removeUser(userId)) {
+ System.out.println("Success: removed user");
+ } else {
+ System.err.println("Error: couldn't remove user id " + userId);
}
} catch (RemoteException e) {
System.err.println(e.toString());
@@ -1042,6 +1050,11 @@ public final class Pm {
System.err.println(PM_NOT_RUNNING_ERR);
}
}
+
+ public void runGetMaxUsers() {
+ System.out.println("Maximum supported users: " + UserManager.getMaxSupportedUsers());
+ }
+
class PackageDeleteObserver extends IPackageDeleteObserver.Stub {
boolean finished;
boolean result;
@@ -1451,6 +1464,7 @@ public final class Pm {
System.err.println(" pm trim-caches DESIRED_FREE_SPACE");
System.err.println(" pm create-user USER_NAME");
System.err.println(" pm remove-user USER_ID");
+ System.err.println(" pm get-max-users");
System.err.println("");
System.err.println("pm list packages: prints all packages, optionally only");
System.err.println(" those whose package name contains the text in FILTER. Options:");