Skip to content

NavigationQueueContainer Class to manage reroute and feedback queues - #457

Merged
electrostat merged 24 commits into
masterfrom
aa-null-checks-routeprogress
Nov 6, 2017
Merged

electrostat merged 24 commits into
masterfrom
aa-null-checks-routeprogress

Conversation

@electrostat

Copy link
Copy Markdown
Contributor

Fix bug associated with RouteProgress being null after onDestroy and preventing RerouteEvent and FeedbackEvent from being sent under those circumstances.

- added in null checks to sendRerouteEvent and sendFeedbackEvent
- fixes NPE caused by routeProgress being null following onDestroy
- checkstyle fix
@electrostat electrostat added the bug Defect to be fixed. label Oct 31, 2017
@electrostat electrostat self-assigned this Oct 31, 2017
@electrostat

Copy link
Copy Markdown
Contributor Author

Resolves #351 and #436

@electrostat electrostat added ⚠️ DO NOT MERGE PR should not be merged! topic: telemetry and removed bug Defect to be fixed. labels Oct 31, 2017
@electrostat electrostat changed the title RouteProgress NPE Fix NavigationQueueContainer Class to manage reroute and feedback queues Oct 31, 2017
- create NavigationQueueContainer
- extract queue logic from navigationService and add it to queue contianer
- cleanup code
- perform null check and replace when sending Events
@electrostat electrostat added ✓ ready for review and removed ⚠️ DO NOT MERGE PR should not be merged! labels Nov 1, 2017
return obtainNewRouteProgress();
}

private RouteProgress obtainNewRouteProgress() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, let's remove the field locationEngineName and use obtainLocationEngineName() when updating the queue class.

@danesfeder

Copy link
Copy Markdown
Contributor

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is recentDistancesFromManeuverInMeters and why does it need to be cleared here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@electrostat Yeah this is a good catch - once this is figured out, let's ship this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

electrostat and others added 8 commits November 3, 2017 15:54
- 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
Guardiola31337 and others added 5 commits November 3, 2017 16:31
…ox-navigation-android into aa-null-checks-routeprogress
- no longer clear out recentDistancesFromManeuverInMeters
- was preventing system from logging distances to manuevers
@electrostat
electrostat merged commit e1c945b into master Nov 6, 2017
@electrostat
electrostat deleted the aa-null-checks-routeprogress branch November 6, 2017 18:17
@danesfeder danesfeder mentioned this pull request Nov 13, 2017
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants