Merge \"Add pm operation to set user restrictions.\" into mnc-dev
am: 144b3a42cc
Change-Id: I1de4650ef53751654145a3ad1c40390711414341
This commit is contained in:
@@ -262,6 +262,10 @@ public final class Pm {
|
|||||||
return runMovePrimaryStorage();
|
return runMovePrimaryStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("set-user-restriction".equals(op)) {
|
||||||
|
return runSetUserRestriction();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("-l")) {
|
if (args[0].equalsIgnoreCase("-l")) {
|
||||||
@@ -1518,6 +1522,38 @@ public final class Pm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int runSetUserRestriction() {
|
||||||
|
int userId = UserHandle.USER_OWNER;
|
||||||
|
String opt = nextOption();
|
||||||
|
if (opt != null && "--user".equals(opt)) {
|
||||||
|
String arg = nextArg();
|
||||||
|
if (arg == null || !isNumber(arg)) {
|
||||||
|
System.err.println("Error: valid userId not specified");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
userId = Integer.parseInt(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
String restriction = nextArg();
|
||||||
|
String arg = nextArg();
|
||||||
|
boolean value;
|
||||||
|
if ("1".equals(arg)) {
|
||||||
|
value = true;
|
||||||
|
} else if ("0".equals(arg)) {
|
||||||
|
value = false;
|
||||||
|
} else {
|
||||||
|
System.err.println("Error: valid value not specified");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
mUm.setUserRestriction(restriction, value, userId);
|
||||||
|
return 0;
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
System.err.println(e.toString());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int runUninstall() throws RemoteException {
|
private int runUninstall() throws RemoteException {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int userId = UserHandle.USER_ALL;
|
int userId = UserHandle.USER_ALL;
|
||||||
|
|||||||
Reference in New Issue
Block a user