diff --git a/BoardConfig.mk b/BoardConfig.mk
index 7ba526c2..85151e17 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -70,6 +70,7 @@ BOARD_USES_QCOM_HARDWARE := true
# HIDL
DEVICE_MATRIX_FILE := hardware/qcom-caf/common/compatibility_matrix.xml
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
+ $(DEVICE_PATH)/configs/hidl/device_framework_compatibility_matrix.xml \
hardware/qcom-caf/common/vendor_framework_compatibility_matrix.xml \
hardware/xiaomi/vintf/xiaomi_framework_compatibility_matrix.xml \
vendor/aosp/config/device_framework_matrix.xml
diff --git a/configs/audio/audio_effects.xml b/configs/audio/audio_effects.xml
index 0724ff66..f2077ce1 100644
--- a/configs/audio/audio_effects.xml
+++ b/configs/audio/audio_effects.xml
@@ -74,6 +74,15 @@
+
+
+
+
+
+
+
+
+
@@ -122,6 +131,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/configs/audio/audio_policy_configuration.xml b/configs/audio/audio_policy_configuration.xml
index 0772e03a..8d3fb424 100644
--- a/configs/audio/audio_policy_configuration.xml
+++ b/configs/audio/audio_policy_configuration.xml
@@ -81,9 +81,6 @@
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
-
-
+ sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+
+ vendor.dolby.hardware.dms
+ 2.0
+
+ IDms
+ default
+
+
+
+ android.hardware.media.c2
+ 1.0
+
+ IComponentStore
+ default
+ software
+
+
+
diff --git a/configs/hidl/manifest.xml b/configs/hidl/manifest.xml
index 9e4b3905..8d9cd018 100644
--- a/configs/hidl/manifest.xml
+++ b/configs/hidl/manifest.xml
@@ -29,6 +29,25 @@
@1.0::IBluetoothHci/default
+
+ vendor.dolby.hardware.dms
+ hwbinder
+ 2.0
+
+ IDms
+ default
+
+
+
+ android.hardware.media.c2
+ hwbinder
+ 1.0
+
+ IComponentStore
+ default
+ software
+
+
android.hardware.camera.provider
hwbinder
diff --git a/configs/media/media_codecs_dolby_audio.xml b/configs/media/media_codecs_dolby_audio.xml
new file mode 100644
index 00000000..1c98a624
--- /dev/null
+++ b/configs/media/media_codecs_dolby_audio.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/device.mk b/device.mk
index 5a4af540..fa7ec68e 100644
--- a/device.mk
+++ b/device.mk
@@ -107,7 +107,7 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/audio/mixer_paths_parrot_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/sku_parrot/foursemi/mixer_paths_parrot_qrd.xml \
$(LOCAL_PATH)/configs/audio/mixer_paths_parrot_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/sku_parrot/mixer_paths_parrot_qrd.xml \
$(LOCAL_PATH)/configs/audio/resourcemanager_parrot_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/sku_parrot/resourcemanager_parrot_qrd.xml \
- $(LOCAL_PATH)/configs/audio/resourcemanager_parrot_qrd_foursemi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/sku_parrot/foursemi/resourcemanager_parrot_qrd.xml \
+ $(LOCAL_PATH)/configs/audio/resourcemanager_parrot_qrd_foursemi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio/sku_parrot/foursemi/resourcemanager_parrot_qrd.xml
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
@@ -186,6 +186,18 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
hardware/qcom-caf/sm8450/display/config/snapdragon_color_libs_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/snapdragon_color_libs_config.xml
+# Dolby
+PRODUCT_PACKAGES += \
+ XiaomiDolby
+
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/configs/media/media_codecs_dolby_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_dolby_audio.xml
+
+# Dolby VNDK libs
+PRODUCT_COPY_FILES += \
+ prebuilts/vndk/v33/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefright_foundation-v33.so \
+ prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefright_foundation-v33.so
+
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm@1.4.vendor \
@@ -319,7 +331,8 @@ PRODUCT_PACKAGES += \
# Media
PRODUCT_PACKAGES += \
libcodec2_hidl@1.0.vendor \
- libcodec2_vndk.vendor
+ libcodec2_vndk.vendor \
+ libcodec2_soft_common.vendor
PRODUCT_PACKAGES += \
libavservices_minijail \
@@ -329,7 +342,7 @@ PRODUCT_COPY_FILES += \
$(AUDIO_HAL_DIR)/configs/common/codec2/service/1.0/c2audio.vendor.base-arm.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/c2audio.vendor.base-arm.policy \
$(AUDIO_HAL_DIR)/configs/common/codec2/service/1.0/c2audio.vendor.base-arm64.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/c2audio.vendor.base-arm64.policy \
$(AUDIO_HAL_DIR)/configs/common/codec2/service/1.0/c2audio.vendor.ext-arm.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/c2audio.vendor.ext-arm.policy \
- $(AUDIO_HAL_DIR)/configs/common/codec2/service/1.0/c2audio.vendor.ext-arm64.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/c2audio.vendor.ext-arm64.policy \
+ $(AUDIO_HAL_DIR)/configs/common/codec2/service/1.0/c2audio.vendor.ext-arm64.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/c2audio.vendor.ext-arm64.policy
PRODUCT_COPY_FILES += \
$(AUDIO_HAL_DIR)/configs/common/codec2/media_codecs_c2_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_c2_audio.xml \
diff --git a/extract-files.sh b/extract-files.sh
index 47cfb3ab..6b655e0f 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -77,17 +77,21 @@ function blob_fixup() {
[ "$2" = "" ] && return 0
sed -i 's/on charger/on property:init.svc.vendor.charger=running/g' "${2}"
;;
- vendor/etc/vintf/manifest/c2_manifest_vendor.xml)
- [ "$2" = "" ] && return 0
- sed -ni '/dolby/!p' "${2}"
- ;;
vendor/etc/media_codecs_parrot_v0.xml)
[ "$2" = "" ] && return 0
sed -i -E '/media_codecs_(google_audio|google_c2|google_telephony|vendor_audio)/d' "${2}"
;;
+ vendor/lib64/hw/audio.primary.parrot.so)
+ [ "$2" = "" ] && return 0
+ "${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
+ ;;
vendor/lib64/vendor.libdpmframework.so)
[ "$2" = "" ] && return 0
grep -q "libhidlbase_shim.so" "${2}" || "${PATCHELF}" --add-needed "libhidlbase_shim.so" "${2}"
+ ;;
+ vendor/lib/libstagefright_soft_ddpdec.so|vendor/lib/libstagefrightdolby.so|vendor/lib64/libdlbdsservice.so|vendor/lib64/libstagefright_soft_ddpdec.so|vendor/lib64/libstagefrightdolby.so)
+ [ "$2" = "" ] && return 0
+ grep -q "libstagefright_foundation-v33.so" "${2}" || "${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}"
;;
*)
return 1
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 3661b413..504f7225 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -1470,6 +1470,52 @@ vendor/lib64/vendor.display.color@1.6.so|f9f914003858e641fd19d41676465167e5b2005
vendor/lib64/vendor.display.color@1.7.so|982805fb0f7a68df6a796173d6d3bb24a7dbaa7a
vendor/lib64/vendor.display.postproc@1.0.so|d4698e4d21e0a65611f2e508a841749447c71498
+# Dolby Atmos
+vendor/bin/hw/dolbycodec2
+vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service
+vendor/etc/dolby/dax-default.xml
+vendor/etc/dolby/dax-fs19xx.xml
+vendor/etc/dolby_vision.cfg
+vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc
+vendor/etc/init/vendor.dolby.media.c2@1.0-service.rc
+vendor/lib/c2.dolby.avc.dec.so
+vendor/lib/c2.dolby.avc.sec.dec.so
+vendor/lib/c2.dolby.client.so
+vendor/lib/c2.dolby.egl.so
+vendor/lib/c2.dolby.hevc.dec.so
+vendor/lib/c2.dolby.hevc.enc.so
+vendor/lib/c2.dolby.hevc.sec.dec.so
+vendor/lib/c2.dolby.store.so
+vendor/lib/libdolbyottcameracontrol.so
+vendor/lib/libdolbyvision.so
+vendor/lib/libstagefrightdolby.so
+vendor/lib/libstagefright_soft_ddpdec.so
+vendor/lib/libdeccfg.so
+vendor/lib/android.hardware.media.c2@1.0.so
+vendor/lib/vendor.dolby.hardware.dms@2.0.so
+vendor/lib64/android.hardware.media.c2@1.0.so
+vendor/lib64/soundfx/libhwdap.so
+vendor/lib64/soundfx/libswdap.so
+vendor/lib64/soundfx/libswgamedap.so
+vendor/lib64/soundfx/libswvqe.so
+vendor/lib64/libdlbdsservice.so
+vendor/lib64/libdapparamstorage.so
+vendor/lib64/c2.dolby.avc.dec.so
+vendor/lib64/c2.dolby.avc.sec.dec.so
+vendor/lib64/c2.dolby.client.so
+vendor/lib64/c2.dolby.egl.so
+vendor/lib64/c2.dolby.hevc.dec.so
+vendor/lib64/c2.dolby.hevc.enc.so
+vendor/lib64/c2.dolby.hevc.sec.dec.so
+vendor/lib64/c2.dolby.store.so
+vendor/lib64/libdeccfg.so
+vendor/lib64/libdolbyottcameracontrol.so
+vendor/lib64/libdolbyvision.so
+vendor/lib64/libstagefrightdolby.so
+vendor/lib64/libstagefright_soft_ddpdec.so
+vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so
+vendor/lib64/vendor.dolby.hardware.dms@2.0.so
+
# EMBMS
vendor/bin/embmsslServer
vendor/etc/init/init.embmssl_server.rc
@@ -1798,8 +1844,6 @@ vendor/etc/init/vendor.qti.media.c2@1.0-service.rc
vendor/etc/init/vendor.qti.media.c2audio@1.0-service.rc
vendor/etc/seccomp_policy/codec2.vendor.base-arm64.policy
vendor/etc/seccomp_policy/codec2.vendor.ext-arm64.policy
-vendor/etc/vintf/manifest/c2_manifest_vendor.xml
-vendor/etc/vintf/manifest/c2_manifest_vendor_audio.xml
vendor/lib/libAlacSwDec.so
vendor/lib/libApeSwDec.so
vendor/lib/libEvrcSwCodec.so
diff --git a/props/vendor.prop b/props/vendor.prop
index b2428257..42b1c11e 100644
--- a/props/vendor.prop
+++ b/props/vendor.prop
@@ -17,6 +17,10 @@ ro.config.alarm_vol_steps=15
ro.config.system_vol_steps=15
ro.config.vc_call_vol_steps=11
ro.vendor.audio.camera.loopback.support=false
+ro.vendor.audio.dolby.dax.support=true
+ro.vendor.audio.dolby.eq.half=true
+ro.vendor.audio.dolby.surround.enable=true
+ro.vendor.audio.dolby.vision.support=true
ro.vendor.audio.elus.enable=true
ro.vendor.audio.feature.spatial=7
ro.vendor.audio.gain.support=true
@@ -34,6 +38,9 @@ ro.vendor.audio.soundtrigger.xatx.gmm.user.level=54
ro.vendor.audio.soundtrigger.xatx.vop.level=0
ro.vendor.audio.soundtrigger=sva
ro.vendor.audio.support.sound.id=true
+ro.vendor.dolby.dax.version=DAX3_3.6.1.6_r1
+vendor.audio.dolby.ds2.enabled=false
+vendor.audio.dolby.ds2.hardbypass=false
vendor.audio.adm.buffering.ms=2
vendor.audio.feature.a2dp_offload.enable=true
vendor.audio.feature.afe_proxy.enable=true
@@ -88,6 +95,7 @@ ro.soc.manufacturer=QTI
# Display
ro.vendor.display.sensortype=2
ro.vendor.display.svi=1
+ro.vendor.display.dolbyvision.support=true
vendor.display.comp_mask=0
vendor.display.disable_3d_adaptive_tm=0
vendor.display.disable_excl_rect=0
@@ -160,6 +168,7 @@ ro.hardware.keystore_desede=true
# Media
debug.c2.use_dmabufheaps=1
+debug.config.media.video.dolby_vision_suports=true
debug.stagefright.c2inputsurface=-1
ro.media.xml_variant.profiles=_parrot_v0
diff --git a/sepolicy/vendor/attributes b/sepolicy/vendor/attributes
new file mode 100644
index 00000000..d6fedfa3
--- /dev/null
+++ b/sepolicy/vendor/attributes
@@ -0,0 +1,3 @@
+attribute hal_dms;
+attribute hal_dms_client;
+attribute hal_dms_server;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 1ea723f8..d6867e3e 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -37,10 +37,18 @@
/vendor/lib(64)?/rfsa/adsp/libmialgo_basic_cdsp_skel\.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/rfsa/adsp/libmialgo_slow_motion_cdsp_skel\.so u:object_r:same_process_hal_file:s0
+# Data files
+/data/vendor/dolby(/.*)? u:object_r:vendor_data_file:s0
+
# Displayfeature
/dev/mi_display/disp_feature u:object_r:vendor_displayfeature_device:s0
/sys/devices/virtual/mi_display/disp_feature/disp-DSI-+[0-1](/.*)? u:object_r:vendor_sysfs_displayfeature:s0
+# Dolby
+/vendor/bin/hw/dolbycodec2 u:object_r:mediacodec_exec:s0
+/vendor/bin/hw/vendor.qti.media.c2@1.0-service u:object_r:mediacodec_exec:s0
+/(vendor|system/vendor)/bin/hw/vendor\.dolby\.hardware\.dms@2\.0-service u:object_r:hal_dms_default_exec:s0
+
# Fingerprint
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
/data/vendor/fpc(/.*)? u:object_r:vendor_fingerprint_data_file:s0
diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te
new file mode 100644
index 00000000..230c9bb5
--- /dev/null
+++ b/sepolicy/vendor/hal_audio_default.te
@@ -0,0 +1,2 @@
+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 00000000..84f4fbd6
--- /dev/null
+++ b/sepolicy/vendor/hal_dms.te
@@ -0,0 +1,5 @@
+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 00000000..73b850ea
--- /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 };
+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
new file mode 100644
index 00000000..3ef95d34
--- /dev/null
+++ b/sepolicy/vendor/hwservice.te
@@ -0,0 +1,2 @@
+# Dolby
+type hal_dms_hwservice, hwservice_manager_type;
diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts
index fde869ee..61d47eb0 100644
--- a/sepolicy/vendor/hwservice_contexts
+++ b/sepolicy/vendor/hwservice_contexts
@@ -3,6 +3,9 @@ vendor.xiaomi.hardware.bgservice::IBGService u:object_r:vendor_h
vendor.xiaomi.hardware.campostproc::IMiPostProcService u:object_r:vendor_hal_camerapostproc_xiaomi_hwservice:s0
vendor.xiaomi.hardware.quickcamera::IQuickCameraService u:object_r:hal_quickcamera_hwservice:s0
+# Dolby
+vendor.dolby.hardware.dms::IDms u:object_r:hal_dms_hwservice:s0
+
# Fingerprint
vendor.xiaomi.hardware.fx.tunnel::IMiFxTunnel u:object_r:vendor_hal_fingerprint_hwservice_xiaomi:s0
diff --git a/sepolicy/vendor/mediacodec.te b/sepolicy/vendor/mediacodec.te
new file mode 100644
index 00000000..bf336c1c
--- /dev/null
+++ b/sepolicy/vendor/mediacodec.te
@@ -0,0 +1,2 @@
+allow mediacodec hal_dms_hwservice:hwservice_manager find;
+binder_call(mediacodec, hal_dms_default)
diff --git a/sepolicy/vendor/platform_app.te b/sepolicy/vendor/platform_app.te
new file mode 100644
index 00000000..ae41f509
--- /dev/null
+++ b/sepolicy/vendor/platform_app.te
@@ -0,0 +1,2 @@
+allow platform_app hal_dms_hwservice:hwservice_manager find;
+binder_call(platform_app, hal_dms_default)