am a00ffa53: am 1016b288: Merge "Pm command to get maximum users." into jb-mr1-dev

* commit 'a00ffa53fbe7ced0147451242232f47d117d5e2d':
  Pm command to get maximum users.
This commit is contained in:
Jeff Sharkey
2012-10-12 12:19:34 -07:00
committed by Android Git Automerger

View File

@@ -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:");