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
Delay shutting down secondary transport when device app is backgrounded #1617
Delay shutting down secondary transport when device app is backgrounded #1617
Conversation
The secondary transport now only shuts down when the background task expires.
Added background task ended tests to secondary transport manager unit tests
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
The secondary transport background task is now only destroyed after cleanup finishes
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.
While testing, I saw a few more issues:
- I consistently saw a background task ended that was unknown:
2020-04-14 14:44:03.388147-0400 SDL Example[1175:377941] Can't end BackgroundTask: no background task exists with identifier 3 (0x3), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
It doesn't seem to be causing an issue, but it does make me a bit suspicious.
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
…rt' of https://github.com/smartdevicelink/sdl_ios into bugfix/issue_1560_delay_shutting_down_secondary_transport
I saw the same notifications and it seems to be a known iOS 13 issue. I created an empty single-view Swift app and I get the exact same log |
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.
Please see the remaining request for comment addition.
Fixes #1560
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit Tests
Unit tests were added to the SecondaryTransportManagerSpec.
Core Tests
Tests were performed with a video streaming app using a TCP secondary transport. Tests were considered successful:
Tests Performed
Core version / branch / commit hash / module tested against: SYNC 4 (20016_DEVTEST)
HMI name / version / branch / commit hash / module tested against: SYNC 4 (20016_DEVTEST)
Summary
When the app on the device is backgrounded the secondary transport is now closed when the background task expires instead of immediately. This improves user experience by:
videoStreamBackgroundString
when the app on the device is backgrounded. Previously the warning message was either flashed for a moment or not shown all.In order to ensure that the video, audio and tcp transports are all shutdown before the background task is ended, I moved calling the
videoServiceEndedCompletionHandler
and theaudioServiceEndedCompletionHandler
from the stop service ACK and NAK handler methods to the stopped state of theSDLStreamingVideoLifecycleManager
andSDLStreamingAudioLifecycleManager
to ensure that both managers' properties get reset before the background task ends when the app is backgrounded. This also reduced duplicate code since both the ACK/NAK handlers transition to the stopped state anyways.Changelog
Enhancements
CLA