smstuebe / xamarin-fingerprint

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

java.lang.IllegalStateException: No Identify request. on certain Samsung devices #75

Closed ZoranBebic closed 6 years ago

ZoranBebic commented 6 years ago

This is the callstack from certain Samsung devices (SM-G925F, SM-G950F, SM-G920F and SM-G930F) and I wish I could provide more information. The culprit seems to be this method (call to _spassFingerprint.CancelIdentify()) in your code...

Plugin version was 1.4.4

public override async Task AuthenticateNoDialogAsync(IAuthenticationFailedListener failedListener, CancellationToken cancellationToken) { using (cancellationToken.Register(() => _spassFingerprint.CancelIdentify())) { var identifyListener = new IdentifyListener(StartIdentify, failedListener); return await identifyListener.GetTask(); } }

ExceptionDispatchInfo.Throw () 2 JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) 3 JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod) 4 SpassFingerprint.CancelIdentify () 5 SamsungFingerprintImplementation.b__8_0 () 6 CancellationToken.ActionToActionObjShunt (System.Object obj) 7 CancellationCallbackInfo.ExecutionContextCallback (System.Object obj) 8 ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) 9 ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) 10 ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) 11 CancellationCallbackInfo.ExecuteCallback () 12 CancellationTokenSource.CancellationCallbackCoreWork (System.Threading.CancellationCallbackCoreWorkArguments args) 13 CancellationTokenSource.ExecuteCallbackHandlers (System.Boolean throwOnFirstException) 14 java.lang.IllegalStateException: No Identify request. 15 com.samsung.android.sdk.pass.SpassFingerprint.cancelIdentify(Unknown Source) 16 md525b98c9e7858a0d16b65a6f8fc5afe38.FingerprintDialogFragment.n_onPause(Native Method) 17 md525b98c9e7858a0d16b65a6f8fc5afe38.FingerprintDialogFragment.onPause(FingerprintDialogFragment.java:52) 18 android.app.Fragment.performPause(Fragment.java:2485) 19 android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035) 20 android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1164) 21 android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1146) 22 android.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:1989) 23 android.app.FragmentController.dispatchPause(FragmentController.java:186) 24 android.app.Activity.performPause(Activity.java:7054) 25 android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1340) 26 android.app.ActivityThread.performPauseActivity(ActivityThread.java:4650) 27 android.app.ActivityThread.performPauseActivity(ActivityThread.java:4623) 28 android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4598) 29 android.app.ActivityThread.access$1300(ActivityThread.java:229) 30 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832) 31 android.os.Handler.dispatchMessage(Handler.java:102) 32 android.os.Looper.loop(Looper.java:148) 33 android.app.ActivityThread.main(ActivityThread.java:7325) 34 java.lang.reflect.Method.invoke(Native Method) 35 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 36 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

smsissuechecker commented 6 years ago

Hi @ZoranBebic,

I'm the friendly issue checker. It seems like (100.00 %) you haven't used our issue template :cry: I think it is very frustrating for the repository owners, if you ignore them.

If you think it's fine to make an exception, just ignore this message. But if you think it was a mistake to delete the template, please close the issue and create a new one.

Thanks!

smstuebe commented 6 years ago

Can you please post the exception message as well? How do I reproduce this error?

ZoranBebic commented 6 years ago

Exception message is in the title of the thread.

To reproduce I guess you will need access to one of above mentioned devices and you only need query for fingerprint availability with your method and initiate fingerprint scan.

Based on details I have I cannot precisely give steps to reproduce but I can tell you the only thing we do in code is check if fingerprint is available then initiate scan (user can either scan or cancel scanning). I have no details which of your methods carries the flow to the problematic method where it crashes (which I exposed above)

_spassFingerprint.CancelIdentify() in Samsung implementation will crash, this much is evident from the stack trace. The reason why it crashes might be hard to pinpoint. I would try to exception guard this part of the code even if it does crash it shouldn't bubble up and bring the app down.

smstuebe commented 6 years ago

Ok. I currently have two Samsung devices. Let's hope I can reproduce it. Please use the Issue template next time!

ZoranBebic commented 6 years ago

I was finally able to obtain some screenshots from a crash to help resolve this issue.

On the other side, I have provided a specific line of your code that would need exception handling, weren't you able to implement that so far?

https://ibb.co/huhu6k https://ibb.co/inwMmk

smstuebe commented 6 years ago

@ZoranBebic can you try 1.4.6-beta2 ?

ZoranBebic commented 6 years ago

I've incorporated 1.4.6-beta2 into our latest build and so far so good on my device. Will be releasing this into the wild in the next couple of days and report back how it behaves.

smstuebe commented 6 years ago

Thanks for the feedback. I'll leave the issue open for 2 more weeks and looking forward to hear your experiences :)

smstuebe commented 6 years ago

no (error-) feedback is good feedback -> close.