From 53e5e35185c059464eba002894a1cace32bd6bdd Mon Sep 17 00:00:00 2001 From: Dzina Dybouskaya Date: Fri, 28 Apr 2023 18:20:17 +0300 Subject: [PATCH] add experimental route line logs --- gradle/artifact-settings.gradle | 2 +- .../maps/route/line/api/MapboxRouteLineApi.kt | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gradle/artifact-settings.gradle b/gradle/artifact-settings.gradle index 265023dc4ab..7b2efacb0d9 100644 --- a/gradle/artifact-settings.gradle +++ b/gradle/artifact-settings.gradle @@ -12,7 +12,7 @@ ext { mapboxArtifactLicenseUrl = 'https://www.mapbox.com/legal/tos/' snapshot = project.hasProperty("snapshot") ? project.property("snapshot").toBoolean() : false releaseTagPrefix = project.hasProperty('RELEASE_TAG_PREFIX') ? project.property('RELEASE_TAG_PREFIX') : 'v' - versionName = getVersionName() + versionName = '2.13.0-route-line-SNAPSHOT' } def getVersionName() { diff --git a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineApi.kt b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineApi.kt index 8cd6db9078c..5ba3d9f6fef 100644 --- a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineApi.kt +++ b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineApi.kt @@ -60,6 +60,7 @@ import com.mapbox.navigation.ui.maps.util.CacheResultUtils.cacheResult import com.mapbox.navigation.ui.utils.internal.ifNonNull import com.mapbox.navigation.utils.internal.InternalJobControlFactory import com.mapbox.navigation.utils.internal.logE +import com.mapbox.navigation.utils.internal.logI import com.mapbox.navigation.utils.internal.logW import com.mapbox.navigation.utils.internal.parallelMap import kotlinx.coroutines.Deferred @@ -663,9 +664,11 @@ class MapboxRouteLineApi( lastLocationPoint = null routeLineOptions.vanishingRouteLine?.vanishPointOffset = 0.0 activeLegIndex = INVALID_ACTIVE_LEG_INDEX + logI("Updated leg index to $activeLegIndex (from clearRouteLine)", LOG_CATEGORY) routes.clear() routeFeatureData.clear() routeLineExpressionData = emptyList() + logI("Cleared route line expression data (from clearRouteLine)", LOG_CATEGORY) resetCaches() consumer.accept( @@ -823,6 +826,12 @@ class MapboxRouteLineApi( routeProgressUpdatesQueue.addJob( CoalescingBlockingQueue.Item( { + logI( + "Update with route progress. " + + "Leg index: ${routeProgress.currentLegProgress?.legIndex}, " + + "state: ${routeProgress.currentState}", + LOG_CATEGORY + ) val currentPrimaryRoute = primaryRoute if (currentPrimaryRoute == null) { val msg = @@ -845,6 +854,12 @@ class MapboxRouteLineApi( updateVanishingPointState(routeProgress.currentState) val currentLegIndex = routeProgress.currentLegProgress?.legIndex + logI( + "Calculate routeLineMaskingLayerDynamicData. " + + "Leg index: ${routeProgress.currentLegProgress?.legIndex}, " + + "state: ${routeProgress.currentState}, activeLegIndex: $activeLegIndex", + LOG_CATEGORY + ) val routeLineMaskingLayerDynamicData = when ((currentLegIndex ?: INVALID_ACTIVE_LEG_INDEX) != activeLegIndex) { true -> getRouteLineDynamicDataForMaskingLayers( @@ -855,6 +870,7 @@ class MapboxRouteLineApi( } val legChange = (currentLegIndex ?: 0) > activeLegIndex activeLegIndex = currentLegIndex ?: INVALID_ACTIVE_LEG_INDEX + logI("Update leg index to $activeLegIndex (from route progress update)", LOG_CATEGORY) // If the de-emphasize inactive route legs feature is enabled and the vanishing route line // feature is enabled and the active leg index has changed, then calling the @@ -1036,6 +1052,11 @@ class MapboxRouteLineApi( return ifNonNull(route, routeProgress.currentLegProgress) { navRoute, currentLegProgress -> val numLegs = navRoute.directionsRoute.legs()?.size ?: 0 val legIndex = currentLegProgress.legIndex + logI( + "getRouteLineDynamicDataForMaskingLayers for legIndex: $legIndex, " + + "numLegs: $numLegs, data size: ${routeLineExpressionData.size}", + LOG_CATEGORY + ) if (numLegs > 1 && legIndex < numLegs) { getRouteLineDynamicDataForMaskingLayers(routeLineExpressionData, legIndex) } else { @@ -1421,6 +1442,7 @@ class MapboxRouteLineApi( primaryRoute = distinctNewRoutes.firstOrNull() MapboxRouteLineUtils.trimRouteDataCacheToSize(size = distinctNewRoutes.size) this.activeLegIndex = INVALID_ACTIVE_LEG_INDEX + logI("Updated activeLegIndex to $activeLegIndex (from setNewRouteData)", LOG_CATEGORY) preWarmRouteCaches( distinctNewRoutes, @@ -1653,10 +1675,18 @@ class MapboxRouteLineApi( when (legsCount > 1) { true -> { routeLineExpressionData = deferred.await() + logI( + "Inited route line expression data: ${routeLineExpressionData.size} sync", + LOG_CATEGORY + ) } false -> { jobControl.scope.launch(Dispatchers.Main) { routeLineExpressionData = deferred.await() + logI( + "Inited route line expression data: ${routeLineExpressionData.size} async", + LOG_CATEGORY + ) } } }