Don't access fingerprint service when unavailable
For devices which don't have a fingerprint service, an attempt to get the fingerprint system service creates an Error. We want to avoid this, so we add a check prior to the access. Bug: 174800840 Test: Bugreport on a non-fingerprint device no longer has a "No service published for: fingerprint" Error Change-Id: I2e96e8cb8cc45ab86d0b2bfa9d651c85b58cd0da
This commit is contained in:
@@ -30,6 +30,7 @@ import android.app.admin.DevicePolicyManager;
|
||||
import android.app.trust.ITrustManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.ContentObserver;
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
@@ -809,12 +810,13 @@ public class BiometricService extends SystemService {
|
||||
|
||||
public List<FingerprintSensorPropertiesInternal> getFingerprintSensorProperties(
|
||||
Context context) {
|
||||
final FingerprintManager fpm = context.getSystemService(FingerprintManager.class);
|
||||
if (fpm != null) {
|
||||
return fpm.getSensorPropertiesInternal();
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
|
||||
final FingerprintManager fpm = context.getSystemService(FingerprintManager.class);
|
||||
if (fpm != null) {
|
||||
return fpm.getSensorPropertiesInternal();
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user