-
Notifications
You must be signed in to change notification settings - Fork 171
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
Attepted fix of NPE in #1783 #1786
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1786 +/- ##
=============================================
+ Coverage 54.36% 54.42% +0.05%
- Complexity 5513 5522 +9
=============================================
Files 562 562
Lines 25516 25543 +27
Branches 3319 3328 +9
=============================================
+ Hits 13872 13901 +29
Misses 10382 10382
+ Partials 1262 1260 -2
|
Add another check in case the manager listener is never instantiated
Also make SdlManager default constructor package private
Resolve merge conflicts
Also add debug warning about using the constructor outside the builder
} | ||
} else { | ||
DebugTool.logError(TAG, "Change Registration onError: " + response.getResultCode() + " | Info: " + response.getInfo()); | ||
retryChangeRegistration(); |
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.
Looks like this code was missed, this should not be removed
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.
Good catch
SdlManager sdlManager = createSampleManager("Test App", "test.test.test", lockScreenConfig); | ||
sdlManager.dispose(); | ||
sdlManager.retryChangeRegistration(); | ||
} |
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 dont think these unit tests actually will catch what we are trying to prevent. If the checkLifecycleConfiguration method is updated to manually throw an exception these tests will still pass. It does not look like the code is waiting for the runnable to complete so I believe the tests are completing before the runnable even executes.
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.
Think I should just remove them then?
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.
Yeah, I dont believe these tests are needed
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.
Okay, will do
}; | ||
|
||
public SdlManager(){ | ||
DebugTool.logWarning(TAG, "If this SdlManager was created without using SdlManager.Builder, most of its members are not initialized"); |
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.
DebugTool.logWarning(TAG, "If this SdlManager was created without using SdlManager.Builder, most of its members are not initialized"); | |
DebugTool.logWarning(TAG, "SdlManager must be created with SdlManager.Builder"); |
Fixes #1783 This is not ready for review. RiskNone Testing Plan
Unit Tests
Core TestsBoth Core tests were performed in a modified version of Hello Sdl Android, while locally making
Core version / branch / commit hash / module tested against: SDL Core v8.0.0 master 68f082169e0a40fccd9eb0db3c83911c28870f07 SummaryConverts local variable Add In In ChangelogBreaking Changes
Enhancements
Bug FixesCLA
|
Fixes #1783
This is not ready for review.
Risk
None
Testing Plan
Unit Tests
testDisposeAfterRetryChangeRegistration()
- Creates a sampleSdlManager
, callsretryChangeRegistration()
and then callsdispose()
. This test will pass if no exceptions are thrown.testRetryChangeRegistrationAfterDispose()
- Creates a sampleSdlManager
, callsdispose()
and then callsretryChangeRegistration()
. This test will pass if no exceptions are thrown.Core Tests
Both Core tests were performed in a modified version of Hello Sdl Android, while locally making
retryChangeRegistration()
public so it can be directly called in the app.At the end of
SdlService.performWelcomeShow()
I calledsdlManager.retryChangeRegistration()
thensdlManager.dispose()
. As a result, the app did not crash andSdlManager
did not throw a visible exception.At the end of
SdlService.performWelcomeShow()
I calledsdlManager.dispose()
thensdlManager.retryChangeRegistration()
. As a result, the app did not crash andSdlManager
did not throw a visible exception.Core version / branch / commit hash / module tested against: SDL Core v8.0.0 master 68f082169e0a40fccd9eb0db3c83911c28870f07
HMI name / version / branch / commit hash / module tested against: Generic HMI v0.11.0 master 47e0ad42f05b27adff61befd864e79c2ab4b8cec
Summary
Converts local variable
handler
inSdlManager.retryChangeRegistration()
to a private member of the classCreates private member
changeRegistrationRunnable
to replace anonymousRunnable
inSdlManager.retryChangeRegistration()
Add
DebugTool
warning in the default constructor ofSdlManager
to let developers know not to use the constructor directly.In
SdlManager.dismiss()
, removechangeRegistrationRunnable
fromhandler
if both are not nullIn
BaseSdlManager.checkLifecycleConfiguration()
add a null check formanagerListener
Changelog
Breaking Changes
Enhancements
Bug Fixes
CLA