Skip to content

Prevent exceptions being thrown for remaining startForegroundService calls#1830

Merged
JulianKast merged 4 commits intodevelopfrom
bugfix/issue_1829
Sep 14, 2022
Merged

Prevent exceptions being thrown for remaining startForegroundService calls#1830
JulianKast merged 4 commits intodevelopfrom
bugfix/issue_1829

Conversation

@joeygrover
Copy link
Member

Fixes #1829

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).
  • I have tested Android, Java SE, and Java EE (as this only affected Android classes)

Unit Tests

N/A as these exceptions occur on random Android devices and are not easily reproducible outside of adding logic to make it happen.

Core Tests

N/A This only occurs because of Android having a bug when starting foreground services and isn't related to Core or the IVI directly.

Summary

Searched the project for any calls to startForegroundService and surrounded them with a try/catch. If an exception occurs it is passed to a method to handle it by logging out the reason for the exception.

Changelog

Bug Fixes
  • Prevent exceptions being thrown for Android's inability to properly time starting foreground services based on when the OS can start them instead of the time at which the startForegroundService is called initially.

CLA

@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #1830 (c28b81b) into develop (b99a2ca) will increase coverage by 0.12%.
The diff coverage is 0.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #1830      +/-   ##
=============================================
+ Coverage      54.04%   54.16%   +0.12%     
- Complexity      5532     5569      +37     
=============================================
  Files            562      562              
  Lines          25821    25953     +132     
  Branches        3398     3459      +61     
=============================================
+ Hits           13954    14058     +104     
- Misses         10596    10614      +18     
- Partials        1271     1281      +10     
Impacted Files Coverage Δ
...martdevicelink/transport/SdlBroadcastReceiver.java 3.02% <ø> (ø)
...tdevicelink/transport/SdlRouterStatusProvider.java 0.00% <0.00%> (ø)
...link/transport/USBAccessoryAttachmentActivity.java 0.00% <0.00%> (ø)
...com/smartdevicelink/util/MediaStreamingStatus.java 64.76% <0.00%> (+0.95%) ⬆️
...rtdevicelink/streaming/video/SdlRemoteDisplay.java 51.21% <0.00%> (+1.21%) ⬆️
...anagers/lifecycle/BaseSystemCapabilityManager.java 71.97% <0.00%> (+4.29%) ⬆️

Co-authored-by: Julian Kast <julian.kast@live.com>
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.

2 participants