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

Address pre-existing StrictMode violations #1328

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Jul 22, 2021

Goal

Addresses some pre-existing StrictMode violations by moving affected code onto background threads where possible, and only calling Future#get() when the result is absolutely required.

Changeset

  • Altered various storage setup methods to avoid unnecessary calls (e.g. DeviceIdStore no longer calls file.exists() as file.createNewFile() is sufficient)
  • Altered ImmutableConfig so that persistenceDirectory is a lazy property. This avoids calling context#getCacheDir() on the main thread
  • Simplified the Client constructor by extracting the construction and configuration of objects into related DependencyModules which form a dependency graph. These make it simpler to run I/O on background threads and also lay the framework for greater dependency injection in future.
  • Altered device.freeDisk calculation to run on IO thread
  • Set a traffic stats tag on network requests
  • Loaded plugins on a background thread

Testing

Relied on existing test coverage. Confirmed the strictmode violations are resolved by enabling all penalties in the example app.

@fractalwrench fractalwrench changed the title Plat 7027/refactor strictmode violations Address pre-existing StrictMode violations Jul 22, 2021
@fractalwrench fractalwrench force-pushed the PLAT-7027/refactor-strictmode-violations branch 7 times, most recently from 4791839 to b4b8eeb Compare July 22, 2021 14:34
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Jul 22, 2021

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1519.47 1409.46
arm64_v8a 410.3 299.71
armeabi 389.81 279.22
armeabi_v7a 373.44 262.85
x86 447.14 336.55
x86_64 430.77 320.18

Generated by 🚫 Danger

@fractalwrench fractalwrench force-pushed the PLAT-7027/refactor-strictmode-violations branch from b4b8eeb to de220a4 Compare July 22, 2021 15:50
@fractalwrench fractalwrench marked this pull request as ready for review July 22, 2021 15:57
@fractalwrench fractalwrench force-pushed the PLAT-7027/refactor-strictmode-violations branch 2 times, most recently from 65aa21f to 3c24ea7 Compare July 26, 2021 10:18
Copy link
Contributor

@lemnik lemnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fractalwrench fractalwrench force-pushed the PLAT-7027/refactor-strictmode-violations branch from ea340d9 to 091fcee Compare July 26, 2021 11:27
@fractalwrench fractalwrench merged commit 271eb82 into integration/road-757-strictmode Jul 26, 2021
@fractalwrench fractalwrench deleted the PLAT-7027/refactor-strictmode-violations branch July 26, 2021 12:14
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

Successfully merging this pull request may close these issues.

3 participants