-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix crash when splash screen is not specified for FlutterFragmentActivity #27062
Conversation
c2e4e28 to
ba3792e
Compare
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@blasten any thoughts on how this should be tested? Seems like flutter/flutter#44242 was filed previously for the tests when #13660 was created. |
blasten
left a comment
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.
change LG, but could we add a test?
ba3792e to
95cff24
Compare
|
@blasten sorry for the delay, I have added the tests |
| } | ||
|
|
||
| @Test | ||
| public void itWithMetadataWithoutSplashScreenResourceDoesNotLoadsSplashScreenDrawable() |
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.
is this test name correct?
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.
More or less, it has the metadata file but does not have the lines
activityInfo.metaData.putInt(
FlutterActivityLaunchConfigs.SPLASH_SCREEN_META_DATA_KEY,
SplashShadowResources.THEMED_SPLASH_DRAWABLE_ID);
to put the <meta-data> entry. Updated it to make it a bit clearer though.
| } | ||
|
|
||
| @Test | ||
| public void itWithMetadataWithoutSplashScreenResourceDoesNotLoadsSplashScreenDrawable() |
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.
ditto
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.
Same as above
blasten
left a comment
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.
LGTM + comment about test name
When the manifest file doesn't specify
io.flutter.embedding.android.SplashScreenDrawableandFlutterFragmentActivityis used, the app crashes with aandroid.content.res.Resources$NotFoundException: Resource ID #0x0exception.This should have been part of #13660.
FlutterFragmentActivityTestas well – they should have been instantiating aFlutterFragmentActivityinstead ofFlutterActivity.Related Issue
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.