-
Notifications
You must be signed in to change notification settings - Fork 6k
[PlatformView][Android]VirtualDisplay resize on Android31 and above #47946
Conversation
|
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 or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). 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. |
|
Hi, Can you please update your branch so it can be merged? Also, how can write a test for this scenario? |
| // When 'hot reload', although the resize method is triggered, the size of the native View has | ||
| // not changed. | ||
| if (width == getRenderTargetWidth() && height == getRenderTargetHeight()) { | ||
| getView().postDelayed(onNewSizeFrameAvailable, 0); |
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.
What is the contract around onNewSizeFrameAvailable? In the case that the size doesn't change do we need to run it?
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.
yes, postDelayed can 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.
I don't think this is true, it must be called.
| return; | ||
| } | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
| resizeAboveAndroidS(getView(), width, height, onNewSizeFrameAvailable); |
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.
Please use the numeric version instead of S:
resize31(...);
| renderTarget.release(); | ||
| } | ||
|
|
||
| @TargetApi(21) |
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.
This should be 31
| private void resizeAboveAndroidS( | ||
| View embeddedView, int width, int height, final Runnable onNewSizeFrameAvailable) { | ||
| renderTarget.resize(width, height); | ||
| // https://android.googlesource.com/platform/prebuilts/fullsdk/sources/android-30/+/refs/heads/master/android/app/Presentation.java#293 |
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.
Rewrite this comment block as:
// On Android versions 31+ resizing of a Virtual Display's Presentation is natively supported.
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.
Please address this comment.
|
@johnmccutchan hi, thanks for code review. I have merge main branch to pre/128920. |
|
something wrong with build windows, https://github.com/flutter/engine/pull/47946/checks?check_run_id=18690556117 |
By a test I mean an automated test that is part of this PR. |
|
@designDo Are you going to address my other comments? |
I modified everything mentioned in the code review |
|
johnmccutchan
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.
Just a couple nits left and then I will approve. Thanks for the contribution!
| private void resizeAboveAndroidS( | ||
| View embeddedView, int width, int height, final Runnable onNewSizeFrameAvailable) { | ||
| renderTarget.resize(width, height); | ||
| // https://android.googlesource.com/platform/prebuilts/fullsdk/sources/android-30/+/refs/heads/master/android/app/Presentation.java#293 |
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.
Please address this comment.
| // When 'hot reload', although the resize method is triggered, the size of the native View has | ||
| // not changed. | ||
| if (width == getRenderTargetWidth() && height == getRenderTargetHeight()) { | ||
| return; |
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.
After reading the calling code, we do need to run the onNewSizeFrameAvailable in this case.
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.
Meaningless comments have been removed.
In this case, added onNewSizeFrameAvailable callback.
Thank you for your guidance and help!
| View embeddedView, int width, int height, final Runnable onNewSizeFrameAvailable) { | ||
| renderTarget.resize(width, height); | ||
| // On Android versions 31+ resizing of a Virtual Display's Presentation is natively supported. | ||
| // Fix in: https://github.com/flutter/flutter/issues/128920 |
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.
Please remove the comment "// Fix in: ..." as it isn't needed in the code.
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.
OK, this line has removed. I have merged main into pre/128920.
|
Thanks for your contribution! |
…138774) flutter/engine@3348fb0...70b1c73 2023-11-21 [email protected] [PlatformView][Android]VirtualDisplay resize on Android31 and above (flutter/engine#47946) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Resolves: flutter/flutter#128920