Skip to content

Commit a2bf593

Browse files
authored
Core telemetry migration (#6423)
1 parent c0471d0 commit a2bf593

File tree

46 files changed

+1787
-636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1787
-636
lines changed

LICENSE.md

Lines changed: 0 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -621,176 +621,6 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
621621

622622

623623
#### Metrics SDK module
624-
Mapbox Navigation uses portions of the Android App Startup Runtime.
625-
URL: [https://developer.android.com/jetpack/androidx/releases/startup#1.0.0](https://developer.android.com/jetpack/androidx/releases/startup#1.0.0)
626-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
627-
628-
===========================================================================
629-
630-
Mapbox Navigation uses portions of the Android Arch-Common.
631-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
632-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
633-
634-
===========================================================================
635-
636-
Mapbox Navigation uses portions of the Android Arch-Runtime.
637-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
638-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
639-
640-
===========================================================================
641-
642-
Mapbox Navigation uses portions of the Android DB.
643-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
644-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
645-
646-
===========================================================================
647-
648-
Mapbox Navigation uses portions of the Android Lifecycle LiveData.
649-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
650-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
651-
652-
===========================================================================
653-
654-
Mapbox Navigation uses portions of the Android Lifecycle LiveData Core.
655-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
656-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
657-
658-
===========================================================================
659-
660-
Mapbox Navigation uses portions of the Android Lifecycle Runtime.
661-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
662-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
663-
664-
===========================================================================
665-
666-
Mapbox Navigation uses portions of the Android Lifecycle Service.
667-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
668-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
669-
670-
===========================================================================
671-
672-
Mapbox Navigation uses portions of the Android Lifecycle ViewModel.
673-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
674-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
675-
676-
===========================================================================
677-
678-
Mapbox Navigation uses portions of the Android Lifecycle-Common.
679-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
680-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
681-
682-
===========================================================================
683-
684-
Mapbox Navigation uses portions of the Android Room-Common.
685-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
686-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
687-
688-
===========================================================================
689-
690-
Mapbox Navigation uses portions of the Android Room-Runtime.
691-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
692-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
693-
694-
===========================================================================
695-
696-
Mapbox Navigation uses portions of the Android Support Library Annotations (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs.).
697-
URL: [https://developer.android.com/jetpack/androidx/releases/annotation#1.2.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.2.0)
698-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
699-
700-
===========================================================================
701-
702-
Mapbox Navigation uses portions of the Android Support Library collections (Standalone efficient collections.).
703-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
704-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
705-
706-
===========================================================================
707-
708-
Mapbox Navigation uses portions of the Android Support Library compat (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
709-
URL: [https://developer.android.com/jetpack/androidx/releases/core#1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)
710-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
711-
712-
===========================================================================
713-
714-
Mapbox Navigation uses portions of the Android Support Library core utils (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
715-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
716-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
717-
718-
===========================================================================
719-
720-
Mapbox Navigation uses portions of the Android Support Library Document File (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
721-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
722-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
723-
724-
===========================================================================
725-
726-
Mapbox Navigation uses portions of the Android Support Library loader (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
727-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
728-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
729-
730-
===========================================================================
731-
732-
Mapbox Navigation uses portions of the Android Support Library Local Broadcast Manager (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
733-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
734-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
735-
736-
===========================================================================
737-
738-
Mapbox Navigation uses portions of the Android Support Library Print (The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.).
739-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
740-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
741-
742-
===========================================================================
743-
744-
Mapbox Navigation uses portions of the Android Support SQLite - Framework Implementation (The implementation of Support SQLite library using the framework code.).
745-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
746-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
747-
748-
===========================================================================
749-
750-
Mapbox Navigation uses portions of the Android Tracing.
751-
URL: [https://developer.android.com/jetpack/androidx/releases/tracing#1.0.0](https://developer.android.com/jetpack/androidx/releases/tracing#1.0.0)
752-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
753-
754-
===========================================================================
755-
756-
Mapbox Navigation uses portions of the Android WorkManager Runtime (Android WorkManager runtime library).
757-
URL: [https://developer.android.com/jetpack/androidx/releases/work#2.7.1](https://developer.android.com/jetpack/androidx/releases/work#2.7.1)
758-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
759-
760-
===========================================================================
761-
762-
Mapbox Navigation uses portions of the Experimental annotation (Java annotation for use on unstable Android API surfaces. When used in conjunction with the Experimental annotation lint checks, this annotation provides functional parity with Kotlin's Experimental annotation.).
763-
URL: [https://developer.android.com/jetpack/androidx/releases/annotation#1.1.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.1.0)
764-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
765-
766-
===========================================================================
767-
768-
Mapbox Navigation uses portions of the Gson.
769-
License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
770-
771-
===========================================================================
772-
773-
Mapbox Navigation uses portions of the Guava ListenableFuture only (Contains Guava's com.google.common.util.concurrent.ListenableFuture class,
774-
without any of its other classes -- but is also available in a second
775-
"version" that omits the class to avoid conflicts with the copy in Guava
776-
itself. The idea is:
777-
778-
- If users want only ListenableFuture, they depend on listenablefuture-1.0.
779-
780-
- If users want all of Guava, they depend on guava, which, as of Guava
781-
27.0, depends on
782-
listenablefuture-9999.0-empty-to-avoid-conflict-with-guava. The 9999.0-...
783-
version number is enough for some build systems (notably, Gradle) to select
784-
that empty artifact over the "real" listenablefuture-1.0 -- avoiding a
785-
conflict with the copy of ListenableFuture in guava itself. If users are
786-
using an older version of Guava or a build system other than Gradle, they
787-
may see class conflicts. If so, they can solve them by manually excluding
788-
the listenablefuture artifact or manually forcing their build systems to
789-
use 9999.0-....).
790-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
791-
792-
===========================================================================
793-
794624
Mapbox Navigation uses portions of the IntelliJ IDEA Annotations (A set of annotations used for code inspection support and code documentation.).
795625
URL: [http://www.jetbrains.org](http://www.jetbrains.org)
796626
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
@@ -833,30 +663,6 @@ License: [The Apache Software License, Version 2.0](https://www.apache.org/licen
833663

834664
===========================================================================
835665

836-
Mapbox Navigation uses portions of the Mapbox Telemetry for Android (Mapbox Android Telemetry Library).
837-
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
838-
License: [MIT](https://mit-license.org)
839-
840-
===========================================================================
841-
842-
Mapbox Navigation uses portions of the okhttp (Square’s meticulous HTTP client for Java and Kotlin.).
843-
URL: [https://square.github.io/okhttp/](https://square.github.io/okhttp/)
844-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
845-
846-
===========================================================================
847-
848-
Mapbox Navigation uses portions of the Okio (A modern I/O API for Java).
849-
URL: [https://github.com/square/okio/](https://github.com/square/okio/)
850-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
851-
852-
===========================================================================
853-
854-
Mapbox Navigation uses portions of the VersionedParcelable (Provides a stable but relatively compact binary serialization format that can be passed across processes or persisted safely.).
855-
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
856-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
857-
858-
===========================================================================
859-
860666

861667

862668
#### Navigator SDK module

gradle/dependencies.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ ext {
2020
version = [
2121
mapboxMapSdk : '10.9.0-beta.2',
2222
mapboxSdkServices : '6.8.0',
23-
mapboxEvents : '8.1.5',
2423
mapboxCore : '5.0.2',
2524
mapboxNavigator : "${mapboxNavigatorVersion}",
2625
mapboxCommonNative : '23.1.0-beta.2',
@@ -77,7 +76,6 @@ ext {
7776
mapboxSdkTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${version.mapboxSdkServices}",
7877
mapboxSdkDirectionsModels : "com.mapbox.mapboxsdk:mapbox-sdk-directions-models:${version.mapboxSdkServices}",
7978
mapboxSdkRefreshModels : "com.mapbox.mapboxsdk:mapbox-sdk-directions-refresh-models:${version.mapboxSdkServices}",
80-
mapboxEvents : "com.mapbox.mapboxsdk:mapbox-android-telemetry:${version.mapboxEvents}",
8179
mapboxCore : "com.mapbox.mapboxsdk:mapbox-android-core:${version.mapboxCore}",
8280
mapboxNavigator : "com.mapbox.navigator:mapbox-navigation-native:${version.mapboxNavigator}",
8381
mapboxCommonNative : "com.mapbox.common:common:${version.mapboxCommonNative}",

libnavigation-base/api/current.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,12 @@ package com.mapbox.navigation.base.metrics {
282282
public interface MetricsReporter {
283283
method public void addEvent(com.mapbox.navigation.base.metrics.MetricEvent metricEvent);
284284
method public void removeObserver();
285+
method public void sendTurnstileEvent(com.mapbox.common.TurnstileEvent turnstileEvent);
285286
method public void setMetricsObserver(com.mapbox.navigation.base.metrics.MetricsObserver metricsObserver);
286287
}
287288

288289
public final class NavigationMetrics {
289-
field public static final String APP_USER_TURNSTILE = "appUserTurnstile";
290+
field @Deprecated public static final String APP_USER_TURNSTILE = "appUserTurnstile";
290291
field public static final String ARRIVE = "navigation.arrive";
291292
field public static final String CANCEL_SESSION = "navigation.cancel";
292293
field public static final String CUSTOM_EVENT = "navigation.customEvent";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.mapbox.navigation.base.internal.metric
2+
3+
import com.mapbox.bindgen.Value
4+
import com.mapbox.navigation.base.metrics.MetricEvent
5+
6+
interface MetricEventInternal : MetricEvent {
7+
8+
/**
9+
* Present [MetricEvent] as [Value]
10+
*
11+
* @return Value
12+
*/
13+
fun toValue(): Value
14+
}

libnavigation-base/src/main/java/com/mapbox/navigation/base/metrics/MetricEvent.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ object NavigationMetrics {
8585
/**
8686
* Navigation Event "App User turnstile" name
8787
*/
88+
@Deprecated(
89+
"APP_USER_TURNSTILE event is handled under and not available on the client-side"
90+
)
8891
const val APP_USER_TURNSTILE = "appUserTurnstile"
8992

9093
/**

libnavigation-base/src/main/java/com/mapbox/navigation/base/metrics/MetricsReporter.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.navigation.base.metrics
22

3+
import com.mapbox.common.TurnstileEvent
4+
35
/**
46
* Defines API for handling metric events.
57
*/
@@ -12,6 +14,11 @@ interface MetricsReporter {
1214
*/
1315
fun addEvent(metricEvent: MetricEvent)
1416

17+
/**
18+
* Send [TurnstileEvent] event.
19+
*/
20+
fun sendTurnstileEvent(turnstileEvent: TurnstileEvent)
21+
1522
/**
1623
* Adds an observer that will be triggered when a metric event is handled
1724
*

libnavigation-core/api/current.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,9 @@ package com.mapbox.navigation.core.telemetry.events {
815815
public final class BitmapEncodeOptionsKt {
816816
}
817817

818+
public final class CoreTelemetryEventUtilsKt {
819+
}
820+
818821
public final class FeedbackEvent {
819822
field public static final String ALTERNATIVE_ROUTE_NOT_EXPECTED = "alternative_route_not_expected";
820823
field public static final String ARRIVAL_FEEDBACK_CONFUSING_INSTRUCTIONS = "arrival_feedback_confusing_instructions";

libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import androidx.annotation.RequiresPermission
1010
import androidx.annotation.UiThread
1111
import androidx.annotation.VisibleForTesting
1212
import com.mapbox.android.core.location.LocationEngine
13-
import com.mapbox.android.telemetry.TelemetryEnabler
1413
import com.mapbox.annotation.module.MapboxModuleType
1514
import com.mapbox.api.directions.v5.models.DirectionsResponse
1615
import com.mapbox.api.directions.v5.models.DirectionsRoute
@@ -115,6 +114,7 @@ import com.mapbox.navigation.core.trip.session.eh.GraphAccessor
115114
import com.mapbox.navigation.core.trip.session.eh.RoadObjectMatcher
116115
import com.mapbox.navigation.core.trip.session.eh.RoadObjectsStore
117116
import com.mapbox.navigation.metrics.MapboxMetricsReporter
117+
import com.mapbox.navigation.metrics.internal.TelemetryUtilsDelegate
118118
import com.mapbox.navigation.navigator.internal.MapboxNativeNavigator
119119
import com.mapbox.navigation.navigator.internal.NavigatorLoader
120120
import com.mapbox.navigation.navigator.internal.router.RouterInterfaceAdapter
@@ -1744,7 +1744,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
17441744
}
17451745

17461746
private inline fun <T> runInTelemetryContext(func: (MapboxNavigationTelemetry) -> T): T? {
1747-
return if (TelemetryEnabler.isEventsEnabled(navigationOptions.applicationContext)) {
1747+
return if (TelemetryUtilsDelegate.getEventsCollectionState()) {
17481748
func(MapboxNavigationTelemetry)
17491749
} else {
17501750
null

0 commit comments

Comments
 (0)