Reduce duplicate drawing of polylines and polygons + fix feature removing in Google Maps#7065
Merged
grzesiek2010 merged 4 commits intogetodk:masterfrom Feb 1, 2026
Merged
Conversation
seadowg
approved these changes
Feb 1, 2026
|
Tested with success Verified on Android 14 Verified cases:
|
|
Tested with success Verified on Android 10 |
|
Tested with success Verified on Android 16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7058
This PR focuses on:
from #7058
Why is this the best possible solution? Were any other approaches considered?
There are at least two issues in the way we update polylines/polygons:
The process of updating polylines/polygons is quite heavy because, despite being called an
update, it actually removes the existing polyline/polygon entirely and recreates it from scratch. This means that every time a new point is recorded for a polyline/polygon, the full remove-and-create sequence is repeated.Additionally, the update was triggered by changes in combined LiveData (the list of points and the invalid polygon message). As a result, any change in either of these LiveData sources caused an update even in cases where the value didn’t effectively change (for example, when the invalid polygon message was null and remained null). This led to redundant updates where identical polylines/polygons were removed and recreated.
Google Maps somehow doesn't like that heavy approach and has problems with redrawing polylines/polygons properly. I've fixed the latter in 4fd62ed This helped a little, but didn’t fix the issue entirely. I considered addressing the root cause properly by updating polylines/polygons instead of removing and recreating them from scratch, but that would require more time and introduce additional risk. Instead, for now, in Collect v2026.1, I implemented a workaround to address the issue see: 2ae024b
However, I think we should file a separate issue for addressing updating properly.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Since there are a few other PRs with the needs testing label that address related issues in this area, I think it makes sense to test everything as a whole rather than focusing on any particular area of risk.
Do we need any specific form for testing your changes? If so, please attach one.
The form is linked in the issue.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest(or./gradlew testLab) and confirmed all checks still passDateFormatsTest