Google is committed to advancing racial equity for Black communities. See how.

CarOccupantZoneManager

public class CarOccupantZoneManager
extends Object

java.lang.Object
   ↳ android.car.CarOccupantZoneManager


API to get information on displays and users in the car.

Summary

Nested classes

interface CarOccupantZoneManager.OccupantZoneConfigChangeListener

Listener to monitor any Occupant Zone configuration change. 

class CarOccupantZoneManager.OccupantZoneInfo

Represents an occupant zone in a car. 

Constants

int DISPLAY_TYPE_AUXILIARY

Auxiliary display which can provide additional screen for DISPLAY_TYPE_MAIN.

int DISPLAY_TYPE_HUD

Head Up Display.

int DISPLAY_TYPE_INPUT

Dedicated display for showing IME for DISPLAY_TYPE_MAIN

int DISPLAY_TYPE_INSTRUMENT_CLUSTER

Instrument cluster display.

int DISPLAY_TYPE_MAIN

Main display users are interacting with.

int DISPLAY_TYPE_UNKNOWN

Display type is not known.

int OCCUPANT_TYPE_DRIVER

Represents driver.

int OCCUPANT_TYPE_FRONT_PASSENGER

Represents front passengers who sits in front side of car.

int OCCUPANT_TYPE_REAR_PASSENGER

Represents passengers in rear seats.

int ZONE_CONFIG_CHANGE_FLAG_AUDIO

Zone config change caused by audio zone change.

int ZONE_CONFIG_CHANGE_FLAG_DISPLAY

Zone config change caused by display changes.

int ZONE_CONFIG_CHANGE_FLAG_USER

Zone config change caused by user change.

Public methods

List<Display> getAllDisplaysForOccupant(CarOccupantZoneManager.OccupantZoneInfo occupantZone)

Returns all displays assigned for the given occupant zone.

List<CarOccupantZoneManager.OccupantZoneInfo> getAllOccupantZones()

Returns all available occupants in the system.

Display getDisplayForOccupant(CarOccupantZoneManager.OccupantZoneInfo occupantZone, int displayType)

Gets the display for the occupant for the specified display type, or returns null if no display matches the requirements.

int getDisplayType(Display display)

Returns assigned display type for the display.

int getUserForOccupant(CarOccupantZoneManager.OccupantZoneInfo occupantZone)

Returns android user id assigned for the given zone.

void registerOccupantZoneConfigChangeListener(CarOccupantZoneManager.OccupantZoneConfigChangeListener listener)

Registers the listener for occupant zone config change.

void unregisterOccupantZoneConfigChangeListener(CarOccupantZoneManager.OccupantZoneConfigChangeListener listener)

Unregisters the listener.

Inherited methods

Constants

DISPLAY_TYPE_AUXILIARY

public static final int DISPLAY_TYPE_AUXILIARY

Auxiliary display which can provide additional screen for DISPLAY_TYPE_MAIN. Activity running in DISPLAY_TYPE_MAIN may use Presentation to show additional information.

Constant Value: 5 (0x00000005)

DISPLAY_TYPE_HUD

public static final int DISPLAY_TYPE_HUD

Head Up Display. This may exist only for driver.

Constant Value: 3 (0x00000003)

DISPLAY_TYPE_INPUT

public static final int DISPLAY_TYPE_INPUT

Dedicated display for showing IME for DISPLAY_TYPE_MAIN

Constant Value: 4 (0x00000004)

DISPLAY_TYPE_INSTRUMENT_CLUSTER

public static final int DISPLAY_TYPE_INSTRUMENT_CLUSTER

Instrument cluster display. This may exist only for driver.

Constant Value: 2 (0x00000002)

DISPLAY_TYPE_MAIN

public static final int DISPLAY_TYPE_MAIN

Main display users are interacting with. UI for the user will be launched to this display by default. Display#DEFAULT_DISPLAY will be always have this type. But there can be multiple of this type as each passenger can have their own main display.

Constant Value: 1 (0x00000001)

DISPLAY_TYPE_UNKNOWN

public static final int DISPLAY_TYPE_UNKNOWN

Display type is not known. In some system, some displays may be just public display without any additional information and such displays will be treated as unknown.

Constant Value: 0 (0x00000000)

OCCUPANT_TYPE_DRIVER

public static final int OCCUPANT_TYPE_DRIVER

Represents driver. There can be only one driver for the system.

Constant Value: 0 (0x00000000)

OCCUPANT_TYPE_FRONT_PASSENGER

public static final int OCCUPANT_TYPE_FRONT_PASSENGER

Represents front passengers who sits in front side of car. Most cars will have only one passenger of this type but this can be multiple.

Constant Value: 1 (0x00000001)

OCCUPANT_TYPE_REAR_PASSENGER

public static final int OCCUPANT_TYPE_REAR_PASSENGER

Represents passengers in rear seats. There can be multiple passengers of this type.

Constant Value: 2 (0x00000002)

ZONE_CONFIG_CHANGE_FLAG_AUDIO

public static final int ZONE_CONFIG_CHANGE_FLAG_AUDIO

Zone config change caused by audio zone change. Assigned audio zone for passenger zones have changed.

Constant Value: 4 (0x00000004)

ZONE_CONFIG_CHANGE_FLAG_DISPLAY

public static final int ZONE_CONFIG_CHANGE_FLAG_DISPLAY

Zone config change caused by display changes. A display could have been added / removed. Besides change in display itself. this can lead into removal / addition of passenger zones.

Constant Value: 1 (0x00000001)

ZONE_CONFIG_CHANGE_FLAG_USER

public static final int ZONE_CONFIG_CHANGE_FLAG_USER

Zone config change caused by user change. Assigned user for passenger zones have changed.

Constant Value: 2 (0x00000002)

Public methods

getAllDisplaysForOccupant

public List<Display> getAllDisplaysForOccupant (CarOccupantZoneManager.OccupantZoneInfo occupantZone)

Returns all displays assigned for the given occupant zone. If no display is available for the passenger, it will return empty list.

Parameters
occupantZone CarOccupantZoneManager.OccupantZoneInfo

Returns
List<Display>

getAllOccupantZones

public List<CarOccupantZoneManager.OccupantZoneInfo> getAllOccupantZones ()

Returns all available occupants in the system. If no occupant zone is defined in the system or none is available at the moment, it will return empty list.

Returns
List<CarOccupantZoneManager.OccupantZoneInfo>

getDisplayForOccupant

public Display getDisplayForOccupant (CarOccupantZoneManager.OccupantZoneInfo occupantZone, 
                int displayType)

Gets the display for the occupant for the specified display type, or returns null if no display matches the requirements.

Parameters
occupantZone CarOccupantZoneManager.OccupantZoneInfo

displayType int: This should be a valid display type and passing DISPLAY_TYPE_UNKNOWN will always lead into ERROR(/null) return. Value is DISPLAY_TYPE_UNKNOWN, DISPLAY_TYPE_MAIN, DISPLAY_TYPE_INSTRUMENT_CLUSTER, DISPLAY_TYPE_HUD, DISPLAY_TYPE_INPUT, or DISPLAY_TYPE_AUXILIARY

Returns
Display

getDisplayType

public int getDisplayType (Display display)

Returns assigned display type for the display. It will return DISPLAY_TYPE_UNKNOWN if type is not specified or if display is no longer available.

Parameters
display Display

Returns
int Value is DISPLAY_TYPE_UNKNOWN, DISPLAY_TYPE_MAIN, DISPLAY_TYPE_INSTRUMENT_CLUSTER, DISPLAY_TYPE_HUD, DISPLAY_TYPE_INPUT, or DISPLAY_TYPE_AUXILIARY

getUserForOccupant

public int getUserForOccupant (CarOccupantZoneManager.OccupantZoneInfo occupantZone)

Returns android user id assigned for the given zone. It will return UserHandle#USER_NULL if user is not assigned or if zone is not available.

Parameters
occupantZone CarOccupantZoneManager.OccupantZoneInfo

Returns
int

registerOccupantZoneConfigChangeListener

public void registerOccupantZoneConfigChangeListener (CarOccupantZoneManager.OccupantZoneConfigChangeListener listener)

Registers the listener for occupant zone config change. Registering multiple listeners are allowed.

Parameters
listener CarOccupantZoneManager.OccupantZoneConfigChangeListener

unregisterOccupantZoneConfigChangeListener

public void unregisterOccupantZoneConfigChangeListener (CarOccupantZoneManager.OccupantZoneConfigChangeListener listener)

Unregisters the listener. Listeners not registered before will be ignored.

Parameters
listener CarOccupantZoneManager.OccupantZoneConfigChangeListener