From 78e0f9de8ad59a08c15ca632aa94ec2f752e9948 Mon Sep 17 00:00:00 2001 From: Milton Wu Date: Tue, 13 Jun 2023 16:09:21 +0800 Subject: [PATCH] [BiometricsV2] Fix fingerprintSettings not shown Fix "Fingerprint Unlock" page not show when 1st fingerprint is added through biometrics v2 enrollment on a device w/ faceunlock Do no check bundle is null or not during check activity result because it may be null if callee activity doesn't need to pass anything back to previous caller activity. Bug: 286993437 Test: test this scenario on a fingerprint only device w/o v2 Test: test this scenario on a faceunlock device w/o v2 Test: test this scenario on a fingerprint only device w/ v2 Test: test this scenario on a faceunlock device w/ v2 Change-Id: Ic6168e73de378ecc1555808d4f0969f4c490a38d --- .../biometrics/fingerprint/FingerprintSettings.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java index 9c42fc88d57..9fc186223e0 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java @@ -920,7 +920,7 @@ public class FingerprintSettings extends SubSettings { activity.finish(); } } else if (requestCode == AUTO_ADD_FIRST_FINGERPRINT_REQUEST) { - if (resultCode != RESULT_FINISHED || data == null) { + if (resultCode != RESULT_FINISHED) { Log.d(TAG, "Add first fingerprint, fail or null data, result:" + resultCode); if (resultCode == BiometricEnrollBase.RESULT_TIMEOUT) { // If "Fingerprint Unlock" is closed because of timeout, notify result code @@ -932,14 +932,19 @@ public class FingerprintSettings extends SubSettings { return; } - mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); + if (mToken == null && data != null) { + mToken = data.getByteArrayExtra( + ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); + } if (mToken == null) { Log.w(TAG, "Add first fingerprint, null token"); finish(); return; } - mChallenge = data.getLongExtra(EXTRA_KEY_CHALLENGE, -1L); + if (mChallenge == -1L && data != null) { + mChallenge = data.getLongExtra(EXTRA_KEY_CHALLENGE, -1L); + } if (mChallenge == -1L) { Log.w(TAG, "Add first fingerprint, invalid challenge"); finish();