Loading services/audiopolicy/AudioPolicyInterface.h +2 −2 Original line number Diff line number Diff line Loading @@ -158,14 +158,14 @@ public: int indexMax) = 0; // sets the new stream volume at a level corresponding to the supplied index for the // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME means // setting volume for all devices virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device) = 0; // retrieve current volume index for the specified stream and the // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME means // querying the volume of the active device. virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index, Loading services/audiopolicy/common/include/policy.h +17 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,23 @@ static const audio_format_t gDynamicFormat = AUDIO_FORMAT_DEFAULT; #define APM_AUDIO_DEVICE_IN_MATCH_ADDRESS_ALL (AUDIO_DEVICE_IN_REMOTE_SUBMIX|AUDIO_DEVICE_IN_BUS) /** * Stub audio output device. Used in policy configuration file on platforms without audio outputs. * This alias value to AUDIO_DEVICE_OUT_DEFAULT is only used in the audio policy context. */ #define AUDIO_DEVICE_OUT_STUB AUDIO_DEVICE_OUT_DEFAULT /** * Stub audio input device. Used in policy configuration file on platforms without audio inputs. * This alias value to AUDIO_DEVICE_IN_DEFAULT is only used in the audio policy context. */ #define AUDIO_DEVICE_IN_STUB AUDIO_DEVICE_IN_DEFAULT /** * Alias to AUDIO_DEVICE_OUT_DEFAULT defined for clarification when this value is used by volume * control APIs (e.g setStreamVolumeIndex(). */ #define AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME AUDIO_DEVICE_OUT_DEFAULT /** * Check if the state given correspond to an in call state. * @TODO find a better name for widely call state Loading services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ class VolumeCurvesForStream : public KeyedVector<device_category, sp<VolumeCurve public: VolumeCurvesForStream() : mIndexMin(0), mIndexMax(1), mCanBeMuted(true) { mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT, 0); mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME, 0); } sp<VolumeCurve> getCurvesFor(device_category device) const Loading @@ -88,9 +88,9 @@ public: int getVolumeIndex(audio_devices_t device) const { device = Volume::getDeviceForVolume(device); // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME if (mIndexCur.indexOfKey(device) < 0) { device = AUDIO_DEVICE_OUT_DEFAULT; device = AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME; } return mIndexCur.valueFor(device); } Loading services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -128,14 +128,35 @@ status_t AudioPatchCollection::listAudioPatches(unsigned int *num_patches, size_t patchesWritten = 0; size_t patchesMax = *num_patches; for (size_t i = 0; i < size() && patchesWritten < patchesMax; i++) { const sp<AudioPatch> patch = valueAt(i); *num_patches = 0; for (size_t patchIndex = 0; patchIndex < size(); patchIndex++) { // do not report patches with AUDIO_DEVICE_IN_STUB as source or // AUDIO_DEVICE_OUT_STUB as sink as those devices are used by stub HALs by convention const sp<AudioPatch> patch = valueAt(patchIndex); bool skip = false; for (size_t srcIndex = 0; srcIndex < patch->mPatch.num_sources && !skip; srcIndex++) { if (patch->mPatch.sources[srcIndex].type == AUDIO_PORT_TYPE_DEVICE && patch->mPatch.sources[srcIndex].ext.device.type == AUDIO_DEVICE_IN_STUB) { skip = true; } } for (size_t sinkIndex = 0; sinkIndex < patch->mPatch.num_sinks && !skip; sinkIndex++) { if (patch->mPatch.sinks[sinkIndex].type == AUDIO_PORT_TYPE_DEVICE && patch->mPatch.sinks[sinkIndex].ext.device.type == AUDIO_DEVICE_OUT_STUB) { skip = true; } } if (skip) { continue; // to next audio patch } if (patchesWritten < patchesMax) { patches[patchesWritten] = patch->mPatch; patches[patchesWritten++].id = patch->mHandle; } (*num_patches)++; ALOGV("listAudioPatches() patch %zu num_sources %d num_sinks %d", i, patch->mPatch.num_sources, patch->mPatch.num_sinks); patchIndex, patch->mPatch.num_sources, patch->mPatch.num_sinks); } *num_patches = size(); ALOGV("listAudioPatches() got %zu patches needed %d", patchesWritten, *num_patches); return NO_ERROR; Loading services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -39,15 +39,15 @@ StreamDescriptor::StreamDescriptor() // Initialize the current stream's index to mIndexMax so volume isn't 0 in // cases where the Java layer doesn't call into the audio policy service to // set the default volume. mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT, mIndexMax); mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME, mIndexMax); } int StreamDescriptor::getVolumeIndex(audio_devices_t device) const { device = Volume::getDeviceForVolume(device); // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME if (mIndexCur.indexOfKey(device) < 0) { device = AUDIO_DEVICE_OUT_DEFAULT; device = AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME; } return mIndexCur.valueFor(device); } Loading Loading
services/audiopolicy/AudioPolicyInterface.h +2 −2 Original line number Diff line number Diff line Loading @@ -158,14 +158,14 @@ public: int indexMax) = 0; // sets the new stream volume at a level corresponding to the supplied index for the // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME means // setting volume for all devices virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device) = 0; // retrieve current volume index for the specified stream and the // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME means // querying the volume of the active device. virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index, Loading
services/audiopolicy/common/include/policy.h +17 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,23 @@ static const audio_format_t gDynamicFormat = AUDIO_FORMAT_DEFAULT; #define APM_AUDIO_DEVICE_IN_MATCH_ADDRESS_ALL (AUDIO_DEVICE_IN_REMOTE_SUBMIX|AUDIO_DEVICE_IN_BUS) /** * Stub audio output device. Used in policy configuration file on platforms without audio outputs. * This alias value to AUDIO_DEVICE_OUT_DEFAULT is only used in the audio policy context. */ #define AUDIO_DEVICE_OUT_STUB AUDIO_DEVICE_OUT_DEFAULT /** * Stub audio input device. Used in policy configuration file on platforms without audio inputs. * This alias value to AUDIO_DEVICE_IN_DEFAULT is only used in the audio policy context. */ #define AUDIO_DEVICE_IN_STUB AUDIO_DEVICE_IN_DEFAULT /** * Alias to AUDIO_DEVICE_OUT_DEFAULT defined for clarification when this value is used by volume * control APIs (e.g setStreamVolumeIndex(). */ #define AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME AUDIO_DEVICE_OUT_DEFAULT /** * Check if the state given correspond to an in call state. * @TODO find a better name for widely call state Loading
services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ class VolumeCurvesForStream : public KeyedVector<device_category, sp<VolumeCurve public: VolumeCurvesForStream() : mIndexMin(0), mIndexMax(1), mCanBeMuted(true) { mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT, 0); mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME, 0); } sp<VolumeCurve> getCurvesFor(device_category device) const Loading @@ -88,9 +88,9 @@ public: int getVolumeIndex(audio_devices_t device) const { device = Volume::getDeviceForVolume(device); // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME if (mIndexCur.indexOfKey(device) < 0) { device = AUDIO_DEVICE_OUT_DEFAULT; device = AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME; } return mIndexCur.valueFor(device); } Loading
services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -128,14 +128,35 @@ status_t AudioPatchCollection::listAudioPatches(unsigned int *num_patches, size_t patchesWritten = 0; size_t patchesMax = *num_patches; for (size_t i = 0; i < size() && patchesWritten < patchesMax; i++) { const sp<AudioPatch> patch = valueAt(i); *num_patches = 0; for (size_t patchIndex = 0; patchIndex < size(); patchIndex++) { // do not report patches with AUDIO_DEVICE_IN_STUB as source or // AUDIO_DEVICE_OUT_STUB as sink as those devices are used by stub HALs by convention const sp<AudioPatch> patch = valueAt(patchIndex); bool skip = false; for (size_t srcIndex = 0; srcIndex < patch->mPatch.num_sources && !skip; srcIndex++) { if (patch->mPatch.sources[srcIndex].type == AUDIO_PORT_TYPE_DEVICE && patch->mPatch.sources[srcIndex].ext.device.type == AUDIO_DEVICE_IN_STUB) { skip = true; } } for (size_t sinkIndex = 0; sinkIndex < patch->mPatch.num_sinks && !skip; sinkIndex++) { if (patch->mPatch.sinks[sinkIndex].type == AUDIO_PORT_TYPE_DEVICE && patch->mPatch.sinks[sinkIndex].ext.device.type == AUDIO_DEVICE_OUT_STUB) { skip = true; } } if (skip) { continue; // to next audio patch } if (patchesWritten < patchesMax) { patches[patchesWritten] = patch->mPatch; patches[patchesWritten++].id = patch->mHandle; } (*num_patches)++; ALOGV("listAudioPatches() patch %zu num_sources %d num_sinks %d", i, patch->mPatch.num_sources, patch->mPatch.num_sinks); patchIndex, patch->mPatch.num_sources, patch->mPatch.num_sinks); } *num_patches = size(); ALOGV("listAudioPatches() got %zu patches needed %d", patchesWritten, *num_patches); return NO_ERROR; Loading
services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -39,15 +39,15 @@ StreamDescriptor::StreamDescriptor() // Initialize the current stream's index to mIndexMax so volume isn't 0 in // cases where the Java layer doesn't call into the audio policy service to // set the default volume. mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT, mIndexMax); mIndexCur.add(AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME, mIndexMax); } int StreamDescriptor::getVolumeIndex(audio_devices_t device) const { device = Volume::getDeviceForVolume(device); // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT // there is always a valid entry for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME if (mIndexCur.indexOfKey(device) < 0) { device = AUDIO_DEVICE_OUT_DEFAULT; device = AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME; } return mIndexCur.valueFor(device); } Loading