Adding biometric FRR Notification atom.

Test: statsd_testdrive 793
Test: statsd_testdrive 184
Test: m -j50 RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.biometrics
Test: atest FingerprintUpdaterTest FaceUpdaterTest
Bug: 302171089

Change-Id: I4c921b75321db79cc975b98b54b176a43379cd7c
This commit is contained in:
Joshua McCloskey
2023-12-21 21:31:53 +00:00
committed by Joshua Mccloskey
parent e28934a9f9
commit e5f62676c8
23 changed files with 184 additions and 48 deletions

View File

@@ -43,6 +43,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.hardware.face.Face;
import android.hardware.face.FaceEnrollOptions;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorProperties;
import android.hardware.face.FaceSensorPropertiesInternal;
@@ -196,6 +197,8 @@ public class FaceEnrollIntroductionTest {
final Intent testIntent = new Intent();
// Set the challenge token so the confirm screen will not be shown
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
testIntent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
FaceEnrollOptions.ENROLL_REASON_SETTINGS);
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
null /* Simulate no posture intent */);
@@ -220,6 +223,8 @@ public class FaceEnrollIntroductionTest {
testIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
testIntent.putExtra(EXTRA_KEY_NEXT_LAUNCHED, false);
testIntent.putExtra(EXTRA_LAUNCHED_POSTURE_GUIDANCE, false);
testIntent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
FaceEnrollOptions.ENROLL_REASON_SETTINGS);
when(mFakeFeatureFactory.mFaceFeatureProvider.getPostureGuidanceIntent(any())).thenReturn(
testIntent);
@@ -641,4 +646,14 @@ public class FaceEnrollIntroductionTest {
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNull();
}
@Test
public void testFaceEnrollIntroduction_forwardsEnrollOptions() {
setupActivity();
final Intent intent = mActivity.getEnrollingIntent();
assertThat(intent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1))
.isEqualTo(FaceEnrollOptions.ENROLL_REASON_SETTINGS);
}
}

View File

@@ -669,7 +669,8 @@ public class FingerprintEnrollEnrollingTest {
any(CancellationSignal.class),
anyInt(),
callbackCaptor.capture(),
eq(FingerprintManager.ENROLL_ENROLL));
eq(FingerprintManager.ENROLL_ENROLL),
any());
return callbackCaptor.getValue();
}

View File

@@ -227,7 +227,8 @@ public class FingerprintEnrollFindSensorTest {
any(CancellationSignal.class),
anyInt(),
callbackCaptor.capture(),
eq(FingerprintManager.ENROLL_FIND_SENSOR));
eq(FingerprintManager.ENROLL_FIND_SENSOR),
any());
return callbackCaptor.getValue();
}

View File

@@ -40,6 +40,7 @@ import android.content.res.Resources;
import android.hardware.biometrics.ComponentInfoInternal;
import android.hardware.biometrics.SensorProperties;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintEnrollOptions;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
@@ -52,6 +53,7 @@ import androidx.annotation.Nullable;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.settings.R;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.biometrics.GatekeeperPasswordProvider;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -289,6 +291,18 @@ public class FingerprintEnrollIntroductionTest {
assertThat(mFingerprintEnrollIntroduction.shouldFinishWhenBackgrounded()).isEqualTo(true);
}
@Test
public void testFingerprintEnrollIntroduction_forwardsEnrollOptions() {
final Intent intent = newTokenOnlyIntent();
intent.putExtra(BiometricUtils.EXTRA_ENROLL_REASON,
FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
setupFingerprintEnrollIntroWith(intent);
final Intent enrollingIntent = mFingerprintEnrollIntroduction.getEnrollingIntent();
assertThat(enrollingIntent.getIntExtra(BiometricUtils.EXTRA_ENROLL_REASON, -1))
.isEqualTo(FingerprintEnrollOptions.ENROLL_REASON_SUW);
}
private Intent newTokenOnlyIntent() {
return new Intent()
.putExtra(EXTRA_KEY_CHALLENGE_TOKEN, new byte[] { 1 });