Add properties to use vendor audio policy, and to disable audio effects

This commit is contained in:
Pierre-Hugues Husson 2020-05-03 18:05:30 +02:00 committed by tboy1991
parent 23cd1f93b6
commit b8ba68ae2b

View File

@ -52,6 +52,15 @@ xiaomi_toggle_dt2w_event_node() {
return 1
}
restartAudio() {
setprop ctl.restart audioserver
audioHal="$(getprop |sed -nE 's/.*init\.svc\.(.*audio-hal[^]]*).*/\1/p')"
setprop ctl.restart "$audioHal"
setprop ctl.restart vendor.audio-hal-2-0
setprop ctl.restart audio-hal-2-0
}
if [ "$1" == "persist.sys.phh.xiaomi.dt2w" ]; then
if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then
exit 1
@ -90,3 +99,33 @@ if [ "$1" == "persist.sys.phh.oppo.usbotg" ]; then
echo "$prop_value" >/sys/class/power_supply/usb/otg_switch
exit
fi
if [ "$1" == "persist.sys.phh.disable_audio_effects" ];then
if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then
exit 1
fi
if [[ "$prop_value" == 1 ]];then
resetprop ro.audio.ignore_effects true
else
resetprop --delete ro.audio.ignore_effects
fi
restartAudio
exit
fi
if [ "$1" == "persist.sys.phh.caf.audio_policy" ];then
if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then
exit 1
fi
if [[ "$prop_value" == 1 ]];then
umount /vendor/etc/audio
mount /audio_policy_configuration.xml /vendor/etc/audio_policy_configuration.xml
else
umount /vendor/etc/audio_policy_configuration.xml
mount /mnt/phh/empty_dir /vendor/etc/audio
fi
restartAudio
exit
fi