Skip to content

[google_maps_flutter_android] Avoid redundant ground overlay image updates#12242

Open
ziyad-aljohani wants to merge 1 commit into
flutter:mainfrom
ziyad-aljohani:agent/skip-unchanged-ground-overlay-image
Open

[google_maps_flutter_android] Avoid redundant ground overlay image updates#12242
ziyad-aljohani wants to merge 1 commit into
flutter:mainfrom
ziyad-aljohani:agent/skip-unchanged-ground-overlay-image

Conversation

@ziyad-aljohani

@ziyad-aljohani ziyad-aljohani commented Jul 19, 2026

Copy link
Copy Markdown

interpretGroundOverlayOptions currently converts and applies the image on every ground overlay change, even when only properties such as transparency or position changed. For byte-backed images, this unnecessarily decodes the image and recreates its BitmapDescriptor on the platform thread.

This change stores the last PlatformBitmap in GroundOverlayController and uses its generated deep equality to determine whether the image changed. Property-only updates now skip image conversion and setImage, while genuine image changes continue through the existing path.

Partially addresses flutter/flutter#189702 by removing redundant image work from property-only updates. This optimization does not make multi-overlay swaps transactional.

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

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla

google-cla Bot commented Jul 19, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Copy link
Copy Markdown
Contributor

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 modifies the Android implementation of the Google Maps Flutter plugin to avoid recreating ground overlay images when only other overlay properties change. It updates Convert.java, GroundOverlayController.java, and GroundOverlaysController.java to track the current PlatformBitmap and only update the image if it has changed. Additionally, it includes corresponding unit tests in GroundOverlaysControllerTest.java and bumps the package version to 2.19.13. There are no review comments, and I have no feedback to provide.

@stuartmorgan-g
stuartmorgan-g self-requested a review July 21, 2026 18:14
@stuartmorgan-g stuartmorgan-g added the triage-android Should be looked at in Android triage label Jul 21, 2026
@stuartmorgan-g
stuartmorgan-g requested a review from reidbaker July 21, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants