summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-04-30 13:46:54 -0700
committerJeff Sharkey <jsharkey@android.com>2012-04-30 13:46:54 -0700
commit719a6320a789e76566d6416d5ec35491d21f5c44 (patch)
tree3054ec8d31d3c2cd1936667aaeac46ae257109f5 /cmds
parent263d044c790923d7d83ab036e79a3decc25c7b4d (diff)
downloadframeworks_base-719a6320a789e76566d6416d5ec35491d21f5c44.zip
frameworks_base-719a6320a789e76566d6416d5ec35491d21f5c44.tar.gz
frameworks_base-719a6320a789e76566d6416d5ec35491d21f5c44.tar.bz2
Change permission enforcement through pm command.
Add "set-permission-enforced", which can currently only mutate enforcement of READ_EXTERNAL_STORAGE. Bug: 6363043 Change-Id: I3f7929738c8c36b0a54fbf171c03fe16c09b5d99
Diffstat (limited to 'cmds')
-rw-r--r--cmds/pm/src/com/android/commands/pm/Pm.java33
1 files changed, 33 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 4d638d0..e19ad66 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -136,6 +136,11 @@ public final class Pm {
return;
}
+ if ("set-permission-enforced".equals(op)) {
+ runSetPermissionEnforced();
+ return;
+ }
+
if ("set-install-location".equals(op)) {
runSetInstallLocation();
return;
@@ -1114,6 +1119,33 @@ public final class Pm {
}
}
+ private void runSetPermissionEnforced() {
+ final String permission = nextArg();
+ if (permission == null) {
+ System.err.println("Error: no permission specified");
+ showUsage();
+ return;
+ }
+ final String enforcedRaw = nextArg();
+ if (enforcedRaw == null) {
+ System.err.println("Error: no enforcement specified");
+ showUsage();
+ return;
+ }
+ final boolean enforced = Boolean.parseBoolean(enforcedRaw);
+ try {
+ mPm.setPermissionEnforced(permission, enforced);
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(PM_NOT_RUNNING_ERR);
+ } catch (IllegalArgumentException e) {
+ System.err.println("Bad argument: " + e.toString());
+ showUsage();
+ } catch (SecurityException e) {
+ System.err.println("Operation not allowed: " + e.toString());
+ }
+ }
+
/**
* Displays the package file for a package.
* @param pckg
@@ -1214,6 +1246,7 @@ public final class Pm {
System.err.println(" pm revoke PACKAGE PERMISSION");
System.err.println(" pm set-install-location [0/auto] [1/internal] [2/external]");
System.err.println(" pm get-install-location");
+ System.err.println(" pm set-permission-enforced PERMISSION [true|false]");
System.err.println(" pm create-user USER_NAME");
System.err.println(" pm remove-user USER_ID");
System.err.println("");