apptentive / apptentive-android

Apptentive Android SDK
http://www.apptentive.com
BSD 3-Clause "New" or "Revised" License
65 stars 64 forks source link

StrictMode policy violations when initializing Android SDK #159

Closed gmbett closed 1 year ago

gmbett commented 6 years ago

Hi,

When the Android SDK is initialized by

Apptentive.register(context, key, signature);

A lot of issues are detected by strict mode (disk read on UI thread):

StrictMode: StrictMode policy violation; ~duration=26 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:541) at android.app.ContextImpl.getCacheDir(ContextImpl.java:613) at android.content.ContextWrapper.getCacheDir(ContextWrapper.java:283) at com.apptentive.android.sdk.ApptentiveLog.getLogsDirectory(ApptentiveLog.java:135) at com.apptentive.android.sdk.ApptentiveLog.initializeLogWriter(ApptentiveLog.java:36) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:216) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

StrictMode policy violation; ~duration=18 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:541) at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:497) at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:656) at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:374) at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:171) at com.apptentive.android.sdk.ApptentiveInternal.(ApptentiveInternal.java:164) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:229) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

StrictMode policy violation; ~duration=17 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:203) at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:224) at com.apptentive.android.sdk.ApptentiveInternal.getEndpointBase(ApptentiveInternal.java:914) at com.apptentive.android.sdk.ApptentiveInternal.(ApptentiveInternal.java:165) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:229) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

StrictMode policy violation; ~duration=16 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:541) at android.app.ContextImpl.getFilesDir(ContextImpl.java:562) at android.content.ContextWrapper.getFilesDir(ContextWrapper.java:253) at com.apptentive.android.sdk.util.Util.getInternalDir(Util.java:1100) at com.apptentive.android.sdk.ApptentiveInternal.(ApptentiveInternal.java:167) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:229) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

StrictMode policy violation; ~duration=16 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at com.apptentive.android.sdk.util.Util.getInternalDir(Util.java:1102) at com.apptentive.android.sdk.ApptentiveInternal.(ApptentiveInternal.java:167) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:229) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

StrictMode policy violation; ~duration=13 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249) at java.io.File.exists(File.java:780) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:541) at android.app.ContextImpl.getFilesDir(ContextImpl.java:562) at android.content.ContextWrapper.getFilesDir(ContextWrapper.java:253) at com.apptentive.android.sdk.storage.ApptentiveDatabaseHelper.(ApptentiveDatabaseHelper.java:229) at com.apptentive.android.sdk.storage.ApptentiveTaskManager.(ApptentiveTaskManager.java:68) at com.apptentive.android.sdk.ApptentiveInternal.(ApptentiveInternal.java:170) at com.apptentive.android.sdk.ApptentiveInternal.createInstance(ApptentiveInternal.java:229) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:124) at com.apptentive.android.sdk.Apptentive.register(Apptentive.java:106)

Is there any plan to fix these issues ? (I'm using the latest version)

weeeBox commented 6 years ago

Hi @gmbett,

Thanks for finding these issues. We'll fix them in a future release. Stay tuned!

-Alex

alexandru-calinoiu commented 5 years ago

@weeeBox any updates on this issue?

weeeBox commented 5 years ago

Hi @gmbett, @alexandru-calinoiu

Sorry for the delay. We're getting this item triaged and hopefully include the fix into the next release.

alexandru-calinoiu commented 5 years ago

@weeeBox planning a release soon?

weeeBox commented 5 years ago

We're planning to incorporate it in the upcoming release (some time after Google I/O)