From 82399e4be992c4c1b3ee9a12c03b6b1242d700bc Mon Sep 17 00:00:00 2001 From: Dzina Dybouskaya Date: Fri, 17 Feb 2023 12:48:04 +0300 Subject: [PATCH] NAVAND-1166: add snapshot logs --- gradle/artifact-settings.gradle | 2 +- libnavui-maps/build.gradle | 5 +++++ .../com/mapbox/navigation/ui/maps/camera/LogTag.kt | 6 ++++++ .../camera/data/MapboxNavigationViewportDataSource.kt | 11 +++++++++++ .../maps/camera/data/ViewportDataSourceProcessor.kt | 6 +++++- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/LogTag.kt diff --git a/gradle/artifact-settings.gradle b/gradle/artifact-settings.gradle index 42792aeef58..b4e8682bd46 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.7.2-logged-SNAPSHOT' } def getVersionName() { diff --git a/libnavui-maps/build.gradle b/libnavui-maps/build.gradle index 5833da7783d..c328af504cd 100644 --- a/libnavui-maps/build.gradle +++ b/libnavui-maps/build.gradle @@ -43,6 +43,11 @@ dependencies { implementation project(":libnavui-resources") api dependenciesList.mapboxMapSdk + api("com.mapbox.maps:android-core") { + version { + strictly '10.7.0-a34a63fde5-SNAPSHOT' + } + } api dependenciesList.mapboxSdkTurf implementation dependenciesList.androidXAppCompat diff --git a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/LogTag.kt b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/LogTag.kt new file mode 100644 index 00000000000..f2d05c2c6b3 --- /dev/null +++ b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/LogTag.kt @@ -0,0 +1,6 @@ +package com.mapbox.navigation.ui.maps.camera + +internal object LogTag { + + const val TAG = "[maps-core-sdk]" +} diff --git a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/MapboxNavigationViewportDataSource.kt b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/MapboxNavigationViewportDataSource.kt index 4fa254462d3..b1383471c8e 100644 --- a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/MapboxNavigationViewportDataSource.kt +++ b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/MapboxNavigationViewportDataSource.kt @@ -1,6 +1,7 @@ package com.mapbox.navigation.ui.maps.camera.data import android.location.Location +import android.util.Log import androidx.annotation.UiThread import com.mapbox.api.directions.v5.models.DirectionsRoute import com.mapbox.api.directions.v5.models.LegStep @@ -16,6 +17,7 @@ import com.mapbox.navigation.base.route.NavigationRoute import com.mapbox.navigation.base.route.toNavigationRoute import com.mapbox.navigation.base.trip.model.RouteProgress import com.mapbox.navigation.core.MapboxNavigation +import com.mapbox.navigation.ui.maps.camera.LogTag import com.mapbox.navigation.ui.maps.camera.NavigationCamera import com.mapbox.navigation.ui.maps.camera.data.ViewportDataSourceProcessor.getMapAnchoredPaddingFromUserPadding import com.mapbox.navigation.ui.maps.camera.data.ViewportDataSourceProcessor.getPitchFallbackFromRouteProgress @@ -558,6 +560,7 @@ class MapboxNavigationViewportDataSource( * Provide additional points that should be fitted into the following frame update. */ fun additionalPointsToFrameForFollowing(points: List) { + Log.i(LogTag.TAG, "additionalPointsToFrameForFollowing: $points") additionalPointsToFrameForFollowing = ArrayList(points) } @@ -577,6 +580,7 @@ class MapboxNavigationViewportDataSource( * @see [evaluate] */ fun followingCenterPropertyOverride(value: Point?) { + Log.i(LogTag.TAG, "followingCenterPropertyOverride: $value") followingCenterProperty.override = value } @@ -589,6 +593,7 @@ class MapboxNavigationViewportDataSource( * @see [evaluate] */ fun followingZoomPropertyOverride(value: Double?) { + Log.i(LogTag.TAG, "followingZoomPropertyOverride: $value") followingZoomProperty.override = value } @@ -601,6 +606,7 @@ class MapboxNavigationViewportDataSource( * @see [evaluate] */ fun followingBearingPropertyOverride(value: Double?) { + Log.i(LogTag.TAG, "followingBearingPropertyOverride: $value") followingBearingProperty.override = value } @@ -613,6 +619,7 @@ class MapboxNavigationViewportDataSource( * @see [evaluate] */ fun followingPitchPropertyOverride(value: Double?) { + Log.i(LogTag.TAG, "followingPitchPropertyOverride: $value") followingPitchProperty.override = value } @@ -699,6 +706,8 @@ class MapboxNavigationViewportDataSource( // needs to be added here to be taken into account for bearing smoothing pointsForFollowing.addAll(additionalPointsToFrameForFollowing) + Log.i(LogTag.TAG, "Target location: $localTargetLocation, pointsToFrame: $pointsForFollowing") + if (pointsForFollowing.isEmpty()) { options.followingFrameOptions.run { val cameraState = mapboxMap.cameraState @@ -734,6 +743,7 @@ class MapboxNavigationViewportDataSource( options.followingFrameOptions.maximizeViewableGeometryWhenPitchZero && followingPitchProperty.get() == ZERO_PITCH ) { + Log.i(LogTag.TAG, "maximizeViewableGeometryWhenPitchZero=true, \npoints to frame: $pointsForFollowing, \npadding: $followingPadding") mapboxMap.cameraForCoordinates( pointsForFollowing, followingPadding, @@ -758,6 +768,7 @@ class MapboxNavigationViewportDataSource( .pitch(followingPitchProperty.get()) .zoom(cameraState.zoom) .build() + Log.i(LogTag.TAG, "maximizeViewableGeometryWhenPitchZero=false, \npoints to frame: $pointsForFollowing, \ncamera center: ${fallbackCameraOptions.center}\nmap size: $mapSize, followingPadding=${followingPadding}, screenBox=$screenBox, resultingPadding=$padding, zoom=${fallbackCameraOptions.zoom}") if (pointsForFollowing.size > 1) { mapboxMap.cameraForCoordinates( pointsForFollowing, diff --git a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/ViewportDataSourceProcessor.kt b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/ViewportDataSourceProcessor.kt index 89797132734..0797646d402 100644 --- a/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/ViewportDataSourceProcessor.kt +++ b/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/camera/data/ViewportDataSourceProcessor.kt @@ -1,5 +1,6 @@ package com.mapbox.navigation.ui.maps.camera.data +import android.util.Log import com.mapbox.api.directions.v5.models.DirectionsRoute import com.mapbox.geojson.LineString import com.mapbox.geojson.Point @@ -11,6 +12,7 @@ import com.mapbox.navigation.base.trip.model.RouteLegProgress import com.mapbox.navigation.base.trip.model.RouteProgress import com.mapbox.navigation.base.trip.model.RouteStepProgress import com.mapbox.navigation.base.utils.DecodeUtils.stepsGeometryToPoints +import com.mapbox.navigation.ui.maps.camera.LogTag import com.mapbox.navigation.utils.internal.logE import com.mapbox.turf.TurfConstants import com.mapbox.turf.TurfException @@ -250,7 +252,7 @@ internal object ViewportDataSourceProcessor { } return followingFrameOptions.pitchNearManeuvers.run { - if ( + (if ( enabled && upcomingManeuverType !in excludedManeuvers && currentStepProgress.distanceRemaining <= triggerDistanceFromManeuver @@ -258,6 +260,8 @@ internal object ViewportDataSourceProcessor { MapboxNavigationViewportDataSource.ZERO_PITCH } else { followingFrameOptions.defaultPitch + }).also { + Log.i(LogTag.TAG, "getPitchFallbackFromRouteProgress, result=$it, default pitch=${followingFrameOptions.defaultPitch}, distanceRemaining=${currentStepProgress.distanceRemaining}, triggerDistanceFromManeuver=$triggerDistanceFromManeuver") } } }