matomo-org / matomo-sdk-android

SDK for Android to measure your apps with Matomo. Works on Android phones, tablets, Fire TV sticks, and more!
BSD 3-Clause "New" or "Revised" License
386 stars 163 forks source link

Strict violations #434

Open hannesa2 opened 9 months ago

hannesa2 commented 9 months ago

When I use strict mode observation, then I detect a lot of them in this library. Unfortunately strict mode violations are not observed in CI test.

hannesa2 commented 9 months ago

Hmm, after introduce some smoke tests in CI and using same strict mode finds a lot locally but not on CI

image

StrictMode policy violation; ~duration=5 ms: 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.getDataDir(ContextImpl.java:2539)
   at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:626)
   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 org.matomo.sdk.Matomo.<init>(Matomo.kt:36)
   at org.matomo.sdk.Matomo.<init>(Unknown Source:0)
   at org.matomo.sdk.Matomo$Companion.getInstance(Matomo.kt:74)
   at org.matomo.sdk.Matomo.getInstance(Unknown Source:5)
   at org.matomo.sdk.extra.MatomoApplication.getMatomo(MatomoApplication.java:20)
   at org.matomo.sdk.extra.MatomoApplication.getTracker(MatomoApplication.java:29)
   at org.matomo.demo.DemoApp.onInitTracker(DemoApp.kt:54)
   at org.matomo.demo.DemoApp.onCreate(DemoApp.kt:37)
   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
   at android.app.ActivityThread.access$1300(ActivityThread.java:237)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
   at android.os.Handler.dispatchMessage(Handler.java:106)