Fix BiometricPrompt for face + non-UDFPS fingerprint

Currently, the dual-sensor config for BiometricPrompt requires a face
sensor and under-display fingerprint sensor. This commit loosens the
restriction to also accept non-UDFPS fingerprint sensors. The fallback
logic in this case is the same as for face + UDFPS.

Test: Manually verified that BiometricPrompt no longer crashes

Fixes: 185301549
Change-Id: I8d90e8e10ae64adb29f7d3c7ce51004aa7a6f1b8
This commit is contained in:
Curtis Belmonte
2021-04-21 15:31:36 -07:00
parent 8b7253d316
commit d8bcccb21f
3 changed files with 25 additions and 22 deletions

View File

@@ -14,7 +14,7 @@
~ limitations under the License.
-->
<com.android.systemui.biometrics.AuthBiometricFaceToUdfpsView
<com.android.systemui.biometrics.AuthBiometricFaceToFingerprintView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -22,4 +22,4 @@
<include layout="@layout/auth_biometric_contents"/>
</com.android.systemui.biometrics.AuthBiometricFaceToUdfpsView>
</com.android.systemui.biometrics.AuthBiometricFaceToFingerprintView>

View File

@@ -32,12 +32,12 @@ import android.widget.TextView;
import com.android.systemui.R;
/**
* Manages the layout of an auth dialog for devices with a face sensor and an under-display
* fingerprint sensor (UDFPS). Face authentication is attempted first, followed by fingerprint if
* the initial attempt is unsuccessful.
* Manages the layout of an auth dialog for devices with both a face sensor and a fingerprint
* sensor. Face authentication is attempted first, followed by fingerprint if the initial attempt is
* unsuccessful.
*/
public class AuthBiometricFaceToUdfpsView extends AuthBiometricFaceView {
private static final String TAG = "BiometricPrompt/AuthBiometricFaceToUdfpsView";
public class AuthBiometricFaceToFingerprintView extends AuthBiometricFaceView {
private static final String TAG = "BiometricPrompt/AuthBiometricFaceToFingerprintView";
protected static class UdfpsIconController extends IconController {
protected UdfpsIconController(
@@ -87,20 +87,23 @@ public class AuthBiometricFaceToUdfpsView extends AuthBiometricFaceView {
@BiometricAuthenticator.Modality private int mActiveSensorType = TYPE_FACE;
@Nullable UdfpsDialogMeasureAdapter mMeasureAdapter;
@Nullable private UdfpsIconController mUdfpsIconController;
@Nullable UdfpsDialogMeasureAdapter mUdfpsMeasureAdapter;
public AuthBiometricFaceToUdfpsView(Context context) {
public AuthBiometricFaceToFingerprintView(Context context) {
super(context);
}
public AuthBiometricFaceToUdfpsView(Context context, AttributeSet attrs) {
public AuthBiometricFaceToFingerprintView(Context context, AttributeSet attrs) {
super(context, attrs);
}
void setFingerprintSensorProps(@NonNull FingerprintSensorPropertiesInternal sensorProps) {
if (mMeasureAdapter == null || mMeasureAdapter.getSensorProps() != sensorProps) {
mMeasureAdapter = new UdfpsDialogMeasureAdapter(this, sensorProps);
if (!sensorProps.isAnyUdfpsType()) {
return;
}
if (mUdfpsMeasureAdapter == null || mUdfpsMeasureAdapter.getSensorProps() != sensorProps) {
mUdfpsMeasureAdapter = new UdfpsDialogMeasureAdapter(this, sensorProps);
}
}
@@ -140,8 +143,8 @@ public class AuthBiometricFaceToUdfpsView extends AuthBiometricFaceView {
@NonNull
AuthDialog.LayoutParams onMeasureInternal(int width, int height) {
final AuthDialog.LayoutParams layoutParams = super.onMeasureInternal(width, height);
return mMeasureAdapter != null
? mMeasureAdapter.onMeasureInternal(width, height, layoutParams)
return mUdfpsMeasureAdapter != null
? mUdfpsMeasureAdapter.onMeasureInternal(width, height, layoutParams)
: layoutParams;
}
}

View File

@@ -348,14 +348,14 @@ public class AuthContainerView extends LinearLayout
}
}
if (fingerprintSensorProps != null && fingerprintSensorProps.isAnyUdfpsType()) {
final AuthBiometricFaceToUdfpsView faceToUdfpsView =
(AuthBiometricFaceToUdfpsView) factory.inflate(
R.layout.auth_biometric_face_to_udfps_view, null, false);
faceToUdfpsView.setFingerprintSensorProps(fingerprintSensorProps);
mBiometricView = faceToUdfpsView;
if (fingerprintSensorProps != null) {
final AuthBiometricFaceToFingerprintView faceToFingerprintView =
(AuthBiometricFaceToFingerprintView) factory.inflate(
R.layout.auth_biometric_face_to_fingerprint_view, null, false);
faceToFingerprintView.setFingerprintSensorProps(fingerprintSensorProps);
mBiometricView = faceToFingerprintView;
} else {
Log.e(TAG, "Fingerprint must be UDFPS for dual-sensor config");
Log.e(TAG, "Fingerprint props not found for sensor ID: " + fingerprintSensorId);
mBiometricView = null;
mBackgroundView = null;
mBiometricScrollView = null;