Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StrictMode Error DiskReadViolation #1127

Open
EugeneSytnyk opened this issue Aug 23, 2024 · 2 comments
Open

StrictMode Error DiskReadViolation #1127

EugeneSytnyk opened this issue Aug 23, 2024 · 2 comments

Comments

@EugeneSytnyk
Copy link

EugeneSytnyk commented Aug 23, 2024

Braintree SDK Version

4.49.1

Environment

Sandbox

Android Version & Device

Target SDK: 34
Compile SDK: 34
Device: Any

Braintree dependencies

com.braintreepayments.api:card:4.49.1
com.braintreepayments.api:paypal:4.49.1
com.braintreepayments.api:google-pay:4.49.1
com.braintreepayments.api:three-d-secure:4.49.1

Describe the bug

There is a disk access in the main thread. This provokes android.os.strictmode.DiskReadViolation error

Stack trace:
java.lang.Error: android.os.strictmode.DiskReadViolation
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1173)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.os.strictmode.DiskReadViolation
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
at libcore.io.BlockGuardOs.access(BlockGuardOs.java:71)
at libcore.io.ForwardingOs.access(ForwardingOs.java:72)
at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:7533)
at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:281)
at java.io.File.exists(File.java:815)
at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:681)
at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:672)
at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:628)
at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:853)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:475)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:188)
at com.braintreepayments.api.PersistentStore.get(PersistentStore.java:24)
at com.braintreepayments.api.BrowserSwitchPersistentStore.getActiveRequest(BrowserSwitchPersistentStore.java:33)
at com.braintreepayments.api.BrowserSwitchClient.getResult(BrowserSwitchClient.java:162)
at com.braintreepayments.api.BraintreeClient.getBrowserSwitchResult(BraintreeClient.kt:371)
at com.braintreepayments.api.PayPalClient.getBrowserSwitchResult(PayPalClient.java:388)
at com.braintreepayments.api.PayPalLifecycleObserver$1.run(PayPalLifeCycleObserver.java:62)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)

To reproduce

  1. Perform PayPal payment
  2. An error appears

Expected behavior

There is no DiskReadViolation error

Screenshots

No response

@sshropshire
Copy link
Contributor

Hi @EugeneSytnyk thanks for using the Braintree SDK for Android. Are you able to reproduce this 100%? Also what version of Android are you using?

@EugeneSytnyk
Copy link
Author

Hi @EugeneSytnyk thanks for using the Braintree SDK for Android. Are you able to reproduce this 100%? Also what version of Android are you using?

Yes, this is reproduced 100% of the time. Of course, with StrictMode enabled. I tried Android versions 26, 30, 33. But I’m sure that it can be reproduced on any Android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants