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

Commit 72411548 authored by Wenhui Yang's avatar Wenhui Yang Committed by Android (Google) Code Review
Browse files

Merge "Fix ServiceNotFoundException when face/fp feature not available" into main

parents 17d10609 1e0084bb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ public class AuthenticationStatsCollector {

    @NonNull private final Context mContext;
    @NonNull private final PackageManager mPackageManager;
    @NonNull private final FaceManager mFaceManager;
    @NonNull private final FingerprintManager mFingerprintManager;
    @Nullable private final FaceManager mFaceManager;
    @Nullable private final FingerprintManager mFingerprintManager;

    private final boolean mEnabled;
    private final float mThreshold;
@@ -197,11 +197,11 @@ public class AuthenticationStatsCollector {
    }

    private boolean hasEnrolledFace(int userId) {
        return mFaceManager.hasEnrolledTemplates(userId);
        return mFaceManager != null && mFaceManager.hasEnrolledTemplates(userId);
    }

    private boolean hasEnrolledFingerprint(int userId) {
        return mFingerprintManager.hasEnrolledTemplates(userId);
        return mFingerprintManager != null && mFingerprintManager.hasEnrolledTemplates(userId);
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -271,6 +271,7 @@ public class AuthenticationStatsCollectorTest {
                .thenReturn(true);
        when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(false);
        when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
        when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(null);

        mAuthenticationStatsCollector.authenticate(USER_ID_1, false /* authenticated */);