phoneState

val phoneState: StateFlow<PhoneAppState>

Public read-only StateFlow of the phone app state.

Android Auto collects this flow to react to phone app lifecycle changes.

Carried over from one car session to the next

The state outlives the car session while the phone app keeps running, that is while a phoneAppCallback is registered: the next session starts from the state the phone app reported last, and the phone app does not have to report it again. It is reset to PhoneAppState.UNKNOWN at a session boundary (onSessionCreated, onSessionDestroyed) in two cases only:

  • no phoneAppCallback is registered: the phone app is not running, and it reports its state afresh once the session has launched it;

  • the state is PhoneAppState.CLOSING, which concerns the session it was reported in.