Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fingerprint crash on specific Samsung devices

I've recently released a new app which contains support for authentication via fingerprint.

This has worked fine on all of our test devices:
- OnePlus Three
- OnePlus Five
- Samsung S6 Edge
- Samsung S7
- Samsung S8

But when released, we began 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 are experiencing the crash:
- Galaxy A5
- Galaxy S5 Mini
- Galaxy A3(2016)

All of them are running Android 6.0.1.

Seeing as they're all Samsung devices, I began suspecting that Knox could be the issue, even though it isn't specifically listed anywhere in the stacktrace. But i have no idea on how to work around it, or fix it.

I found a similar issue posted on Samsung's own website, but without a fix:
https://seap.samsung.com/forum-topic/getting-javalangsecurityexception-permission-denial

The permission that's named in the stacktrace is a system permission, which no user apps can get. Only system apps can.

Does anyone have an idea on how to fix this?

like image 924
Moonbloom Avatar asked Nov 10 '17 11:11

Moonbloom


People also ask

Why is my fingerprint sensor not working Samsung?

Inspect the screen and fingerprint sensor for scratches and dirt. Scratches or dirt may cause recognition issues with the fingerprint sensor. The phone may not recognize fingerprints that are affected by wrinkles or scars. Fingers that are particularly small or slim may also not be recognized.

What causes fingerprint sensor to stop working?

Software BugPending updates cause fingerprint sensors to not work properly, install them to keep your phones updated. Moreover, if any issue occurred after software update, please roll-back to the previous OS version. To install important updates follow these steps: Go to the Settings app.

How do you test a fingerprint sensor?

The Enroll a Fingerprint — Scan your finger screen appears. Place your finger on the fingerprint reader and wait until success is confirmed. Ensure the finger you place on the reader matches the finger you chose in the previous step. For each successful enrollment, a number will turn blue starting with 1.


1 Answers

Not sure if you were ever able to find a solution for this, as a workaround I simply wrapped our calls in a permission check.

inline val Activity.fingerprintManager: FingerprintManagerCompat?
  get() = (
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED) {
      FingerprintManagerCompat.from(this)
    } else { null }
  )
like image 74
sschmitz Avatar answered Oct 11 '22 14:10

sschmitz