Car
public
final
class
Car
extends Object
java.lang.Object | |
↳ | android.car.Car |
Top level car API for Android Automotive OS deployments.
This API works only for devices with PackageManager.FEATURE_AUTOMOTIVE
Calling this API on a device with no such feature will lead to an exception.
Summary
Nested classes | |
---|---|
interface |
Car.CarServiceLifecycleListener
Callback to notify the Lifecycle of car service. |
Constants | |
---|---|
int |
API_VERSION_MAJOR_INT
This constant is deprecated.
- This does not return the correct version. Use
|
int |
API_VERSION_MINOR_INT
This constant is deprecated.
- This does not return the correct version. Use
|
String |
APP_FOCUS_SERVICE
Service name for |
String |
AUDIO_SERVICE
Service name for |
String |
CAR_EXTRA_BROWSE_SERVICE_FOR_SESSION
Used as a string extra field of media session to specify the service corresponding to the session. |
String |
CAR_EXTRA_MEDIA_COMPONENT
This constant is deprecated.
Use |
String |
CAR_INTENT_ACTION_MEDIA_TEMPLATE
This constant is deprecated.
Use |
String |
CAR_NAVIGATION_SERVICE
Service name for |
String |
CAR_OCCUPANT_ZONE_SERVICE
Service name for |
String |
CAR_UX_RESTRICTION_SERVICE
Service name for |
long |
CAR_WAIT_TIMEOUT_DO_NOT_WAIT
|
long |
CAR_WAIT_TIMEOUT_WAIT_FOREVER
|
String |
CAR_WATCHDOG_SERVICE
Service name for |
int |
CONNECTION_TYPE_EMBEDDED
This constant is deprecated. connection type constants are no longer used |
String |
INFO_SERVICE
Service name for |
String |
META_DATA_DISTRACTION_OPTIMIZED
This represents AndroidManifest meta-data to tell that |
String |
META_DATA_REQUIRES_CAR_FEATURE
This represents AndroidManifest meta-data to tell that |
String |
PACKAGE_SERVICE
Service name for |
String |
PERMISSION_ADJUST_RANGE_REMAINING
Signature|Privileged permission necessary to change value of car's range remaining. |
String |
PERMISSION_CAR_CONTROL_AUDIO_SETTINGS
Signature|Privileged permission necessary to change car audio settings through
|
String |
PERMISSION_CAR_CONTROL_AUDIO_VOLUME
Signature|Privileged permission necessary to change car audio volume through
|
String |
PERMISSION_CAR_DRIVING_STATE
Signature|Privileged permission necessary to access a car's driving state (E.g. |
String |
PERMISSION_CAR_DRIVING_STATE_3P
Dangerous permission necessary to access a car's driving state. |
String |
PERMISSION_CAR_DYNAMICS_STATE
Signature|Privileged permission necessary to access car's dynamics state. |
String |
PERMISSION_CAR_ENGINE_DETAILED
Signature|Privileged permission necessary to access car's engine information. |
String |
PERMISSION_CAR_ENGINE_DETAILED_3P
Dangerous permission necessary to access car's engine information. |
String |
PERMISSION_CAR_EPOCH_TIME
Signature|Privileged permission necessary to access car's property
|
String |
PERMISSION_CAR_INFO
Normal permission necessary to use |
String |
PERMISSION_CAR_NAVIGATION_MANAGER
Signature|Privileged permission necessary to use |
String |
PERMISSION_CONTROL_ADAS_SETTINGS
Signature|Privileged permission necessary to control ADAS settings information. |
String |
PERMISSION_CONTROL_ADAS_STATES
Signature|Privileged permission necessary to control ADAS states information. |
String |
PERMISSION_CONTROL_CAR_AIRBAGS
Signature|Privileged permission necessary to enable/disable a seat's ability to deploy airbag(s) when triggered (e.g. by a crash). |
String |
PERMISSION_CONTROL_CAR_CLIMATE
Signature|Privileged permission necessary to access Car HVAC APIs. |
String |
PERMISSION_CONTROL_CAR_DOORS
Signature|Privileged permission necessary to control car's door. |
String |
PERMISSION_CONTROL_CAR_DYNAMICS_STATE
Signature|Privileged permission necessary to control car's dynamics state. |
String |
PERMISSION_CONTROL_CAR_ENERGY
Signature|Privileged permission necessary to control car's EV charge settings. |
String |
PERMISSION_CONTROL_CAR_HORN
Signature|Privileged permission necessary to control car horn state. |
String |
PERMISSION_CONTROL_CAR_MIRRORS
Signature|Privileged permission necessary to control car's mirrors. |
String |
PERMISSION_CONTROL_CAR_SEATS
Signature|Privileged permission necessary to control car's seats. |
String |
PERMISSION_CONTROL_CAR_WINDOWS
Signature|Privileged permission necessary to control car's windows. |
String |
PERMISSION_CONTROL_DISPLAY_UNITS
Normal permission necessary to control display units for distance, fuel volume, tire pressure and ev battery. |
String |
PERMISSION_CONTROL_DRIVER_MONITORING_SETTINGS
Signature|Privileged permission necessary to control driver monitoring systems settings information. |
String |
PERMISSION_CONTROL_ENERGY_PORTS
Signature|Privileged permission necessary to control car's fuel door and ev charge port. |
String |
PERMISSION_CONTROL_EXTERIOR_LIGHTS
Signature|Privileged permission necessary to control car's exterior lights. |
String |
PERMISSION_CONTROL_GLOVE_BOX
Signature|Privileged permission necessary to control car glove box. |
String |
PERMISSION_CONTROL_HEAD_UP_DISPLAY
Signature|Privileged permission necessary to control head up display. |
String |
PERMISSION_CONTROL_INTERIOR_LIGHTS
Signature|Privileged permission necessary to control car's interior lights. |
String |
PERMISSION_CONTROL_POWERTRAIN
Signature|Privileged permission necessary to control car's powertrain information. |
String |
PERMISSION_CONTROL_STEERING_WHEEL
Signature|Privileged permission necessary to control car's steering wheel. |
String |
PERMISSION_CONTROL_VALET_MODE
Signature|Privileged permission necessary to control valet mode. |
String |
PERMISSION_CONTROL_WINDSHIELD_WIPERS
Signature|Privileged permission necessary to control car's windshield wipers. |
String |
PERMISSION_ENERGY
Dangerous permission necessary to access car's energy information. |
String |
PERMISSION_ENERGY_PORTS
Normal permission necessary to access car's fuel door and ev charge port. |
String |
PERMISSION_EXTERIOR_ENVIRONMENT
Normal permission necessary to read temperature of car's exterior environment. |
String |
PERMISSION_EXTERIOR_LIGHTS
Signature|Privileged permission necessary to read car's exterior lights information. |
String |
PERMISSION_IDENTIFICATION
Signature|Privileged permission necessary to access car's VIN information |
String |
PERMISSION_MILEAGE
Signature|Privileged permission necessary to access car's mileage information. |
String |
PERMISSION_MILEAGE_3P
Dangerous permission necessary to access car's mileage information. |
String |
PERMISSION_POWERTRAIN
Normal permission necessary to access car's powertrain information. |
String |
PERMISSION_PRIVILEGED_CAR_INFO
Signature|Privileged permission necessary to access privileged car info. |
String |
PERMISSION_READ_ADAS_SETTINGS
Signature|Privileged permission necessary to read ADAS settings information. |
String |
PERMISSION_READ_ADAS_STATES
Signature|Privileged permission necessary to read ADAS states information. |
String |
PERMISSION_READ_BRAKE_INFO
Dangerous permission necessary to read brake information. |
String |
PERMISSION_READ_CAR_AIRBAGS
Signature|Privileged permission necessary to read state of car airbags. |
String |
PERMISSION_READ_CAR_HORN
Dangerous permission necessary to read car horn state. |
String |
PERMISSION_READ_CAR_PEDALS
Dangerous permission necessary to read car pedal information. |
String |
PERMISSION_READ_CAR_POWER_POLICY
Normal permission necessary to read the current power policy or be notified of power policy change. |
String |
PERMISSION_READ_CAR_SEATS
Dangerous permission necessary to read car's seats. |
String |
PERMISSION_READ_CAR_SEAT_BELTS
Signature|Privileged permission necessary to read state of seat belts. |
String |
PERMISSION_READ_DISPLAY_UNITS
Normal permission necessary to read and write display units for distance, fuel volume, tire pressure and ev battery. |
String |
PERMISSION_READ_DRIVER_MONITORING_SETTINGS
Signature|Privileged permission necessary to read driver monitoring systems settings information. |
String |
PERMISSION_READ_DRIVER_MONITORING_STATES
Signature|Privileged permission necessary to read driver monitoring systems states information. |
String |
PERMISSION_READ_EXTERIOR_LIGHTS
Dangerous permission necessary to read car's exterior lights information. |
String |
PERMISSION_READ_HEAD_UP_DISPLAY_STATUS
Signature|Privileged permission necessary to read head up display status (e.g. whether the head up display is enabled). |
String |
PERMISSION_READ_IMPACT_SENSORS
Signature|Privileged permission necessary to read impact sensors information. |
String |
PERMISSION_READ_INTERIOR_LIGHTS
Signature|Privileged permission necessary to read car's interior lights information. |
String |
PERMISSION_READ_STEERING_STATE
Signature|Privileged permission necessary to access car's steering angle information. |
String |
PERMISSION_READ_STEERING_STATE_3P
Dangerous permission necessary to access car's steering angle information. |
String |
PERMISSION_READ_ULTRASONICS_SENSOR_DATA
Signature|Privileged permission necessary to read ultrasonics sensor data. |
String |
PERMISSION_READ_VALET_MODE
Signature|Privileged permission necessary to read valet mode. |
String |
PERMISSION_READ_WINDSHIELD_WIPERS
Signature|Privileged permission necessary to read car's windshield wipers. |
String |
PERMISSION_READ_WINDSHIELD_WIPERS_3P
Dangerous permission necessary to read car's windshield wipers. |
String |
PERMISSION_SPEED
Dangerous permission necessary to access car's speed. |
String |
PERMISSION_TIRES
Signature|Privileged permission necessary to access car's tire pressure information. |
String |
PERMISSION_TIRES_3P
Dangerous permission necessary to access car's tire pressure information. |
String |
PERMISSION_USE_REMOTE_ACCESS
Normal permission necessary to use remote access. |
String |
POWER_SERVICE
Service name for |
String |
PROPERTY_SERVICE
Service name for |
String |
SENSOR_SERVICE
This constant is deprecated.
|
Fields | |
---|---|
public
static
final
int |
PLATFORM_VERSION_MINOR_INT
This field is deprecated.
- use |
Public methods | |
---|---|
void
|
connect()
This method is deprecated.
this method is not need if this object is created via
|
static
Car
|
createCar(Context context, Handler handler)
Creates new |
static
Car
|
createCar(Context context)
Creates new |
static
Car
|
createCar(Context context, ServiceConnection serviceConnectionListener)
This method is deprecated.
use |
static
Car
|
createCar(Context context, Handler handler, long waitTimeoutMs, Car.CarServiceLifecycleListener statusChangeListener)
Creates new |
static
Car
|
createCar(Context context, ServiceConnection serviceConnectionListener, Handler handler)
This method is deprecated.
use |
void
|
disconnect()
Disconnect from car service. |
int
|
getCarConnectionType()
This method is deprecated.
connection type will be always |
Object
|
getCarManager(String serviceName)
Get car specific service manager as in |
<T>
T
|
getCarManager(Class<T> serviceClass)
|
static
CarVersion
|
getCarVersion()
This method is deprecated.
- use |
static
PlatformVersion
|
getPlatformVersion()
This method is deprecated.
- use |
static
boolean
|
isApiAndPlatformVersionAtLeast(int requiredApiVersionMajor, int minPlatformSdkInt)
This method is deprecated.
- use
|
static
boolean
|
isApiAndPlatformVersionAtLeast(int requiredApiVersionMajor, int requiredApiVersionMinor, int minPlatformSdkInt)
This method is deprecated.
- use |
static
boolean
|
isApiVersionAtLeast(int requiredApiVersionMajor)
This method is deprecated.
- use |
static
boolean
|
isApiVersionAtLeast(int requiredApiVersionMajor, int requiredApiVersionMinor)
This method is deprecated.
- use |
boolean
|
isConnected()
Tells if it is connected to the service or not. |
boolean
|
isConnecting()
Tells if this instance is already connecting to car service or not. |
boolean
|
isFeatureEnabled(String featureName)
Checks if |
Protected methods | |
---|---|
void
|
finalize()
|
Inherited methods | |
---|---|
Constants
API_VERSION_MAJOR_INT
public static final int API_VERSION_MAJOR_INT
This constant is deprecated.
- This does not return the correct version. Use
getCarVersion().getMajorVersion()
instead.
Constant Value: 34 (0x00000022)
API_VERSION_MINOR_INT
public static final int API_VERSION_MINOR_INT
This constant is deprecated.
- This does not return the correct version. Use
getCarVersion().getMinorVersion()
instead
Constant Value: 0 (0x00000000)
APP_FOCUS_SERVICE
public static final String APP_FOCUS_SERVICE
Service name for CarAppFocusManager
.
Constant Value: "app_focus"
AUDIO_SERVICE
public static final String AUDIO_SERVICE
Service name for CarAudioManager
Constant Value: "audio"
CAR_EXTRA_BROWSE_SERVICE_FOR_SESSION
public static final String CAR_EXTRA_BROWSE_SERVICE_FOR_SESSION
Used as a string extra field of media session to specify the service corresponding to the session.
Constant Value: "android.media.session.BROWSE_SERVICE"
CAR_EXTRA_MEDIA_COMPONENT
public static final String CAR_EXTRA_MEDIA_COMPONENT
This constant is deprecated.
Use CarMediaIntents.EXTRA_MEDIA_COMPONENT
instead.
Constant Value: "android.car.intent.extra.MEDIA_COMPONENT"
CAR_INTENT_ACTION_MEDIA_TEMPLATE
public static final String CAR_INTENT_ACTION_MEDIA_TEMPLATE
This constant is deprecated.
Use CarMediaIntents.ACTION_MEDIA_TEMPLATE
instead.
Constant Value: "android.car.intent.action.MEDIA_TEMPLATE"
CAR_NAVIGATION_SERVICE
public static final String CAR_NAVIGATION_SERVICE
Service name for CarNavigationStatusManager
Constant Value: "car_navigation_service"
CAR_OCCUPANT_ZONE_SERVICE
public static final String CAR_OCCUPANT_ZONE_SERVICE
Service name for CarOccupantZoneManager
Constant Value: "car_occupant_zone_service"
CAR_UX_RESTRICTION_SERVICE
public static final String CAR_UX_RESTRICTION_SERVICE
Service name for CarUxRestrictionsManager
Constant Value: "uxrestriction"
CAR_WAIT_TIMEOUT_DO_NOT_WAIT
public static final long CAR_WAIT_TIMEOUT_DO_NOT_WAIT
createCar(android.content.Context, android.os.Handler, long, android.car.Car.CarServiceLifecycleListener)
's
waitTimeoutMs value to use to skip any waiting inside the call.
Constant Value: 0 (0x0000000000000000)
CAR_WAIT_TIMEOUT_WAIT_FOREVER
public static final long CAR_WAIT_TIMEOUT_WAIT_FOREVER
createCar(android.content.Context, android.os.Handler, long, android.car.Car.CarServiceLifecycleListener)
's
waitTimeoutMs value to use to wait forever inside the call until car service is ready.
Constant Value: -1 (0xffffffffffffffff)
CAR_WATCHDOG_SERVICE
public static final String CAR_WATCHDOG_SERVICE
Service name for CarWatchdogManager
Constant Value: "car_watchdog"
CONNECTION_TYPE_EMBEDDED
public static final int CONNECTION_TYPE_EMBEDDED
This constant is deprecated.
connection type constants are no longer used
Type of car connection: platform runs directly in car.
Constant Value: 5 (0x00000005)
INFO_SERVICE
public static final String INFO_SERVICE
Service name for CarInfoManager
, to be used in getCarManager(java.lang.String)
.
Constant Value: "info"
META_DATA_DISTRACTION_OPTIMIZED
public static final String META_DATA_DISTRACTION_OPTIMIZED
This represents AndroidManifest meta-data to tell that Activity
is optimized for
driving distraction.
Activities without this meta-data can be blocked while car is in moving / driving state.
Note that having this flag does not guarantee that the Activity
will be always
allowed for all driving states.
For this meta-data, android:value can be true
(=optimized) or false
.
Example usage:
Constant Value: "distractionOptimized"
META_DATA_REQUIRES_CAR_FEATURE
public static final String META_DATA_REQUIRES_CAR_FEATURE
This represents AndroidManifest meta-data to tell that Application
requires specific
car features to work.
Apps like launcher or installer app can use this information to filter out apps not usable in a specific car. This meta-data is not necessary for mandatory features.
For this meta-data, android:value should contain the feature name string defined by
OptionalFeature
or ExperimentalFeature
annotations.
Example usage:
Constant Value: "requires-car-feature"
PACKAGE_SERVICE
public static final String PACKAGE_SERVICE
Service name for CarPackageManager
Constant Value: "package"
PERMISSION_ADJUST_RANGE_REMAINING
public static final String PERMISSION_ADJUST_RANGE_REMAINING
Signature|Privileged permission necessary to change value of car's range remaining.
Constant Value: "android.car.permission.ADJUST_RANGE_REMAINING"
PERMISSION_CAR_CONTROL_AUDIO_SETTINGS
public static final String PERMISSION_CAR_CONTROL_AUDIO_SETTINGS
Signature|Privileged permission necessary to change car audio settings through
CarAudioManager
.
Constant Value: "android.car.permission.CAR_CONTROL_AUDIO_SETTINGS"
PERMISSION_CAR_CONTROL_AUDIO_VOLUME
public static final String PERMISSION_CAR_CONTROL_AUDIO_VOLUME
Signature|Privileged permission necessary to change car audio volume through
CarAudioManager
.
Constant Value: "android.car.permission.CAR_CONTROL_AUDIO_VOLUME"
PERMISSION_CAR_DRIVING_STATE
public static final String PERMISSION_CAR_DRIVING_STATE
Signature|Privileged permission necessary to access a car's driving state (E.g. CarDrivingStateService).
Constant Value: "android.car.permission.CAR_DRIVING_STATE"
PERMISSION_CAR_DRIVING_STATE_3P
public static final String PERMISSION_CAR_DRIVING_STATE_3P
Dangerous permission necessary to access a car's driving state.
Constant Value: "android.car.permission.CAR_DRIVING_STATE_3P"
PERMISSION_CAR_DYNAMICS_STATE
public static final String PERMISSION_CAR_DYNAMICS_STATE
Signature|Privileged permission necessary to access car's dynamics state.
Constant Value: "android.car.permission.CAR_DYNAMICS_STATE"
PERMISSION_CAR_ENGINE_DETAILED
public static final String PERMISSION_CAR_ENGINE_DETAILED
Signature|Privileged permission necessary to access car's engine information.
Constant Value: "android.car.permission.CAR_ENGINE_DETAILED"
PERMISSION_CAR_ENGINE_DETAILED_3P
public static final String PERMISSION_CAR_ENGINE_DETAILED_3P
Dangerous permission necessary to access car's engine information.
Constant Value: "android.car.permission.CAR_ENGINE_DETAILED_3P"
PERMISSION_CAR_EPOCH_TIME
public static final String PERMISSION_CAR_EPOCH_TIME
Signature|Privileged permission necessary to access car's property
VehiclePropertyIds.EPOCH_TIME
.
Constant Value: "android.car.permission.CAR_EPOCH_TIME"
PERMISSION_CAR_INFO
public static final String PERMISSION_CAR_INFO
Normal permission necessary to use CarInfoManager
.
Constant Value: "android.car.permission.CAR_INFO"
PERMISSION_CAR_NAVIGATION_MANAGER
public static final String PERMISSION_CAR_NAVIGATION_MANAGER
Signature|Privileged permission necessary to use CarNavigationStatusManager
.
Constant Value: "android.car.permission.CAR_NAVIGATION_MANAGER"
PERMISSION_CONTROL_ADAS_SETTINGS
public static final String PERMISSION_CONTROL_ADAS_SETTINGS
Signature|Privileged permission necessary to control ADAS settings information. Examples of settings include the ENABLED properties for the supported ADAS features.
Constant Value: "android.car.permission.CONTROL_ADAS_SETTINGS"
PERMISSION_CONTROL_ADAS_STATES
public static final String PERMISSION_CONTROL_ADAS_STATES
Signature|Privileged permission necessary to control ADAS states information. Examples include the STATE properties for the supported ADAS features.
Constant Value: "android.car.permission.CONTROL_ADAS_STATES"
PERMISSION_CONTROL_CAR_AIRBAGS
public static final String PERMISSION_CONTROL_CAR_AIRBAGS
Signature|Privileged permission necessary to enable/disable a seat's ability to deploy airbag(s) when triggered (e.g. by a crash).
Constant Value: "android.car.permission.CONTROL_CAR_AIRBAGS"
PERMISSION_CONTROL_CAR_CLIMATE
public static final String PERMISSION_CONTROL_CAR_CLIMATE
Signature|Privileged permission necessary to access Car HVAC APIs.
Constant Value: "android.car.permission.CONTROL_CAR_CLIMATE"
PERMISSION_CONTROL_CAR_DOORS
public static final String PERMISSION_CONTROL_CAR_DOORS
Signature|Privileged permission necessary to control car's door.
Constant Value: "android.car.permission.CONTROL_CAR_DOORS"
PERMISSION_CONTROL_CAR_DYNAMICS_STATE
public static final String PERMISSION_CONTROL_CAR_DYNAMICS_STATE
Signature|Privileged permission necessary to control car's dynamics state.
Constant Value: "android.car.permission.CONTROL_CAR_DYNAMICS_STATE"
PERMISSION_CONTROL_CAR_ENERGY
public static final String PERMISSION_CONTROL_CAR_ENERGY
Signature|Privileged permission necessary to control car's EV charge settings.
Constant Value: "android.car.permission.CONTROL_CAR_ENERGY"
PERMISSION_CONTROL_CAR_HORN
public static final String PERMISSION_CONTROL_CAR_HORN
Signature|Privileged permission necessary to control car horn state.
Constant Value: "android.car.permission.CONTROL_CAR_HORN"
PERMISSION_CONTROL_CAR_MIRRORS
public static final String PERMISSION_CONTROL_CAR_MIRRORS
Signature|Privileged permission necessary to control car's mirrors.
Constant Value: "android.car.permission.CONTROL_CAR_MIRRORS"
PERMISSION_CONTROL_CAR_SEATS
public static final String PERMISSION_CONTROL_CAR_SEATS
Signature|Privileged permission necessary to control car's seats.
Constant Value: "android.car.permission.CONTROL_CAR_SEATS"
PERMISSION_CONTROL_CAR_WINDOWS
public static final String PERMISSION_CONTROL_CAR_WINDOWS
Signature|Privileged permission necessary to control car's windows.
Constant Value: "android.car.permission.CONTROL_CAR_WINDOWS"
PERMISSION_CONTROL_DISPLAY_UNITS
public static final String PERMISSION_CONTROL_DISPLAY_UNITS
Normal permission necessary to control display units for distance, fuel volume, tire pressure
and ev battery. Currently, all display unit properties require both PERMISSION_CONTROL_DISPLAY_UNITS
and PERMISSION_VENDOR_EXTENSION
to be granted in
order to write to them.
Constant Value: "android.car.permission.CONTROL_CAR_DISPLAY_UNITS"
PERMISSION_CONTROL_DRIVER_MONITORING_SETTINGS
public static final String PERMISSION_CONTROL_DRIVER_MONITORING_SETTINGS
Signature|Privileged permission necessary to control driver monitoring systems settings information. Examples of settings include the ENABLED properties for the supported driver monitoring features.
Constant Value: "android.car.permission.CONTROL_DRIVER_MONITORING_SETTINGS"
PERMISSION_CONTROL_ENERGY_PORTS
public static final String PERMISSION_CONTROL_ENERGY_PORTS
Signature|Privileged permission necessary to control car's fuel door and ev charge port.
Constant Value: "android.car.permission.CONTROL_CAR_ENERGY_PORTS"
PERMISSION_CONTROL_EXTERIOR_LIGHTS
public static final String PERMISSION_CONTROL_EXTERIOR_LIGHTS
Signature|Privileged permission necessary to control car's exterior lights.
Constant Value: "android.car.permission.CONTROL_CAR_EXTERIOR_LIGHTS"
PERMISSION_CONTROL_GLOVE_BOX
public static final String PERMISSION_CONTROL_GLOVE_BOX
Signature|Privileged permission necessary to control car glove box.
Constant Value: "android.car.permission.CONTROL_GLOVE_BOX"
PERMISSION_CONTROL_HEAD_UP_DISPLAY
public static final String PERMISSION_CONTROL_HEAD_UP_DISPLAY
Signature|Privileged permission necessary to control head up display.
Constant Value: "android.car.permission.CONTROL_HEAD_UP_DISPLAY"
PERMISSION_CONTROL_INTERIOR_LIGHTS
public static final String PERMISSION_CONTROL_INTERIOR_LIGHTS
Signature|Privileged permission necessary to control car's interior lights.
Constant Value: "android.car.permission.CONTROL_CAR_INTERIOR_LIGHTS"
PERMISSION_CONTROL_POWERTRAIN
public static final String PERMISSION_CONTROL_POWERTRAIN
Signature|Privileged permission necessary to control car's powertrain information.
Constant Value: "android.car.permission.CONTROL_CAR_POWERTRAIN"
PERMISSION_CONTROL_STEERING_WHEEL
public static final String PERMISSION_CONTROL_STEERING_WHEEL
Signature|Privileged permission necessary to control car's steering wheel.
Constant Value: "android.car.permission.CONTROL_STEERING_WHEEL"
PERMISSION_CONTROL_VALET_MODE
public static final String PERMISSION_CONTROL_VALET_MODE
Signature|Privileged permission necessary to control valet mode.
Constant Value: "android.car.permission.CONTROL_VALET_MODE"
PERMISSION_CONTROL_WINDSHIELD_WIPERS
public static final String PERMISSION_CONTROL_WINDSHIELD_WIPERS
Signature|Privileged permission necessary to control car's windshield wipers.
Constant Value: "android.car.permission.CONTROL_WINDSHIELD_WIPERS"
PERMISSION_ENERGY
public static final String PERMISSION_ENERGY
Dangerous permission necessary to access car's energy information.
Constant Value: "android.car.permission.CAR_ENERGY"
PERMISSION_ENERGY_PORTS
public static final String PERMISSION_ENERGY_PORTS
Normal permission necessary to access car's fuel door and ev charge port.
Constant Value: "android.car.permission.CAR_ENERGY_PORTS"
PERMISSION_EXTERIOR_ENVIRONMENT
public static final String PERMISSION_EXTERIOR_ENVIRONMENT
Normal permission necessary to read temperature of car's exterior environment.
Constant Value: "android.car.permission.CAR_EXTERIOR_ENVIRONMENT"
PERMISSION_EXTERIOR_LIGHTS
public static final String PERMISSION_EXTERIOR_LIGHTS
Signature|Privileged permission necessary to read car's exterior lights information.
Constant Value: "android.car.permission.CAR_EXTERIOR_LIGHTS"
PERMISSION_IDENTIFICATION
public static final String PERMISSION_IDENTIFICATION
Signature|Privileged permission necessary to access car's VIN information
Constant Value: "android.car.permission.CAR_IDENTIFICATION"
PERMISSION_MILEAGE
public static final String PERMISSION_MILEAGE
Signature|Privileged permission necessary to access car's mileage information.
Constant Value: "android.car.permission.CAR_MILEAGE"
PERMISSION_MILEAGE_3P
public static final String PERMISSION_MILEAGE_3P
Dangerous permission necessary to access car's mileage information.
Constant Value: "android.car.permission.CAR_MILEAGE_3P"
PERMISSION_POWERTRAIN
public static final String PERMISSION_POWERTRAIN
Normal permission necessary to access car's powertrain information.
Constant Value: "android.car.permission.CAR_POWERTRAIN"
PERMISSION_PRIVILEGED_CAR_INFO
public static final String PERMISSION_PRIVILEGED_CAR_INFO
Signature|Privileged permission necessary to access privileged car info.
Constant Value: "android.car.permission.PRIVILEGED_CAR_INFO"
PERMISSION_READ_ADAS_SETTINGS
public static final String PERMISSION_READ_ADAS_SETTINGS
Signature|Privileged permission necessary to read ADAS settings information. Examples of settings include the ENABLED properties for the supported ADAS features.
Constant Value: "android.car.permission.READ_ADAS_SETTINGS"
PERMISSION_READ_ADAS_STATES
public static final String PERMISSION_READ_ADAS_STATES
Signature|Privileged permission necessary to read ADAS states information. Examples include the STATE properties for the supported ADAS features.
Constant Value: "android.car.permission.READ_ADAS_STATES"
PERMISSION_READ_BRAKE_INFO
public static final String PERMISSION_READ_BRAKE_INFO
Dangerous permission necessary to read brake information.
Constant Value: "android.car.permission.READ_BRAKE_INFO"
PERMISSION_READ_CAR_AIRBAGS
public static final String PERMISSION_READ_CAR_AIRBAGS
Signature|Privileged permission necessary to read state of car airbags.
Constant Value: "android.car.permission.READ_CAR_AIRBAGS"
PERMISSION_READ_CAR_HORN
public static final String PERMISSION_READ_CAR_HORN
Dangerous permission necessary to read car horn state.
Constant Value: "android.car.permission.READ_CAR_HORN"
PERMISSION_READ_CAR_PEDALS
public static final String PERMISSION_READ_CAR_PEDALS
Dangerous permission necessary to read car pedal information.
Constant Value: "android.car.permission.READ_CAR_PEDALS"
PERMISSION_READ_CAR_POWER_POLICY
public static final String PERMISSION_READ_CAR_POWER_POLICY
Normal permission necessary to read the current power policy or be notified of power policy change.
Constant Value: "android.car.permission.READ_CAR_POWER_POLICY"
PERMISSION_READ_CAR_SEATS
public static final String PERMISSION_READ_CAR_SEATS
Dangerous permission necessary to read car's seats.
Constant Value: "android.car.permission.READ_CAR_SEATS"
PERMISSION_READ_CAR_SEAT_BELTS
public static final String PERMISSION_READ_CAR_SEAT_BELTS
Signature|Privileged permission necessary to read state of seat belts.
Constant Value: "android.car.permission.READ_CAR_SEAT_BELTS"
PERMISSION_READ_DISPLAY_UNITS
public static final String PERMISSION_READ_DISPLAY_UNITS
Normal permission necessary to read and write display units for distance, fuel volume, tire pressure and ev battery.
Constant Value: "android.car.permission.READ_CAR_DISPLAY_UNITS"
PERMISSION_READ_DRIVER_MONITORING_SETTINGS
public static final String PERMISSION_READ_DRIVER_MONITORING_SETTINGS
Signature|Privileged permission necessary to read driver monitoring systems settings information. Examples of settings include the ENABLED properties for the supported driver monitoring features.
Constant Value: "android.car.permission.READ_DRIVER_MONITORING_SETTINGS"
PERMISSION_READ_DRIVER_MONITORING_STATES
public static final String PERMISSION_READ_DRIVER_MONITORING_STATES
Signature|Privileged permission necessary to read driver monitoring systems states
information.
Examples of states include the STATE and WARNING properties for the supported driver
monitoring features.
This is different from ERROR(/PERMISSION_READ_DRIVER_MONITORING_SETTINGS)
, which allows an
app to read the system settings, such as whether the system is enabled or disabled.
Constant Value: "android.car.permission.READ_DRIVER_MONITORING_STATES"
PERMISSION_READ_EXTERIOR_LIGHTS
public static final String PERMISSION_READ_EXTERIOR_LIGHTS
Dangerous permission necessary to read car's exterior lights information.
Constant Value: "android.car.permission.READ_CAR_EXTERIOR_LIGHTS"
PERMISSION_READ_HEAD_UP_DISPLAY_STATUS
public static final String PERMISSION_READ_HEAD_UP_DISPLAY_STATUS
Signature|Privileged permission necessary to read head up display status (e.g. whether the head up display is enabled).
Constant Value: "android.car.permission.READ_HEAD_UP_DISPLAY_STATUS"
PERMISSION_READ_IMPACT_SENSORS
public static final String PERMISSION_READ_IMPACT_SENSORS
Signature|Privileged permission necessary to read impact sensors information.
Constant Value: "android.car.permission.READ_IMPACT_SENSORS"
PERMISSION_READ_INTERIOR_LIGHTS
public static final String PERMISSION_READ_INTERIOR_LIGHTS
Signature|Privileged permission necessary to read car's interior lights information.
Constant Value: "android.car.permission.READ_CAR_INTERIOR_LIGHTS"
PERMISSION_READ_STEERING_STATE
public static final String PERMISSION_READ_STEERING_STATE
Signature|Privileged permission necessary to access car's steering angle information.
Constant Value: "android.car.permission.READ_CAR_STEERING"
PERMISSION_READ_STEERING_STATE_3P
public static final String PERMISSION_READ_STEERING_STATE_3P
Dangerous permission necessary to access car's steering angle information.
Constant Value: "android.car.permission.READ_CAR_STEERING_3P"
PERMISSION_READ_ULTRASONICS_SENSOR_DATA
public static final String PERMISSION_READ_ULTRASONICS_SENSOR_DATA
Signature|Privileged permission necessary to read ultrasonics sensor data.
Constant Value: "android.car.permission.READ_ULTRASONICS_SENSOR_DATA"
PERMISSION_READ_VALET_MODE
public static final String PERMISSION_READ_VALET_MODE
Signature|Privileged permission necessary to read valet mode.
Constant Value: "android.car.permission.READ_VALET_MODE"
PERMISSION_READ_WINDSHIELD_WIPERS
public static final String PERMISSION_READ_WINDSHIELD_WIPERS
Signature|Privileged permission necessary to read car's windshield wipers.
Constant Value: "android.car.permission.READ_WINDSHIELD_WIPERS"
PERMISSION_READ_WINDSHIELD_WIPERS_3P
public static final String PERMISSION_READ_WINDSHIELD_WIPERS_3P
Dangerous permission necessary to read car's windshield wipers.
Constant Value: "android.car.permission.READ_WINDSHIELD_WIPERS_3P"
PERMISSION_SPEED
public static final String PERMISSION_SPEED
Dangerous permission necessary to access car's speed.
Constant Value: "android.car.permission.CAR_SPEED"
PERMISSION_TIRES
public static final String PERMISSION_TIRES
Signature|Privileged permission necessary to access car's tire pressure information.
Constant Value: "android.car.permission.CAR_TIRES"
PERMISSION_TIRES_3P
public static final String PERMISSION_TIRES_3P
Dangerous permission necessary to access car's tire pressure information.
Constant Value: "android.car.permission.CAR_TIRES_3P"
PERMISSION_USE_REMOTE_ACCESS
public static final String PERMISSION_USE_REMOTE_ACCESS
Normal permission necessary to use remote access.
Constant Value: "android.car.permission.USE_REMOTE_ACCESS"
POWER_SERVICE
public static final String POWER_SERVICE
Service name for CarPowerManager
Constant Value: "power"
PROPERTY_SERVICE
public static final String PROPERTY_SERVICE
Service name for CarPropertyManager
Constant Value: "property"
SENSOR_SERVICE
public static final String SENSOR_SERVICE
This constant is deprecated.
CarSensorManager
is deprecated. Use CarPropertyManager
instead.
Service name for CarSensorManager
, to be used in getCarManager(java.lang.String)
.
Constant Value: "sensor"
Fields
PLATFORM_VERSION_MINOR_INT
public static final int PLATFORM_VERSION_MINOR_INT
This field is deprecated.
- use getPlatformApiVersion().getMinorVersion()
instead
Public methods
connect
public void connect ()
This method is deprecated.
this method is not need if this object is created via
createCar(android.content.Context, android.os.Handler)
.
Throws | |
---|---|
IllegalStateException |
createCar
public static Car createCar (Context context, Handler handler)
Creates new Car
object which connected synchronously to Car Service and ready to use.
Instance created with this should be disconnected from car service by calling
disconnect()
before the passed Context
is released.
Parameters | |
---|---|
context |
Context : This should not be null . If you are passing ContextWrapper ,
make sure that its base context is not
null as well.
Otherwise it will throw NullPointerException . |
handler |
Handler : the handler on which the manager's callbacks will be executed, or null to
execute on the application's main thread. |
Returns | |
---|---|
Car |
Car object if operation succeeded, otherwise null. |
createCar
public static Car createCar (Context context)
Creates new Car
object which connected synchronously to Car Service and ready to use.
Instance created with this should be disconnected from car service by calling
disconnect()
before the passed Context
is released.
Parameters | |
---|---|
context |
Context : application's context |
Returns | |
---|---|
Car |
Car object if operation succeeded, otherwise null. |
createCar
public static Car createCar (Context context, ServiceConnection serviceConnectionListener)
This method is deprecated.
use createCar(android.content.Context, android.os.Handler)
instead.
A factory method that creates Car instance for all Car API access using main thread Looper
.
Instance created with this should be disconnected from car service by calling
disconnect()
before the passed Context
is released.
Parameters | |
---|---|
context |
Context |
serviceConnectionListener |
ServiceConnection |
Returns | |
---|---|
Car |
createCar
public static Car createCar (Context context, Handler handler, long waitTimeoutMs, Car.CarServiceLifecycleListener statusChangeListener)
Creates new Car
object with CarServiceLifecycleListener
.
Instance created with this should be disconnected from car service by calling
disconnect()
before the passed Context
is released.
If car service is ready inside this call and if the caller is running in the main thread,
CarServiceLifecycleListener.onLifecycleChanged(Car, boolean)
will be called
with ready set to be true. Otherwise,
CarServiceLifecycleListener.onLifecycleChanged(Car, boolean)
will be called
from the main thread later.
This call can block up to specified waitTimeoutMs to wait for car service to be ready. If car service is not ready within the given time, it will return a Car instance in disconnected state. Blocking main thread forever can lead into getting ANR (Application Not Responding) killing from system and should not be used if the app is supposed to survive across the crash / restart of car service. It can be still useful in case the app cannot do anything without car service being ready. In any waiting, if the thread is getting interrupted, it will return immediately.
Note that returned Car
object is not guaranteed to be connected when there is
a limited timeout. Regardless of returned car being connected or not, it is recommended to
implement all car related initialization inside
CarServiceLifecycleListener.onLifecycleChanged(Car, boolean)
and avoid the
needs to check if returned Car
is connected or not from returned Car
.
Parameters | |
---|---|
context |
Context : This should not be null . If you are passing ContextWrapper ,
make sure that its base context is not
null as well.
Otherwise it will throw NullPointerException . |
handler |
Handler : dispatches all Car*Manager events to this Handler. Exception is
CarServiceLifecycleListener which will be always dispatched to main
thread. Passing null leads into dispatching all Car*Manager callbacks to main
thread as well. |
waitTimeoutMs |
long : Setting this to CAR_WAIT_TIMEOUT_DO_NOT_WAIT will guarantee
that the API does not wait for the car service at all. Setting this to
to CAR_WAIT_TIMEOUT_WAIT_FOREVER will block the call forever
until the car service is ready. Setting any positive value will be
interpreted as timeout value. |
statusChangeListener |
Car.CarServiceLifecycleListener |
Returns | |
---|---|
Car |
createCar
public static Car createCar (Context context, ServiceConnection serviceConnectionListener, Handler handler)
This method is deprecated.
use createCar(android.content.Context, android.os.Handler)
instead.
A factory method that creates Car instance for all Car API access.
Instance created with this should be disconnected from car service by calling
disconnect()
before the passed Context
is released.
Parameters | |
---|---|
context |
Context : This should not be null . If you are passing ContextWrapper ,
make sure that its base context is not
null as well.
Otherwise it will throw NullPointerException . |
serviceConnectionListener |
ServiceConnection : listener for monitoring service connection. It is allowed
but not recommended to pass null . If this is null , client has to periodically
check isConnected() to know when car service is connected. |
handler |
Handler : the handler on which the callback should execute, or null to execute on the
service's main thread. Note: the service connection listener will be always on the main
thread regardless of the handler given. |
Returns | |
---|---|
Car |
Car instance if system is in car environment and returns null otherwise. |
disconnect
public void disconnect ()
Disconnect from car service. This can be called while disconnected. Once disconnect is
called, all Car*Managers from this instance become invalid, and
Car.getCarManager(String)
or will return a
different instance if it is connected again.
getCarConnectionType
public int getCarConnectionType ()
This method is deprecated.
connection type will be always CONNECTION_TYPE_EMBEDDED
Returns | |
---|---|
int |
the type of currently connected car.
Value is CONNECTION_TYPE_EMBEDDED |
getCarManager
public Object getCarManager (String serviceName)
Get car specific service manager as in Context.getSystemService(String)
. Returned
Object
should be type-casted to the desired service manager.
For example, to get the manager for sensor service,
CarSensorManager carSensorManager = (CarSensorManager) car.getCarManager(Car.SENSOR_SERVICE);
For getting Car.AUDIO_SERVICE
, this call might be blocked on car audio service
initialization if the client calls this early during the boot process.
Parameters | |
---|---|
serviceName |
String : Name of service that should be created like SENSOR_SERVICE . |
Returns | |
---|---|
Object |
Matching service manager or null if there is no such service. |
getCarManager
public T getCarManager (Class<T> serviceClass)
Get car specific service manager by class as in .
Returns the desired service. No type casting is needed.
For example, to get the manager for sensor service,
CarSensorManager carSensorManager = car.getCarManager(CarSensorManager.class);
For getting CarAudioManager
, this call might be blocked on car audio service
initialization if the client calls this early during the boot process.
Parameters | |
---|---|
serviceClass |
Class : The class of the desired service. |
Returns | |
---|---|
T |
Matching service manager or null if there is no such service. |
getCarVersion
public static CarVersion getCarVersion ()
This method is deprecated.
- use android.os.Build.VERSION#SDK_INT
instead
Defines the version
of the Car
APIs in the device.
Starting on Android 13
, the Car
APIs can be upgraded without an OTA, so it's possible that these APIs are higher than the
platform's
.
Returns | |
---|---|
CarVersion |
getPlatformVersion
public static PlatformVersion getPlatformVersion ()
This method is deprecated.
- use android.os.Build.VERSION#SDK_INT
instead
Defines the version
of the standard SDK
APIs in the
device.
Its major version
will be the same as
Build.VERSION.SDK_INT
for released build but will be
Build.VERSION_CODES.CUR_DEVELOPMENT
for platform still under development.
Returns | |
---|---|
PlatformVersion |
isApiAndPlatformVersionAtLeast
public static boolean isApiAndPlatformVersionAtLeast (int requiredApiVersionMajor, int minPlatformSdkInt)
This method is deprecated.
- use
getCarVersion().isAtLeast(CarVersion.forMajorVersion(requiredApiVersionMajor))
&& getPlatformVersion().isAtLeast(PlatformVersion.forMajorVersion(minPlatformSdkInt))
instead.
Parameters | |
---|---|
requiredApiVersionMajor |
int |
minPlatformSdkInt |
int |
Returns | |
---|---|
boolean |
isApiAndPlatformVersionAtLeast
public static boolean isApiAndPlatformVersionAtLeast (int requiredApiVersionMajor, int requiredApiVersionMinor, int minPlatformSdkInt)
This method is deprecated.
- use getCarVersion().isAtLeast(CarVersion.forMajorAndMinorVersions(
requiredApiVersionMajor, requiredApiVersionMinor)) && getPlatformVersion().isAtLeast(
PlatformVersion.forMajorVersion(minPlatformSdkInt))
instead.
Parameters | |
---|---|
requiredApiVersionMajor |
int |
requiredApiVersionMinor |
int |
minPlatformSdkInt |
int |
Returns | |
---|---|
boolean |
isApiVersionAtLeast
public static boolean isApiVersionAtLeast (int requiredApiVersionMajor)
This method is deprecated.
- use getCarApiVersion().isAtLeast(CarVersion.forMajorAndMinorVersions(
requiredApiVersionMajor))
instead
Parameters | |
---|---|
requiredApiVersionMajor |
int |
Returns | |
---|---|
boolean |
isApiVersionAtLeast
public static boolean isApiVersionAtLeast (int requiredApiVersionMajor, int requiredApiVersionMinor)
This method is deprecated.
- use getCarVersion().isAtLeast(CarVersion.forMajorAndMinorVersions(
requiredApiVersionMajor, requiredApiVersionMinor)
instead
Parameters | |
---|---|
requiredApiVersionMajor |
int |
requiredApiVersionMinor |
int |
Returns | |
---|---|
boolean |
isConnected
public boolean isConnected ()
Tells if it is connected to the service or not. This will return false if it is still connecting.
Returns | |
---|---|
boolean |
true if service is connected |
isConnecting
public boolean isConnecting ()
Tells if this instance is already connecting to car service or not.
Returns | |
---|---|
boolean |
true if instance is connecting to a service |
isFeatureEnabled
public boolean isFeatureEnabled (String featureName)
Checks if featureName
is enabled in this car.
For optional features, this can return false if the car cannot support it. Optional features should be used only when they are supported.
For mandatory features, this will always return true.
Parameters | |
---|---|
featureName |
String |
Returns | |
---|---|
boolean |
Protected methods
finalize
protected void finalize ()
Throws | |
---|---|
Throwable |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-10-09 UTC.