Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation events #489

Merged
merged 28 commits into from
Aug 14, 2017
Merged

Navigation events #489

merged 28 commits into from
Aug 14, 2017

Conversation

zugaldia
Copy link
Member

Expands the telemetry module with new navigation events.

cc: @ericrwolfe @cammace @danesfeder

*/
public static int getVolumeLevel(Context context) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
return audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);

Choose a reason for hiding this comment

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

Based on what @danesfeder has mentioned, Android has multiple streams for different types of audio. @danesfeder can you verify that this is the volume of the stream we'll be outputting voice on?

Choose a reason for hiding this comment

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

Also, let's make sure to normalize this as an int from 0-100 (it looks like there's a getStreamMaxVolume(int) to normalize against)

Copy link
Member Author

Choose a reason for hiding this comment

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

@danesfeder can you verify that this is the volume of the stream we'll be outputting voice on?

@danesfeder Anything to keep in mind here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ericrwolfe @zugaldia Yeah I'm streaming the voice audio through AudioManager.STREAM_MUSIC and AudioManager.STREAM_NORMAL - we are going to need to ticket it this to find a better way to get the volume.

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -10,7 +10,8 @@

public class TelemetryConstants {

public static final String OPERATING_SYSTEM = "Android - " + Build.VERSION.RELEASE;
public static final String PLATFORM = "Android";
public static final String OPERATING_SYSTEM = PLATFORM + " - " + Build.VERSION.RELEASE;
Copy link

@ericrwolfe ericrwolfe Jun 26, 2017

Choose a reason for hiding this comment

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

The current iOS Maps SDK omits the - (e.g. iOS 10.3.1); @mick specified the - so @boundsj is iOS 10.3.1 (no dash) an iOS telem bug?

Choose a reason for hiding this comment

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

FWIW, @mick also specified the platforms as lowercased without spaces, e.g. (android-x.x.x and ios-x.x.x). We should circle back on this with @mick for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ericrwolfe This has been the value the library has been setting all along (this PR doesn't change that). Happy to change the formatting upon @mick confirmation to make sure the backend pipeline doesn't get affected.

Copy link

Choose a reason for hiding this comment

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

we havent been relying on attribute, 👍 for making it consistent with the spec

event.put(KEY_DURATION_REMAINING, durationRemaining);
event.put(KEY_NEW_DISTANCE_REMAINING, newDistanceRemaining);
event.put(KEY_NEW_DURATION_REMAINING, newDurationRemaining);
event.put(KEY_SECONDS_SINCE_LAST_REROUTE, secondsSinceLastReroute);

Choose a reason for hiding this comment

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

newDistanceRemaining, newDurationRemaining, and secondsSinceLastReroute are only required when the feedbackType=="reroute", they should be empty or null otherwise.


// Event keys
public static final String KEY_EVENT = "event";
public static final String KEY_PLATFORM = "platform";

Choose a reason for hiding this comment

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

We've removed platform from the spec since it can be derived from the operating system/SDK identifier.

public static final String KEY_DISTANCE_COMPLETED = "distanceCompleted";
public static final String KEY_DISTANCE_REMAINING = "distanceRemaining";
public static final String KEY_DURATION_REMAINING = "durationRemaining";
public static final String KEY_SECONDS_SINCE_LAST_REROUTE = "secondsSinceLastReroute";
Copy link

@ericrwolfe ericrwolfe Jul 13, 2017

Choose a reason for hiding this comment

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

We've added a few additional keys to look out for in the spec:

General:

  • simulation
  • originalRequestIdentifier
  • requestIdentifier
  • originalGeometry
  • originalEstimatedDistance
  • originalEstimatedDuration
  • audioOutput

Feedback:

  • description
  • userId
  • feedbackId
  • screenshot
  • feedbackType (added more enum values)
  • step (see below)

Reroute:

  • feedbackId
  • newDistanceRemaining
  • newDurationRemaining
  • newGeometry
  • screenshot
  • step (see below)

Step (Metadata about the current + upcoming step as a JSON object):

  • upcomingInstruction (string)
  • upcomingType (string)
  • upcomingModifier (string)
  • upcomingName (Name of the street)
  • previousInstruction (string)
  • previousType (string)
  • previousModifier (string)
  • previousName (Name of the street)
  • distance (int, meters)
  • duration (int, seconds)
  • distanceRemaining (int, meters)
  • durationRemaining (int, seconds)

Cancel:

  • arrivalTimestamp

Event version has been increased to 5 along with the above changes.

@ericrwolfe
Copy link

@zugaldia added a few notes on some of the relevant changes we've made to the spec

@zugaldia
Copy link
Member Author

zugaldia commented Jul 14, 2017

I've made a few changes to address the PR comments but we still need to sync the fields for each event. Like #489 (comment) points out, we need to make sure we're up to date with the latest spec.

@zugaldia
Copy link
Member Author

Per chat with @cammace , he's gonna give it a pass to make sure we've included all items from the latest version of the spec. If so, we're good to 🚢 . Next would be mapbox/mapbox-navigation-android#113.

@cammace
Copy link

cammace commented Aug 1, 2017

I've added most of the missing keys but i'm not sure what we should do with the screenshot metadata. Do we already have a util for taking screenshots and encoding it? Should the encoding be done in this library or in the nav sdk? I would prefer the former.

I'm also not completely sure whether the step metadata is being added correctly, @zugaldia could you check this?

General:

  • simulation
  • originalRequestIdentifier
  • requestIdentifier
  • originalGeometry
  • originalEstimatedDistance
  • originalEstimatedDuration
  • audioOutput

Feedback:

  • description
  • userId
  • feedbackId
  • screenshot
  • feedbackType (added more enum values)
  • step (see below)

Reroute:

  • feedbackId
  • newDistanceRemaining
  • newDurationRemaining
  • newGeometry
  • screenshot
  • step (see below)

Step (Metadata about the current + upcoming step as a JSON object):

  • upcomingInstruction (string)
  • upcomingType (string)
  • upcomingModifier (string)
  • upcomingName (Name of the street)
  • previousInstruction (string)
  • previousType (string)
  • previousModifier (string)
  • previousName (Name of the street)
  • distance (int, meters)
  • duration (int, seconds)
  • distanceRemaining (int, meters)
  • durationRemaining (int, seconds)

Cancel:

  • arrivalTimestamp

  • Event version has been increased to 5 along with the above changes.

@zugaldia
Copy link
Member Author

zugaldia commented Aug 1, 2017

Should the encoding be done in this library or in the nav sdk? I would prefer the former.

Agreed - let's put this logic on the telemetry library, other clients could benefit from this functionality. Related: mapbox/mapbox-gl-native#8040.

I'm also not completely sure whether the step metadata is being added correctly, @zugaldia could you check this?

Sure thing - could you point me at the code you want me to look at?

@zugaldia
Copy link
Member Author

zugaldia commented Aug 1, 2017

I see it now, thanks (

event.put(KEY_STEP, getStepMetadata(upcomingInstruction, upcomingType, upcomingModifier, upcomingName,
) - could you add test that checks that all the data gets serialized? Basically, the test will build the JSON object like we do here and then we'd check the content of the resulting string.

@cammace
Copy link

cammace commented Aug 1, 2017

I've made a few fixes to missing metadata values, this PR should be good to merge now @zugaldia @ericrwolfe

Copy link

@ericrwolfe ericrwolfe left a comment

Choose a reason for hiding this comment

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

Looks like you've added everything @cammace 👍.

Are the locations/keys for locationsBefore and locationsAfter being serialized in the Navigation SDK?

I'll defer to @zugaldia for the final ✅.

@cammace
Copy link

cammace commented Aug 9, 2017

Bumping this since we need it in order to begin nav metric work.

@cammace cammace merged commit 7e1a87b into master Aug 14, 2017
@cammace cammace deleted the nav-telem branch August 14, 2017 16:01
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.

5 participants