Android指纹:hasEnrolledFingerprints在某些三星手机上触发异常 [英] Android Fingerprints: hasEnrolledFingerprints triggers exception on some Samsungs
问题描述
当启用来自Android 6用户的指纹时,我们的生产应用程序中看到很多例外,我无法在任何本地三星设备上复制这些指纹。堆栈跟踪为:
I'm seeing a lot of exceptions in our production app when enabling fingerprints coming from Android 6 users, which I cannot reproduce on any of my local Samsung devices. The stacktrace is:
Message: SecurityException: Permission Denial: getCurrentUser() from pid=24365, uid=10229 requires android.permission.INTERACT_ACROSS_USERS
android.os.Parcel.readException in Parcel.java::1620
android.os.Parcel.readException in Parcel.java::1573
android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints in IFingerprintService.java::503
android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints in FingerprintManager.java::762
android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23.a in SourceFile::39
android.support.v4.hardware.fingerprint.FingerprintManagerCompat$Api23FingerprintManagerCompatImpl.a in SourceFile::239
android.support.v4.hardware.fingerprint.FingerprintManagerCompat.a in SourceFile::66
这只是使用标准的 FingerprintManagerCompat
类从支持库,检查工作c
This is just using the standard FingerprintManagerCompat
class from the support library, and the check works correctly on other devices.
我不想向我的应用添加此权限-似乎与指纹无关。
I don't want to add this permission to my app - it seems to have nothing to do with fingerprints.
有人遇到过类似的事情吗?
Has anyone encountered anything like this?
推荐答案
我在三星Galaxy上遇到了同样的问题S6,运行Android 6.0.1
I came across the same problem on a Samsung Galaxy S6, running Android 6.0.1
问题是由于调用
fingerprintManager.hasEnrolledFingerprints()
我通过添加以下调用来修复它: / p>
I fixed it by adding a call to check for hardware before:
fingerprintManager.isHardwareDetected()
&& mFingerprintManager.hasEnrolledFingerprints()
在没有可用硬件的情况下检查指纹似乎在某些设备上导致此异常。
Checking for fingerprints without the hardware available seems to cause this exception on some devices.
这篇关于Android指纹:hasEnrolledFingerprints在某些三星手机上触发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!