smstuebe / xamarin-fingerprint

Xamarin and MvvMCross plugin for authenticate a user via fingerprint sensor
Microsoft Public License
494 stars 118 forks source link

Samsung - `UnsupportedOperationException` when trying `GetAvailabilityAsync()` #70

Closed kspearrin closed 7 years ago

kspearrin commented 7 years ago

On occasion I am seeing the following crashes from older Samsung devices that I imagine don't have fingerprint available on them.

This results from doing a simple GetAvailabilityAsync() check.

Full implementation here: https://github.com/bitwarden/mobile


Steps to reproduce

  1. Using a SM-N930F or SM-G900A device

  2. Use fingerprint library

  3. Observe crash

Expected behavior

Working.

Actual behavior

UnsupportedOperationException is thrown

Crashlog

Package: com.x8bit.bitwarden
Version Code: 852
Version Name: 1.7.0
Android: 6.0.1
Android Build: Phronesis.N930FXXU1BPH6.v6.0
Manufacturer: samsung
Model: SM-N930F
Thread: main-1
CrashReporter Key: 3B3A6208-F25F-A320-A77A-774A3FF05BFFDB3C54BE
Start Date: Sun Jul 02 22:00:44 GMT+08:00 2017
Date: Sun Jul 02 22:00:46 GMT+08:00 2017
Format: Xamarin

java.lang.UnsupportedOperationException: Fingerprint Service is not running on the device.
    at com.samsung.android.sdk.pass.SpassFingerprint.i(Unknown Source)
    at com.samsung.android.sdk.pass.SpassFingerprint.hasRegisteredFinger(Unknown Source)
    at md5fb78b69c5ddbc157f4db38fd738139a6.MainActivity.n_onCreate(Native Method)
    at md5fb78b69c5ddbc157f4db38fd738139a6.MainActivity.onCreate(MainActivity.java:35)
    at android.app.Activity.performCreate(Activity.java)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.access$1100(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
Xamarin caused by: Java.Lang.UnsupportedOperationException: Fingerprint Service is not running on the device.
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <bcd8240d7af947609bc90217da665031>:0 
  at Android.Runtime.JNIEnv.CallBooleanMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <710066b47c0b4a28b2bb67cc962e7328>:0 
  at Com.Samsung.Android.Sdk.Pass.SpassFingerprint.get_HasRegisteredFinger () [0x00043] in <c401134bc4aa49e195a02b0d60947f25>:0 
  at Plugin.Fingerprint.Samsung.SamsungFingerprintImplementation+<GetAvailabilityAsync>d__10.MoveNext () [0x0002b] in <78e4b9aa0c8d4f078d4506534f8aba13>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at Bit.App.Pages.SettingsPage+<Init>d__71.MoveNext () [0x00115] in <2ae4bcaf271347088de12e67efc1a580>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <1a74e27b71bf49d282fbe0caed059475>:0 
  at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <710066b47c0b4a28b2bb67cc962e7328>:0 
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <710066b47c0b4a28b2bb67cc962e7328>:0 
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <710066b47c0b4a28b2bb67cc962e7328>:0 
  at (wrapper dynamic-method) System.Object:fc55742f-aba2-4e7a-a4be-8875c5de4a81 (intptr,intptr)
  --- End of managed Java.Lang.UnsupportedOperationException stack trace ---
java.lang.UnsupportedOperationException: Fingerprint Service is not running on the device.
    at com.samsung.android.sdk.pass.SpassFingerprint.i(Unknown Source)
    at com.samsung.android.sdk.pass.SpassFingerprint.hasRegisteredFinger(Unknown Source)
    at md5fb78b69c5ddbc157f4db38fd738139a6.MainActivity.n_onCreate(Native Method)
    at md5fb78b69c5ddbc157f4db38fd738139a6.MainActivity.onCreate(MainActivity.java:35)
    at android.app.Activity.performCreate(Activity.java)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.access$1100(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)

Configuration

Version of the Plugin: 1.4.4

Platform: Android 5.0 and Android 6.0.1

Device: SM-N930F, SM-G900A

smsissuechecker commented 7 years ago

Hi @kspearrin,

I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.

smstuebe commented 7 years ago

related to #53

smstuebe commented 7 years ago

Hmm weird.... I'm checking the availability as documented: http://img-developer.samsung.com/onlinedocs/sms/pass/com/samsung/android/sdk/pass/Spass.html#isFeatureEnabled-int-

The described behavior would mean Samsung isn't fulfilling their own API contract -.-

I double checked your devices. They seem to have a sensor. I'll just add a try/catch.

kspearrin commented 7 years ago

After all the edge cases I've see in Android, I'm not surprised.

smstuebe commented 7 years ago

Tested it on multiple Devices on mobile center. It only fails on a Galaxy Neo as in #53.

image

I'll fix i, soon.

smstuebe commented 7 years ago

Should be fixed in 1.4.5

image

smstuebe commented 7 years ago

no feedback = good feedback -> close

kspearrin commented 7 years ago

I'll update for our next release and let you know if I still see the issue. Thanks.