hal: Add APIs for HIDL 5.0
Change-Id: I87e19cfe4583d397098f6b2c2acf48651d372007
diff --git a/hal/Android.mk b/hal/Android.mk
index 245679b..82eb510 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -486,6 +486,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
+LOCAL_CFLAGS += -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
include $(BUILD_SHARED_LIBRARY)
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3181a82..3f20bcb 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -460,6 +460,12 @@
}
#endif
+#if ANDROID_PLATFORM_SDK_VERSION >= 29
+static int in_set_microphone_direction(const struct audio_stream_in *stream,
+ audio_microphone_direction_t dir);
+static int in_set_microphone_field_dimension(const struct audio_stream_in *stream, float zoom);
+#endif
+
static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
int flags __unused)
{
@@ -4149,6 +4155,25 @@
return ret;
}
+#if ANDROID_PLATFORM_SDK_VERSION >= 29
+static int in_set_microphone_direction(const struct audio_stream_in *stream,
+ audio_microphone_direction_t dir) {
+ int ret_val = -ENOSYS;
+ (void)stream;
+ (void)dir;
+ ALOGV("---- in_set_microphone_direction()");
+ return ret_val;
+}
+
+static int in_set_microphone_field_dimension(const struct audio_stream_in *stream, float zoom) {
+ int ret_val = -ENOSYS;
+ (void)zoom;
+ (void)stream;
+ ALOGV("---- in_set_microphone_field_dimension()");
+ return ret_val;
+}
+#endif
+
static bool stream_get_parameter_channels(struct str_parms *query,
struct str_parms *reply,
audio_channel_mask_t *supported_channel_masks) {
@@ -7340,6 +7365,10 @@
in->stream.read = in_read;
in->stream.get_input_frames_lost = in_get_input_frames_lost;
in->stream.get_active_microphones = in_get_active_microphones;
+#if ANDROID_PLATFORM_SDK_VERSION >= 29
+ in->stream.set_microphone_direction = in_set_microphone_direction;
+ in->stream.set_microphone_field_dimension = in_set_microphone_field_dimension;
+#endif
in->device = devices;
in->source = source;