setLoadingState

Sets the current loading state and notifies the listener.

Called primarily by MSDKSession's phoneState observer to update the loading state as the phone app progresses through initialization. MSDKSurfaceCallback only sets MAP_READY as a safety net in onAAMapViewReady() (for surface recreation when the Session's observer won't re-emit READY).

MAP_READY Protection

Once the loading state reaches AndroidAutoLoadingState.MAP_READY, it must NOT be downgraded back to a loading/initialization state. MAP_READY must persist until the surface is destroyed (AndroidAutoLoadingState.IDLE) or an error occurs (AndroidAutoLoadingState.ERROR).

This guard provides defense-in-depth against race conditions where a stale phone state re-emission triggers a loading state change after the map is already rendering.

AndroidAutoLoadingState.IDLE (surface destroyed / phone closing), AndroidAutoLoadingState.ERROR, AndroidAutoLoadingState.ONBOARDING_REQUIRED (e.g., map data deleted while AA is connected), and AndroidAutoLoadingState.LICENSE_REQUIRED (license check failed on reconnect) are allowed to override MAP_READY.

LICENSE_REQUIRED Protection

Similarly, once the loading state reaches AndroidAutoLoadingState.LICENSE_REQUIRED, it must NOT be overridden by initialization states. LICENSE_REQUIRED is a definitive state set by the phone app when the license does not include Android Auto features.

Only AndroidAutoLoadingState.IDLE (session ended) and AndroidAutoLoadingState.ERROR can override LICENSE_REQUIRED.

ONBOARDING_REQUIRED Protection

Similarly, once the loading state reaches AndroidAutoLoadingState.ONBOARDING_REQUIRED, it must NOT be overridden by initialization states. ONBOARDING_REQUIRED is set when the user hasn't completed onboarding yet. It must persist until the phone transitions past onboarding (INITIALIZING_MAPS, MAP_READY) or a definitive state is reached (LICENSE_REQUIRED, ERROR).

Only AndroidAutoLoadingState.IDLE (session ended), AndroidAutoLoadingState.INITIALIZING_MAPS (past onboarding), AndroidAutoLoadingState.MAP_READY (past onboarding), AndroidAutoLoadingState.LICENSE_REQUIRED (license checked after onboarding), AndroidAutoLoadingState.ERROR, and ONBOARDING_REQUIRED itself can override ONBOARDING_REQUIRED.

Parameters

state

The new loading state