diff --git a/BoardConfig.mk b/BoardConfig.mk
index 1452669f..21f485de 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -148,6 +148,7 @@ CHRE_DAEMON_ENABLED := true
CHRE_DAEMON_USE_SDSPRPC := true
# Audio
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
BOARD_USES_ALSA_AUDIO := true
AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
AUDIO_FEATURE_ENABLED_SND_MONITOR := true
diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml
index 38b267df..d1acf368 100644
--- a/audio_policy_configuration.xml
+++ b/audio_policy_configuration.xml
@@ -59,6 +59,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+
+
+
+
+
+
diff --git a/init.hardware.rc b/init.hardware.rc
index 5f481fb6..b3a01065 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -754,3 +754,7 @@ on property:sys.boot_completed=1
on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
start init-fingerprint-sh
+
+# Dolby
+ mkdir /data/vendor/dolby 0770 media media
+ mkdir /data/vendor/multimedia 0775 system system
\ No newline at end of file
diff --git a/manifest.xml b/manifest.xml
index f143a42e..14e6b9e1 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -306,4 +306,13 @@
cnd
+
+ vendor.dolby.hardware.dms
+ hwbinder
+ 2.0
+
+ IDms
+ default
+
+
diff --git a/media_codecs.xml b/media_codecs.xml
index 03b6d1dc..d95d50fc 100644
--- a/media_codecs.xml
+++ b/media_codecs.xml
@@ -349,4 +349,5 @@ Only the three quirks included above are recognized at this point:
+
diff --git a/media_codecs_dolby_audio.xml b/media_codecs_dolby_audio.xml
new file mode 100644
index 00000000..1c98a624
--- /dev/null
+++ b/media_codecs_dolby_audio.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 9fb2146d..11c9e385 100755
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -282,6 +282,8 @@
- "/apex/com.android.art/javalib/core-oj.jar"
- "/apex/com.android.art/javalib/core-libart.jar"
- "/system_ext/priv-app/SystemUIGoogle/SystemUIGoogle.apk"
+ - "/system_ext/priv-app/MotoDolbyDax3/MotoDolbyDax3.apk"
+ - "/system_ext/priv-app/daxService/daxService.apk"
- "/system/bin/surfaceflinger"
diff --git a/sepolicy/public/attributes b/sepolicy/public/attributes
new file mode 100644
index 00000000..b9f1b700
--- /dev/null
+++ b/sepolicy/public/attributes
@@ -0,0 +1 @@
+hal_attribute_lineage(dms)
\ No newline at end of file
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 29b739d3..6fcbc3cf 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -281,3 +281,7 @@
# b/70518189 vDSO experiments
/sys/module/vdso/parameters u:object_r:sysfs_vdso:s0
+
+# Dolby
+/data/vendor/dolby(/.*)? u:object_r:vendor_data_file:s0
+/(vendor|system/vendor)/bin/hw/vendor\.dolby\.hardware\.dms@2\.0-service u:object_r:hal_dms_default_exec:s0
diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te
index 8f0079d5..047394a4 100644
--- a/sepolicy/vendor/hal_audio_default.te
+++ b/sepolicy/vendor/hal_audio_default.te
@@ -8,3 +8,6 @@ hal_client_domain(hal_audio_default, hal_power)
userdebug_or_eng(`
allow hal_audio diag_device:chr_file rw_file_perms;
')
+
+allow hal_audio_default hal_dms_hwservice:hwservice_manager find;
+binder_call(hal_audio_default, hal_dms_default)
\ No newline at end of file
diff --git a/sepolicy/vendor/hal_dms.te b/sepolicy/vendor/hal_dms.te
new file mode 100644
index 00000000..7b88a9f7
--- /dev/null
+++ b/sepolicy/vendor/hal_dms.te
@@ -0,0 +1,6 @@
+# HwBinder IPC from client to server, and callbacks
+binder_call(hal_dms_client, hal_dms_server)
+binder_call(hal_dms_server, hal_dms_client)
+
+add_hwservice(hal_dms_server, hal_dms_hwservice)
+allow hal_dms_client hal_dms_hwservice:hwservice_manager find;
\ No newline at end of file
diff --git a/sepolicy/vendor/hal_dms_default.te b/sepolicy/vendor/hal_dms_default.te
new file mode 100644
index 00000000..a409fa9e
--- /dev/null
+++ b/sepolicy/vendor/hal_dms_default.te
@@ -0,0 +1,11 @@
+type hal_dms_default, domain;
+hal_server_domain(hal_dms_default, hal_dms)
+
+type hal_dms_default_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(hal_dms_default)
+
+allow hal_dms_default vendor_data_file:file { rw_file_perms create unlink };
+allow hal_dms_default vendor_data_file:dir { rw_file_perms add_name remove_name };
+binder_call(hal_dms_default, hal_audio_default)
+binder_call(hal_dms_default, platform_app)
+binder_call(hal_dms_default, mediacodec)
\ No newline at end of file
diff --git a/sepolicy/vendor/hwservice.te b/sepolicy/vendor/hwservice.te
index b47d3b4d..ec42c49b 100644
--- a/sepolicy/vendor/hwservice.te
+++ b/sepolicy/vendor/hwservice.te
@@ -4,3 +4,4 @@ type vnd_atcmdfwd_hwservice, hwservice_manager_type, vendor_hwservice_type;
type hal_imsrtp_hwservice, hwservice_manager_type, vendor_hwservice_type;
type nxpnfc_hwservice, hwservice_manager_type, vendor_hwservice_type;
type nxpese_hwservice, hwservice_manager_type, vendor_hwservice_type;
+type hal_dms_hwservice, hwservice_manager_type;
diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts
index 1fc05615..aaca1a36 100644
--- a/sepolicy/vendor/hwservice_contexts
+++ b/sepolicy/vendor/hwservice_contexts
@@ -8,3 +8,4 @@ com.quicinc.cne.api::IApiService u:object_r:hal_c
com.quicinc.cne.server::IServer u:object_r:hal_cne_hwservice:s0
vendor.nxp.nxpnfc::INxpNfc u:object_r:nxpnfc_hwservice:s0
vendor.nxp.nxpese::INxpEse u:object_r:nxpese_hwservice:s0
+vendor.dolby.hardware.dms::IDms u:object_r:hal_dms_hwservice:s0
diff --git a/sepolicy/vendor/mediacodec.te b/sepolicy/vendor/mediacodec.te
index 1c4fe3d4..722862cd 100644
--- a/sepolicy/vendor/mediacodec.te
+++ b/sepolicy/vendor/mediacodec.te
@@ -6,3 +6,6 @@ allow mediacodec system_file:dir r_dir_perms;
userdebug_or_eng(`
allow mediacodec dumpstate:fd use;
')
+
+allow mediacodec hal_dms_hwservice:hwservice_manager find;
+binder_call(mediacodec, hal_dms_default)
\ No newline at end of file
diff --git a/sepolicy/vendor/platform_app.te b/sepolicy/vendor/platform_app.te
index e69de29b..04cdd963 100644
--- a/sepolicy/vendor/platform_app.te
+++ b/sepolicy/vendor/platform_app.te
@@ -0,0 +1,3 @@
+allow platform_app hal_dms_hwservice:hwservice_manager find;
+binder_call(platform_app, hal_dms_default)
+get_prop(platform_app, audio_config_prop)
\ No newline at end of file