Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b02a2f4 authored by Pavel Grafov's avatar Pavel Grafov Committed by Android (Google) Code Review
Browse files

Merge "Add credential verification command to locksetting."

parents 50aadec1 5f679b21
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);
+9 −0
Original line number Diff line number Diff line
@@ -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() {
    }