Repository navigation
NavigationQueueContainer Class to manage reroute and feedback queues - #457
Conversation
- added in null checks to sendRerouteEvent and sendFeedbackEvent - fixes NPE caused by routeProgress being null following onDestroy
- checkstyle fix
- create NavigationQueueContainer - extract queue logic from navigationService and add it to queue contianer
- cleanup code - perform null check and replace when sending Events
| return obtainNewRouteProgress(); | ||
| } | ||
|
|
||
| private RouteProgress obtainNewRouteProgress() { |
There was a problem hiding this comment.
It looks like this will still throw NPE in the metrics wrapper. Anything that uses directionsRoute() or currentLegProgress() will still crash.
It may be cleaner to wrap RouteProgress in a class (MetricRouteProgress for example) that only has getters for the information needed in NavigationMetricsWrapper. So, if null, the class will still provide 0 or "" to the wrapper class for the event depending on the variable needed.
The same would apply to a null Location. So a class that wraps Location and provides 0.0 0.0 if the location it was constructed with is null.
| @@ -170,6 +157,7 @@ void acquireLocationEngine() { | |||
| locationEngine = mapboxNavigation.getLocationEngine(); | |||
| locationEngine.addLocationEngineListener(this); | |||
| locationEngineName = obtainLocationEngineName(); | |||
There was a problem hiding this comment.
If possible, let's remove the field locationEngineName and use obtainLocationEngineName() when updating the queue class.
|
Added a couple comments and then some TODOs in the code to indicate the parts we discussed that can still be extracted. |
- remove locationEngineName - port additional code over to NavigationQueueContainer
- tweak setRouteProgress method - create metricsRouteProgress class - ingest routeprogress - return non-null values
- create metricsLocation - hook up to currentLocation and provide location getter - added MetricsRoutePrgress to arrive, cancel, and depart events - Make main routeprogress in NavigationQueueContainer into MetricsRouteProgress for distribution to all events
| } else { | ||
| timeIntervalSinceLastOffRoute = location.getTime(); | ||
| navigationQueueContainer.onUserOffRoute(location, userOffRoute); | ||
| recentDistancesFromManeuverInMeters.clear(); |
There was a problem hiding this comment.
What is recentDistancesFromManeuverInMeters and why does it need to be cleared here?
There was a problem hiding this comment.
@electrostat Yeah this is a good catch - once this is figured out, let's ship this
There was a problem hiding this comment.
Removed this clear. recentDistancesFromManeuverInMeters logs distances to upcoming maneuvers. If the clear is present then it never passes these values on to the rest of the system. Was present in the previous iteration of this system/service and the reason it was added. Removed now and all fixed.
- added in null checks to sendRerouteEvent and sendFeedbackEvent - fixes NPE caused by routeProgress being null following onDestroy
- checkstyle fix
- create NavigationQueueContainer - extract queue logic from navigationService and add it to queue contianer
- cleanup code - perform null check and replace when sending Events
- remove locationEngineName - port additional code over to NavigationQueueContainer
- tweak setRouteProgress method - create metricsRouteProgress class - ingest routeprogress - return non-null values
- create metricsLocation - hook up to currentLocation and provide location getter - added MetricsRoutePrgress to arrive, cancel, and depart events - Make main routeprogress in NavigationQueueContainer into MetricsRouteProgress for distribution to all events
…ox-navigation-android into aa-null-checks-routeprogress
- no longer clear out recentDistancesFromManeuverInMeters - was preventing system from logging distances to manuevers
…ox-navigation-android into aa-null-checks-routeprogress
Fix bug associated with RouteProgress being null after onDestroy and preventing RerouteEvent and FeedbackEvent from being sent under those circumstances.