Merge "Update settings tests with biometric component info" into sc-dev

This commit is contained in:
Haining Chen
2021-03-19 03:49:10 +00:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ import android.app.Activity;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.hardware.biometrics.ComponentInfoInternal;
import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.SensorProperties;
import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorProperties;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
@@ -53,6 +54,7 @@ import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowKeyguardManager; import org.robolectric.shadows.ShadowKeyguardManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
@Config(shadows = { @Config(shadows = {
@@ -70,10 +72,19 @@ public class FingerprintSuggestionActivityTest {
Shadows.shadowOf(application.getPackageManager()) Shadows.shadowOf(application.getPackageManager())
.setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true); .setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true);
final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */,
"vendor/model/revision" /* hardwareVersion */, "1.01" /* firmwareVersion */,
"00000001" /* serialNumber */, "" /* softwareVersion */));
componentInfo.add(new ComponentInfoInternal("matchingAlgorithm" /* componentId */,
"" /* hardwareVersion */, "" /* firmwareVersion */, "" /* serialNumber */,
"vendor/version/revision" /* softwareVersion */));
final FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal( final FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal(
0 /* sensorId */, 0 /* sensorId */,
SensorProperties.STRENGTH_STRONG, SensorProperties.STRENGTH_STRONG,
5 /* maxEnrollmentsPerUser */, 5 /* maxEnrollmentsPerUser */,
componentInfo,
FingerprintSensorProperties.TYPE_REAR, FingerprintSensorProperties.TYPE_REAR,
true /* resetLockoutRequiresHardwareAuthToken */); true /* resetLockoutRequiresHardwareAuthToken */);
final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>();

View File

@@ -24,8 +24,8 @@ import static org.robolectric.RuntimeEnvironment.application;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.hardware.biometrics.ComponentInfoInternal;
import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.SensorProperties;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorProperties;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.view.View; import android.view.View;
@@ -59,6 +59,7 @@ import org.robolectric.shadows.ShadowActivity.IntentForResult;
import org.robolectric.shadows.ShadowKeyguardManager; import org.robolectric.shadows.ShadowKeyguardManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
@Config(shadows = { @Config(shadows = {
@@ -76,10 +77,19 @@ public class SetupFingerprintEnrollIntroductionTest {
Shadows.shadowOf(application.getPackageManager()) Shadows.shadowOf(application.getPackageManager())
.setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true); .setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true);
final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */,
"vendor/model/revision" /* hardwareVersion */, "1.01" /* firmwareVersion */,
"00000001" /* serialNumber */, "" /* softwareVersion */));
componentInfo.add(new ComponentInfoInternal("matchingAlgorithm" /* componentId */,
"" /* hardwareVersion */, "" /* firmwareVersion */, "" /* serialNumber */,
"vendor/version/revision" /* softwareVersion */));
final FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal( final FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal(
0 /* sensorId */, 0 /* sensorId */,
SensorProperties.STRENGTH_STRONG, SensorProperties.STRENGTH_STRONG,
5 /* maxEnrollmentsPerUser */, 5 /* maxEnrollmentsPerUser */,
componentInfo,
FingerprintSensorProperties.TYPE_REAR, FingerprintSensorProperties.TYPE_REAR,
true /* resetLockoutRequiresHardwareAuthToken */); true /* resetLockoutRequiresHardwareAuthToken */);
final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>();