-
Notifications
You must be signed in to change notification settings - Fork 319
NAVAND-1025: fix the crash in MapboxVoiceInstructionsPlayer #6760
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6760 +/- ##
=========================================
Coverage 72.51% 72.51%
- Complexity 5540 5541 +1
=========================================
Files 777 777
Lines 30038 30039 +1
Branches 3546 3547 +1
=========================================
+ Hits 21782 21783 +1
Misses 6832 6832
Partials 1424 1424
|
| val currentAnnouncement = currentPlayCallback.announcement | ||
| val currentClientCallback = currentPlayCallback.consumer | ||
| currentClientCallback.accept(currentAnnouncement) | ||
| if (currentPlayCallback != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the following test to MapboxVoiceInstructionsPlayerTest:
@Test
fun `play is done after clear`() {
val anyLanguage = Locale.US.language
val mockedAnnouncement: SpeechAnnouncement = mockk(relaxed = true)
val mapboxVoiceInstructionsPlayer =
MapboxVoiceInstructionsPlayer(
aMockedContext,
anyLanguage,
mockedPlayerOptions
)
val mockedPlay: SpeechAnnouncement = mockedAnnouncement
val voiceInstructionsPlayerConsumer =
mockk<MapboxNavigationConsumer<SpeechAnnouncement>>(relaxed = true)
val requestSlotCallback = slot<AudioFocusRequestCallback>()
every {
mockedAudioFocusDelegate.requestFocus(any(), capture(requestSlotCallback))
} just Runs
mapboxVoiceInstructionsPlayer.play(mockedPlay, voiceInstructionsPlayerConsumer)
mapboxVoiceInstructionsPlayer.clear()
requestSlotCallback.captured.invoke(true)
verify(exactly = 0) { voiceInstructionsPlayerConsumer.accept(any()) }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'd wait for Tomasz though, he's the one who's been working with voice instructions lately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we's out until after the holidays, let's merge.
| val currentAnnouncement = currentPlayCallback.announcement | ||
| val currentClientCallback = currentPlayCallback.consumer | ||
| currentClientCallback.accept(currentAnnouncement) | ||
| if (currentPlayCallback != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add a changelog entry. Sth like:
- Fixed a rare `java.lang.NullPointerException: Attempt to read from field 'en.b dn.m.a' on a null object reference` crash in `PlayCallback.getAnnouncement`. [#6760](https://github.com/mapbox/mapbox-navigation-android/pull/6760)
to mapbox-navigation-android/CHANGELOG.md.
1c5ca98 to
5f75465
Compare
|
@zeac noting that |
5f75465 to
fccadfe
Compare
Oh well, maybe not #6760 (comment) wdyt @dzinad? |
732dff4 to
fe32c8b
Compare
fe32c8b to
3c2fa0c
Compare
Description
This PR fixes the possible crash. The reproduce steps are unknown, I guess there is a race between calls to
clearand focus callback calls.