Make HCPP upgrading work for vd/tlhc#181024
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly implements the fallback mechanism to HCPP for TextureAndroidViewController, addressing a potential null pointer exception. The changes are logical and well-contained. The modifications in RenderAndroidView to handle composition-based views are also appropriate.
The pull request description mentions that these changes are currently untested, with a plan for testing in a follow-up PR. While untested changes are generally a concern, the plan to add tests in a subsequent PR is noted. Please ensure that the follow-up testing is comprehensive.
| @override | ||
| void paint(PaintingContext context, Offset offset) { | ||
| if (_viewController.textureId == null || _currentTextureSize == null) { | ||
| if ((_viewController.textureId == null && !_viewController.requiresViewComposition) || |
There was a problem hiding this comment.
Double check on this logic change is your intent
(Null texture id and does not require view composition) or (null texture size)?
There was a problem hiding this comment.
Yes, otherwise we would return early from paint in all cases in the hcpp flow, which is not what we would want (because texture id is always null in that case).
|
|
||
| @override | ||
| Future<Size> _sendResizeMessage(Size size) { | ||
| if (_internals.requiresViewComposition) { |
There was a problem hiding this comment.
Can you add a comment explaining why this does not need to send the resize message?
|
|
||
| @override | ||
| Future<void> setOffset(Offset off) { | ||
| if (_internals.requiresViewComposition) { |
Before the change we get a NPE when trying to cast the return of the create message as an int. There are also some more changes needed on top of the change to the cast, making the `TextureAndroidViewController` aware of if it is using HCPP and exposing that bool for use in `packages/flutter/lib/src/rendering/platform_view.dart` This is untested because it currently isn't possible to use HCPP without uncommenting the code block here: https://github.com/flutter/flutter/blob/2beceb6b1c0701ce0d3289dec41c7fa7f8678b9e/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java#L95 It will be tested in the follow up pr which adds the cli flag, uncomments the block, and adds golden tests that we can upgrade each of the 3 legacy modes. Fixes flutter#181000 --------- Co-authored-by: Gray Mackall <mackall@google.com>
This reverts commit a191754.
This reverts commits a191754 and 242d4f9 as a fix for b/483943343 and a speculative fix for b/489613062. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…ter#183310) This reverts commit b53c2e6.
…er#183310) This reverts commits flutter@a191754 and flutter@242d4f9 as a fix for b/483943343 and a speculative fix for b/489613062. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Before the change we get a NPE when trying to cast the return of the create message as an int. There are also some more changes needed on top of the change to the cast, making the `TextureAndroidViewController` aware of if it is using HCPP and exposing that bool for use in `packages/flutter/lib/src/rendering/platform_view.dart` This is untested because it currently isn't possible to use HCPP without uncommenting the code block here: https://github.com/flutter/flutter/blob/2beceb6b1c0701ce0d3289dec41c7fa7f8678b9e/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java#L95 It will be tested in the follow up pr which adds the cli flag, uncomments the block, and adds golden tests that we can upgrade each of the 3 legacy modes. Fixes flutter#181000 --------- Co-authored-by: Gray Mackall <mackall@google.com>
…er#183310) This reverts commits flutter@a191754 and flutter@242d4f9 as a fix for b/483943343 and a speculative fix for b/489613062. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…ter#183310) (flutter#183360) Undo the revert, as it was not the problem. Co-authored-by: Gray Mackall <mackall@google.com> Co-authored-by: Jenn Magder <magder@google.com>
…er#183310) This reverts commits flutter@a191754 and flutter@242d4f9 as a fix for b/483943343 and a speculative fix for b/489613062. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…ter#183310) (flutter#183360) Undo the revert, as it was not the problem. Co-authored-by: Gray Mackall <mackall@google.com> Co-authored-by: Jenn Magder <magder@google.com>
Before the change we get a NPE when trying to cast the return of the create message as an int.
There are also some more changes needed on top of the change to the cast, making the
TextureAndroidViewControlleraware of if it is using HCPP and exposing that bool for use inpackages/flutter/lib/src/rendering/platform_view.dartThis is untested because it currently isn't possible to use HCPP without uncommenting the code block here:
flutter/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformViewsChannel.java
Line 95 in 2beceb6
It will be tested in the follow up pr which adds the cli flag, uncomments the block, and adds golden tests that we can upgrade each of the 3 legacy modes.
Fixes #181000