Merge "Fix possible NPE in fingerprint service provider" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b318266238
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -516,7 +516,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
return properties;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Nullable
|
||||
@Override
|
||||
public FingerprintSensorPropertiesInternal getSensorProperties(int sensorId) {
|
||||
return mSensorProperties;
|
||||
|
||||
Reference in New Issue
Block a user