Skip to content

StrictMode Error DiskReadViolation #1127

@EugeneSytnyk

Description

@EugeneSytnyk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions