Fingerprint Failure on Some Samsung Devices

I recently released a new application that contains fingerprint authentication support.

This works great on all of our test devices:
 - OnePlus Three
 - OnePlus Five
 - Samsung S6 Edge
 - Samsung S7
 - Samsung S8

But when released, we started getting crashes from Fabric with this stack trace:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.our.app/com.our.app.ui.LoginActivity}: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
       at android.app.ActivityThread.access$1100(ActivityThread.java:229)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7325)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
       at android.os.Parcel.readException(Parcel.java:1620)
       at android.os.Parcel.readException(Parcel.java:1573)
       at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints(IFingerprintService.java:503)
       at android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints(FingerprintManager.java:776)
       at com.our.app.fingerprint.handler.FingerprintHandler.canUseFingerprint(SourceFile:65)
       at com.our.app.Client.canUseFingerprint(SourceFile:335)
       at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:501)
       at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:472)
       at com.our.app.ui.LoginActivity.continueWithOnCreateLogic(SourceFile:399)
       at com.our.app.ui.LoginActivity.onCreate(SourceFile:321)
       at android.app.Activity.performCreate(Activity.java:6904)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
       at android.app.ActivityThread.access$1100(ActivityThread.java:229)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7325)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

According to Fabric, these devices crash:
- Galaxy A5
- Galaxy S5 Mini
- Galaxy A3 (2016)

All of them are running Android 6.0.1.

Seeing that all Samsung devices, I began to suspect that Knox could be a problem, although it is not listed anywhere on the stack. But I do not know how to get around this or fix it.

, - Samsung, :
https://seap.samsung.com/forum-topic/getting-javalangsecurityexception-permission-denial

, stacktrace, , . .

- , ?

+4
1

, - , .

inline val Activity.fingerprintManager: FingerprintManagerCompat?
  get() = (
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED) {
      FingerprintManagerCompat.from(this)
    } else { null }
  )
0

Source: https://habr.com/ru/post/1689055/


All Articles