regulaforensics / DocumentReader-Android

Android Framework for reading and validation of identification documents
64 stars 26 forks source link

Sample app - StrictMode policy violation #32

Closed damienlo closed 2 years ago

damienlo commented 3 years ago

Hello,

When implementing the full library I am facing a StrictMode policy violation; This is reproducible with the sample app provided in this repository by simply adding this following Application class.

Application.kt

class DocumentReaderApp : Application() {

    override fun onCreate() {
        super.onCreate()

        StrictMode.setThreadPolicy(
                StrictMode.ThreadPolicy.Builder()
                        .detectCustomSlowCalls()
                        .penaltyLog()
                        .penaltyDeath()
                        .build()
        )
    }
}

Here is the stacktrace of the issue :

D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.regula.documentreader, PID: 14515
    java.lang.RuntimeException: StrictMode ThreadPolicy violation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onThreadPolicyViolation(StrictMode.java:1705)
        at android.os.StrictMode$AndroidBlockGuardPolicy.lambda$handleViolationWithTimingAttempt$0(StrictMode.java:1619)
        at android.os.-$$Lambda$StrictMode$AndroidBlockGuardPolicy$9nBulCQKaMajrWr41SB7f7YRT1I.run(Unknown Source:6)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7050)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
     Caused by: android.os.strictmode.CustomViolation: gcore.dynamite
        at android.os.StrictMode$AndroidBlockGuardPolicy.onCustomSlowCall(StrictMode.java:1471)
        at android.os.StrictMode.noteSlowCall(StrictMode.java:2324)
        at vxt.a(:com.google.android.gms@212116030@21.21.16 (100408-378233385):0)
        at com.google.android.gms.chimera.container.GmsModuleChimeraProvider.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):10)
        at tgf.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):3)
        at android.content.ContentProvider.query(ContentProvider.java:1078)
        at dzs.superQuery(:com.google.android.gms@212116030@21.21.16 (100408-378233385):2)
        at com.google.android.chimera.ContentProvider.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):2)
        at tgf.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):8)
        at android.content.ContentProvider.query(ContentProvider.java:1170)
        at dzs.superQuery(:com.google.android.gms@212116030@21.21.16 (100408-378233385):1)
        at com.google.android.chimera.ContentProvider.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):1)
        at dzs.query(:com.google.android.gms@212116030@21.21.16 (100408-378233385):2)
        at android.content.ContentProvider$Transport.query(ContentProvider.java:241)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:102)
        at android.os.Binder.execTransact(Binder.java:739)
I/Process: Sending signal. PID: 14515 SIG: 9
vyakimchik commented 3 years ago

Hi @damienlo,

Thanks for reporting!

Unfortunately, we haven't managed yet to reproduce what you reported. Could you please send us the project at support@regulaforensics.com where it can be reproduced and describe the steps? Thanks in advance!

damienlo commented 3 years ago

Hi @vyakimchik,

Thank you for your response.I sent an email to support@regulaforensics.com

But just in case, here is the sample project : https://github.com/damienlo/DocumentReader-Android And the commit of interest : https://github.com/damienlo/DocumentReader-Android/commit/b896be952b0ebd116daa5bf81e703339c17b4577

Reproduction steps :

Let me know if you need anything else

vyakimchik commented 3 years ago

Hi @damienlo,

Forgot to let you know that we managed to reproduce the issue, and we are investigating why it occurs. Once we have any news, we'll let you know.

Thanks!

syakimchik commented 2 years ago

Hi @damienlo Fix for this issue will be released in the 6.0 release which is coming soon.