# CarAudioManager

Summary:[Nested Classes](https://developer.android.com/reference/android/car/media/CarAudioManager#nestedclasses)\|[Constants](https://developer.android.com/reference/android/car/media/CarAudioManager#constants)\|[Methods](https://developer.android.com/reference/android/car/media/CarAudioManager#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/car/media/CarAudioManager#inhmethods)  

# CarAudioManager

`
public

final

class
CarAudioManager
`  
`

extends Object


``


`

|---|-----------------------------------|
| java.lang.Object                     ||
| ↳ | android.car.media.CarAudioManager |

<br />

*** ** * ** ***

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:
- Audio devices are grouped into zones
- There is at least one primary zone, and extra secondary zones such as RSE (Rear Seat Entertainment)
- Within each zone, audio devices are grouped into volume groups for volume control
- Audio is assigned to an audio device based on its AudioAttributes usage

When audio dynamic routing is disabled:
- There is exactly one audio zone, which is the primary zone
- Each volume group represents a controllable STREAM_TYPE, same as AudioManager

<br />

## Summary

|                                                                                           ### Nested classes                                                                                            ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [CarAudioManager.CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback) Callback interface to receive volume change events in a car. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ### Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [AUDIO_FEATURE_AUDIO_MIRRORING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_AUDIO_MIRRORING) This is used to determine if audio mirroring is supported via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int)) If enabled, audio mirroring can be managed by using the following APIs:[ERROR(/#setAudioZoneMirrorStatusCallback(java.util.concurrent.Executor,android.car.media.AudioZonesMirrorStatusCallback))](https://developer.android.com/),[ERROR(/#clearAudioZonesMirrorStatusCallback())](https://developer.android.com/),[ERROR(/#canEnableAudioMirror())](https://developer.android.com/),[ERROR(/#enableMirrorForAudioZones(java.util.List))](https://developer.android.com/),[ERROR(/#extendAudioMirrorRequest(long,java.util.List))](https://developer.android.com/),[ERROR(/#disableAudioMirrorForZone(int))](https://developer.android.com/),[ERROR(/#disableAudioMirror(long))](https://developer.android.com/),[ERROR(/#getMirrorAudioZonesForAudioZone(int))](https://developer.android.com/),[ERROR(/#getMirrorAudioZonesForMirrorRequest(long))](https://developer.android.com/) |
| `int` | [AUDIO_FEATURE_DYNAMIC_ROUTING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_DYNAMIC_ROUTING) This is used to determine if dynamic routing is enabled via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `int` | [AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME) This is used to determine if min/max activation volume level is supported via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int)) If enabled, the volume of the volume group with min/max activation volume setting will be set to min activation volume or max activation volume if volume during activation is lower than min activation volume or higher than max activation volume respectively.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `int` | [AUDIO_FEATURE_OEM_AUDIO_SERVICE](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_OEM_AUDIO_SERVICE) This is used to determine if the OEM audio service is enabled via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int)) If enabled, car audio focus, car audio volume, and ducking control behaviour can change as it can be OEM dependent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `int` | [AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES) This is used to determine if fade and balance values are persisted via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int)) If this feature is enabled, the fade and balance values set using[ERROR(/#setFadeTowardFront(float))](https://developer.android.com/)and[ERROR(/#setBalanceTowardRight(float))](https://developer.android.com/)will be: - Persisted per user.<br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `int` | [AUDIO_FEATURE_VOLUME_GROUP_EVENTS](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_EVENTS) This is used to determine if volume group events is supported via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int)) 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](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_MUTING) This is used to determine if volume group muting is enabled via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

|                                                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                                                      ||
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean` | ` `[isAudioFeatureEnabled](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))`(int audioFeature) ` Determines if an audio feature is enabled.                                                                                                                                                                                                                                                                                                                 |
| ` void`    | ` `[registerCarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager#registerCarVolumeCallback(android.car.media.CarAudioManager.CarVolumeCallback))`(`[CarAudioManager.CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)` callback) ` Registers a[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)to receive volume change callbacks           |
| ` void`    | ` `[unregisterCarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager#unregisterCarVolumeCallback(android.car.media.CarAudioManager.CarVolumeCallback))`(`[CarAudioManager.CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)` callback) ` Unregisters a[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)from receiving volume change callbacks |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## 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)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))

If enabled, audio mirroring can be managed by using the following APIs:[ERROR(/#setAudioZoneMirrorStatusCallback(java.util.concurrent.Executor,android.car.media.AudioZonesMirrorStatusCallback))](https://developer.android.com/),[ERROR(/#clearAudioZonesMirrorStatusCallback())](https://developer.android.com/),[ERROR(/#canEnableAudioMirror())](https://developer.android.com/),[ERROR(/#enableMirrorForAudioZones(java.util.List))](https://developer.android.com/),[ERROR(/#extendAudioMirrorRequest(long,java.util.List))](https://developer.android.com/),[ERROR(/#disableAudioMirrorForZone(int))](https://developer.android.com/),[ERROR(/#disableAudioMirror(long))](https://developer.android.com/),[ERROR(/#getMirrorAudioZonesForAudioZone(int))](https://developer.android.com/),[ERROR(/#getMirrorAudioZonesForMirrorRequest(long))](https://developer.android.com/)

<br />

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)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))

<br />

Constant Value: 1 (0x00000001)  

### AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME

```
public static final int AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME
```

This is used to determine if min/max activation volume level is supported via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))

If enabled, the volume of the volume group with min/max activation volume setting will be set to min activation volume or max activation volume if volume during activation is lower than min activation volume or higher than max activation volume respectively.

<br />

Constant Value: 6 (0x00000006)  

### 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)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))

If enabled, car audio focus, car audio volume, and ducking control behaviour can change as it can be OEM dependent.

<br />

Constant Value: 3 (0x00000003)  

### AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES

```
public static final int AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES
```

This is used to determine if fade and balance values are persisted via[isAudioFeatureEnabled(int)](https://developer.android.com/reference/android/car/media/CarAudioManager#isAudioFeatureEnabled(int))

If this feature is enabled, the fade and balance values set using[ERROR(/#setFadeTowardFront(float))](https://developer.android.com/)and[ERROR(/#setBalanceTowardRight(float))](https://developer.android.com/)will be:

- Persisted per user.
- Persistence occurs across ignition cycles.
- Persistence applies to the cabin zone or the primary audio zone (only).

If this feature is disabled, the fade and balance settings will not be saved and will revert to defaults on the next power cycle or user change.

<br />

Constant Value: 7 (0x00000007)  

### 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)](https://developer.android.com/reference/android/car/media/CarAudioManager#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`.

<br />

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)](https://developer.android.com/reference/android/car/media/CarAudioManager#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.

<br />

Constant Value: 2 (0x00000002)

## Public methods

### isAudioFeatureEnabled

```
public boolean isAudioFeatureEnabled (int audioFeature)
```

Determines if an audio feature is enabled.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `audioFeature` | `int`: audio feature to query, can be any of:[AUDIO_FEATURE_DYNAMIC_ROUTING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_DYNAMIC_ROUTING),[AUDIO_FEATURE_VOLUME_GROUP_MUTING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_MUTING),[AUDIO_FEATURE_VOLUME_GROUP_EVENTS](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_EVENTS),[AUDIO_FEATURE_AUDIO_MIRRORING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_AUDIO_MIRRORING),[AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME)or[AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES)Value is[AUDIO_FEATURE_DYNAMIC_ROUTING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_DYNAMIC_ROUTING),[AUDIO_FEATURE_VOLUME_GROUP_MUTING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_MUTING),[AUDIO_FEATURE_OEM_AUDIO_SERVICE](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_OEM_AUDIO_SERVICE),[AUDIO_FEATURE_VOLUME_GROUP_EVENTS](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_VOLUME_GROUP_EVENTS),[AUDIO_FEATURE_AUDIO_MIRRORING](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_AUDIO_MIRRORING),[AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_MIN_MAX_ACTIVATION_VOLUME), or[AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES](https://developer.android.com/reference/android/car/media/CarAudioManager#AUDIO_FEATURE_PERSIST_FADE_BALANCE_VALUES) <br /> |

|                                  Returns                                   ||
|-----------|-----------------------------------------------------------------|
| `boolean` | Returns`true`if the feature is enabled,`false`otherwise. <br /> |

### registerCarVolumeCallback

```
public void registerCarVolumeCallback (CarAudioManager.CarVolumeCallback callback)
```

Registers a[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)to receive volume change callbacks

<br />

|                                                                                                                      Parameters                                                                                                                       ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `callback` | `CarAudioManager.CarVolumeCallback`:[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)instance, can not be null Requires permission Car.PERMISSION_CAR_CONTROL_AUDIO_VOLUME |

### unregisterCarVolumeCallback

```
public void unregisterCarVolumeCallback (CarAudioManager.CarVolumeCallback callback)
```

Unregisters a[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)from receiving volume change callbacks

<br />

|                                                                                                                                 Parameters                                                                                                                                  ||
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `callback` | `CarAudioManager.CarVolumeCallback`:[CarVolumeCallback](https://developer.android.com/reference/android/car/media/CarAudioManager.CarVolumeCallback)instance previously registered, can not be null Requires permission Car.PERMISSION_CAR_CONTROL_AUDIO_VOLUME |