axolotl: audio: switch to open source sound trigger hal

The audio hal expects the version of the android and sound trigger
hal to match.

As the prebuilt sound trigger hal is built with a BSP based on
Android 10, the version is older than expected and sound trigger fails
to initialize.

11-11 11:37:55.774  4103  4107 I soundtrigger: audio_extn_sound_trigger_init: Enter
11-11 11:37:55.775  4103  4107 I soundtrigger: audio_extn_sound_trigger_init: DLOPEN successful for /vendor/lib/hw/sound_trigger.primary.sdm845.so
11-11 11:37:55.775  4103  4107 E soundtrigger: audio_extn_sound_trigger_init: Incompatible API versions ahal:0x200 != sthal:0x101

Test: atest CtsSoundTriggerTestCases
Test: atest VtsHalSoundtriggerV2_0TargetTest
Test: atest VtsHalSoundtriggerV2_1TargetTest
Test: atest VtsHalSoundtriggerV2_2TargetTest

Depends-On: https://review.lineageos.org/344863
Change-Id: I23b052149bf243f86ebfa13dbbc5053abe4b92e1
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index ba8c33b..b80bd65 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -128,9 +128,12 @@
 AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
 AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
 AUDIO_FEATURE_ENABLED_GEF_SUPPORT := true
-BOARD_SUPPORTS_SOUND_TRIGGER := true
 BOARD_USES_ALSA_AUDIO := true
 
+# Audio - Sound Trigger
+BOARD_SUPPORTS_SOUND_TRIGGER := true
+BOARD_SUPPORTS_OPENSOURCE_STHAL := true
+
 # Filesystem
 TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/rootdir/config.fs
 
diff --git a/device.mk b/device.mk
index 0d8ed0c..15c8f3e 100644
--- a/device.mk
+++ b/device.mk
@@ -69,7 +69,6 @@
     android.hardware.audio@6.0-impl \
     android.hardware.audio.effect@6.0-impl \
     android.hardware.audio.service \
-    android.hardware.soundtrigger@2.2-impl \
     audio.primary.sdm845 \
     audio.r_submix.default \
     audio.usb.default \
@@ -88,6 +87,10 @@
     libvolumelistener \
     tinymix \
 
+PRODUCT_PACKAGES += \
+    android.hardware.soundtrigger@2.2-impl \
+    sound_trigger.primary.sdm845 \
+
 PRODUCT_COPY_FILES += \
     frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration.xml \
     frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 5333fd8..39b2f47 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -686,7 +686,6 @@
 vendor/lib64/libqtikeymaster4.so
 
 # Listen
-vendor/lib/hw/sound_trigger.primary.sdm845.so
 vendor/lib/libadpcmdec.so
 vendor/lib/libcapiv2svacnn.so
 vendor/lib/libcapiv2vop.so
@@ -698,7 +697,6 @@
 vendor/lib/liblistensoundmodel2.so
 vendor/lib/libmulawdec.so
 vendor/lib/libsmwrapper.so
-vendor/lib64/hw/sound_trigger.primary.sdm845.so
 vendor/lib64/libcapiv2svacnn.so
 vendor/lib64/libcapiv2vop.so
 vendor/lib64/libgcs-calwrapper.so