-
Notifications
You must be signed in to change notification settings - Fork 48
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
Workaround for Strict mode Untagged Socket issue #443
Conversation
This fixes #425 |
} else { | ||
this.configurationClient = new ConfigurationClient(applicationContext, | ||
TelemetryUtils.createFullUserAgent(userAgent, applicationContext), sAccessToken.get(), | ||
new OkHttpClient().newBuilder().build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builder is unused
// Strict mode work around : https://github.com/square/okhttp/issues/3537 | ||
this.configurationClient = new ConfigurationClient(applicationContext, | ||
TelemetryUtils.createFullUserAgent(userAgent, applicationContext), sAccessToken.get(), | ||
new OkHttpClient().newBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could consider moving this code to TelemetryUtils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments/suggestions, overall 🚀
Add custom socket factory and set TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient).
9da6387
to
02c088a
Compare
… fix-strict-mode-socket-error
Codecov Report
@@ Coverage Diff @@
## master #443 +/- ##
===========================================
- Coverage 68.65% 68.46% -0.2%
- Complexity 394 395 +1
===========================================
Files 69 69
Lines 2144 2156 +12
Branches 171 171
===========================================
+ Hits 1472 1476 +4
- Misses 575 583 +8
Partials 97 97 |
Add custom socket factory and set TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient). (cherry picked from commit 40b8f44)
Set version in gradle.properties . Replace master with long-term-support in config.yml .
Add custom socket factory and set TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient).
Add custom socket factory and set TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient).
* Update Changelog.md for release Core 1.4.0 / Telemetry 4.7.0(#440) * Update Gradle Versions: (#444) Gradle Version : 5.6.4 Android Gradle Plugin Version : 3.5.3 * Update Node version to >=10 in package.json (#445) Update version to 4.7.1 in package.json * Workaround for Strict mode socket issue: (#443) Add custom socket factory and set TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient). * Fix Turnstile Obfuscation (#457) * Fix obfuscation: Prevent obfuscation of Event classes to keep properties in JSON schema unaltered. Throw Assertion Error in Test App in case of POST failure for an event. Set minifyEnabled true in build.gradle for debug build to make the test app behave close to production app. Add button on test app's main screen, which sends turnstile event on click. Add @SerializedName annotation to Turnstile and Crash Event properties to keep them consistent with other events. Fix Location Schema test to ignore the properties(speed, course, floor, speedAccuracy, courseAccuracy, and verticalAccuracy) that are added in the backend but not incorporated into the SDK yet! * Update Config.yml to indicate long-term-support as pseudo master branch. Append -lts to name of the binary while publishing the binary size. Update Version in gradle.properties and package.json.
Untagged socket detection is one of the anomalies detected by Strict Mode in android from Android O. Since the Telemetry Test app enables the Strict mode with penalty death in debug mode, the app crashes/freezes on installation.
Strict mode expects a tag set to every thread and the threads created by Okhttp sockets does not not seem to do so for different reason. This is still an open issue
square/okhttp#3537
This pull request adds custom socket factory and sets TrafficStats.setThreadStatsTag(1000) for configuration client(okhttpClient). The main Telemetry Client has the similar workaround that already in place.
mapbox-events-android/libtelemetry/src/main/java/com/mapbox/android/telemetry/GzipRequestInterceptor.java
Line 29 in 22367f5