Repository navigation
Conversation
The MapView was only used to reach MapTelemetry, whose setUserTelemetryRequestState calls TelemetryUtils.setEventsCollectionState. Creating it sent a MAPS_MAUS turnstile, started a render thread and was never destroyed. Call TelemetryUtils directly instead. Fixes #4456
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4456. This is @Noitham's change from #4457, which they closed without comment; their commit and authorship are kept.
On Android,
setTelemetryEnabledcreated aMapViewonly to reachMapTelemetry, and never destroyed it. Creating it sends a billableMAPS_MAUSturnstile, even for users who never open a map, and leaks about 6 views per call.MapTelemetry.setUserTelemetryRequestStateonly callsTelemetryUtils.setEventsCollectionState(enabled, callback), in every v11 version, so this calls it directly. iOS is unchanged.TelemetryUtils's static methods are annotated@RestrictTo(LIBRARY_GROUP_PREFIX)in Mapbox Common, so a future Mapbox SDK could change them without notice. The Navigation SDK uses the same call.Checklist
CONTRIBUTING.mdyarn generatein the root folder (not needed, Kotlin only)/exampleapp./example) (bug fix)Before / after
Example app on an API 34 emulator, reproducer from #4456 (no
MapViewon screen):mainGLMapboxRenderThread createdafter 101 callsevents.mapbox.comTelemetryUtils.getEventsCollectionState()/getClientServerEventsCollectionState()give the same values on both builds:false/TurnstileEventsOnlyaftersetTelemetryEnabled(false),true/EnabledaftersetTelemetryEnabled(true), and both survive an app restart.Component to reproduce the issue you're fixing
The reproducer is in #4456.