diff options
author | Amith Yamasani <yamasani@google.com> | 2012-03-13 16:08:00 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-03-22 10:08:24 -0700 |
commit | 483f3b06ea84440a082e21b68ec2c2e54046f5a6 (patch) | |
tree | cc0dff8ea3d133a4dc910bc1e90c85380cea2064 /cmds/am/src | |
parent | 8fca15f1f2273fa429e58f783d0970251d0942e5 (diff) | |
download | frameworks_base-483f3b06ea84440a082e21b68ec2c2e54046f5a6.zip frameworks_base-483f3b06ea84440a082e21b68ec2c2e54046f5a6.tar.gz frameworks_base-483f3b06ea84440a082e21b68ec2c2e54046f5a6.tar.bz2 |
Package restrictions per user
Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.
Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.
Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml
Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.
Added some tests for pm.Settings and PackageManager.
Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
Diffstat (limited to 'cmds/am/src')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index c15c49f..53a0186 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -62,6 +62,7 @@ public class Am { private boolean mStopOption = false; private int mRepeat = 0; + private int mUserId = 0; private String mProfileFile; @@ -135,7 +136,7 @@ public class Am { runToUri(false); } else if (op.equals("to-intent-uri")) { runToUri(true); - } else if (op.equals("switch-profile")) { + } else if (op.equals("switch-user")) { runSwitchUser(); } else { throw new IllegalArgumentException("Unknown command: " + op); @@ -152,6 +153,7 @@ public class Am { mStopOption = false; mRepeat = 0; mProfileFile = null; + mUserId = 0; Uri data = null; String type = null; @@ -308,6 +310,8 @@ public class Am { mStopOption = true; } else if (opt.equals("--opengl-trace")) { mStartFlags |= ActivityManager.START_FLAG_OPENGL_TRACES; + } else if (opt.equals("--user")) { + mUserId = Integer.parseInt(nextArgRequired()); } else { System.err.println("Error: Unknown option: " + opt); showUsage(); @@ -407,7 +411,8 @@ public class Am { System.err.println("Error: Package manager not running; aborting"); return; } - List<ResolveInfo> activities = pm.queryIntentActivities(intent, mimeType, 0); + List<ResolveInfo> activities = pm.queryIntentActivities(intent, mimeType, 0, + mUserId); if (activities == null || activities.size() <= 0) { System.err.println("Error: Intent does not match any activities: " + intent); @@ -550,7 +555,7 @@ public class Am { IntentReceiver receiver = new IntentReceiver(); System.out.println("Broadcasting: " + intent); mAm.broadcastIntent(null, intent, null, receiver, 0, null, null, null, true, false, - Binder.getOrigCallingUser()); + mUserId); receiver.waitForFinish(); } @@ -1294,6 +1299,7 @@ public class Am { " am display-size [reset|MxN]\n" + " am to-uri [INTENT]\n" + " am to-intent-uri [INTENT]\n" + + " am switch-user <USER_ID>\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + |