Refactor FingerprintDialogBoundKeysTest to use BiometricDialog
Since we're renaming FingerprintDialog to BiometricDialog the
associated CTS Verifier test also needs updating. This CL updates the
test and references within it to reflect this.
Bug: 74831038
Test: Verifier test works and registers fingerprints correctly.
Change-Id: I3332a4ed705016987a84077399e081756c28da25
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 3315991..772454e 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -62,6 +62,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
+ <uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
@@ -1000,7 +1001,7 @@
<meta-data android:name="test_required_features" android:value="android.hardware.fingerprint" />
</activity>
- <activity android:name=".security.FingerprintDialogBoundKeysTest"
+ <activity android:name=".security.BiometricDialogBoundKeysTest"
android:label="@string/sec_fingerprint_dialog_bound_key_test"
android:configChanges="keyboardHidden|orientation|screenSize" >
<intent-filter>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/security/FingerprintDialogBoundKeysTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/security/BiometricDialogBoundKeysTest.java
similarity index 80%
rename from apps/CtsVerifier/src/com/android/cts/verifier/security/FingerprintDialogBoundKeysTest.java
rename to apps/CtsVerifier/src/com/android/cts/verifier/security/BiometricDialogBoundKeysTest.java
index 89277dd..af4112e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/security/FingerprintDialogBoundKeysTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/security/BiometricDialogBoundKeysTest.java
@@ -17,17 +17,17 @@
package com.android.cts.verifier.security;
import android.content.DialogInterface;
-import android.hardware.fingerprint.FingerprintDialog;
+import android.hardware.biometrics.BiometricDialog;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.Executor;
-public class FingerprintDialogBoundKeysTest extends FingerprintBoundKeysTest {
+public class BiometricDialogBoundKeysTest extends FingerprintBoundKeysTest {
private DialogCallback mDialogCallback;
- private FingerprintDialog mFingerprintDialog;
+ private BiometricDialog mBiometricDialog;
private CancellationSignal mCancellationSignal;
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -41,14 +41,14 @@
};
private class DialogCallback extends
- FingerprintDialog.AuthenticationCallback {
+ BiometricDialog.AuthenticationCallback {
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
showToast(errString.toString());
}
@Override
- public void onAuthenticationSucceeded(FingerprintDialog.AuthenticationResult result) {
+ public void onAuthenticationSucceeded(BiometricDialog.AuthenticationResult result) {
if (tryEncrypt()) {
showToast("Test passed.");
getPassButton().setEnabled(true);
@@ -62,7 +62,7 @@
protected void showAuthenticationScreen() {
mCancellationSignal = new CancellationSignal();
mDialogCallback = new DialogCallback();
- mFingerprintDialog = new FingerprintDialog.Builder()
+ mBiometricDialog = new BiometricDialog.Builder(getApplicationContext())
.setTitle("Authenticate with fingerprint")
.setNegativeButton("Cancel", mExecutor,
(DialogInterface dialogInterface, int which) -> {
@@ -70,9 +70,9 @@
mHandler.post(mNegativeButtonRunnable);
}
})
- .build(getApplicationContext());
- mFingerprintDialog.authenticate(
- new FingerprintDialog.CryptoObject(getCipher()),
+ .build();
+ mBiometricDialog.authenticate(
+ new BiometricDialog.CryptoObject(getCipher()),
mCancellationSignal, mExecutor, mDialogCallback);
}
}