Don't attemp to verify synthetic password from adb.
This is a follow up for http://ag/2540318. Currently if the profile
uses unified challenge, there is no way to check its synthetic password
directly in the UI. This CL prevents it from locksettings shell command
as well.
Bug: 63295016
Test: adb shell cmd lock_settings verify --user 10 --old sdfasdf
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest
Change-Id: Idfe45922015c348685da4f2b0200ac930d430b66
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
index 3c236b4..df1b127 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
@@ -160,6 +160,11 @@
final boolean havePassword = mLockPatternUtils.isLockPasswordEnabled(mCurrentUserId);
final boolean havePattern = mLockPatternUtils.isLockPatternEnabled(mCurrentUserId);
if (havePassword || havePattern) {
+ if (mLockPatternUtils.isManagedProfileWithUnifiedChallenge(mCurrentUserId)) {
+ getOutPrintWriter().println("Profile uses unified challenge");
+ return false;
+ }
+
try {
final boolean result;
if (havePassword) {
@@ -168,9 +173,7 @@
result = mLockPatternUtils.checkPattern(stringToPattern(mOld), mCurrentUserId);
}
if (!result) {
- if (!mLockPatternUtils.isManagedProfileWithUnifiedChallenge(mCurrentUserId)) {
- mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId);
- }
+ mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId);
getOutPrintWriter().println("Old password '" + mOld + "' didn't match");
}
return result;