Loading media/libaudioclient/include/media/AudioParameter.h +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ public: static const char * const valueListSeparator; // keyReconfigA2dp: Ask HwModule to reconfigure A2DP offloaded codec // keyReconfigA2dpSupported: Query if HwModule supports A2DP offload codec config static const char * const keyReconfigA2dp; static const char * const keyReconfigA2dpSupported; String8 toString() const { return toStringImpl(true); } String8 keysToString() const { return toStringImpl(false); } Loading media/libmedia/AudioParameter.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ const char * const AudioParameter::keyStreamSupportedSamplingRates = const char * const AudioParameter::valueOn = AUDIO_PARAMETER_VALUE_ON; const char * const AudioParameter::valueOff = AUDIO_PARAMETER_VALUE_OFF; const char * const AudioParameter::valueListSeparator = AUDIO_PARAMETER_VALUE_LIST_SEPARATOR; const char * const AudioParameter::keyReconfigA2dp = AUDIO_PARAMETER_RECONFIG_A2DP; const char * const AudioParameter::keyReconfigA2dpSupported = AUDIO_PARAMETER_A2DP_RECONFIG_SUPPORTED; AudioParameter::AudioParameter(const String8& keyValuePairs) { Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -368,6 +368,9 @@ status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device, const char *device_name) { status_t status; String8 reply; AudioParameter param; int isReconfigA2dpSupported = 0; ALOGV("handleDeviceConfigChange(() device: 0x%X, address %s name %s", device, device_address, device_name); Loading @@ -384,6 +387,26 @@ status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device, return NO_ERROR; } // For offloaded A2DP, Hw modules may have the capability to // configure codecs. Check if any of the loaded hw modules // supports this. // If supported, send a set parameter to configure A2DP codecs // and return. No need to toggle device state. if (device & AUDIO_DEVICE_OUT_ALL_A2DP) { reply = mpClientInterface->getParameters( AUDIO_IO_HANDLE_NONE, String8(AudioParameter::keyReconfigA2dpSupported)); AudioParameter repliedParameters(reply); repliedParameters.getInt( String8(AudioParameter::keyReconfigA2dpSupported), isReconfigA2dpSupported); if (isReconfigA2dpSupported) { const String8 key(AudioParameter::keyReconfigA2dp); param.add(key, String8("true")); mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString()); return NO_ERROR; } } // Toggle the device state: UNAVAILABLE -> AVAILABLE // This will force reading again the device configuration status = setDeviceConnectionState(device, Loading Loading
media/libaudioclient/include/media/AudioParameter.h +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ public: static const char * const valueListSeparator; // keyReconfigA2dp: Ask HwModule to reconfigure A2DP offloaded codec // keyReconfigA2dpSupported: Query if HwModule supports A2DP offload codec config static const char * const keyReconfigA2dp; static const char * const keyReconfigA2dpSupported; String8 toString() const { return toStringImpl(true); } String8 keysToString() const { return toStringImpl(false); } Loading
media/libmedia/AudioParameter.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ const char * const AudioParameter::keyStreamSupportedSamplingRates = const char * const AudioParameter::valueOn = AUDIO_PARAMETER_VALUE_ON; const char * const AudioParameter::valueOff = AUDIO_PARAMETER_VALUE_OFF; const char * const AudioParameter::valueListSeparator = AUDIO_PARAMETER_VALUE_LIST_SEPARATOR; const char * const AudioParameter::keyReconfigA2dp = AUDIO_PARAMETER_RECONFIG_A2DP; const char * const AudioParameter::keyReconfigA2dpSupported = AUDIO_PARAMETER_A2DP_RECONFIG_SUPPORTED; AudioParameter::AudioParameter(const String8& keyValuePairs) { Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -368,6 +368,9 @@ status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device, const char *device_name) { status_t status; String8 reply; AudioParameter param; int isReconfigA2dpSupported = 0; ALOGV("handleDeviceConfigChange(() device: 0x%X, address %s name %s", device, device_address, device_name); Loading @@ -384,6 +387,26 @@ status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device, return NO_ERROR; } // For offloaded A2DP, Hw modules may have the capability to // configure codecs. Check if any of the loaded hw modules // supports this. // If supported, send a set parameter to configure A2DP codecs // and return. No need to toggle device state. if (device & AUDIO_DEVICE_OUT_ALL_A2DP) { reply = mpClientInterface->getParameters( AUDIO_IO_HANDLE_NONE, String8(AudioParameter::keyReconfigA2dpSupported)); AudioParameter repliedParameters(reply); repliedParameters.getInt( String8(AudioParameter::keyReconfigA2dpSupported), isReconfigA2dpSupported); if (isReconfigA2dpSupported) { const String8 key(AudioParameter::keyReconfigA2dp); param.add(key, String8("true")); mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString()); return NO_ERROR; } } // Toggle the device state: UNAVAILABLE -> AVAILABLE // This will force reading again the device configuration status = setDeviceConnectionState(device, Loading