Merge " hal: Add check for compress-offload streams in open"
diff --git a/configs/audio_vendor_product.mk b/configs/audio_vendor_product.mk
index 7bf600b..e0f394c 100644
--- a/configs/audio_vendor_product.mk
+++ b/configs/audio_vendor_product.mk
@@ -169,7 +169,7 @@
MM_AUDIO += libsynth
MM_AUDIO += libicc
-ifneq ( ,$(filter T Tiramisu 13, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter T Tiramisu 13 U UpsideDownCake 14, $(PLATFORM_VERSION)))
MM_AUDIO += vendor.qti.hardware.automotive.audiocontrol-service
else
MM_AUDIO += android.hardware.automotive.audiocontrol-service.example
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index cfcc6c5..51a9832 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -117,7 +117,7 @@
AUDIO_FEATURE_ENABLED_AUTO_HAL := true
AUDIO_FEATURE_ENABLED_EXT_HW_PLUGIN := true
AUDIO_FEATURE_ENABLED_AUDIO_CONTROL_HAL := true
-ifneq ( ,$(filter T Tiramisu 13, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter T Tiramisu 13 U UpsideDownCake 14, $(PLATFORM_VERSION)))
AUDIO_FEATURE_ENABLED_AUDIO_CONTROL_HAL_AIDL := true
endif
ifneq ($(ENABLE_HYP),true)
@@ -137,7 +137,7 @@
endif
AUDIO_FEATURE_ENABLED_FM_TUNER_EXT := true
AUDIO_FEATURE_ENABLED_ICC := true
-ifneq ( ,$(filter S 12 T 13, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter T Tiramisu 13 U UpsideDownCake 14, $(PLATFORM_VERSION)))
AUDIO_FEATURE_ENABLED_POWER_POLICY := true
endif
ifneq ( ,$(filter msmnile_gvmq msmnile_au msmnile_au_km4 msmnile_au_ar, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX)$(TARGET_BOARD_DERIVATIVE_SUFFIX)))
@@ -150,7 +150,7 @@
DEVICE_PACKAGE_OVERLAYS += vendor/qcom/opensource/audio-hal/primary-hal/configs/common/overlay
endif
-ifneq ( ,$(filter T 13, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter T Tiramisu 13 U UpsideDownCake 14, $(PLATFORM_VERSION)))
ifneq ( ,$(filter msmnile_au msmnile_au_km4 msmnile_au_ar, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX))$(TARGET_BOARD_DERIVATIVE_SUFFIX))
AUDIO_FEATURE_MMAP_AAUDIO = true
endif
diff --git a/hal/audio_extn/sndmonitor.c b/hal/audio_extn/sndmonitor.c
index 5e39d37..a0bd6d3 100644
--- a/hal/audio_extn/sndmonitor.c
+++ b/hal/audio_extn/sndmonitor.c
@@ -55,6 +55,7 @@
#include <log/log.h>
#include <cutils/str_parms.h>
#include <ctype.h>
+#include <linux/version.h>
#include "audio_hw.h"
#include "audio_extn.h"
@@ -158,17 +159,20 @@
s->fd = fd; // dup?
char *state = read_state(fd);
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
if (!state) {
free(s);
return -1;
}
bool online = state && !strcmp(state, "ONLINE");
- ALOGV("card %d initial state %s %d", card, state, online);
-
if (state)
free(state);
+#else
+ bool online = atoi(state);
+#endif
+
+ ALOGV("card %d initial state %s %d", card, state, online);
s->status = online ? CARD_STATUS_ONLINE : CARD_STATUS_OFFLINE;
list_add_tail(&sndmonitor.cards, &s->node);
@@ -234,8 +238,11 @@
ALOGW("Skip over non-ADSP snd card %s", card_id);
continue;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
snprintf(path, sizeof(path), "/proc/asound/card%s/state", ptr);
+#else
+ snprintf(path, sizeof(path), "/sys/kernel/snd_card/card_state");
+#endif
ALOGV("Opening sound card state : %s", path);
fd = open(path, O_RDONLY);
@@ -446,18 +453,26 @@
char rd_buf[9]={0};
card_status_t status;
- if (read(s->fd, rd_buf, 8) <= 0)
+ if (read(s->fd, rd_buf, 8) < 0) {
+ ALOGE("read card state error");
return -1;
+ }
rd_buf[8] = '\0';
lseek(s->fd, 0, SEEK_SET);
ALOGV("card num %d, new state %s", s->card, rd_buf);
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
if (strstr(rd_buf, "OFFLINE"))
status = CARD_STATUS_OFFLINE;
else if (strstr(rd_buf, "ONLINE"))
status = CARD_STATUS_ONLINE;
+#else
+ if (!atoi(rd_buf))
+ status = CARD_STATUS_OFFLINE;
+ else if (atoi(rd_buf))
+ status = CARD_STATUS_ONLINE;
+#endif
else {
ALOGE("unknown state");
return 0;