Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10617ed3 authored by Zhou Song's avatar Zhou Song Committed by Shiv Maliyappanahalli
Browse files

hal: restore a2dp device for active usecases when out of suspended

Routing request to a2dp could come before a2dp out of suspended
thus the request is ignored, and audio continues on the last device.

Restore device to a2dp for all current active usecases if a2dp is
requsted before.

CRs-Fixed: 2063836
Change-Id: I43a9f65315dcf0ccd19cf30485c3093ec47853ca
parent 319c45d7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -794,6 +794,8 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
                   a2dp.audio_suspend_stream();
            } else if (a2dp.a2dp_suspended == true) {
                ALOGD("Resetting a2dp suspend state");
                struct audio_usecase *uc_info;
                struct listnode *node;
                if(a2dp.clear_a2dpsuspend_flag)
                    a2dp.clear_a2dpsuspend_flag();
                a2dp.a2dp_suspended = false;
@@ -818,6 +820,13 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
                        }
                    }
                }
                // restore A2DP device for active usecases
                list_for_each(node, &a2dp.adev->usecase_list) {
                    uc_info = node_to_item(node, struct audio_usecase, list);
                    if ((uc_info->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
                            (uc_info->out_snd_device != SND_DEVICE_OUT_BT_A2DP))
                        select_devices(a2dp.adev, uc_info->id);
                }
            }
        }
        goto param_handled;