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

Commit 8020f1aa authored by Eric Biggers's avatar Eric Biggers
Browse files

LockSettingsShellCommand: improve an error message

Show an appropriate error message when trying to set a lock credential
when the user already has one and the old credential wasn't provided.

Previously the empty credential got passed down to
LockPatternUtils#checkCredential(), resulting in an error of
"Credential can't be null or empty" which was confusing in this context.

Bug: 351910156
Test: locksettings set-pin 1234; locksettings set-pin 5678
Change-Id: Iaede42c5ea18fab1fc23d5c0dfd82da91c8019de
parent c3eca001
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -340,6 +340,11 @@ class LockSettingsShellCommand extends ShellCommand {
                getOutPrintWriter().println("Profile uses unified challenge");
                return false;
            }
            if (mOld.isEmpty()) {
                getOutPrintWriter().println(
                        "User has a lock credential, but old credential was not provided");
                return false;
            }

            try {
                final boolean result = mLockPatternUtils.checkCredential(getOldCredential(),