From 250aec6265d22eef7dffe24305e624dbc5ffce04 Mon Sep 17 00:00:00 2001
From: Erfan Abdi <erfangplus@gmail.com>
Date: Thu, 2 Jan 2020 00:20:13 +0330
Subject: [PATCH] beckham: Add moto audio mods helper effect

* MMI effects wrapper is also needed.
" Add moto EQ HAL to manifest.

Change-Id: Id2031156c20cfb9e6f3f0036b0792e9272b6aa7e
---
 BoardConfig.mk          |  3 +++
 audio/audio_effects.xml | 27 +++++++++++++++++++++++++++
 motomods.xml            | 12 ++++++++++++
 proprietary-files.txt   |  6 ++++++
 4 files changed, 48 insertions(+)
 create mode 100644 motomods.xml

diff --git a/BoardConfig.mk b/BoardConfig.mk
index c9061c8..622cd12 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -28,6 +28,9 @@ TARGET_SCREEN_DENSITY := 420
 # Kernel
 TARGET_KERNEL_CONFIG := lineageos_beckham_defconfig
 
+# HIDL
+DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/motomods.xml
+
 # NFC
 BOARD_NFC_CHIPSET := pn553
 
diff --git a/audio/audio_effects.xml b/audio/audio_effects.xml
index 8417403..4cb91fd 100644
--- a/audio/audio_effects.xml
+++ b/audio/audio_effects.xml
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <audio_effects_conf version="2.0" xmlns="http://schemas.android.com/audio/audio_effects_conf/v2_0">
     <libraries>
+        <library name="mmieffects" path="libmmieffectswrapper.so"/>
+        <library name="mot_speaker_helper" path="libspeakerbundle.so"/>
         <library name="bundle" path="libbundlewrapper.so"/>
         <library name="reverb" path="libreverbwrapper.so"/>
         <library name="visualizer_sw" path="libvisualizer.so"/>
@@ -26,6 +28,7 @@
             <libhw library="offload_bundle" uuid="a0dac280-401c-11e3-9379-0002a5d5c51b"/>
         </effectProxy>
         <effect name="volume" library="bundle" uuid="119341a0-8469-11df-81f9-0002a5d5c51b"/>
+        <effect name="mmieffects" library="mmieffects" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01ba"/>
         <effectProxy name="reverb_env_aux" library="proxy" uuid="48404ac9-d202-4ccc-bf84-0002a5d5c51b">
             <libsw library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
             <libhw library="offload_bundle" uuid="79a18026-18fd-4185-8233-0002a5d5c51b"/>
@@ -51,7 +54,31 @@
         <effect name="aec" library="audio_pre_processing" uuid="0f8d0d2a-59e5-45fe-b6e4-248c8a799109"/>
         <effect name="ns" library="audio_pre_processing" uuid="1d97bb0b-9e2f-4403-9ae3-58c2554306f8"/>
         <effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
+        <effectProxy name="music_helper" library="proxy" uuid="00905020-4e52-11e4-83aa-0002a5d5c51b">
+            <libsw library="mot_speaker_helper" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01ab"/>
+            <libhw library="mot_speaker_helper" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01b0"/>
+        </effectProxy>
+        <effect name="voice_helper" library="mot_speaker_helper" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01ac"/>
+        <effect name="ring_helper" library="mot_speaker_helper" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01ad"/>
+        <effect name="notification_helper" library="mot_speaker_helper" uuid="bce61ec2-eca4-445c-9dcb-91cc7cce01ae"/>
     </effects>
+    <postprocess>
+        <stream type="music">
+            <apply effect="music_helper"/>
+        </stream>
+        <stream type="ring">
+            <apply effect="ring_helper"/>
+        </stream>
+        <stream type="alarm">
+            <apply effect="ring_helper"/>
+        </stream>
+        <stream type="voice_call">
+            <apply effect="voice_helper"/>
+        </stream>
+        <stream type="notification">
+            <apply effect="notification_helper"/>
+        </stream>
+    </postprocess>
     <preprocess>
         <stream type="voice_communication">
             <apply effect="aec"/>
diff --git a/motomods.xml b/motomods.xml
new file mode 100644
index 0000000..312ba8a
--- /dev/null
+++ b/motomods.xml
@@ -0,0 +1,12 @@
+<manifest version="1.0" type="device">
+    <hal format="hidl">
+        <name>motorola.hardware.audio.eqservice</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IEQServiceHIDL</name>
+            <instance>default</instance>
+        </interface>
+        <fqname>@1.0::IEQServiceHIDL/default</fqname>
+    </hal>
+</manifest>
diff --git a/proprietary-files.txt b/proprietary-files.txt
index cc26385..ecb3180 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -7,6 +7,12 @@ etc/acdbdata/Hdmi_cal.acdb:vendor/etc/acdbdata/Hdmi_cal.acdb
 etc/acdbdata/Headset_cal.acdb:vendor/etc/acdbdata/Headset_cal.acdb
 etc/acdbdata/Speaker_cal.acdb:vendor/etc/acdbdata/Speaker_cal.acdb
 
+# Audio - Soundfx
+vendor/lib/soundfx/libspeakerbundle.so
+vendor/lib/soundfx/libmmieffectswrapper.so
+vendor/lib/libeqservicebridge.so
+vendor/lib/motorola.hardware.audio.eqservice@1.0_vendor.so
+
 # Camera
 etc/zaf/zaf_mot_s5k2l7sa.json:vendor/etc/zaf/zaf_mot_s5k2l7sa.json
 etc/zaf/zaf_imx386.json:vendor/etc/zaf/zaf_imx386.json
-- 
GitLab