adyen-3ds2-android icon indicating copy to clipboard operation
adyen-3ds2-android copied to clipboard

DiskReadViolation at AppUpgradeBroadcastReceiver

Open fcduarte opened this issue 1 year ago • 4 comments

Describe the bug Enabling disk violations with Strict Mode makes the Adyen SDK to report an issue at AppUpgradeBroadcastReceiver

StrictMode policy violation; ~duration=2ms: android.os.strictmode.DiskReadViolation
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1658)
at libcore.io.BlockGuardOs.access(BlockGuardOs.java:74)
at libcore.io.ForwardingOs.access(ForwardingOs.java:128)
at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:7749)
at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:281)
at java.io.File.exists(File.java:813)
at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:759)
at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:750)
at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:706)
at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:931)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:553)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:217)
at atd.m0.b.a(Unknown Source:3)
at com.adyen.threeds2.internal.e.b(Unknown Source:2)
at com.adyen.threeds2.internal.e.<init>(Unknown Source:5)
at com.adyen.threeds2.internal.e.a(Unknown Source:1)
at com.adyen.threeds2.internal.AppUpgradeBroadcastReceiver.onReceive(Unknown Source:3)

To Reproduce Steps to reproduce the behavior:

  1. Enable disk violations with Strict Mode:
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
             .detectDiskReads()
             .detectDiskWrites()
             .detectNetwork()   // or .detectAll() for all detectable problems
             .penaltyLog()
             .build());
  1. Run an app integrated with Adyen SDK
  2. See error at logcat

Expected behavior To avoid ANRs and OOM errors, ideally this shouldn't happen

Screenshots N/A

Desktop (please complete the following information): OS: Android Browser: N/A Version: Adyen Android SDK 4.12.1

Smartphone (please complete the following information): Device: emulator OS: 13 Browser: N/A Version Adyen Android SDK 4.12.1

Additional context N/A

fcduarte avatar Aug 30 '23 14:08 fcduarte

@fcduarte Thank you for reporting this. Our team will look into it and get back to you as soon as we know more.

fdcb avatar Aug 31 '23 12:08 fdcb

@fcduarte I haven't managed to bump into this warning. Could you give me more details on how to replicate it? Does it happen with every transaction, regardless of what challenge is triggered?

fdcb avatar Sep 08 '23 08:09 fdcb

Hey @fdcb, yeah this is tough. I noticed one time in the logs but I can't reproduce every time. Considering the name of the broadcast receiver, maybe it was when you install a new version APK on top of a previous one?

fcduarte avatar Sep 08 '23 13:09 fcduarte

@fcduarte Yes that would indeed be the only use case were we would run into this warning. It is also not very impactful. We will update this issue once we release a version that addresses this issue.

fdcb avatar Sep 11 '23 12:09 fdcb

@fcduarte The newest version (2.2.20) no longer has this DiskReadViolation.

Once again, thank you for reporting 😊

fdcb avatar Sep 11 '24 08:09 fdcb