Rethinking the User Model for Vehicles
In a standard Android phone environment, the device is typically tied to a single user. While Android supports multi-user profiles on tablets, switching users is often a slow, blocking operation.
Android Automotive OS (AAOS) completely reimagines the multi-user architecture. A car is inherently a shared device. Family members share cars, rental cars have new drivers every day, and a single journey might involve both a driver and multiple passengers interacting with different screens simultaneously.
Pre-Created Users for Faster Switching
User creation in Android involves heavy I/O operations: creating encrypted data directories, initializing user-specific system services, and extracting default APK data. In a car, waiting 10-15 seconds for a profile to load when you turn the key is unacceptable.
AAOS solves this with Pre-created Users. During system idle time (or boot), CarUserManager automatically creates background "guest" or "secondary" users. When a new driver enters the vehicle, the system simply renames and activates a pre-created user, reducing the switch time to mere milliseconds.
// Conceptual interaction with CarUserManager for background user creation
CarUserManager carUserManager = (CarUserManager) car.getCarManager(Car.CAR_USER_SERVICE);
// The framework handles pre-creation based on config.xml overlays:
// <integer name="config_multiuserMaxRunningUsers">3</integer>
Driver and Passenger User Concepts
Modern IVI systems often feature multiple displays (Center Console, Instrument Cluster, Rear Seat Entertainment screens). AAOS 11+ introduces concepts to map Android users to specific physical spaces in the car.
Profile Types
- System User (User 0): In AAOS, User 0 runs in the background. It hosts system services and the VHAL connection, but it is never the active foreground user interacting with the UI.
- Foreground User (Driver): The primary user profile currently driving the car (e.g., User 10). They have control over the primary displays and global vehicle settings.
- Passenger Profiles: Additional users running concurrently, interacting only with secondary displays.
User Assignment to Displays (Multi-Display)
The CarOccupantZoneManager bridges the gap between physical seats, displays, and Android users. It allows the system to route audio, input, and UI instances appropriately.
For example, a passenger in the rear left seat can have their own Android user profile running on their dedicated display, completely isolated from the driver's navigation app.
// Example: Querying occupant zones
CarOccupantZoneManager zoneManager = (CarOccupantZoneManager) car.getCarManager(Car.CAR_OCCUPANT_ZONE_SERVICE);
List<OccupantZoneInfo> zones = zoneManager.getAllOccupantZones();
for (OccupantZoneInfo zone : zones) {
if (zone.occupantType == CarOccupantZoneManager.OCCUPANT_TYPE_REAR_PASSENGER) {
// Assign a specific user to this rear display
Display display = zoneManager.getDisplayForOccupant(zone, CarOccupantZoneManager.DISPLAY_TYPE_MAIN);
Log.d("MultiUser", "Rear passenger display ID: " + display.getDisplayId());
}
}
CarUserManager API
The CarUserManager provides automotive-specific lifecycle callbacks that differ from standard Android broadcast receivers. Apps can register listeners to know exactly when a user switch starts, completes, or if a user is unlocked.
CarUserManager.UserLifecycleListener listener = new CarUserManager.UserLifecycleListener() {
@Override
public void onEvent(UserLifecycleEvent event) {
if (event.getEventType() == CarUserManager.USER_LIFECYCLE_EVENT_TYPE_SWITCHING) {
// Pause current user's media playback immediately
Log.d("CarUser", "Switching from user " + event.getPreviousUserId() + " to " + event.getUserId());
}
}
};
carUserManager.addListener(Runnable::run, listener);
By leveraging pre-created users and display-to-seat mappings, AAOS provides a seamless, personalized experience for every occupant in the vehicle without compromising boot speed or performance.