pa_sink *sink = NULL;
pa_source *source = NULL;
+ pa_sink_input *si = NULL;
+ uint32_t si_idx = 0;
+ const char *media_role = NULL;
+ hal_route_option route_option;
+
pa_assert(c);
pa_assert(data);
pa_assert(m);
data->event_id, data->is_connected, data->device, device_type, device_id, device_direction, use_internal_codec);
/* mute all the streams belong to this device, those will be un-muted in event_fully_handled_hook_cb */
- if (!data->is_connected && (device_direction & DM_DEVICE_DIRECTION_OUT))
+ if (!data->is_connected && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
if ((sink = pa_tz_device_get_sink(data->device, DEVICE_ROLE_NORMAL)))
mute_sink_inputs_as_device_disconnection(m, data->event_id, true, sink->inputs);
+ /* If Earjack is disconnected, search for sink-input which has radio role,
+ if found, let radio mute to avoid intermediate noise */
+ if (pa_safe_streq(device_type, DEVICE_TYPE_AUDIO_JACK)) {
+ PA_IDXSET_FOREACH(si, c->sink_inputs, si_idx) {
+ media_role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE);
+ if (pa_safe_streq(media_role, STREAM_ROLE_RADIO)) {
+ pa_log_info(" sink-input(%d) is radio, let HAL mute for disconnect of earjack", si->index);
+ memset(&route_option, 0, sizeof(hal_route_option));
+ route_option.role = STREAM_ROLE_RADIO;
+ route_option.name = "mute";
+ route_option.value = 1;
+ pa_hal_interface_update_route_option(m->hal, &route_option);
+ }
+ }
+ }
+ }
+
/* Update streams belong to this external device that have MAUAL_EXT route type */
if (!use_internal_codec && (device_direction & DM_DEVICE_DIRECTION_IN)) {
if ((source = pa_tz_device_get_source(data->device, DEVICE_ROLE_NORMAL)))