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

Commit 199d469f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix NullPointerException in getAuthenticatorId when ID is missing"

parents 83d14224 1c5fee63
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -482,7 +482,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {

    @Override
    public long getAuthenticatorId(int sensorId, int userId) {
        return mAuthenticatorIds.get(userId);
        return mAuthenticatorIds.getOrDefault(userId, 0L);
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -682,7 +682,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider

    @Override
    public long getAuthenticatorId(int sensorId, int userId) {
        return mAuthenticatorIds.get(userId);
        return mAuthenticatorIds.getOrDefault(userId, 0L);
    }

    @Override
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.biometrics.sensors.face.hidl;

import static junit.framework.Assert.assertEquals;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -75,6 +77,12 @@ public class Face10Test {
        mBinder = new Binder();
    }

    @Test
    public void getAuthenticatorId_doesNotCrashWhenIdNotFound() {
        assertEquals(0, mFace10.getAuthenticatorId(0 /* sensorId */, 111 /* userId */));
        waitForIdle();
    }

    @Test
    public void scheduleRevokeChallenge_doesNotCrash() {
        mFace10.scheduleRevokeChallenge(0 /* sensorId */, 0 /* userId */, mBinder, TAG,
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.biometrics.sensors.fingerprint.hidl;

import static junit.framework.Assert.assertEquals;

import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -84,6 +86,12 @@ public class Fingerprint21Test {
                mHalResultController);
    }

    @Test
    public void getAuthenticatorId_doesNotCrashWhenIdNotFound() {
        assertEquals(0, mFingerprint21.getAuthenticatorId(0 /* sensorId */, 111 /* userId */));
        waitForIdle();
    }

    @Test
    public void halServiceDied_resetsScheduler() {
        // It's difficult to test the linkToDeath --> serviceDied path, so let's just invoke