-
Notifications
You must be signed in to change notification settings - Fork 131
Fix #1351 #1360
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
Fix #1351 #1360
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1360 +/- ##
============================================
- Coverage 47.67% 47.62% -0.05%
Complexity 4432 4432
============================================
Files 489 489
Lines 23845 23872 +27
Branches 2753 2759 +6
============================================
+ Hits 11369 11370 +1
- Misses 11775 11801 +26
Partials 701 701
|
|
|
||
| public void startUpSequence(){ | ||
|
|
||
| setRouterServiceExceptionHandler(); |
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.
I think we should call this method first thing in onCreate() because currently, the service could enter foreground before adding the exception handler
| super.onCreate(); | ||
| //This must be done regardless of if this service shuts down or not | ||
| //Add this first to avoid the runtime exceptions for the entire lifecycle of the service | ||
| setRouterServiceExceptionHandler(); |
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.
Spacing seems to be strange here.
| SdlRouterService.this.setSdlRouterServicePrefs(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE, true); | ||
| try{ | ||
| SdlRouterService.this.setSdlRouterServicePrefs(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE, true); | ||
| }catch (Exception exception){ |
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.
Spacing seems to be strange here as well.
Fixes #1351
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Tests
This issue is tricky to test since we have not found anyone who can actually reproduce the issue. Therefore we will have to simulate the issue and test around it. There are essentially two tests we can run: one to ensure the exception handler is properly triggered, and two to make sure the flag is properly saved and retrieved.
Testing the exception handler:
Comment out line ~1514 that is
notificationManager.createNotificationChannel(notificationChannel);and add a log into the exception handler. This will prevent the channel from being actually registered with the system and then the exception handler should trigger. Simply turn on the bluetooth adapter and connect to the module. The service will start up and the exception will be thrown within a few seconds.Testing the flag is set
Change the previous line to
On first pass this will throw the exception. The router service will shutdown. Turn off bluetooth or disconnect from the device. Then turn bluetooth back on and reconnect to the device. This time, since the flag was set, the channel will be created.
Summary
Changelog
Bug Fixes
CLA