[google_maps_flutter_android] Avoid redundant ground overlay image updates#12242
[google_maps_flutter_android] Avoid redundant ground overlay image updates#12242ziyad-aljohani wants to merge 1 commit into
Conversation
|
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. |
There was a problem hiding this comment.
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.
| @NonNull AssetManager assetManager, | ||
| float density, | ||
| @NonNull BitmapDescriptorFactoryWrapper wrapper) { | ||
| @NonNull BitmapDescriptorFactoryWrapper wrapper, |
There was a problem hiding this comment.
it seems like the wrong scope to me for the interpretGroundOverlayOptions method to take the decision about if it should update the image instead of having. It looks like you have code that sometimes decides and sometimes you hardcode true. Can you talk to me a bit about what callers expect and what constraints you have?
Or maybe the sink should keep a record of the last image and diff? Either way I think understanding what layer shoudl be responsible for preventing duplicates is something i want more information about.
| new GroundOverlayController( | ||
| groundOverlay, | ||
| platformGroundOverlay.getBounds() != null, | ||
| platformGroundOverlay.getImage()); |
There was a problem hiding this comment.
why does interpretGroundOverlayOptions now need platformGroundOverlay.getImage() when it didnt before
are you using it as a kind of sudosignal that the image didnt change?
interpretGroundOverlayOptionscurrently 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 itsBitmapDescriptoron the platform thread.This change stores the last
PlatformBitmapinGroundOverlayControllerand uses its generated deep equality to determine whether the image changed. Property-only updates now skip image conversion andsetImage, 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
[shared_preferences]///).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.Footnotes
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