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

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

Merge "Fix possible NPE in fingerprint service provider" into sc-dev

parents e410f1ff 13c7b270
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -67,7 +67,13 @@ public interface ServiceProvider {
    @NonNull
    List<FingerprintSensorPropertiesInternal> getSensorProperties();

    @NonNull
    /**
     * Returns the internal properties of the specified sensor, if owned by this provider.
     *
     * @param sensorId The ID of a fingerprint sensor, or -1 for any sensor.
     * @return An object representing the internal properties of the specified sensor.
     */
    @Nullable
    FingerprintSensorPropertiesInternal getSensorProperties(int sensorId);

    void scheduleResetLockout(int sensorId, int userId, @Nullable byte[] hardwareAuthToken);
+11 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

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

import static android.hardware.fingerprint.FingerprintManager.SENSOR_ID_ANY;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -240,10 +242,17 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
        return props;
    }

    @NonNull
    @Nullable
    @Override
    public FingerprintSensorPropertiesInternal getSensorProperties(int sensorId) {
        return mSensors.get(sensorId).getSensorProperties();
        if (mSensors.size() == 0) {
            return null;
        } else if (sensorId == SENSOR_ID_ANY) {
            return mSensors.valueAt(0).getSensorProperties();
        } else {
            final Sensor sensor = mSensors.get(sensorId);
            return sensor != null ? sensor.getSensorProperties() : null;
        }
    }

    private void scheduleLoadAuthenticatorIds(int sensorId) {
+1 −1
Original line number Diff line number Diff line
@@ -516,7 +516,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
        return properties;
    }

    @NonNull
    @Nullable
    @Override
    public FingerprintSensorPropertiesInternal getSensorProperties(int sensorId) {
        return mSensorProperties;