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

Commit 3e8964d4 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

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
parent 089d0f68
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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,13 +810,14 @@ public class BiometricService extends SystemService {

        public List<FingerprintSensorPropertiesInternal> getFingerprintSensorProperties(
                Context context) {
            if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
                final FingerprintManager fpm = context.getSystemService(FingerprintManager.class);
                if (fpm != null) {
                    return fpm.getSensorPropertiesInternal();
            } else {
                return new ArrayList<>();
                }
            }
            return new ArrayList<>();
        }
    }

    /**