Fixed message on cmd device_policy is-operation-safe

Test: adb shell cmd device_policy is-operation-safe 7
Bug: 172376923

Change-Id: Ia8bdcde96728507f78495f12255894e2f02dc978
This commit is contained in:
Felipe Leme
2021-04-09 13:31:37 -07:00
parent c8472887fc
commit 46771d107f

View File

@@ -100,8 +100,8 @@ final class DevicePolicyManagerServiceShellCommand extends ShellCommand {
int operation = Integer.parseInt(getNextArgRequired());
int reason = mService.getUnsafeOperationReason(operation);
boolean safe = reason == DevicePolicyManager.OPERATION_SAFETY_REASON_NONE;
pw.printf("Operation %s is %b. Reason: %s\n",
DevicePolicyManager.operationToString(operation), safe,
pw.printf("Operation %s is %s. Reason: %s\n",
DevicePolicyManager.operationToString(operation), safeToString(safe),
DevicePolicyManager.operationSafetyReasonToString(reason));
return 0;
}
@@ -110,11 +110,14 @@ final class DevicePolicyManagerServiceShellCommand extends ShellCommand {
int reason = Integer.parseInt(getNextArgRequired());
boolean safe = mService.isSafeOperation(reason);
pw.printf("Operations affected by %s are %s\n",
DevicePolicyManager.operationSafetyReasonToString(reason),
(safe ? "SAFE" : "UNSAFE"));
DevicePolicyManager.operationSafetyReasonToString(reason), safeToString(safe));
return 0;
}
private static String safeToString(boolean safe) {
return safe ? "SAFE" : "UNSAFE";
}
private int runSetSafeOperation(PrintWriter pw) {
int operation = Integer.parseInt(getNextArgRequired());
int reason = Integer.parseInt(getNextArgRequired());