Merge "Add credential verification command to locksetting."

This commit is contained in:
Pavel Grafov
2017-06-27 10:28:02 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 1 deletions

View File

@@ -33,6 +33,10 @@ public final class LockSettingsCmd extends BaseCommand {
" locksettings set-pin [--old OLD_CREDENTIAL] NEW_PIN\n" +
" locksettings set-password [--old OLD_CREDENTIAL] NEW_PASSWORD\n" +
" locksettings clear [--old OLD_CREDENTIAL]\n" +
" locksettings verify [--old OLD_CREDENTIAL]\n" +
"\n" +
"flags: \n" +
" --user USER_ID: specify the user, default value is current user\n" +
"\n" +
"locksettings set-pattern: sets a pattern\n" +
" A pattern is specified by a non-separated list of numbers that index the cell\n" +
@@ -44,7 +48,9 @@ public final class LockSettingsCmd extends BaseCommand {
"\n" +
"locksettings set-password: sets a password\n" +
"\n" +
"locksettings clear: clears the unlock credential\n";
"locksettings clear: clears the unlock credential\n" +
"\n" +
"locksettings verify: verifies the credential and unlocks the user\n";
public static void main(String[] args) {
(new LockSettingsCmd()).run(args);

View File

@@ -36,6 +36,7 @@ class LockSettingsShellCommand extends ShellCommand {
private static final String COMMAND_CLEAR = "clear";
private static final String COMMAND_SP = "sp";
private static final String COMMAND_SET_DISABLED = "set-disabled";
private static final String COMMAND_VERIFY = "verify";
private int mCurrentUserId;
private final LockPatternUtils mLockPatternUtils;
@@ -76,6 +77,9 @@ class LockSettingsShellCommand extends ShellCommand {
case COMMAND_SET_DISABLED:
runSetDisabled();
break;
case COMMAND_VERIFY:
runVerify();
break;
default:
getErrPrintWriter().println("Unknown command: " + cmd);
break;
@@ -88,6 +92,11 @@ class LockSettingsShellCommand extends ShellCommand {
}
}
private void runVerify() {
// The command is only run if the credential is correct.
getOutPrintWriter().println("Lock credential verified successfully");
}
@Override
public void onHelp() {
}