Skip to content

Improve code quality in PlatformViewsController.java#181338

Merged
auto-submit[bot] merged 1 commit intoflutter:masterfrom
AbdeMohlbi:improve_coed_quality_in_pltaformViews
Jan 26, 2026
Merged

Improve code quality in PlatformViewsController.java#181338
auto-submit[bot] merged 1 commit intoflutter:masterfrom
AbdeMohlbi:improve_coed_quality_in_pltaformViews

Conversation

@AbdeMohlbi
Copy link
Contributor

@AbdeMohlbi AbdeMohlbi commented Jan 22, 2026

This change mostly is a cleanup :

  • fixes typos in method names.
  • replaces :
    for (int i = 0; i < pendingTransactions.size(); i++) {
      activeTransactions.add(pendingTransactions.get(i));
    }

with :

    activeTransactions.addAll(pendingTransactions);
  • removes unnecessary cast in:
layoutParams.leftMargin = (int) x;
layoutParams.topMargin = (int) y;

because :

public void onDisplayOverlaySurface(int id, int x, int y, int width, int height) {

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-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.

@github-actions github-actions bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Jan 22, 2026
@AbdeMohlbi AbdeMohlbi changed the title WIP Improve code quality in PlatformViewsController.java Jan 23, 2026
@AbdeMohlbi AbdeMohlbi marked this pull request as ready for review January 23, 2026 16:03
@AbdeMohlbi AbdeMohlbi requested a review from a team as a code owner January 23, 2026 16:03
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

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

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

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

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

MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".

    disposeAllViews();

engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (990)

medium

MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".

    disposeAllViews();

engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java (1120)

medium

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

MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".

    disposeAllViews();

engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (319)

medium

MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".

    disposeAllViews();

engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController2.java (413)

medium

MEDIUM: "diposeAllViews" is misspelled. It should be "disposeAllViews".

  private void disposeAllViews() {

@flutter-dashboard

This comment was marked as off-topic.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 26, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 26, 2026
Merged via the queue into flutter:master with commit 8480c41 Jan 26, 2026
179 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 26, 2026
…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
flutter-zl pushed a commit to flutter-zl/flutter that referenced this pull request Feb 10, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants