stripe / stripe-terminal-android

Stripe Terminal Android SDK
https://stripe.dev/stripe-terminal-android/
Other
93 stars 45 forks source link

Crash occurs when discovering Tap to Pay (localmobile) readers targeting API level 35 on Android 15 devices #479

Closed sjl-stripe closed 1 week ago

sjl-stripe commented 3 months ago

Summary

On Android devices targeting API level 35 (Android 15), a native crash occurs on Android 15 devices during the discovery process for Tap to Pay (localmobile) readers. This crash prevents the detection of localmobile readers, resulting in no available readers for connection.

...
Cmdline: com.stripe.terminal.testapp:stripelocalmobile
2024-07-30 15:40:43.260 23489-23489 DEBUG crash_dump64 A pid: 23465, tid: 23485, name: Thread-5 >>> com.stripe.terminal.testapp:stripelocalmobile <<<
2024-07-30 15:40:43.260 23489-23489 DEBUG crash_dump64 A #03 pc 000000000007b248 /data/app/~~-khKdAHFBnRNZVGrE_yPrQ==/com.stripe.terminal.testapp-wfh7ybCveRWM0J0J_y8f3w==/base.apk!libsecurepin_.so (offset 0xffc000) (BuildId: 8fb6c34684042f67db1593acb2f04f90bd7a00be)
2024-07-30 15:40:45.164 23497-23517 ripelocalmobile zygote64 A runtime.cc:708] native: #02 pc 000789d8 /data/app/~~-khKdAHFBnRNZVGrE_yPrQ==/com.stripe.terminal.testapp-wfh7ybCveRWM0J0J_y8f3w==/base.apk (offset ffc000) (???) (BuildId: 8fb6c34684042f67db1593acb2f04f90bd7a00be)
runtime.cc:708] native: #03 pc 00095624 /data/app/~~-khKdAHFBnRNZVGrE_yPrQ==/com.stripe.terminal.testapp-wfh7ybCveRWM0J0J_y8f3w==/base.apk (offset ffc000) (???) (BuildId: 8fb6c34684042f67db1593acb2f04f90bd7a00be)
runtime.cc:708] native: #04 pc 0009dcec /data/app/~~-khKdAHFBnRNZVGrE_yPrQ==/com.stripe.terminal.testapp-wfh7ybCveRWM0J0J_y8f3w==/base.apk (offset ffc000) (Java_securepin_1_Loader_l+384) (BuildId: 8fb6c34684042f67db1593acb2f04f90bd7a00be)
runtime.cc:708] native: #05 pc 00379170 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 31eac738ce2c7ea2458e525c9212337b)
runtime.cc:708] native: #06 pc 0077e588 /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 31eac738ce2c7ea2458e525c9212337b)
runtime.cc:708] native: #07 pc 01537d78 /data/app/~~-khKdAHFBnRNZVGrE_yPrQ==/com.stripe.terminal.testapp-wfh7ybCveRWM0J0J_y8f3w==/oat/arm64/base.vdex (com.whitecryption.securepin.SecurePinAssets.<clinit>+16)
...

Impacted devices (Android devices or readers)

Android 15 devices.

SDK version

The issue has been identified on SDK 3.8.0, and it likely impacts older versions of the SDK.

TatsuUkraine commented 1 month ago

I have crashes on builds targeting sdk 34 after update to v3.8

ivantespass commented 1 week ago

We also are facing crashes targeting API Level 34 after update to v3.8 (it seems that reader is discovered and connected, then app crashes)

With v3.9 and v3.10 we are facing an error instead, maybe related to this issue (?)

> 2024-10-29 10:42:16.487 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - Trace >> [STRIPE TERMINAL] Local Discovery timeout
> 2024-10-29 10:42:16.489 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - Trace >> [STRIPE TERMINAL] Discovery ErrorCode: LOCAL_MOBILE_UNSUPPORTED_DEVICE
> 2024-10-29 10:42:16.489 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - Trace >> [STRIPE TERMINAL] Discovery ErrorMessage: Localmobile reader not operating in secure process
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - Error >> reader_discover_error
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - Exception >> 
>                                                                                                       --- End of managed Com.Stripe.Stripeterminal.External.Models.TerminalException stack trace ---
>                                                                                                     com.stripe.stripeterminal.external.models.TerminalException: Localmobile reader not operating in secure process
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.checkAndThrowCotsError(CotsAdapter.kt:627)
>                                                                                                       at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.access$checkAndThrowCotsError(CotsAdapter.kt:83)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$DiscoverReadersOperation.execute(CotsAdapter.kt:709)
>                                                                                                       at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$DiscoverReadersOperation.execute(CotsAdapter.kt:701)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.discoverReaders(CotsAdapter.kt:514)
>                                                                                                       at com.stripe.stripeterminal.internal.common.adapter.ProxyAdapter.discoverReaders(ProxyAdapter.kt:259)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$DiscoverReadersOperation.executeIfNotCanceled(TerminalSession.kt:2439)
>                                                                                                       at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CancelableOperation.execute(TerminalSession.kt:1319)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:1274)
>                                                                                                       at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:1089)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0)
>                                                                                                       at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
>                                                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:264)
>                                                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>                                                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I     at java.lang.Thread.run(Thread.java:1012)
> 2024-10-29 10:42:16.490 19220-19823 DOTNET                  net.mycompany.myapp             I  LOG - >> Errore discovering readers: Localmobile reader not operating in secure process

I clarify that we are using MAUI and Java Binding Project to wrap Stripe Terminal Android SDK: with v3.7.1 we don't get any error or exception and all works as excepted both in develop and release mode, both with simulated and non-simulated readers.

If it can be useful, error seems also related to a workaround used in MAUI to correctly define and declare :stripelocalmobile inner SDK process, in our autogenerated manifest:

[Service(Process = ":stripelocalmobile")] public class DummyService : Service { }

Above code snippet is inserted in our code to resolve this open issue (with v3.7.1 all works as excepted): https://github.com/dotnet/android/issues/8675

Is it possible that something changed related to that process management, between v3.7.1 and latest ones? Any ideas?

sjl-stripe commented 1 week ago

Hi @ivantespass could you open a new ticket for this? It appears that the issue you're facing isn't specifically a problem with targeting Android 15 devices.

sjl-stripe commented 1 week ago

Upgrade to SDK version 3.10.0 or 4.0.0 and above to target Android 15 devices.