CarAudioManager
public
final
class
CarAudioManager
extends Object
java.lang.Object | |
↳ | android.car.media.CarAudioManager |
APIs for handling audio in a car.
In a car environment, we introduced the support to turn audio dynamic routing on/off by setting the "audioUseDynamicRouting" attribute in config.xml
When audio dynamic routing is enabled:
When audio dynamic routing is disabled:
Summary
Nested classes | |
---|---|
class |
CarAudioManager.CarVolumeCallback
Callback interface to receive volume change events in a car. |
Constants | |
---|---|
int |
AUDIO_FEATURE_AUDIO_MIRRORING
This is used to determine if audio mirroring is supported via
If enabled, audio mirroring can be managed by using the following APIs:
|
int |
AUDIO_FEATURE_DYNAMIC_ROUTING
This is used to determine if dynamic routing is enabled via
|
int |
AUDIO_FEATURE_OEM_AUDIO_SERVICE
This is used to determine if the OEM audio service is enabled via
If enabled, car audio focus, car audio volume, and ducking control behaviour can change as it can be OEM dependent. |
int |
AUDIO_FEATURE_VOLUME_GROUP_EVENTS
This is used to determine if volume group events is supported via
If enabled, the car volume group event callback can be used to receive event changes to volume, mute, attenuation. |
int |
AUDIO_FEATURE_VOLUME_GROUP_MUTING
This is used to determine if volume group muting is enabled via
If enabled, car volume group muting APIs can be used to mute each volume group, also car volume group muting changed callback will be called upon group mute changes. |
Public methods | |
---|---|
boolean
|
isAudioFeatureEnabled(int audioFeature)
Determines if an audio feature is enabled. |
void
|
registerCarVolumeCallback(CarAudioManager.CarVolumeCallback callback)
Registers a |
void
|
unregisterCarVolumeCallback(CarAudioManager.CarVolumeCallback callback)
Unregisters a |
Inherited methods | |
---|---|
Constants
AUDIO_FEATURE_AUDIO_MIRRORING
public static final int AUDIO_FEATURE_AUDIO_MIRRORING
This is used to determine if audio mirroring is supported via
isAudioFeatureEnabled(int)
If enabled, audio mirroring can be managed by using the following APIs:
setAudioZoneMirrorStatusCallback(Executor, AudioZonesMirrorStatusCallback)
,
clearAudioZonesMirrorStatusCallback()
, canEnableAudioMirror()
,
enableMirrorForAudioZones(List)
, extendAudioMirrorRequest(long, List)
,
disableAudioMirrorForZone(int)
, disableAudioMirror(long)
,
getMirrorAudioZonesForAudioZone(int)
,
getMirrorAudioZonesForMirrorRequest(long)
Constant Value: 5 (0x00000005)
AUDIO_FEATURE_DYNAMIC_ROUTING
public static final int AUDIO_FEATURE_DYNAMIC_ROUTING
This is used to determine if dynamic routing is enabled via
isAudioFeatureEnabled(int)
Constant Value: 1 (0x00000001)
AUDIO_FEATURE_OEM_AUDIO_SERVICE
public static final int AUDIO_FEATURE_OEM_AUDIO_SERVICE
This is used to determine if the OEM audio service is enabled via
isAudioFeatureEnabled(int)
If enabled, car audio focus, car audio volume, and ducking control behaviour can change as it can be OEM dependent.
Constant Value: 3 (0x00000003)
AUDIO_FEATURE_VOLUME_GROUP_EVENTS
public static final int AUDIO_FEATURE_VOLUME_GROUP_EVENTS
This is used to determine if volume group events is supported via
isAudioFeatureEnabled(int)
If enabled, the car volume group event callback can be used to receive event changes
to volume, mute, attenuation.
If disabled, the register/unregister APIs will return false
.
Constant Value: 4 (0x00000004)
AUDIO_FEATURE_VOLUME_GROUP_MUTING
public static final int AUDIO_FEATURE_VOLUME_GROUP_MUTING
This is used to determine if volume group muting is enabled via
isAudioFeatureEnabled(int)
If enabled, car volume group muting APIs can be used to mute each volume group, also car volume group muting changed callback will be called upon group mute changes. If disabled, car volume will toggle master mute instead.
Constant Value: 2 (0x00000002)
Public methods
isAudioFeatureEnabled
public boolean isAudioFeatureEnabled (int audioFeature)
Determines if an audio feature is enabled.
Parameters | |
---|---|
audioFeature |
int : audio feature to query, can be AUDIO_FEATURE_DYNAMIC_ROUTING ,
AUDIO_FEATURE_VOLUME_GROUP_MUTING or
AUDIO_FEATURE_VOLUME_GROUP_EVENTS
Value is AUDIO_FEATURE_DYNAMIC_ROUTING , AUDIO_FEATURE_VOLUME_GROUP_MUTING , AUDIO_FEATURE_OEM_AUDIO_SERVICE , AUDIO_FEATURE_VOLUME_GROUP_EVENTS , or AUDIO_FEATURE_AUDIO_MIRRORING |
Returns | |
---|---|
boolean |
Returns true if the feature is enabled, false otherwise. |
registerCarVolumeCallback
public void registerCarVolumeCallback (CarAudioManager.CarVolumeCallback callback)
Registers a CarVolumeCallback
to receive volume change callbacks
Parameters | |
---|---|
callback |
CarAudioManager.CarVolumeCallback : CarVolumeCallback instance, can not be null
Requires permission Car.PERMISSION_CAR_CONTROL_AUDIO_VOLUME |
unregisterCarVolumeCallback
public void unregisterCarVolumeCallback (CarAudioManager.CarVolumeCallback callback)
Unregisters a CarVolumeCallback
from receiving volume change callbacks
Parameters | |
---|---|
callback |
CarAudioManager.CarVolumeCallback : CarVolumeCallback instance previously registered, can not be null
Requires permission Car.PERMISSION_CAR_CONTROL_AUDIO_VOLUME |
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 2024-05-24 UTC.