Improve code quality in PlatformViewsController.java#181338
Improve code quality in PlatformViewsController.java#181338auto-submit[bot] merged 1 commit intoflutter:masterfrom
PlatformViewsController.java#181338Conversation
There was a problem hiding this comment.
Code Review
This pull request focuses on improving code quality in PlatformViewsController.java and PlatformViewsController2.java by fixing typos, replacing a loop with addAll, and removing unnecessary casts. The changes enhance readability and maintainability, aligning with the repository's style guide emphasizing code readability.
I am having trouble creating individual review comments. Click here to see my feedback.
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (1284-1286)
HIGH: Unnecessary casts are removed as width, height, x, and y are already integers, which aligns with the constructor's expected input types. This simplifies the code and improves readability.
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(width, height);
layoutParams.leftMargin = x;
layoutParams.topMargin = y;
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (552-554)
HIGH: Using activeTransactions.addAll(pendingTransactions) is more concise and efficient than iterating through pendingTransactions and adding each element individually.
activeTransactions.addAll(pendingTransactions);
pendingTransactions.clear();engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (322)
MEDIUM: "embeded" is misspelled. It should be "embedded".
// This offset doesn't affect the position of the embedded view by itself since the GL
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (714)
MEDIUM: "VirtualDiplay" is misspelled. It should be "VirtualDisplay".
float density, PlatformViewTouch touch, boolean usingVirtualDisplay) {
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (735)
MEDIUM: "VirtualDiplay" is misspelled. It should be "VirtualDisplay".
if (!usingVirtualDisplay && trackedEvent != null) {
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (986)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
disposeAllViews();
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (990)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
disposeAllViews();
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (1120)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
private void disposeAllViews() {
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (315)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
disposeAllViews();
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (319)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
disposeAllViews();
engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (413)
MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".
private void disposeAllViews() {
This comment was marked as off-topic.
This comment was marked as off-topic.
…10903) Manual roll requested by [email protected] flutter/flutter@def9ca9...7165649 2026-01-26 [email protected] Roll Skia from ad914f07941a to be280d242a60 (4 revisions) (flutter/flutter#181499) 2026-01-26 [email protected] Roll Dart SDK from 60553fc4c04f to ba23b5ed0a97 (2 revisions) (flutter/flutter#181497) 2026-01-26 [email protected] Improve code quality in `PlatformViewsController.java` (flutter/flutter#181338) 2026-01-26 [email protected] Roll Packages from 5af5f50 to e712bfa (22 revisions) (flutter/flutter#181493) 2026-01-26 [email protected] Roll Skia from 0513d99df30d to ad914f07941a (3 revisions) (flutter/flutter#181489) 2026-01-26 [email protected] Roll Skia from 2830fbe8bafe to 0513d99df30d (1 revision) (flutter/flutter#181476) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
This change mostly is a cleanup :
- fixes typos in method names.
- replaces :
```java
for (int i = 0; i < pendingTransactions.size(); i++) {
activeTransactions.add(pendingTransactions.get(i));
}
```
with :
```java
activeTransactions.addAll(pendingTransactions);
```
- removes unnecessary cast in:
```java
layoutParams.leftMargin = (int) x;
layoutParams.topMargin = (int) y;
```
because :
https://github.com/flutter/flutter/blob/bfc9041eb1188b35fedd1258bb9548489834bc73/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java#L1273
## 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].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] 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
This change mostly is a cleanup :
with :
because :
flutter/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java
Line 1273 in bfc9041
Pre-launch Checklist
///).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. Comments from the
gemini-code-assistbot 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.