summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-06-12 14:19:10 -0700
committerAmith Yamasani <yamasani@google.com>2013-06-25 16:03:55 -0700
commit655d0e2029e6ae77a47e922dce4c4989818b8dd1 (patch)
tree67a9e2261c5e61f5a1b8f7f4f8cfcca5b433046c /cmds
parentbf991a8f426921c26e21e54e493781e1d5eb39ff (diff)
downloadframeworks_base-655d0e2029e6ae77a47e922dce4c4989818b8dd1.zip
frameworks_base-655d0e2029e6ae77a47e922dce4c4989818b8dd1.tar.gz
frameworks_base-655d0e2029e6ae77a47e922dce4c4989818b8dd1.tar.bz2
Single-user restrictions
Introduces a new "blocked" state for each package. This is used to temporarily disable an app via Settings->Restrictions. PIN creation and challenge activities for use by Settings and other apps. PIN is stored by the User Manager and it manages the interval for retry attempts across reboots. Change-Id: I4915329d1f72399bbcaf93a9ca9c0d2e69d098dd
Diffstat (limited to 'cmds')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index 6f57ae0..d1ded10 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -147,6 +147,16 @@ public final class Pm {
return;
}
+ if ("block".equals(op)) {
+ runSetBlockedSetting(true);
+ return;
+ }
+
+ if ("unblock".equals(op)) {
+ runSetBlockedSetting(false);
+ return;
+ }
+
if ("grant".equals(op)) {
runGrantRevokePermission(true);
return;
@@ -1256,6 +1266,36 @@ public final class Pm {
}
}
+ private void runSetBlockedSetting(boolean state) {
+ int userId = 0;
+ String option = nextOption();
+ if (option != null && option.equals("--user")) {
+ String optionData = nextOptionData();
+ if (optionData == null || !isNumber(optionData)) {
+ System.err.println("Error: no USER_ID specified");
+ showUsage();
+ return;
+ } else {
+ userId = Integer.parseInt(optionData);
+ }
+ }
+
+ String pkg = nextArg();
+ if (pkg == null) {
+ System.err.println("Error: no package or component specified");
+ showUsage();
+ return;
+ }
+ try {
+ mPm.setApplicationBlockedSettingAsUser(pkg, state, userId);
+ System.err.println("Package " + pkg + " new blocked state: "
+ + mPm.getApplicationBlockedSettingAsUser(pkg, userId));
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(PM_NOT_RUNNING_ERR);
+ }
+ }
+
private void runGrantRevokePermission(boolean grant) {
String pkg = nextArg();
if (pkg == null) {
@@ -1482,6 +1522,8 @@ public final class Pm {
System.err.println(" pm disable [--user USER_ID] PACKAGE_OR_COMPONENT");
System.err.println(" pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT");
System.err.println(" pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT");
+ System.err.println(" pm block [--user USER_ID] PACKAGE_OR_COMPONENT");
+ System.err.println(" pm unblock [--user USER_ID] PACKAGE_OR_COMPONENT");
System.err.println(" pm grant PACKAGE PERMISSION");
System.err.println(" pm revoke PACKAGE PERMISSION");
System.err.println(" pm set-install-location [0/auto] [1/internal] [2/external]");