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
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index b7942ae..8123366 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -434,6 +434,7 @@
#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_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);
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index a07796a..aa13c2b 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -84,6 +84,7 @@
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 @@
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)
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 739a0bf..8c4c71d 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -8079,6 +8079,7 @@
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);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 459c37c..676a30d 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -7896,15 +7896,20 @@
case USECASE_AUDIO_PLAYBACK_MULTI_CH:
case USECASE_AUDIO_PLAYBACK_OFFLOAD:
case USECASE_AUDIO_PLAYBACK_OFFLOAD2:
- needs_event = true;
- break;
- /* concurrent playback in low latency allowed */
- case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
- break;
- /* concurrent playback FM needs event */
case USECASE_AUDIO_PLAYBACK_FM:
needs_event = true;
break;
+ 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;
+ case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
+ if (property_get_bool("persist.vendor.audio.ll_playback_bargein",
+ false))
+ needs_event = true;
+ break;
/* concurrent capture usecases which needs event */
case USECASE_AUDIO_RECORD: