Add credential verification command to locksetting.
This is useful when we need to unlock the user in a test.
Currently credential verification is done for any command
(e.g. "clear") when "--old" parameter is provided, so this
CL doesn't add anything new really, just makes it official.
Test: adb shell locksettings set-pin 1111
Test: adb shell locksettings verify --old 1111
Bug: 36608972
Change-Id: I3fdd6a309479739567622285945d17bb3acf972e
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
index d730c56..67ead6f 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
@@ -36,6 +36,7 @@
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 @@
case COMMAND_SET_DISABLED:
runSetDisabled();
break;
+ case COMMAND_VERIFY:
+ runVerify();
+ break;
default:
getErrPrintWriter().println("Unknown command: " + cmd);
break;
@@ -88,6 +92,11 @@
}
}
+ private void runVerify() {
+ // The command is only run if the credential is correct.
+ getOutPrintWriter().println("Lock credential verified successfully");
+ }
+
@Override
public void onHelp() {
}