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

Commit abdf6dc9 authored by kunleiz's avatar kunleiz
Browse files

hal: restore device for other active usecases when VOICE stopped

During record and VOICE both are active scenario, there is no
device restore for recording usecase after closing voice call.
Therefore, recording input device still use voice device even
if voice is not active.

Fix this by updating proper device for other active usecase when
voice is closed.

CRs-Fixed: 2041312
Change-Id: I300c2fdb4379cc784cef58bca52d8f138ad7a551
parent 46b1c25d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4754,6 +4754,8 @@ static int adev_get_master_mute(struct audio_hw_device *dev __unused,
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
    struct audio_device *adev = (struct audio_device *)dev;
    struct audio_usecase *uc_info;
    struct listnode *node;

    pthread_mutex_lock(&adev->lock);
    if (adev->mode != mode) {
@@ -4763,6 +4765,12 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
            voice_stop_call(adev);
            platform_set_gsm_mode(adev->platform, false);
            adev->current_call_output = NULL;

            // restore device for other active usecases after stop call
            list_for_each(node, &adev->usecase_list) {
                uc_info = node_to_item(node, struct audio_usecase, list);
                select_devices(adev, uc_info->id);
            }
        }
    }
    pthread_mutex_unlock(&adev->lock);