Skip to content

fix: AdvancedMarker pinConfig, pending camera moves and Street View source - #1046

Merged
dkhawk merged 1 commit into
mainfrom
fix/library-review-findings
Oct 20, 2026
Merged

dkhawk merged 1 commit into
mainfrom
fix/library-review-findings

Conversation

@kikoso

@kikoso kikoso commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Three small bug fixes in maps-compose, each with a JVM unit test.

AdvancedMarker drops pinConfig on first composition

When the node is inserted, update(icon) ran after update(pinConfig). With icon == null it called setIcon(null) and replaced the PinConfig glyph with the default pin. This hit the common AdvancedMarker(state, pinConfig = ...) case (README example, AdvancedMarkersActivity). Both update blocks now resolve the icon through advancedMarkerIcon(), which uses the factory's precedence (pinConfig over icon), so a null icon no longer overwrites a set pinConfig.

Setting position before the map binds did not override a pending move()/animate()

With no map bound, the position setter only wrote rawPosition. When the map bound, setMap() moved to the new position and then ran the stale pending move or animation, overwriting it. That contradicts the move() and animate() KDoc. The setter now cancels the pending callback and clears movementOwner.

StreetViewCameraPositionState.setPosition dropped source without radius

setPosition(latLng, source = OUTDOOR) fell through to setPosition(latLng). It now calls StreetViewPanorama.setPosition(LatLng, StreetViewSource).

Tests

maps-compose had no unit tests. FakeMapsSdk.kt adds small java.lang.reflect.Proxy fakes of the SDK delegate interfaces (IGoogleMapDelegate, IStreetViewPanoramaDelegate, ICameraUpdateFactoryDelegate) that record calls, so these run on the JVM with no new dependencies. I checked that the camera and Street View tests fail without their fixes.

  • ./gradlew :maps-compose:testDebugUnitTest: 10 tests pass
  • ./gradlew :maps-compose:lintDebug: no new issues (existing PotentialBehaviorOverride warnings in MapApplier.kt)
  • Spotless: clean on all changed files

BEGIN_COMMIT_OVERRIDE
fix(markers): keep the pinConfig icon on AdvancedMarker when icon is null
fix(camera): setting position while unbound cancels a pending move or animation
fix(streetview): forward source in setPosition when radius is null
END_COMMIT_OVERRIDE

…ource

- AdvancedMarker: a null icon no longer overwrites the pinConfig icon during
  composition. The update blocks now resolve the icon with the same
  precedence as the factory (pinConfig over icon).
- CameraPositionState: setting position while no map is bound now cancels a
  pending move() or animate(), as the KDoc says, so it is not overwritten
  when the map binds.
- StreetViewCameraPositionState: setPosition forwards source when radius is
  null instead of dropping it.
@kikoso
kikoso marked this pull request as ready for review October 20, 2026 04:17
@github-actions

Copy link
Copy Markdown

Coverage (unit tests)

Compared against cdf8b7f on main (#1044).

Module Line % Change Branch % Change
maps-compose 3.94% 🔺 +3.94 1.60% 🔺 +1.60
maps-compose-utils 2.17% no change 0.94% no change
maps-compose-widgets 0.00% no change 0.00% no change
TOTAL 3.35% 🔺 +2.90 1.43% 🔺 +1.26

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 44.54% -0.11% 🍏
Files changed 47.62% ❌

Module Coverage
maps-app 63.36% -0.27% ❌
Files
Module File Coverage
maps-app CameraPositionState.kt 68.88% -0.25% 🍏
Marker.kt 64.66% -0.61% ❌
StreetViewCameraPositionState.kt 37.25% -5.88% ❌

@dkhawk
dkhawk merged commit a5b018c into main Oct 20, 2026
13 checks passed
@dkhawk
dkhawk deleted the fix/library-review-findings branch October 20, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants