From 258848d2ae04f447ff1c18023fa76b139fcc0862 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Fri, 10 Aug 2012 17:06:33 -0700 Subject: User Manager service to manage users and query user details Moved a bunch of methods from PackageManager to UserManager. Fix launching of activities from recents to correct user. Guest creation APIs Change-Id: I0733405e6eb2829675665e225c759d6baa2b708f --- cmds/pm/src/com/android/commands/pm/Pm.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmds') diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 4cb5270..eb1f9a2 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -20,6 +20,7 @@ import com.android.internal.content.PackageHelper; import android.app.ActivityManagerNative; import android.content.ComponentName; +import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.ContainerEncryptionParams; import android.content.pm.FeatureInfo; @@ -39,9 +40,11 @@ import android.content.res.AssetManager; import android.content.res.Resources; import android.net.Uri; import android.os.Binder; +import android.os.IUserManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserManager; import java.io.File; import java.lang.reflect.Field; @@ -59,6 +62,7 @@ import javax.crypto.spec.SecretKeySpec; public final class Pm { IPackageManager mPm; + IUserManager mUm; private WeakHashMap mResourceCache = new WeakHashMap(); @@ -82,6 +86,7 @@ public final class Pm { return; } + mUm = IUserManager.Stub.asInterface(ServiceManager.getService("user")); mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); if (mPm == null) { System.err.println(PM_NOT_RUNNING_ERR); @@ -985,7 +990,7 @@ public final class Pm { } name = arg; try { - if (mPm.createUser(name, 0) == null) { + if (mUm.createUser(name, 0) == null) { System.err.println("Error: couldn't create User."); showUsage(); } @@ -1017,7 +1022,7 @@ public final class Pm { return; } try { - if (!mPm.removeUser(userId)) { + if (!mUm.removeUser(userId)) { System.err.println("Error: couldn't remove user."); showUsage(); } @@ -1034,7 +1039,7 @@ public final class Pm { return; } try { - List users = mPm.getUsers(); + List users = mUm.getUsers(); if (users == null) { System.err.println("Error: couldn't get users"); } else { -- cgit v1.1