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

Commit 70f20f32 authored by Quinn Male's avatar Quinn Male Committed by Gerrit - the friendly Code Review server
Browse files

hal: Expand the list of Barge-in usecases

This change adds new usecases to the list that will raise a
usecase event to sthal. USECASE_AUDIO_PLAYBACK_LOW_LATENCY and
USECASE_AUDIO_PLAYBACK_ULL are added with system property checks.
USECASE_AUDIO_PLAYBACK_MMAP is also added without a system
property. Additionally, screen state events can now be sent to
sthal.

Change-Id: I936b2390d886b67695daf184a2ca1b018ed17567
parent 007e5e9c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -434,6 +434,7 @@ void audio_extn_listen_set_parameters(struct audio_device *adev,
#define audio_extn_sound_trigger_update_device_status(snd_dev, event)  (0)
#define audio_extn_sound_trigger_update_stream_status(uc_info, event)  (0)
#define audio_extn_sound_trigger_update_battery_status(charging)       (0)
#define audio_extn_sound_trigger_update_screen_status(screen_off)      (0)
#define audio_extn_sound_trigger_set_parameters(adev, parms)           (0)
#define audio_extn_sound_trigger_get_parameters(adev, query, reply)    (0)
#define audio_extn_sound_trigger_check_and_get_session(in)             (0)
@@ -458,6 +459,7 @@ void audio_extn_sound_trigger_update_device_status(snd_device_t snd_device,
void audio_extn_sound_trigger_update_stream_status(struct audio_usecase *uc_info,
                                     st_event_type_t event);
void audio_extn_sound_trigger_update_battery_status(bool charging);
void audio_extn_sound_trigger_update_screen_status(bool screen_off);
void audio_extn_sound_trigger_set_parameters(struct audio_device *adev,
                                             struct str_parms *parms);
void audio_extn_sound_trigger_check_and_get_session(struct stream_in *in);
+12 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ typedef enum {
    AUDIO_EVENT_CAPTURE_STREAM_INACTIVE,
    AUDIO_EVENT_CAPTURE_STREAM_ACTIVE,
    AUDIO_EVENT_BATTERY_STATUS_CHANGED,
    AUDIO_EVENT_SCREEN_STATUS_CHANGED,
    AUDIO_EVENT_GET_PARAM,
    AUDIO_EVENT_UPDATE_ECHO_REF
} audio_event_type_t;
@@ -605,6 +606,17 @@ void audio_extn_sound_trigger_update_battery_status(bool charging)
    st_dev->st_callback(AUDIO_EVENT_BATTERY_STATUS_CHANGED, &ev_info);
}

void audio_extn_sound_trigger_update_screen_status(bool screen_off)
{
    struct audio_event_info ev_info = {{0}, {0}};

    if (!st_dev)
        return;

    ev_info.u.value = screen_off;
    st_dev->st_callback(AUDIO_EVENT_SCREEN_STATUS_CHANGED, &ev_info);
}


void audio_extn_sound_trigger_set_parameters(struct audio_device *adev __unused,
                               struct str_parms *params)
+1 −0
Original line number Diff line number Diff line
@@ -8079,6 +8079,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
            adev->screen_off = false;
        else
            adev->screen_off = true;
        audio_extn_sound_trigger_update_screen_status(adev->screen_off);
    }

    ret = str_parms_get_int(parms, "rotation", &val);
+10 −5
Original line number Diff line number Diff line
@@ -7896,13 +7896,18 @@ bool platform_sound_trigger_usecase_needs_event(audio_usecase_t uc_id)
    case USECASE_AUDIO_PLAYBACK_MULTI_CH:
    case USECASE_AUDIO_PLAYBACK_OFFLOAD:
    case USECASE_AUDIO_PLAYBACK_OFFLOAD2:
    case USECASE_AUDIO_PLAYBACK_FM:
        needs_event = true;
        break;
    /* concurrent playback in low latency allowed */
    case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
    case USECASE_AUDIO_PLAYBACK_ULL:
    case USECASE_AUDIO_PLAYBACK_MMAP:
        if (property_get_bool("persist.vendor.audio.ull_playback_bargein",
            false))
            needs_event = true;
        break;
    /* concurrent playback FM needs event */
    case USECASE_AUDIO_PLAYBACK_FM:
    case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
        if (property_get_bool("persist.vendor.audio.ll_playback_bargein",
            false))
            needs_event = true;
        break;