diff --git a/configs/audio/audio_effects.xml b/configs/audio/audio_effects.xml
index 1618c97..85477d1 100644
--- a/configs/audio/audio_effects.xml
+++ b/configs/audio/audio_effects.xml
@@ -46,6 +46,15 @@
+
+
+
+
+
+
+
+
+
@@ -96,6 +105,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/configs/audio/audio_io_policy.conf b/configs/audio/audio_io_policy.conf
index d8413f9..aeb77c0 100644
--- a/configs/audio/audio_io_policy.conf
+++ b/configs/audio/audio_io_policy.conf
@@ -76,7 +76,7 @@ outputs {
}
compress_passthrough {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING|AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH
- formats AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTS_HD|AUDIO_FORMAT_DSD
+ formats AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_E_AC3_JOC|AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTS_HD|AUDIO_FORMAT_DSD
sampling_rates 32000|44100|48000|88200|96000|176400|192000|352800
bit_width 16
app_type 69941
diff --git a/configs/audio/audio_policy_configuration.xml b/configs/audio/audio_policy_configuration.xml
index 79a77a2..6aa4525 100644
--- a/configs/audio/audio_policy_configuration.xml
+++ b/configs/audio/audio_policy_configuration.xml
@@ -145,6 +145,15 @@
+
+
+
@@ -280,12 +289,12 @@
@@ -295,7 +304,7 @@
@@ -389,7 +398,7 @@
-
+
diff --git a/configs/audio/dax-default.xml b/configs/audio/dax-default.xml
new file mode 100644
index 0000000..4177b92
--- /dev/null
+++ b/configs/audio/dax-default.xml
@@ -0,0 +1,1857 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/configs/hidl/manifest.xml b/configs/hidl/manifest.xml
index 62aab9a..fe9bbcc 100644
--- a/configs/hidl/manifest.xml
+++ b/configs/hidl/manifest.xml
@@ -535,4 +535,14 @@
imsrtpservice
+
+ vendor.dolby.hardware.dms
+ hwbinder
+ 2.0
+
+ IDms
+ default
+
+ @2.0::IDms/default
+
diff --git a/device.mk b/device.mk
index 38dda9d..a74357f 100644
--- a/device.mk
+++ b/device.mk
@@ -66,7 +66,8 @@ PRODUCT_PACKAGES += \
libaudioroute.vendor
PRODUCT_COPY_FILES += \
- $(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/audio/,$(TARGET_COPY_OUT_VENDOR)/etc)
+ $(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/audio/,$(TARGET_COPY_OUT_VENDOR)/etc) \
+ $(LOCAL_PATH)/configs/audio/dax-default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/dolby/dax-default.xml
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration_7_0.xml \
@@ -297,12 +298,14 @@ endif
# Media
PRODUCT_PACKAGES += \
- libcodec2_vndk.vendor \
- libcodec2_hidl@1.0.vendor \
libavservices_minijail \
- libavservices_minijail_32 \
libavservices_minijail.vendor \
libavservices_minijail_vendor \
+ libcodec2_hidl@1.0.vendor \
+ libcodec2_soft_common.vendor \
+ libcodec2_vndk.vendor \
+ libsfplugin_ccodec_utils.vendor \
+ libstagefright_foundation-v33 \
vendor.qti.hardware.capabilityconfigstore@1.0.vendor
PRODUCT_COPY_FILES += \
@@ -377,6 +380,10 @@ PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS += \
PRODUCT_PACKAGES += \
NoCutoutOverlay
+# Parts
+PRODUCT_PACKAGES += \
+ XiaomiDolby
+
# Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 7100626..75cb4d2 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -412,6 +412,23 @@ system_ext/lib64/libdpmframework.so|c3d8d6f1745c19d29466e9de823ff56f9f8f6993
system_ext/lib64/libdpmtcm.so|57b6c42d581305d8ef16aa127cd4cd1672d2e7f1
system_ext/priv-app/dpmserviceapp/dpmserviceapp.apk|4d78eda10ef66c3c59b7b4c13afeb2c93de5bddb
+# Dolby
+vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service
+vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc
+vendor/etc/media_codecs_dolby_audio.xml
+vendor/lib/libdapparamstorage.so
+vendor/lib/libdeccfg.so
+vendor/lib/libstagefright_soft_ac4dec.so
+vendor/lib/libstagefright_soft_ddpdec.so
+vendor/lib/soundfx/libswdap.so|810d0e266e4a77f06cba72fe8bdde2e1ede4f9f9
+vendor/lib/soundfx/libswgamedap.so
+vendor/lib/soundfx/libswvqe.so
+vendor/lib/vendor.dolby.hardware.dms@2.0.so
+vendor/lib64/libdapparamstorage.so
+vendor/lib64/libdlbdsservice.so
+vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so
+vendor/lib64/vendor.dolby.hardware.dms@2.0.so
+
# DPM
vendor/bin/dpmQmiMgr
vendor/etc/init/dpmQmiMgr.rc
diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc
index 394965d..215ddd6 100644
--- a/rootdir/etc/init.target.rc
+++ b/rootdir/etc/init.target.rc
@@ -114,6 +114,10 @@ on post-fs-data
chmod 0644 /dev/elliptic0
chmod 0644 /dev/elliptic1
+ # Dolby
+ mkdir /data/vendor/dolby 0770 media media
+ mkdir /data/vendor/multimedia 0775 system system
+
# Enable suspend to RAM
write /sys/power/mem_sleep "deep"
diff --git a/sepolicy/public/attributes b/sepolicy/public/attributes
index 1a0c38a..159111e 100644
--- a/sepolicy/public/attributes
+++ b/sepolicy/public/attributes
@@ -1 +1,2 @@
hal_attribute_lineage(mlipay)
+hal_attribute_lineage(dms)
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 33da33d..6a14cc3 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -10,6 +10,9 @@
# Contexthub
/vendor/bin/hw/android\.hardware\.contexthub@1\.1-service\.generic u:object_r:hal_contexthub_default_exec:s0
+# Data files
+/data/vendor/dolby(/.*)? u:object_r:vendor_data_file:s0
+
# Fingerprint
/dev/goodix_fp u:object_r:fingerprint_device:s0
/data/vendor/goodix(/.*)? u:object_r:fingerprint_data_file:s0
@@ -22,7 +25,8 @@
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.cepheus u:object_r:hal_fingerprint_default_exec:s0
# HALs
-/vendor/bin/hw/android\.hardware\.light-service\.lineage u:object_r:hal_light_default_exec:s0
+/vendor/bin/hw/android\.hardware\.light-service\.lineage u:object_r:hal_light_default_exec:s0
+/vendor/bin/hw/vendor\.dolby\.hardware\.dms@2\.0-service u:object_r:hal_dms_default_exec:s0
# Hexagon DSP-side executable needed for Halide operation
# This is labeled as public_adsprpcd_file as it needs to be read by apps
diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te
index a4af625..d5d7515 100644
--- a/sepolicy/vendor/hal_audio_default.te
+++ b/sepolicy/vendor/hal_audio_default.te
@@ -12,3 +12,7 @@ userdebug_or_eng(`
');
# Ignore in user builds
dontaudit hal_audio_default vendor_diag_device:chr_file rw_file_perms;
+
+# Dolby
+allow hal_audio_default hal_dms_hwservice:hwservice_manager find;
+binder_call(hal_audio_default, hal_dms_default)
diff --git a/sepolicy/vendor/hal_dms.te b/sepolicy/vendor/hal_dms.te
new file mode 100644
index 0000000..6f3b093
--- /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;
diff --git a/sepolicy/vendor/hal_dms_default.te b/sepolicy/vendor/hal_dms_default.te
new file mode 100644
index 0000000..886e3e8
--- /dev/null
+++ b/sepolicy/vendor/hal_dms_default.te
@@ -0,0 +1,10 @@
+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 };
+allow hal_dms_default mediacodec:binder call;
+binder_call(hal_dms_default, hal_audio_default)
+binder_call(hal_dms_default, platform_app)
diff --git a/sepolicy/vendor/hwservice.te b/sepolicy/vendor/hwservice.te
index b741eba..1ca006a 100644
--- a/sepolicy/vendor/hwservice.te
+++ b/sepolicy/vendor/hwservice.te
@@ -12,4 +12,7 @@ type hal_mlipay_hwservice, hwservice_manager_type;
# NXP services
type nxpese_hwservice, hwservice_manager_type;
-type nxpnfc_hwservice, hwservice_manager_type;
\ No newline at end of file
+type nxpnfc_hwservice, hwservice_manager_type;
+
+# Dolby
+type hal_dms_hwservice, hwservice_manager_type;
diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts
index a6030df..824f5e0 100644
--- a/sepolicy/vendor/hwservice_contexts
+++ b/sepolicy/vendor/hwservice_contexts
@@ -4,6 +4,9 @@ vendor.qti.hardware.bt_channel_avoidance::IBTChannelAvoidance u:ob
# Cam postproc
vendor.xiaomi.hardware.campostproc::IMiPostProcService u:object_r:hal_camerapostproc_xiaomi_hwservice:s0
+# Dolby
+vendor.dolby.hardware.dms::IDms u:object_r:hal_dms_hwservice:s0
+
# Fingerprint
vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_xiaomi_fingerprint_hwservice:s0
vendor.xiaomi.hardware.fingerprintextension::IXiaomiFingerprint u:object_r:hal_xiaomi_fingerprint_hwservice:s0
diff --git a/sepolicy/vendor/mediacodec.te b/sepolicy/vendor/mediacodec.te
new file mode 100644
index 0000000..ffd4b3b
--- /dev/null
+++ b/sepolicy/vendor/mediacodec.te
@@ -0,0 +1,5 @@
+allow mediacodec hal_dms_hwservice:hwservice_manager find;
+binder_call(mediacodec, hal_dms_default)
+
+allow mediacodec hal_dms_default:binder { call transfer };
+allow mediacodec hal_dms_server:binder { call transfer };