Merge "hal: check device type before handling connection/disconnection"
This commit is contained in:
commit
769c7d35e3
|
@ -969,9 +969,9 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
|
|||
|
||||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value,
|
||||
sizeof(value));
|
||||
if( ret >= 0) {
|
||||
if (ret >= 0) {
|
||||
val = atoi(value);
|
||||
if (val & AUDIO_DEVICE_OUT_ALL_A2DP) {
|
||||
if (audio_is_a2dp_out_device(val)) {
|
||||
ALOGV("Received device connect request for A2DP");
|
||||
open_a2dp_output();
|
||||
}
|
||||
|
@ -981,9 +981,9 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
|
|||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value,
|
||||
sizeof(value));
|
||||
|
||||
if( ret >= 0) {
|
||||
if (ret >= 0) {
|
||||
val = atoi(value);
|
||||
if (val & AUDIO_DEVICE_OUT_ALL_A2DP) {
|
||||
if (audio_is_a2dp_out_device(val)) {
|
||||
ALOGV("Received device dis- connect request");
|
||||
reset_a2dp_enc_config_params();
|
||||
close_a2dp_output();
|
||||
|
|
|
@ -380,7 +380,8 @@ int audio_extn_keep_alive_set_parameters(struct audio_device *adev __unused,
|
|||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value));
|
||||
if (ret >= 0) {
|
||||
int val = atoi(value);
|
||||
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
|
||||
if (audio_is_output_devices(val) &&
|
||||
(val & AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
|
||||
if (!audio_extn_passthru_is_active()) {
|
||||
ALOGV("start keep alive");
|
||||
audio_extn_keep_alive_start();
|
||||
|
@ -392,7 +393,8 @@ int audio_extn_keep_alive_set_parameters(struct audio_device *adev __unused,
|
|||
sizeof(value));
|
||||
if (ret >= 0) {
|
||||
int val = atoi(value);
|
||||
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
|
||||
if (audio_is_output_devices(val) &&
|
||||
(val & AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
|
||||
ALOGV("stop keep_alive");
|
||||
audio_extn_keep_alive_stop();
|
||||
}
|
||||
|
|
|
@ -2799,7 +2799,6 @@ int audio_extn_qaf_set_parameters(struct audio_device *adev, struct str_parms *p
|
|||
int status = 0, val = 0, k;
|
||||
char *format_params, *kv_parirs;
|
||||
struct str_parms *qaf_params;
|
||||
char value[32];
|
||||
|
||||
DEBUG_MSG("Entry");
|
||||
|
||||
|
@ -2807,10 +2806,9 @@ int audio_extn_qaf_set_parameters(struct audio_device *adev, struct str_parms *p
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
status = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value));
|
||||
status = str_parms_get_int(parms, AUDIO_PARAMETER_DEVICE_CONNECT, &val);
|
||||
|
||||
if (status >= 0) {
|
||||
val = atoi(value);
|
||||
if ((status >= 0) && audio_is_output_device(val)) {
|
||||
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) { //HDMI is connected.
|
||||
|
||||
p_qaf->hdmi_connect = 1;
|
||||
|
@ -2847,9 +2845,8 @@ int audio_extn_qaf_set_parameters(struct audio_device *adev, struct str_parms *p
|
|||
//TODO else if: Need to consider other devices.
|
||||
}
|
||||
|
||||
status = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value));
|
||||
if (status >= 0) {
|
||||
val = atoi(value);
|
||||
status = str_parms_get_int(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, &val);
|
||||
if ((status >= 0) && audio_is_output_device(val)) {
|
||||
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) { //HDMI is disconnected.
|
||||
|
||||
qaf_params = str_parms_create();
|
||||
|
|
|
@ -6243,7 +6243,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
|||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_CONNECT, value, sizeof(value));
|
||||
if (ret >= 0) {
|
||||
val = atoi(value);
|
||||
if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
|
||||
if (audio_is_output_device(val) &&
|
||||
(val & AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
|
||||
ALOGV("cache new ext disp type and edid");
|
||||
ret = platform_get_ext_disp_type(adev->platform);
|
||||
if (ret < 0) {
|
||||
|
@ -6252,8 +6253,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
|||
goto done;
|
||||
}
|
||||
platform_cache_edid(adev->platform);
|
||||
} else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
|
||||
!(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
|
||||
} else if ((audio_is_output_device(val) && (val & AUDIO_DEVICE_OUT_USB_DEVICE)) ||
|
||||
(audio_is_input_device(val) && ((uint32_t)val & AUDIO_DEVICE_IN_USB_DEVICE))) {
|
||||
/*
|
||||
* Do not allow AFE proxy port usage by WFD source when USB headset is connected.
|
||||
* Per AudioPolicyManager, USB device is higher priority than WFD.
|
||||
|
@ -6263,7 +6264,9 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
|||
*/
|
||||
ret = str_parms_get_str(parms, "card", value, sizeof(value));
|
||||
if (ret >= 0) {
|
||||
if (audio_is_output_device(val))
|
||||
audio_extn_usb_add_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value));
|
||||
else
|
||||
audio_extn_usb_add_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value));
|
||||
}
|
||||
ALOGV("detected USB connect .. disable proxy");
|
||||
|
@ -6280,11 +6283,13 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
|||
* invalidated prior to updating sysfs of the disconnect event
|
||||
* Invalidate will be handled by audio_extn_ext_disp_set_parameters()
|
||||
*/
|
||||
if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
|
||||
!(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
|
||||
if ((audio_is_output_device(val) && (val & AUDIO_DEVICE_OUT_USB_DEVICE)) ||
|
||||
(audio_is_input_device(val) && ((uint32_t)val == AUDIO_DEVICE_IN_USB_DEVICE))) {
|
||||
ret = str_parms_get_str(parms, "card", value, sizeof(value));
|
||||
if (ret >= 0) {
|
||||
if (audio_is_output_device(val))
|
||||
audio_extn_usb_remove_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value));
|
||||
else
|
||||
audio_extn_usb_remove_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value));
|
||||
}
|
||||
ALOGV("detected USB disconnect .. enable proxy");
|
||||
|
|
Loading…
Reference in New Issue