RESTRICT AUTOMERGE: Catch exceptions from setLockCredential()
When LockPatternUtils#setLockCredential() fails, it can either return
false or throw an exception. Catch the exception and treat it the same
way as a false return value, to prevent crashing com.android.settings.
Bug: 253043065
Test: Tried setting lockscreen credential while in secure FRP mode using
smartlock setup activity launched by intent via adb. Verified
that com.android.settings no longer crashes due to the exception
from LockPatternUtils#setLockCredential().
Change-Id: I48b9119c19fb6378b1f88d36433ee4f4c8501d76
(cherry picked from commit 05f1eff1c9
)
Merged-In: I48b9119c19fb6378b1f88d36433ee4f4c8501d76
This commit is contained in:
@@ -107,9 +107,14 @@ public class SaveAndFinishWorker extends Fragment {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
Pair<Boolean, Intent> saveAndVerifyInBackground() {
|
Pair<Boolean, Intent> saveAndVerifyInBackground() {
|
||||||
final int userId = mUserId;
|
final int userId = mUserId;
|
||||||
|
try {
|
||||||
if (!mUtils.setLockCredential(mChosenCredential, mCurrentCredential, userId)) {
|
if (!mUtils.setLockCredential(mChosenCredential, mCurrentCredential, userId)) {
|
||||||
return Pair.create(false, null);
|
return Pair.create(false, null);
|
||||||
}
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Log.e(TAG, "Failed to set lockscreen credential", e);
|
||||||
|
return Pair.create(false, null);
|
||||||
|
}
|
||||||
|
|
||||||
unifyProfileCredentialIfRequested();
|
unifyProfileCredentialIfRequested();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user