AASurfaceLifecycleCallback
Callback interface for Android Auto MapView surface lifecycle events.
This interface handles the initialization and release of the map surface, which is separate from the connection lifecycle. The surface can be created and destroyed multiple times within a single AA session.
Responsibility
Manages MapView surface-level events:
Surface initialization (AA ready to display map)
Surface release (AA surface destroyed)
Callers
Methods in this interface are called by AndroidAutoSurfaceCallback:
onAARequestingInit when phone state becomes READY
onAAReleasing when surface is destroyed
MapView Coordination
Since both phone and AA share the same Navigation instance, only one MapView can be actively attached at a time. This interface coordinates the handoff:
onAARequestingInit: Phone detaches its MapView, AA attaches its MapView
onAAReleasing: AA detaches its MapView, phone re-attaches its MapView
Usage
class MyCallback : AASurfaceLifecycleCallback {
override fun onAARequestingInit() {
// Detach phone MapView, show placeholder screen
}
override fun onAAReleasing() {
// Re-attach phone MapView, hide placeholder
}
}