AAMapState
Focused state holder for Android Auto map display state.
This class manages all state related to the Android Auto map rendering, camera behavior, and user interaction with the map surface:
Camera following: Whether the map auto-centers on GPS position
Split screen: Whether the AA display shows a side panel
Vehicle position: Horizontal center of the visible area for vehicle icon placement
Dark mode: Car head unit day/night mode state
Zoom: Delegated zoom handlers (routed through SurfaceCallback for live camera state)
MapView reattach: Callback for re-attaching MapView after Navigation session restart
Why Zoom Is Delegated
The zoom buttons in NavigationScreen only have access to MapController, whose zoomIn()/zoomOut() methods use a stale ViewModel center during guidance tracking (the MSDK moves the camera directly without updating the ViewModel).
By routing zoom through the SurfaceCallback (which has access to the live aaMapView), we can read the actual camera position via getCurrentMapState() and apply zoom at the correct location using MapController.centerOn().
Thread Safety
StateFlow for all reactive state (inherently thread-safe)
@Volatile for zoomHandler and zoomToRectHandler (set from main thread, may be invoked from binder thread)
See also
Properties
Public read-only StateFlow of the camera following state.
Public read-only StateFlow of the car's dark mode state.
Public read-only StateFlow of the split screen state.
Public read-only StateFlow of the visible area horizontal center fraction.
Functions
Handles a zoom operation by delegating to the registered zoom handler.
Fits the AA MapView camera to a geographic bounding box within the visible screen area.
Requests the Android Auto MapView to be re-attached to Navigation.
Sets the camera following state.
Sets the car's dark mode state.
Sets the callback for MapView re-attachment.
Sets the split screen state.
Sets the horizontal center of the visible area as a fraction of the full surface.
Sets the callback for handling zoom operations on the AA MapView.
Sets the callback for fitting the AA MapView camera to a geographic bounding box.