Check FEATURE_FINGERPRINT before trying to getSystemService

Fixes: 65838275

Test: Tested on Ryu/Walleye, the stack trace is not seen anymore
Change-Id: I7b12fdca81d5f2523dea5a981fcf1daa69254eb4
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 7e959a8..a7469cd 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -20,6 +20,7 @@
 import android.app.Application;
 import android.app.KeyguardManager;
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.hardware.fingerprint.FingerprintManager;
 import android.os.Binder;
 import android.os.IBinder;
@@ -762,6 +763,10 @@
     }
 
     private long getFingerprintOnlySid() {
+        final PackageManager packageManager = mContext.getPackageManager();
+        if (!packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
+            return 0;
+        }
         FingerprintManager fingerprintManager = mContext.getSystemService(FingerprintManager.class);
         if (fingerprintManager == null) {
             return 0;