Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f98f30b6 authored by Curtis Belmonte's avatar Curtis Belmonte Committed by Android (Google) Code Review
Browse files

Merge "Fix BiometricPrompt for face + non-UDFPS fingerprint" into sc-dev

parents e82b66e2 d8bcccb2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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>
 No newline at end of file
</com.android.systemui.biometrics.AuthBiometricFaceToFingerprintView>
 No newline at end of file
+16 −13
Original line number Diff line number Diff line
@@ -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;
    }
}
+7 −7
Original line number Diff line number Diff line
@@ -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;