-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Jetpack Section: Scan - fix crash on snackbar display #14078
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
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
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.
👋 @ashiagr !
I have reviewed and tested this PR as per the instructions, everything works as expected, good fix! 🌟
|
👋 @ashiagr ! I also triggered a re-run of the CI (from failed) because it was stuck as some |
|
👋 @ashiagr ! CI failed again, maybe ask |
|
You can test the changes on this Pull Request by downloading the APK here. |
|
CI fixed! |
|
@JavonDavis I introduced this crash in beta-2 😢. This PR fixes the issue and is targeting the frozen branch. Could you please include it in the next beta version? Thanks! |
|
👋 I see this PR doesn't included the last commit from #14082, unfortunately this is causing a conflict with a PR I'd like to include in the @AliSoftware how should I solve the conflict with or without the last commit? Thanks for the help! |
|
The last commit of #14082 should have been included too indeed – it was added late in the investigation of this issue which is why I forgot to cherry-pick it here later, but it is part of the integrity of the whole fix and should indeed be added on top. Note tho that @jkmassel is currently applying the fix from #14082 to the base of |
Ok, thank you very much @AliSoftware for the info, we'll wait for the fix then. |
Description
This PR fixes below crash when snackbar is displayed on Scan and Threat Details screen.
Findings
We passed fragment's root constraint layout (using Kotlin synthetics) in the
showSnackbarmethod. We started experiencing this crash after replacingFragmentContainerLayoutwithFragmentin the corresponding activity layout xml.As per this SO answer, we instantiated
viewModelsfor these screen insideonViewCreatedso the layout referenced in theshowSnackbarmethod should've been present at the time we had to display the snackbar.I think it is the way Kotlin synthetic properties are cached and referenced in the different ways we add a fragment (directly in the xml or using
FragmentContainerView). Or crash might be occurring on random devices as per this comment, however I'm not 100% sure.Solution
It is sufficient to just pass fragment's view in the
showSnackbarmethod, so I've removed reference to the fragment's constraint layout in the method. This fixes the crash and snackbar is displayed properly.To Test
Fix or ignore a threat from Threat Details screen (on a Jurassic Ninja site with scan capability and bad calendar plugin installed), see that app does not crash and snackbar is displayed properly.
(Or you can return
Failure.RemoteRequestFailurefromFixThreatsUseCaseso that snackbar is shown for the failed response.)PR submission checklist:
RELEASE-NOTES.txtif necessary.