Merge e51cc9c2ab7c360e583ad161750dfdcd9363d761 on remote branch
Change-Id: I9c3b1f294a43bf427ece515ce4b75514c7949d33
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index 85297f7..60bb32a 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -1263,16 +1263,9 @@
pthread_mutex_unlock(&stdev->lock);
}
-static int stdev_get_properties(const struct sound_trigger_hw_device *dev,
- struct sound_trigger_properties *properties)
+static void get_base_properties(struct sound_trigger_device *stdev)
{
- struct sound_trigger_device *stdev = (struct sound_trigger_device *)dev;
-
- ALOGI("%s", __func__);
- if (properties == NULL) {
- ALOGE("%s: NULL properties", __func__);
- return -EINVAL;
- }
+ ALOGI("%s: enter", __func__);
stdev->hw_properties->concurrent_capture = stdev->conc_capture_supported;
@@ -1300,8 +1293,24 @@
stdev->hw_properties->capture_transition,
stdev->hw_properties->concurrent_capture);
- memcpy(properties, stdev->hw_properties,
+ memset(&hw_properties_extended, 0, sizeof(hw_properties_extended));
+ memcpy(&hw_properties_extended.base, stdev->hw_properties,
sizeof(struct sound_trigger_properties));
+}
+
+static int stdev_get_properties(const struct sound_trigger_hw_device *dev,
+ struct sound_trigger_properties *properties)
+{
+ struct sound_trigger_device *stdev = (struct sound_trigger_device *)dev;
+
+ ALOGI("%s", __func__);
+ if (properties == NULL) {
+ ALOGE("%s: NULL properties", __func__);
+ return -EINVAL;
+ }
+
+ get_base_properties(stdev);
+ properties = (struct sound_trigger_properties *)&hw_properties_extended.base;
hw_properties_extended.header.version = SOUND_TRIGGER_DEVICE_API_VERSION_1_0;
return 0;
}
@@ -2734,11 +2743,8 @@
stdev = (struct sound_trigger_device *)dev;
prop_hdr = (struct sound_trigger_properties_header *)&hw_properties_extended;
- status = stdev_get_properties(dev, &hw_properties_extended.base);
- if (status) {
- ALOGW("%s: Failed to initialize the stdev properties", __func__);
- return NULL;
- }
+ get_base_properties(stdev);
+
hw_properties_extended.header.size = sizeof(struct sound_trigger_properties_extended_1_3);
hw_properties_extended.audio_capabilities = 0;
hw_properties_extended.header.version = SOUND_TRIGGER_DEVICE_API_VERSION_1_3;
@@ -2948,6 +2954,11 @@
stdev_ref_cnt++;
pthread_mutex_unlock(&stdev_init_lock);
+ get_base_properties(stdev);
+ hw_properties_extended.header.size = sizeof(struct sound_trigger_properties_extended_1_3);
+ hw_properties_extended.audio_capabilities = 0;
+ hw_properties_extended.header.version = SOUND_TRIGGER_DEVICE_API_VERSION_1_3;
+
ATRACE_END();
return 0;