main 7a74c71037df cached
55 files
163.9 KB
54.3k tokens
1 requests
Download .txt
Repository: reiryuki/Sound-Enhancement-Sony-Xperia-10-Magisk-Module
Branch: main
Commit: 7a74c71037df
Files: 55
Total size: 163.9 KB

Directory structure:
gitextract_4il4hl4e/

├── .github/
│   └── FUNDING.yml
├── LICENSE
├── META-INF/
│   └── com/
│       └── google/
│           └── android/
│               ├── update-binary
│               └── updater-script
├── README.md
├── acdb.conf
├── action.sh
├── aml.sh
├── cleaner.sh
├── copy.sh
├── customize.sh
├── function.sh
├── module.prop
├── package-dolby.txt
├── package.txt
├── post-fs-data.sh
├── sepolicy.rule
├── service.sh
├── system/
│   ├── bin/
│   │   └── sefx
│   ├── etc/
│   │   ├── default-permissions/
│   │   │   └── default-com.sonyericsson.soundenhancement.xml
│   │   ├── permissions/
│   │   │   ├── com.sonyericsson.idd.xml
│   │   │   ├── com.sonymobile.getmore.api.xml
│   │   │   ├── privapp-com.sonyericsson.soundenhancement.xml
│   │   │   ├── privapp-com.sonymobile.audioutil.xml
│   │   │   ├── semc_audioeffectif.xml
│   │   │   └── sonyaudioeffect.xml
│   │   └── sysconfig/
│   │       ├── config-com.sonyericsson.soundenhancement.xml
│   │       └── config-com.sonymobile.audioutil.xml
│   ├── framework/
│   │   ├── com.sonyericsson.idd_impl.jar
│   │   ├── com.sonymobile.getmore.api.jar
│   │   ├── semc_audioeffectif.jar
│   │   └── sonyaudioeffect.jar
│   ├── priv-app/
│   │   ├── AudioSettings/
│   │   │   └── AudioSettings.apk
│   │   ├── ExtendedAudioService/
│   │   │   └── ExtendedAudioService.apk
│   │   └── SoundEnhancement/
│   │       └── SoundEnhancement.apk
│   └── vendor/
│       └── etc/
│           ├── media_codecs_somc_audio.xml
│           └── sony_effect/
│               └── effect_params.data
├── system.prop
├── system_dolby/
│   ├── etc/
│   │   ├── permissions/
│   │   │   ├── dolby_dax.xml
│   │   │   └── privapp-com.dolby.daxservice.xml
│   │   └── sysconfig/
│   │       ├── config-com.dolby.daxappui.xml
│   │       └── config-com.dolby.daxservice.xml
│   ├── framework/
│   │   └── dolby_dax.jar
│   ├── priv-app/
│   │   ├── DaxUI/
│   │   │   └── DaxUI.apk
│   │   └── daxService/
│   │       └── daxService.apk
│   └── vendor/
│       ├── bin/
│       │   └── hw/
│       │       └── vendor.dolby.hardware.dms@1.0-service
│       └── etc/
│           ├── dolby/
│           │   └── dax-default.xml
│           └── media_codecs_dolby_audio.xml
├── system_dolby_36dB/
│   └── priv-app/
│       └── DaxUI/
│           └── DaxUI.apk
├── uninstall.sh
├── unused/
│   └── vendor/
│       └── etc/
│           ├── init/
│           │   └── vendor.dolby.hardware.dms@1.0-service.rc
│           ├── media_codecs.xml
│           └── selinux/
│               ├── vendor_file_contexts
│               └── vendor_hwservice_contexts
└── update.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: reiryuki # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: reiryuki # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: reiryuki # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: https://www.paypal.me/reiryuki # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2020 Rei Ryuki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: META-INF/com/google/android/update-binary
================================================
#!/sbin/sh

#################
# Initialization
#################

umask 022

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() {
  ui_print "*******************************"
  ui_print " Please install Magisk v20.4+! "
  ui_print "*******************************"
  exit 1
}

#########################
# Load util_functions.sh
#########################

OUTFD=$2
ZIPFILE=$3

mount /data 2>/dev/null

[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
. /data/adb/magisk/util_functions.sh
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk

install_module
exit 0


================================================
FILE: META-INF/com/google/android/updater-script
================================================
#MAGISK


================================================
FILE: README.md
================================================
# Sound Enhancement & Dolby Atmos Sony Xperia 10 Magisk Module

## DISCLAIMER
- Dolby & Sony apps and blobs are owned by Dolby™ and Sony™.
- The MIT license specified here is for the Magisk Module only, not for Dolby nor Sony apps and blobs.

## Descriptions
- Equalizers sound effect ported from Sony Xperia 10 (I4113) and integrated as a Magisk Module for all supported and rooted devices with Magisk
- Global type sound effect
- Dolby Atmos changes/spoofs ro.product.manufacturer to Sony which may break some system apps and features functionality
- Dolby Atmos conflicted with `vendor.dolby.hardware.dms@2.0-service`
- Sound Enhancement doesn't support ACDB Magisk Module because using effect proxy

## Sources
- https://dumps.tadiphone.dev/dumps/sony/i4113 kirin_dsds-user-10-53.1.A.2.2-053001A00020000200894138764-release-keys
- libhscomp_jni.so & libhscomp.so: https://dumps.tadiphone.dev/dumps/sony/akari akari-user-9-TAMA2-2.0.1-191021-1837-1-dev-keys
- system_dolby: https://dumps.tadiphone.dev/dumps/sony/xq-at51 qssi-user-10-58.0.A.3.31-058000A003003102854466984-release-keys
- libhidlbase.so, libhidltransport.so, & libhwbinder.so: CrDroid ROM Android 13
- libutils.so: LineageOS 23 Android 16 BP2A.250605.031.A2 1758630651
- libmagiskpolicy.so: Kitsune Mask R6687BB53

## Screenshots
- https://t.me/androidryukimodsdiscussions/144433

## Requirements
- HIDL audio service
- Sound Enhancement:
  - armeabi-v7a or arm64-v8a architecture
  - 32 bit audio service (this also can be found in 64 bit ROM with 32 bit support, not only 32 bit ROM)
  - Android 10 (SDK 29) and up
  - Magisk or Kitsune Mask or KernelSU or Apatch installed
- Dolby Atmos:
  - arm64-v8a architecture
  - Android 10 (SDK 29) and up
  - Magisk or Kitsune Mask or KernelSU or Apatch installed (Recommended to use Magisk Delta/Kitsune Mask for systemless early init mount manifest.xml if your ROM is Read-Only https://t.me/ryukinotes/49)

## WARNING!!!
- Possibility of bootloop or even softbrick or a service failure on Read-Only ROM with the Dolby Atmos if you don't use Magisk Delta/Kitsune Mask.

## Installation Guide & Download Link
- Recommended to use Magisk Delta/Kitsune Mask if Dolby Atmos is activated https://t.me/ryukinotes/49
- Remove any other else Dolby MAGISK MODULE with different name (no need to remove if it's the same name) if Dolby Atmos is activated
- Reboot
- If you are using KernelSU, you need to disable Unmount Modules by Default in KernelSU app settings and install https://github.com/KernelSU-Modules-Repo/meta-overlayfs first
- If you have Dolby in-built in your ROM, then you need to activate data.cleanup=1 at the first time install (READ Optionals bellow!)
- Install this module https://www.pling.com/p/1531791/ via Magisk app or Kitsune Mask app or KernelSU app or Apatch app or Recovery if Magisk or Kitsune Mask installed
- Install AML Magisk Module https://t.me/ryukinotes/34 only if using any other else audio mod module
- Reboot
- Disable the "No active profiles" notification and ignore it it's nothing
- If you are using KernelSU, you need to allow superuser list manually all package name listed in package-dolby.txt (and your home launcher app also) (enable show system apps) and reboot afterwards
- If you are using SUList, you need to allow list manually your home launcher app (enable show system apps) and reboot afterwards
- If you have sensors issue (fingerprint, proximity, gyroscope, etc), then READ Optionals bellow!
- If Sound Enhancement effect doesn't work, then type:

  `su`
  
  `sefx`
  
  at Terminal/Termux app while playing music
- If sefx command triggers integrity failure in your ROM then you can use Xperia Music instead: https://github.com/reiryuki/Xperia-Music-Magisk-Module and choose Sound effects in the app

## Optionals
- https://t.me/ryukinotes/56
- Global: https://t.me/ryukinotes/35
- Stream: https://t.me/ryukinotes/52

## Troubleshootings
- https://t.me/ryukinotes/56
- Global: https://t.me/ryukinotes/34

## Support & Bug Report
- https://t.me/ryukinotes/54
- If you don't do above, issues will be closed immediately

## Credits and Contributors
- @HuskyDG
- https://t.me/viperatmos
- https://t.me/androidryukimodsdiscussions
- @HELLBOY017
- You can contribute ideas about this Magisk Module here: https://t.me/androidappsportdevelopment

## Sponsors
- https://t.me/ryukinotes/25




================================================
FILE: acdb.conf
================================================

# Audio Configuration Database
# gh


# acdb.conf is a module configuration file sourced by the ACDB module to add or remove the configuration of libraries and effects included in this module - determined by the status of a Magisk module being installed, disabled, or enabled.


# Simply insert the appropriate value for the required parameters below for consistent results:


# Required:

libraryid=dap_mod
libraryname=libswdap.so

effectid=dap_mod
effectuuid=9d4921da-8225-4f29-aefa-39537a04bcaa


# Optional:

musicstream=



================================================
FILE: action.sh
================================================
MODPATH=${0%/*}

# info
echo "- Apps caches from this module will be re-cleaned"
echo "  at the next boot."
echo " "

# rename
FILE=$MODPATH/cleaner.sh
if [ -f $FILE.txt ]; then
  mv -f $FILE.txt $FILE
fi




================================================
FILE: aml.sh
================================================
[ ! "$MODPATH" ] && MODPATH=${0%/*}

# destination
[ ! "$libdir" ] && libdir=/vendor
MODAECS=`find $MODPATH -type f -name *audio*effects*.conf`
MODAEXS=`find $MODPATH -type f -name *audio*effects*.xml`
MODAPS=`find $MODPATH -type f -name *policy*.conf -o -name *policy*.xml`
MODAPXS=`find $MODPATH -type f -name *policy*.xml`

# function
archdir() {
if [ -f $libdir/lib/soundfx/$LIB ]\
|| [ -f $MODPATH/system$libdir/lib/soundfx/$LIB ]\
|| [ -f $MODPATH$libdir/lib/soundfx/$LIB ]; then
  ARCHDIR=/lib
elif [ -f $libdir/lib64/soundfx/$LIB ]\
|| [ -f $MODPATH/system$libdir/lib64/soundfx/$LIB ]\
|| [ -f $MODPATH$libdir/lib64/soundfx/$LIB ]; then
  ARCHDIR=/lib64
else
  unset ARCHDIR
fi
}
remove_conf() {
for RMV in $RMVS; do
  sed -i "s|$RMV|removed|g" $MODAEC
done
sed -i 's|path /vendor/lib/soundfx/removed||g' $MODAEC
sed -i 's|path /system/lib/soundfx/removed||g' $MODAEC
sed -i 's|path /vendor/lib/removed||g' $MODAEC
sed -i 's|path /system/lib/removed||g' $MODAEC
sed -i 's|path /vendor/lib64/soundfx/removed||g' $MODAEC
sed -i 's|path /system/lib64/soundfx/removed||g' $MODAEC
sed -i 's|path /vendor/lib64/removed||g' $MODAEC
sed -i 's|path /system/lib64/removed||g' $MODAEC
sed -i 's|library removed||g' $MODAEC
sed -i 's|uuid removed||g' $MODAEC
sed -i "/^        removed {/ {;N s/        removed {\n        }//}" $MODAEC
sed -i 's|removed { }||g' $MODAEC
sed -i 's|removed {}||g' $MODAEC
sed -i '/^[[:space:]]*$/d' $MODAEC
}
remove_xml() {
for RMV in $RMVS; do
  sed -i "s|\"$RMV\"|\"removed\"|g" $MODAEX
done
sed -i 's|<library name="removed" path="removed"/>||g' $MODAEX
sed -i 's|<library name="proxy" path="removed"/>||g' $MODAEX
sed -i 's|<effect name="removed" library="removed" uuid="removed"/>||g' $MODAEX
sed -i 's|<effect name="removed" uuid="removed" library="removed"/>||g' $MODAEX
sed -i 's|<libsw library="removed" uuid="removed"/>||g' $MODAEX
sed -i 's|<libhw library="removed" uuid="removed"/>||g' $MODAEX
sed -i 's|<apply effect="removed"/>||g' $MODAEX
sed -i 's|<library name="removed" path="removed" />||g' $MODAEX
sed -i 's|<library name="proxy" path="removed" />||g' $MODAEX
sed -i 's|<effect name="removed" library="removed" uuid="removed" />||g' $MODAEX
sed -i 's|<effect name="removed" uuid="removed" library="removed" />||g' $MODAEX
sed -i 's|<libsw library="removed" uuid="removed" />||g' $MODAEX
sed -i 's|<libhw library="removed" uuid="removed" />||g' $MODAEX
sed -i 's|<apply effect="removed" />||g' $MODAEX
sed -i '/^[[:space:]]*$/d' $MODAEX
}

# store
RMVS="ring_helper alarm_helper music_helper voice_helper
      notification_helper ma_ring_helper ma_alarm_helper
      ma_music_helper ma_voice_helper ma_system_helper
      ma_notification_helper sa3d fens lmfv dirac dtsaudio
      dlb_music_listener dlb_ring_listener dlb_alarm_listener
      dlb_system_listener dlb_notification_listener"

# setup audio effects conf
for MODAEC in $MODAECS; do
  for RMV in $RMVS; do
    sed -i "/^        $RMV {/ {;N s/        $RMV {\n        }//}" $MODAEC
    sed -i "s|$RMV { }||g" $MODAEC
    sed -i "s|$RMV {}||g" $MODAEC
  done
  if ! grep -q '^output_session_processing {' $MODAEC; then
    sed -i '$a\
\
output_session_processing {\
    music {\
    }\
    ring {\
    }\
    alarm {\
    }\
    system {\
    }\
    voice_call {\
    }\
    notification {\
    }\
    bluetooth_sco {\
    }\
    dtmf {\
    }\
    enforced_audible {\
    }\
    accessibility {\
    }\
    tts {\
    }\
    assistant {\
    }\
    call_assistant {\
    }\
    patch {\
    }\
    rerouting {\
    }\
}\' $MODAEC
  else
    if ! grep -q '^    rerouting {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    rerouting {\n    }" $MODAEC
    fi
    if ! grep -q '^    patch {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    patch {\n    }" $MODAEC
    fi
    if ! grep -q '^    call_assistant {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    call_assistant {\n    }" $MODAEC
    fi
    if ! grep -q '^    assistant {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    assistant {\n    }" $MODAEC
    fi
    if ! grep -q '^    tts {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    tts {\n    }" $MODAEC
    fi
    if ! grep -q '^    accessibility {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    accessibility {\n    }" $MODAEC
    fi
    if ! grep -q '^    enforced_audible {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    enforced_audible {\n    }" $MODAEC
    fi
    if ! grep -q '^    dtmf {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    dtmf {\n    }" $MODAEC
    fi
    if ! grep -q '^    bluetooth_sco {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    bluetooth_sco {\n    }" $MODAEC
    fi
    if ! grep -q '^    notification {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    notification {\n    }" $MODAEC
    fi
    if ! grep -q '^    voice_call {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    voice_call {\n    }" $MODAEC
    fi
    if ! grep -q '^    system {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    system {\n    }" $MODAEC
    fi
    if ! grep -q '^    alarm {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    alarm {\n    }" $MODAEC
    fi
    if ! grep -q '^    ring {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    ring {\n    }" $MODAEC
    fi
    if ! grep -q '^    music {' $MODAEC; then
      sed -i "/^output_session_processing {/a\    music {\n    }" $MODAEC
    fi
  fi
done

# setup audio effects xml
for MODAEX in $MODAEXS; do
  for RMV in $RMVS; do
    sed -i "s|<apply effect=\"$RMV\"/>||g" $MODAEX
    sed -i "s|<apply effect=\"$RMV\" />||g" $MODAEX
  done
  if ! grep -q '<postprocess>' $MODAEX\
  || grep -q 'Audio post processor configurations' $MODAEX; then
    sed -i '/<\/effects>/a\
    <postprocess>\
        <stream type="music">\
        <\/stream>\
        <stream type="ring">\
        <\/stream>\
        <stream type="alarm">\
        <\/stream>\
        <stream type="system">\
        <\/stream>\
        <stream type="voice_call">\
        <\/stream>\
        <stream type="notification">\
        <\/stream>\
        <stream type="bluetooth_sco">\
        <\/stream>\
        <stream type="dtmf">\
        <\/stream>\
        <stream type="enforced_audible">\
        <\/stream>\
        <stream type="accessibility">\
        <\/stream>\
        <stream type="tts">\
        <\/stream>\
        <stream type="assistant">\
        <\/stream>\
        <stream type="call_assistant">\
        <\/stream>\
        <stream type="patch">\
        <\/stream>\
        <stream type="rerouting">\
        <\/stream>\
    <\/postprocess>' $MODAEX
  else
    if ! grep -q '<stream type="rerouting">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"rerouting\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="patch">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"patch\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="call_assistant">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"call_assistant\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="assistant">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"assistant\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="tts">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"tts\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="accessibility">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"accessibility\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="enforced_audible">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"enforced_audible\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="dtmf">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"dtmf\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="bluetooth_sco">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"bluetooth_sco\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="notification">' $MODAEX\
    || grep -q '<!-- YunMang.Xiao@PSW.MM.Dolby' $MODAEX\
    || grep -q '<!-- WuHao@MULTIMEDIA.AUDIOSERVER.EFFECT' $MODAEX\
    || grep -q '<!-- heaton.zhong' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"notification\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="voice_call">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"voice_call\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="system">' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"system\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="alarm">' $MODAEX\
    || grep -q '<!-- YunMang.Xiao@PSW.MM.Dolby' $MODAEX\
    || grep -q '<!-- WuHao@MULTIMEDIA.AUDIOSERVER.EFFECT' $MODAEX\
    || grep -q '<!-- heaton.zhong' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"alarm\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="ring">' $MODAEX\
    || grep -q '<!-- YunMang.Xiao@PSW.MM.Dolby' $MODAEX\
    || grep -q '<!-- WuHao@MULTIMEDIA.AUDIOSERVER.EFFECT' $MODAEX\
    || grep -q '<!-- heaton.zhong' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"ring\">\n        <\/stream>" $MODAEX
    fi
    if ! grep -q '<stream type="music">' $MODAEX\
    || grep -q '<!-- YunMang.Xiao@PSW.MM.Dolby' $MODAEX\
    || grep -q '<!-- WuHao@MULTIMEDIA.AUDIOSERVER.EFFECT' $MODAEX\
    || grep -q '<!-- heaton.zhong' $MODAEX; then
      sed -i "/<postprocess>/a\        <stream type=\"music\">\n        <\/stream>" $MODAEX
    fi
  fi
  sed -i 's|Audio post processor configurations|Ryuki Mod Edit|g' $MODAEX
  sed -i 's|YunMang.Xiao@PSW.MM.Dolby|Ryuki Mod Edit|g' $MODAEX
  sed -i 's|WuHao@MULTIMEDIA.AUDIOSERVER.EFFECT|Ryuki Mod Edit|g' $MODAEX
  sed -i 's|heaton.zhong|Ryuki Mod Edit|g' $MODAEX
done

# function
sound_enhancement() {
LIB=libsonysweffect.so
LIBHW=libsonypostprocbundle.so
LIBNAME=sonyeffect_sw
LIBNAMEHW=sonyeffect_hw
NAME=sonyeffect
UUID=50786e95-da76-4557-976b-7981bdf6feb9
UUIDHW=f9ed8ae0-1b9c-11e4-8900-0002a5d5c51b
UUIDPROXY=af8da7e0-2ca1-11e3-b71d-0002a5d5c51b
RMVS="$LIB $LIBHW $LIBNAME $LIBNAMEHW $NAME $UUID
      $UUIDHW $UUIDPROXY libeffectproxy.so"
archdir
if [ "$ARCHDIR" ]; then
  for MODAEC in $MODAECS; do
    remove_conf
    sed -i "/^libraries {/a\  proxy {\n    path \\$libdir\\$ARCHDIR\/soundfx\/libeffectproxy.so\n  }" $MODAEC
    sed -i "/^libraries {/a\  $LIBNAMEHW {\n    path \\$libdir\\$ARCHDIR\/soundfx\/$LIBHW\n  }" $MODAEC
    sed -i "/^libraries {/a\  $LIBNAME {\n    path \\$libdir\\$ARCHDIR\/soundfx\/$LIB\n  }" $MODAEC
    sed -i "/^effects {/a\  $NAME {\n    library proxy\n    uuid $UUIDPROXY\n  }" $MODAEC
    sed -i "/^    uuid $UUIDPROXY/a\    libhw {\n      library $LIBNAMEHW\n      uuid $UUIDHW\n    }" $MODAEC
    sed -i "/^    uuid $UUIDPROXY/a\    libsw {\n      library $LIBNAME\n      uuid $UUID\n    }" $MODAEC
  done
  for MODAEX in $MODAEXS; do
    remove_xml
    sed -i "/<libraries>/a\        <library name=\"proxy\" path=\"libeffectproxy.so\"\/>" $MODAEX
    sed -i "/<libraries>/a\        <library name=\"$LIBNAMEHW\" path=\"$LIBHW\"\/>" $MODAEX
    sed -i "/<libraries>/a\        <library name=\"$LIBNAME\" path=\"$LIB\"\/>" $MODAEX
    sed -i "/<effects>/a\        <\/effectProxy>" $MODAEX
    sed -i "/<effects>/a\            <libhw library=\"$LIBNAMEHW\" uuid=\"$UUIDHW\"\/>" $MODAEX
    sed -i "/<effects>/a\            <libsw library=\"$LIBNAME\" uuid=\"$UUID\"\/>" $MODAEX
    sed -i "/<effects>/a\        <effectProxy name=\"$NAME\" library=\"proxy\" uuid=\"$UUIDPROXY\">" $MODAEX
  done
fi
}
dolby_atmos() {
LIB=libswdap.so
LIBNAME=dap
LIBNAME=dap_mod
NAME=dap
NAME=dap_mod
UUID=9d4921da-8225-4f29-aefa-39537a04bcaa
RMVS="$LIB $LIBNAME $NAME $UUID"
archdir
if [ "$ARCHDIR" ]; then
  for MODAEC in $MODAECS; do
    remove_conf
    sed -i "/^libraries {/a\  $LIBNAME {\n    path \\$libdir\\$ARCHDIR\/soundfx\/$LIB\n  }" $MODAEC
    sed -i "/^effects {/a\  $NAME {\n    library $LIBNAME\n    uuid $UUID\n  }" $MODAEC
#m    sed -i "/^    music {/a\        $NAME {\n        }" $MODAEC
#r    sed -i "/^    ring {/a\        $NAME {\n        }" $MODAEC
#a    sed -i "/^    alarm {/a\        $NAME {\n        }" $MODAEC
#s    sed -i "/^    system {/a\        $NAME {\n        }" $MODAEC
#v    sed -i "/^    voice_call {/a\        $NAME {\n        }" $MODAEC
#n    sed -i "/^    notification {/a\        $NAME {\n        }" $MODAEC
#b    sed -i "/^    bluetooth_sco {/a\        $NAME {\n        }" $MODAEC
#f    sed -i "/^    dtmf {/a\        $NAME {\n        }" $MODAEC
#e    sed -i "/^    enforced_audible {/a\        $NAME {\n        }" $MODAEC
#y    sed -i "/^    accessibility {/a\        $NAME {\n        }" $MODAEC
#t    sed -i "/^    tts {/a\        $NAME {\n        }" $MODAEC
#i    sed -i "/^    assistant {/a\        $NAME {\n        }" $MODAEC
#c    sed -i "/^    call_assistant {/a\        $NAME {\n        }" $MODAEC
#p    sed -i "/^    patch {/a\        $NAME {\n        }" $MODAEC
#g    sed -i "/^    rerouting {/a\        $NAME {\n        }" $MODAEC
  done
  for MODAEX in $MODAEXS; do
    remove_xml
    sed -i "/<libraries>/a\        <library name=\"$LIBNAME\" path=\"$LIB\"\/>" $MODAEX
    sed -i "/<effects>/a\        <effect name=\"$NAME\" library=\"$LIBNAME\" uuid=\"$UUID\"\/>" $MODAEX
#m    sed -i "/<stream type=\"music\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#r    sed -i "/<stream type=\"ring\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#a    sed -i "/<stream type=\"alarm\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#s    sed -i "/<stream type=\"system\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#v    sed -i "/<stream type=\"voice_call\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#n    sed -i "/<stream type=\"notification\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#b    sed -i "/<stream type=\"bluetooth_sco\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#f    sed -i "/<stream type=\"dtmf\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#e    sed -i "/<stream type=\"enforced_audible\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#y    sed -i "/<stream type=\"accessibility\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#t    sed -i "/<stream type=\"tts\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#i    sed -i "/<stream type=\"assistant\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#c    sed -i "/<stream type=\"call_assistant\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#p    sed -i "/<stream type=\"patch\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
#g    sed -i "/<stream type=\"rerouting\">/a\            <apply effect=\"$NAME\"\/>" $MODAEX
  done
fi
}

# patch audio effects
#hsound_enhancement
#ddolby_atmos

# patch audio policy
for MODAP in $MODAPS; do
  sed -i 's|COMPRESS_OFFLOAD|NONE|g' $MODAP
  sed -i 's|,compressed_offload||g' $MODAP
#u  sed -i 's|RAW|NONE|g' $MODAP
#u  sed -i 's|,raw||g' $MODAP
done

# patch audio policy xml
for MODAPX in $MODAPXS; do
  if ! grep -q 'format="AUDIO_FORMAT_ALAC"' $MODAPX; then
        sed -i '/AUDIO_FORMAT_MP3/i\
                    <profile name="" format="AUDIO_FORMAT_ALAC"\
                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"\
                             channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>' $MODAPX
  fi
done











================================================
FILE: cleaner.sh
================================================
[ ! "$MODPATH" ] && MODPATH=${0%/*}
UID=`id -u`

# run
. $MODPATH/function.sh

# cleaning
remove_cache
PKGS=`cat $MODPATH/package.txt`
#dPKGS=`cat $MODPATH/package-dolby.txt`
for PKG in $PKGS; do
  rm -rf /data/user*/"$UID"/$PKG/cache/*
done







================================================
FILE: copy.sh
================================================
[ ! "$MODPATH" ] && MODPATH=${0%/*}

# function
copy_dir_file() {
  mkdir -p `dirname "$2"`
  cp -af "$1" "$2"
}

# audio file
AUD="*audio*effects*.conf -o -name *audio*effects*.xml -o -name *policy*.conf -o -name *policy*.xml"
rm -f `find $MODPATH -type f -name $AUD`
FILES=`find /system /odm /my_product -type f -name $AUD`
for FILE in $FILES; do
  MODFILE=$MODPATH/system`echo "$FILE" | sed 's|/system||g'`
  copy_dir_file $FILE $MODFILE
done
FILES=`find /vendor -type f -name $AUD`
for FILE in $FILES; do
  MODFILE=$MODPATH$MODSYSTEM$FILE
  copy_dir_file $FILE $MODFILE
done
rm -f `find $MODPATH -type f -name *policy*volume*.xml -o -name *audio*effects*spatializer*.xml -o -name *audio*effects*haptic*.xml`











================================================
FILE: customize.sh
================================================
# space
ui_print " "

# var
UID=`id -u`
[ ! "$UID" ] && UID=0
FIRARCH=`grep_get_prop ro.bionic.arch`
SECARCH=`grep_get_prop ro.bionic.2nd_arch`
ABILIST=`grep_get_prop ro.product.cpu.abilist`
if [ ! "$ABILIST" ]; then
  ABILIST=`grep_get_prop ro.system.product.cpu.abilist`
fi
if [ "$FIRARCH" == arm64 ]\
&& ! echo "$ABILIST" | grep -q arm64-v8a; then
  if [ "$ABILIST" ]; then
    ABILIST="$ABILIST,arm64-v8a"
  else
    ABILIST=arm64-v8a
  fi
fi
if [ "$FIRARCH" == x64 ]\
&& ! echo "$ABILIST" | grep -q x86_64; then
  if [ "$ABILIST" ]; then
    ABILIST="$ABILIST,x86_64"
  else
    ABILIST=x86_64
  fi
fi
if [ "$SECARCH" == arm ]\
&& ! echo "$ABILIST" | grep -q armeabi; then
  if [ "$ABILIST" ]; then
    ABILIST="$ABILIST,armeabi"
  else
    ABILIST=armeabi
  fi
fi
if [ "$SECARCH" == arm ]\
&& ! echo "$ABILIST" | grep -q armeabi-v7a; then
  if [ "$ABILIST" ]; then
    ABILIST="$ABILIST,armeabi-v7a"
  else
    ABILIST=armeabi-v7a
  fi
fi
if [ "$SECARCH" == x86 ]\
&& ! echo "$ABILIST" | grep -q x86; then
  if [ "$ABILIST" ]; then
    ABILIST="$ABILIST,x86"
  else
    ABILIST=x86
  fi
fi
ABILIST32=`grep_get_prop ro.product.cpu.abilist32`
if [ ! "$ABILIST32" ]; then
  ABILIST32=`grep_get_prop ro.system.product.cpu.abilist32`
fi
if [ "$SECARCH" == arm ]\
&& ! echo "$ABILIST32" | grep -q armeabi; then
  if [ "$ABILIST32" ]; then
    ABILIST32="$ABILIST32,armeabi"
  else
    ABILIST32=armeabi
  fi
fi
if [ "$SECARCH" == arm ]\
&& ! echo "$ABILIST32" | grep -q armeabi-v7a; then
  if [ "$ABILIST32" ]; then
    ABILIST32="$ABILIST32,armeabi-v7a"
  else
    ABILIST32=armeabi-v7a
  fi
fi
if [ "$SECARCH" == x86 ]\
&& ! echo "$ABILIST32" | grep -q x86; then
  if [ "$ABILIST32" ]; then
    ABILIST32="$ABILIST32,x86"
  else
    ABILIST32=x86
  fi
fi
if [ ! "$ABILIST32" ]; then
  [ -f /system/lib/libandroid.so ] && ABILIST32=true
fi

# log
if [ "$BOOTMODE" != true ]; then
  FILE=/data/media/"$UID"/$MODID\_recovery.log
  ui_print "- Log will be saved at $FILE"
  exec 2>$FILE
  ui_print " "
fi

# optionals
OPTIONALS=/data/media/"$UID"/optionals.prop
if [ ! -f $OPTIONALS ]; then
  touch $OPTIONALS
fi

# debug
if [ "`grep_prop debug.log $OPTIONALS`" == 1 ]; then
  ui_print "- The install log will contain detailed information"
  set -x
  ui_print " "
fi

# recovery
if [ "$BOOTMODE" != true ]; then
  MODPATH_UPDATE=`echo $MODPATH | sed 's|modules/|modules_update/|g'`
  rm -f $MODPATH/update
  rm -rf $MODPATH_UPDATE
fi

# run
. $MODPATH/function.sh

# info
MODVER=`grep_prop version $MODPATH/module.prop`
MODVERCODE=`grep_prop versionCode $MODPATH/module.prop`
ui_print " ID=$MODID"
ui_print " Version=$MODVER"
ui_print " VersionCode=$MODVERCODE"
if [ "$KSU" == true ]; then
  ui_print " KSUVersion=$KSU_VER"
  ui_print " KSUVersionCode=$KSU_VER_CODE"
  ui_print " KSUKernelVersionCode=$KSU_KERNEL_VER_CODE"
  sed -i 's|#k||g' $MODPATH/post-fs-data.sh
else
  ui_print " MagiskVersion=$MAGISK_VER"
  ui_print " MagiskVersionCode=$MAGISK_VER_CODE"
fi
ui_print " "

# .aml.sh
mv -f $MODPATH/aml.sh $MODPATH/.aml.sh

# sdk
NUM=29
if [ "$API" -lt $NUM ]; then
  ui_print "! Unsupported SDK $API. You have to upgrade your"
  ui_print "  Android version at least SDK $NUM to use this module."
  abort
else
  ui_print "- SDK $API"
  ui_print " "
fi

# recovery
mount_partitions_in_recovery

# dolby
if [ "`grep_prop se.dolby $OPTIONALS`" == 0 ]; then
  DOLBY=false
else
  DOLBY=true
fi

# architecture
if [ "$ABILIST" ]; then
  ui_print "- $ABILIST architecture"
  ui_print " "
fi
NAME=arm64-v8a
NAME2=armeabi-v7a
if ! echo "$ABILIST" | grep -q $NAME; then
  if echo "$ABILIST" | grep -q $NAME2; then
    rm -rf `find $MODPATH/system -type d -name *64*`
    if [ $DOLBY == true ]; then
      ui_print "! Unsupported Dolby Atmos"
      ui_print " "
    fi
    DOLBY=false
  else
    if [ "$BOOTMODE" == true ]; then
      ui_print "! This ROM doesn't support $NAME nor $NAME2 architecture"
    else
      ui_print "! This Recovery doesn't support $NAME nor $NAME2 architecture"
      ui_print "  Try to install via Magisk app instead"
    fi
    abort
  fi
fi
if ! echo "$ABILIST" | grep -q $NAME2; then
  if [ "$BOOTMODE" == true ]; then
    ui_print "! This ROM doesn't support $NAME2 architecture"
  else
    ui_print "! This Recovery doesn't support $NAME2 architecture"
    ui_print "  Try to install via Magisk app instead"
  fi
  ui_print "  Sound Enhancement will not be working"
  if [ $DOLBY == true ]; then
    ui_print "  But you can still use the Dolby Atmos"
  fi
  rm -rf $MODPATH/system*/lib\
   $MODPATH/system*/vendor/lib
  ui_print " "
fi
if ! file /*/bin/hw/*audio* | grep -q 32-bit; then
  ui_print "! Sound Enhancement uses 32 bit audio service only"
  ui_print "  But this ROM uses 64 bit audio service"
  ui_print "  Sound Enhancement will not be working"
  if [ $DOLBY == true ]; then
    ui_print "  But you can still use the Dolby Atmos"
  fi
  ui_print " "
else
  sed -i 's|#h||g' $MODPATH/.aml.sh
fi

# magisk
magisk_setup

# path
SYSTEM=`realpath $MIRROR/system`
VENDOR=`realpath $MIRROR/vendor`
PRODUCT=`realpath $MIRROR/product`
SYSTEM_EXT=`realpath $MIRROR/system_ext`
ODM=`realpath $MIRROR/odm`
MY_PRODUCT=`realpath $MIRROR/my_product`

# create
if [ $DOLBY == true ]; then
  mkdir -p $MODPATH/system_dolby/etc/vintf
  NAMES=vendor.dolby.hardware.dms@2.0-service
  for NAME in $NAMES; do
    if [ -f $VENDOR/bin/hw/$NAME ]; then
      touch $MODPATH/system_dolby/vendor/bin/hw/$NAME
    fi
  done
  if [ -d $ODM/bin/hw ] || [ -d $VENDOR/odm/bin/hw ]; then
    mkdir -p $MODPATH/system_dolby/vendor/odm/bin/hw
  fi
  NAMES="vendor.dolby.hardware.dms@1.0-service
         vendor.dolby.hardware.dms@2.0-service"
  for NAME in $NAMES; do
    if [ -f $ODM/bin/hw/$NAME ]\
    || [ -f $VENDOR/odm/bin/hw/$NAME ]; then
      touch $MODPATH/system_dolby/vendor/odm/bin/hw/$NAME
    fi
  done
fi

# check
if [ $DOLBY == true ]\
&& [ "`grep_prop dolby.mod $OPTIONALS`" == 0 ]; then
  ui_print "- Checking in-built Dolby apps..."
  FILE=`find /system/app /system/priv-app /product/app\
        /product/priv-app /product/preinstall /system_ext/app\
        /system_ext/priv-app /vendor/app /vendor/euclid/product/app\
        -type f -name XiaomyDolby.apk -o -name DolbyManager.apk`
  if [ "$FILE" ]; then
    ui_print "  Detected"
    ui_print "$FILE"
    ui_print "  You need to remove dolby.mod=0 to use the Dolby Atmos,"
    ui_print "  otherwise the Dolby Atmos will not work."
  fi
  ui_print " "
  FILE=/bin/hw/vendor.dolby.media.c2@1.0-service
  if [ -f $SYSTEM$FILE ] || [ -f $VENDOR$FILE ]\
  || [ -f $ODM$FILE ] || [ -f $SYSTEM_EXT$FILE ]\
  || [ -f $PRODUCT$FILE ]; then
    ui_print "! Dolby Atmos maybe conflicting with your"
    ui_print "  $FILE"
    ui_print "  If your device internal storage mount failure,"
    ui_print "  you need to remove dolby.mod=0 to fix that."
    ui_print " "
  fi
fi

# function
check_function() {
if [ -f $MODPATH/system_support$DIR/$LIB ]; then
  ui_print "- Checking"
  ui_print "$NAME"
  ui_print "  function at"
  ui_print "$FILE"
  ui_print "  Please wait..."
  if ! grep -q $NAME $FILE; then
    ui_print "  Function not found."
    ui_print "  Replaces /system$DIR/$LIB systemlessly."
    mv -f $MODPATH/system_support$DIR/$LIB $MODPATH/system$DIR
    [ "$MES" ] && ui_print "$MES"
  fi
  ui_print " "
fi
}
find_file() {
for LIB in $LIBS; do
  if [ -f $MODPATH/system_support$DIR/$LIB ]; then
    FILE=`find $SYSTEM$DIR $SYSTEM_EXT$DIR -type f -name $LIB`
    if [ ! "$FILE" ]; then
      ui_print "- Using /system$DIR/$LIB."
      mv -f $MODPATH/system_support$DIR/$LIB $MODPATH/system$DIR
      ui_print " "
    fi
  fi
done
}

# check
if [ $DOLBY == true ]; then
  ui_print "- Activating Dolby Atmos..."
  ui_print " "
  NAME=_ZN7android8hardware23getOrCreateCachedBinderEPNS_4hidl4base4V1_05IBaseE
  DES=vendor.dolby.hardware.dms@1.0.so
  LIB=libhidlbase.so
  if [ "$IS64BIT" == true ]; then
    DIR=/lib64
    LISTS=`strings $MODPATH/system_dolby/vendor$DIR/$DES | grep ^lib | grep .so`
    FILE=`for LIST in $LISTS; do echo $SYSTEM$DIR/$LIST; done`
    check_function
  fi
  if [ "$ABILIST32" ]; then
    DIR=/lib
    LISTS=`strings $MODPATH/system_dolby/vendor$DIR/$DES | grep ^lib | grep .so`
    FILE=`for LIST in $LISTS; do echo $SYSTEM$DIR/$LIST; done`
    check_function
  fi
  NAME=_ZN7android8String16aSEOS0_
  DES=libhidlbase.so
  LIB=libutils.so
  if [ "$IS64BIT" == true ]; then
    DIR=/lib64
    if [ -f $MODPATH/system$DIR/$DES ]; then
      LISTS=`strings $MODPATH/system$DIR/$DES | grep ^lib | grep .so\
             | sed "s|$DES||g"`
      FILE=`for LIST in $LISTS; do echo $SYSTEM$DIR/$LIST; done`
      check_function
    fi
  fi
  if [ "$ABILIST32" ]; then
    DIR=/lib
    if [ -f $MODPATH/system$DIR/$DES ]; then
      LISTS=`strings $MODPATH/system$DIR/$DES | grep ^lib | grep .so\
             | sed "s|$DES||g"`
      FILE=`for LIST in $LISTS; do echo $SYSTEM$DIR/$LIST; done`
      check_function
    fi
  fi
  MODNAME2='Sound Enhancement and Dolby Atmos Sony Xperia 10'
  sed -i "s|$MODNAME|$MODNAME2|g" $MODPATH/module.prop
  MODNAME=$MODNAME2
  sed -i 's|#d||g' $MODPATH/.aml.sh
  sed -i 's|#d||g' $MODPATH/*.sh
  cp -rf $MODPATH/system_dolby/* $MODPATH/system
fi

# check
if [ $DOLBY == true ]; then
  LIBS="libhidltransport.so libhwbinder.so"
  if [ "$IS64BIT" == true ]; then
    DIR=/lib64
    find_file
  fi
  if [ "$ABILIST32" ]; then
    DIR=/lib
    find_file
  fi
fi

# sepolicy
FILE=$MODPATH/sepolicy.rule
DES=$MODPATH/sepolicy.pfsd
if [ "`grep_prop sepolicy.sh $OPTIONALS`" == 1 ]\
&& [ -f $FILE ]; then
  mv -f $FILE $DES
fi

# mod ui
MOD_UI=false
if [ "`grep_prop mod.ui $OPTIONALS`" == 1 ]; then
  APP=SoundEnhancement
  FILE=/data/media/"$UID"/$APP.apk
  DIR=`find $MODPATH/system -type d -name $APP`
  ui_print "- Using modified UI apk..."
  if [ -f $FILE ]; then
    cp -f $FILE $DIR
    chmod 0644 $DIR/$APP.apk
    ui_print "  Applied"
    MOD_UI=true
  else
    ui_print "  ! There is no $FILE file."
    ui_print "    Please place the apk to your internal storage first"
    ui_print "    and reflash!"
  fi
  ui_print " "
fi

# cleaning
ui_print "- Cleaning..."
if [ $DOLBY == true ]; then
  PKGS=`cat $MODPATH/package-dolby.txt`
  if [ "`grep_prop dolby.mod $OPTIONALS`" == 0 ]; then
    rm -f /data/vendor/dolby/dax_sqlite3.db
  else
    rm -f /data/vendor/dolby/dap_sqlite3.db
    sed -i 's|dax_sqlite3.db|dap_sqlite3.db|g' $MODPATH/uninstall.sh
  fi
else
  PKGS=`cat $MODPATH/package.txt`
fi
if [ "$BOOTMODE" == true ]; then
  for PKG in $PKGS; do
    FILE=`find /data/app -name *$PKG*`
    if [ "$FILE" ]; then
      RES=`pm uninstall $PKG 2>/dev/null`
    fi
  done
fi
rm -rf $MODPATH/system_dolby\
 $MODPATH/system_support\
 $MODPATH/unused
remove_sepolicy_rule
ui_print " "
# power save
#FILE=$MODPATH/system/etc/sysconfig/*
#if [ "`grep_prop power.save $OPTIONALS`" == 1 ]; then
#  ui_print "- $MODNAME will not be allowed in power save."
#  ui_print "  It may save your battery but decreasing $MODNAME performance."
#  for PKG in $PKGS; do
#    sed -i "s|<allow-in-power-save package=\"$PKG\"/>||g" $FILE
#    sed -i "s|<allow-in-power-save package=\"$PKG\" />||g" $FILE
#  done
#  ui_print " "
#fi

# function
conflict() {
for NAME in $NAMES; do
  DIR=/data/adb/modules_update/$NAME
  if [ -f $DIR/uninstall.sh ]; then
    sh $DIR/uninstall.sh
  fi
  rm -rf $DIR
  DIR=/data/adb/modules/$NAME
  rm -f $DIR/update
  touch $DIR/remove
  FILE=/data/adb/modules/$NAME/uninstall.sh
  if [ -f $FILE ]; then
    sh $FILE
    rm -f $FILE
  fi
  rm -rf /metadata/magisk/$NAME\
   /mnt/vendor/persist/magisk/$NAME\
   /persist/magisk/$NAME\
   /data/unencrypted/magisk/$NAME\
   /cache/magisk/$NAME\
   /cust/magisk/$NAME
done
}

# conflict
if [ $DOLBY == true ]; then
  if [ "`grep_prop dolby.mod $OPTIONALS`" == 0 ]; then
    NAMES="dolbyatmos DolbyAtmos DolbyAudio MotoDolby
           dsplus Dolby"
  else
    NAMES="dolbyatmos DolbyAtmos DolbyAudio MotoDolby"
  fi
  conflict
  NAMES=MiSound
  FILE=/data/adb/modules/$NAMES/module.prop
  if grep -q 'and Dolby Atmos' $FILE; then
    conflict
  fi
  NAMES=DolbyAtmosSpatialSound
  FILE=/data/adb/modules/$NAMES/module.prop
  if grep -q 'Dolby Atmos and' $FILE; then
    conflict
  fi
fi

# function
cleanup() {
if [ -f $DIR/uninstall.sh ]; then
  sh $DIR/uninstall.sh
fi
DIR=/data/adb/modules_update/$MODID
if [ -f $DIR/uninstall.sh ]; then
  sh $DIR/uninstall.sh
fi
}

# cleanup
DIR=/data/adb/modules/$MODID
FILE=$DIR/module.prop
PREVMODNAME=`grep_prop name $FILE`
if [ "`grep_prop data.cleanup $OPTIONALS`" == 1 ]; then
  sed -i 's|^data.cleanup=1|data.cleanup=0|g' $OPTIONALS
  ui_print "- Cleaning-up $MODID data..."
  cleanup
  ui_print " "
elif [ -d $DIR ]\
&& [ "$PREVMODNAME" != "$MODNAME" ]; then
  ui_print "- Different module name is detected"
  ui_print "  Cleaning-up $MODID data..."
  cleanup
  ui_print " "
fi

# function
permissive_2() {
sed -i 's|#2||g' $MODPATH/post-fs-data.sh
}
permissive() {
FILE=/sys/fs/selinux/enforce
FILE2=/sys/fs/selinux/policy
if [ "`toybox cat $FILE`" = 1 ]; then
  chmod 640 $FILE
  chmod 440 $FILE2
  echo 0 > $FILE
  if [ "`toybox cat $FILE`" = 1 ]; then
    ui_print "  Your device can't be turned to Permissive state."
    ui_print "  Using Magisk Permissive mode instead."
    permissive_2
  else
    echo 1 > $FILE
    sed -i 's|#1||g' $MODPATH/post-fs-data.sh
  fi
else
  sed -i 's|#1||g' $MODPATH/post-fs-data.sh
fi
}
backup() {
if [ ! -f $FILE.orig ] && [ ! -f $FILE.bak ]; then
  ui_print "- Checking free space..."
  SIZE=`du $FILE | sed "s|$FILE||g"`
  SIZE=$(( $SIZE + 1 ))
  INFO=`df $FILE`
  FREE=`echo "$INFO" | awk 'NR==3{print $3}'`
  if [ ! "$FREE" ]; then
    FREE=`echo "$INFO" | awk 'NR==2{print $4}'`
  fi
  ui_print "$INFO"
  ui_print "  Free space = $FREE KiB"
  ui_print "  Free space required = $SIZE KiB"
  ui_print " "
  if [ "$FREE" -ge "$SIZE" ]; then
    cp -af $FILE $FILE.orig
    if [ -f $FILE.orig ]; then
      ui_print "- Created"
      ui_print "$FILE.orig"
      ui_print "  This file will not be restored automatically even you"
      ui_print "  have uninstalled this module."
    else
      ui_print "- Failed to create"
      ui_print "$FILE.orig"
      ui_print "  The partition is Read-Only"
    fi
    ui_print " "
  fi
fi
}
patch_manifest() {
if [ "$MIRROR" ]\
&& ! grep -q " $MIRROR" /proc/mounts; then
  FILE=`echo $FILE | sed -e "s|$MIRROR||g" -e 's|/system_root||g'`
fi
if [ -f $FILE ]; then
  backup
  if [ -f $FILE.orig ] || [ -f $FILE.bak ]; then
    ui_print "- Patching"
    ui_print "$FILE"
    ui_print "  directly..."
    sed -i '/<manifest/a\
    <hal format="hidl">\
        <name>vendor.dolby.hardware.dms</name>\
        <transport>hwbinder</transport>\
        <fqname>@1.0::IDms/default</fqname>\
    </hal>' $FILE
    ui_print " "
  fi
fi
}
eim_dir_warning() {
ui_print "! It seems Magisk early init mount directory is not"
ui_print "  activated yet. Please reinstall Magisk via Magisk app"
ui_print "  (not via Recovery)."
ui_print " "
}
early_init_mount_dir() {
if echo $MAGISK_VER | grep -Eq 'delta|kitsune'\
&& [ "`grep_prop dolby.skip.early $OPTIONALS`" != 1 ]; then
  check_data
  get_flags > /dev/null 2>&1
  if [ "$BOOTMODE" == true ]; then
    if [ "$MAGISK_VER_CODE" -ge 26000 ]; then
      PREINITDEVICE=`grep_prop PREINITDEVICE $INTERNALDIR/config`
      if [ ! "$PREINITDEVICE" ]; then
        eim_dir_warning
      fi
    fi
    if [ -L $MIRROR/early-mount ]; then
      EIMDIR=`readlink $MIRROR/early-mount`
      [ "${EIMDIR:0:1}" != "/" ] && EIMDIR="$MIRROR/$EIMDIR"
    fi
  fi
  if [ ! "$EIMDIR" ]; then
    if ! $ISENCRYPTED; then
      EIMDIR=/data/adb/early-mount.d
    elif [ -d /data/unencrypted ]\
    && ! grep ' /data ' /proc/mounts | grep -q dm-\
    && grep ' /data ' /proc/mounts | grep -q ext4; then
      EIMDIR=/data/unencrypted/early-mount.d
    elif grep ' /cache ' /proc/mounts | grep -q ext4; then
      EIMDIR=/cache/early-mount.d
    elif grep ' /metadata ' /proc/mounts | grep -q ext4; then
      EIMDIR=/metadata/early-mount.d
    elif grep ' /persist ' /proc/mounts | grep -q ext4; then
      EIMDIR=/persist/early-mount.d
    elif grep ' /mnt/vendor/persist ' /proc/mounts | grep -q ext4; then
      EIMDIR=/mnt/vendor/persist/early-mount.d
    elif grep ' /cust ' /proc/mounts | grep -q ext4; then
      EIMDIR=/cust/early-mount.d
    fi
  fi
  if [ ! "$EIMDIR" ]\
  && [ "$MAGISK_VER_CODE" -ge 26000 ]; then
    if [ -d /data/unencrypted ]\
    && ! grep ' /data ' /proc/mounts | grep -q dm-\
    && grep ' /data ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/data/unencrypted/early-mount.d
    elif grep ' /cache ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/cache/early-mount.d
    elif grep ' /metadata ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/metadata/early-mount.d
    elif grep ' /persist ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/persist/early-mount.d
    elif grep ' /mnt/vendor/persist ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/mnt/vendor/persist/early-mount.d
    elif grep ' /cust ' /proc/mounts | grep -q f2fs; then
      EIMDIR=/cust/early-mount.d
    fi
  fi
  if [ "$EIMDIR" ]; then
    if [ -d ${EIMDIR%/early-mount.d} ]; then
      EIM=true
      mkdir -p $EIMDIR
      ui_print "- Your early init mount directory is"
      ui_print "  $EIMDIR"
      ui_print "  Any file stored to this directory will not be deleted"
      ui_print "  even you have uninstalled this module."
    else
      EIM=false
      ui_print "- Unable to find early init mount directory ${EIMDIR%/early-mount.d}"
    fi
    ui_print " "
  else
    EIM=false
    ui_print "- Unable to find early init mount directory"
    ui_print " "
  fi
else
  EIM=false
fi
}
eim_cache_warning() {
if echo $EIMDIR | grep -q cache; then
  ui_print "  Please do not ever wipe your /cache"
  ui_print "  as long as this module is installed!"
  ui_print "  If your /cache is wiped for some reasons,"
  ui_print "  then you need to uninstall this module and reboot first,"
  ui_print "  then reinstall this module afterwards"
  ui_print "  to get this module working correctly."
fi
}
patch_manifest_eim() {
if [ $EIM == true ]; then
  SRC=$SYSTEM/etc/vintf/manifest.xml
  if [ -f $SRC ]; then
    DIR=$EIMDIR/system/etc/vintf
    DES=$DIR/manifest.xml
    mkdir -p $DIR
    if [ ! -f $DES ]; then
      cp -af $SRC $DIR
    fi
    if ! grep -A2 vendor.dolby.hardware.dms $DES | grep -q 1.0; then
      ui_print "- Patching"
      ui_print "$DES"
      sed -i '/<manifest/a\
    <hal format="hidl">\
        <name>vendor.dolby.hardware.dms</name>\
        <transport>hwbinder</transport>\
        <fqname>@1.0::IDms/default</fqname>\
    </hal>' $DES
      eim_cache_warning
      ui_print " "
    fi
    if echo $MAGISK_VER | grep -q kitsune-; then
      ui_print "! It seems you are using a fake Kitsune Mask version"
      ui_print "  and that is known has a broken early/pre init mount."
      ui_print "  Please use an original Kitsune Mask instead."
      ui_print " "
    fi
  else
    EIM=false
  fi
fi
}

# permissive
if [ "`grep_prop permissive.mode $OPTIONALS`" == 1 ]; then
  ui_print "- Using device Permissive mode."
  rm -f $MODPATH/sepolicy.rule
  permissive
  ui_print " "
elif [ "`grep_prop permissive.mode $OPTIONALS`" == 2 ]; then
  ui_print "- Using Magisk Permissive mode."
  rm -f $MODPATH/sepolicy.rule
  permissive_2
  ui_print " "
fi

# mod ui
MOD_UI_DOLBY=false
if [ $DOLBY == true ]\
&& [ "`grep_prop mod.ui $OPTIONALS`" == 1 ]; then
  APP=DaxUI
  FILE=/data/media/"$UID"/$APP.apk
  DIR=`find $MODPATH/system -type d -name $APP`
  ui_print "- Using modified Dolby UI apk..."
  if [ -f $FILE ]; then
    cp -f $FILE $DIR
    chmod 0644 $DIR/$APP.apk
    ui_print "  Applied"
    MOD_UI_DOLBY=true
  else
    ui_print "  ! There is no $FILE file."
    ui_print "    Please place the apk to your internal storage first"
    ui_print "    and reflash!"
  fi
  ui_print " "
fi

# 36 dB
PROP=`grep_prop dolby.gain $OPTIONALS`
if [ $DOLBY == true ] && [ "$MOD_UI_DOLBY" != true ]\
&& [ "$PROP" ] && [ "$PROP" -gt 192 ]; then
  ui_print "- Using max/min limit 36 dB for Dolby Atmos"
  cp -rf $MODPATH/system_dolby_36dB/* $MODPATH/system
  ui_print " "
fi
rm -rf $MODPATH/system_dolby_36dB

# patch manifest.xml
if [ $DOLBY == true ]; then
  remount_rw
  early_init_mount_dir
  DIR=/data/adb/modules/$MODID
  if [ "$BOOTMODE" == true ]\
  && grep -q 'BUGGY MODE' $DIR/module.prop; then
    FILE="$INTERNALDIR/mirror/*/etc/vintf/manifest.xml
          $INTERNALDIR/mirror/*/*/etc/vintf/manifest.xml
          $INTERNALDIR/mirror/*/etc/vintf/manifest/*.xml
          $INTERNALDIR/mirror/*/*/etc/vintf/manifest/*.xml"
  else
    FILE="$INTERNALDIR/mirror/*/etc/vintf/manifest.xml
          $INTERNALDIR/mirror/*/*/etc/vintf/manifest.xml
          /*/etc/vintf/manifest.xml /*/*/etc/vintf/manifest.xml
          $INTERNALDIR/mirror/*/etc/vintf/manifest/*.xml
          $INTERNALDIR/mirror/*/*/etc/vintf/manifest/*.xml
          /*/etc/vintf/manifest/*.xml /*/*/etc/vintf/manifest/*.xml"
  fi
  if [ "`grep_prop dolby.skip.vendor $OPTIONALS`" != 1 ]\
  && ! grep -A2 vendor.dolby.hardware.dms $FILE | grep -q 1.0; then
    FILE=$VENDOR/etc/vintf/manifest.xml
    patch_manifest
  fi
  if [ "`grep_prop dolby.skip.system $OPTIONALS`" != 1 ]\
  && ! grep -A2 vendor.dolby.hardware.dms $FILE | grep -q 1.0; then
    FILE=$SYSTEM/etc/vintf/manifest.xml
    patch_manifest
  fi
  if [ "`grep_prop dolby.skip.system_ext $OPTIONALS`" != 1 ]\
  && ! grep -A2 vendor.dolby.hardware.dms $FILE | grep -q 1.0; then
    FILE=$SYSTEM_EXT/etc/vintf/manifest.xml
    patch_manifest
  fi
  if ! grep -A2 vendor.dolby.hardware.dms $FILE | grep -q 1.0; then
    patch_manifest_eim
    if [ $EIM == false ]; then
      ui_print "- Using BUGGY MODE systemless manifest.xml patch."
      ui_print "  On some ROMs, it produces some issues or even makes"
      ui_print "  bootloop because not allowed to restart hwservicemanager."
      ui_print "  You can fix this by using original Magisk Delta/Kitsune Mask."
      ui_print " "
    fi
  fi
  remount_ro
fi

# function
hide_oat() {
for APP in $APPS; do
  REPLACE="$REPLACE
  `find $MODPATH/system -type d -name $APP | sed "s|$MODPATH||g"`/oat"
done
}
replace_dir() {
if [ -d $DIR ] && [ ! -d $MODPATH$MODDIR ]; then
  REPLACE="$REPLACE $MODDIR"
fi
}
hide_app() {
for APP in $APPS; do
  DIR=$SYSTEM/app/$APP
  MODDIR=/system/app/$APP
  replace_dir
  DIR=$SYSTEM/priv-app/$APP
  MODDIR=/system/priv-app/$APP
  replace_dir
  DIR=$PRODUCT/app/$APP
  MODDIR=/system/product/app/$APP
  replace_dir
  DIR=$PRODUCT/priv-app/$APP
  MODDIR=/system/product/priv-app/$APP
  replace_dir
  DIR=$MY_PRODUCT/app/$APP
  MODDIR=/system/product/app/$APP
  replace_dir
  DIR=$MY_PRODUCT/priv-app/$APP
  MODDIR=/system/product/priv-app/$APP
  replace_dir
  DIR=$PRODUCT/preinstall/$APP
  MODDIR=/system/product/preinstall/$APP
  replace_dir
  DIR=$SYSTEM_EXT/app/$APP
  MODDIR=/system/system_ext/app/$APP
  replace_dir
  DIR=$SYSTEM_EXT/priv-app/$APP
  MODDIR=/system/system_ext/priv-app/$APP
  replace_dir
  DIR=$VENDOR/app/$APP
  MODDIR=/system/vendor/app/$APP
  replace_dir
  DIR=$VENDOR/euclid/product/app/$APP
  MODDIR=/system/vendor/euclid/product/app/$APP
  replace_dir
done
}

# hide
APPS="`ls $MODPATH/system/priv-app`
      `ls $MODPATH/system/app`"
hide_oat
APPS="$APPS MusicFX AudioFX"
hide_app
if [ $DOLBY == true ]; then
  if [ "`grep_prop dolby.mod $OPTIONALS`" == 0 ]; then
    APPS="MotoDolbyDax3 MotoDolbyV3 OPSoundTuner 
          DolbyAtmos AudioEffectCenter"
  else
    APPS="MotoDolbyDax3 MotoDolbyV3 OPSoundTuner 
          DolbyAtmos"
  fi
  hide_app
fi

# function
stream_mode() {
FILE=$MODPATH/.aml.sh
if echo "$PROP" | grep -q m; then
  ui_print "- Activating Dolby Atmos music stream..."
  sed -i 's|#m||g' $FILE
  sed -i 's|musicstream=|musicstream=true|g' $MODPATH/acdb.conf
  sed -i 's|music_stream false|music_stream true|g' $MODPATH/service.sh
  ui_print "  Dolby Atmos will always be enabled"
  ui_print "  and cannot be disabled by on/off togglers"
  ui_print " "
fi
if echo "$PROP" | grep -q r; then
  ui_print "- Activating Dolby Atmos ring stream..."
  sed -i 's|#r||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q a; then
  ui_print "- Activating Dolby Atmos alarm stream..."
  sed -i 's|#a||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q s; then
  ui_print "- Activating Dolby Atmos system stream..."
  sed -i 's|#s||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q v; then
  ui_print "- Activating Dolby Atmos voice_call stream..."
  sed -i 's|#v||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q n; then
  ui_print "- Activating Dolby Atmos notification stream..."
  sed -i 's|#n||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q b; then
  ui_print "- Activating Dolby Atmos bluetooth_sco stream..."
  sed -i 's|#b||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q f; then
  ui_print "- Activating Dolby Atmos dtmf stream..."
  sed -i 's|#f||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q e; then
  ui_print "- Activating Dolby Atmos enforced_audible stream..."
  sed -i 's|#e||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q y; then
  ui_print "- Activating Dolby Atmos accessibility stream..."
  sed -i 's|#y||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q t; then
  ui_print "- Activating Dolby Atmos tts stream..."
  sed -i 's|#t||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q i; then
  ui_print "- Activating Dolby Atmos assistant stream..."
  sed -i 's|#i||g' $FILE
  ui_print " "
fi
if echo "$PROP" | grep -q c; then
  ui_print "- Activating Dolby Atmos call_assistant stream..."
  sed -i 's|#c||g' $FILE
  ui_print " "
fi
if [ "`grep_prop dolby.game $OPTIONALS`" != 0 ]; then
  sed -i 's|#p||g' $FILE
  sed -i 's|#g||g' $FILE
else
  ui_print "- Does not use Dolby Game patch & rerouting stream"
  ui_print " "
fi
}

# stream mode
FILE=$MODPATH/service.sh
PROP=`grep_prop stream.mode $OPTIONALS`
if echo "$PROP" | grep -q m; then
  ui_print "- Using Sound Enhancement post process type soundfx"
  ui_print "  instead of global type soundfx"
  sed -i 's|ro.sony.global.effect true|ro.sony.global.effect false|g' $FILE
  ui_print " "
fi
if [ $DOLBY == true ]; then
  stream_mode
fi

# function
dolby_settings() {
FILE=$MODPATH/system/vendor/etc/dolby/dax-default.xml
PROP=`grep_prop dolby.bass $OPTIONALS`
if [ "$PROP" == true ]; then
  ui_print "- Changing all bass-enhancer-enable value to true"
  sed -i 's|bass-enhancer-enable value="false"|bass-enhancer-enable value="true"|g' $FILE
elif [ "$PROP" == false ]; then
  ui_print "- Changing all bass-enhancer-enable value to false"
  sed -i 's|bass-enhancer-enable value="true"|bass-enhancer-enable value="false"|g' $FILE
elif [ "$PROP" ] && [ "$PROP" != def ] && [ "$PROP" -gt 0 ]; then
  ui_print "- Changing all bass-enhancer-enable value to true"
  sed -i 's|bass-enhancer-enable value="false"|bass-enhancer-enable value="true"|g' $FILE
  ROWS=`grep bass-enhancer-boost $FILE | sed -e 's|<bass-enhancer-boost value="||g' -e 's|"/>||g' -e 's|" />||g'`
  if [ "$ROWS" ]; then
    ui_print "- Default bass-enhancer-boost value:"
    ui_print "$ROWS"
    ui_print "- Changing all bass-enhancer-boost value to $PROP"
    for ROW in $ROWS; do
      sed -i "s|bass-enhancer-boost value=\"$ROW\"|bass-enhancer-boost value=\"$PROP\"|g" $FILE
    done
  else
    ui_print "- This version does not support bass-enhancer-boost"
  fi
fi
if [ "`grep_prop dolby.virtualizer $OPTIONALS`" == 1 ]; then
  ui_print "- Changing all virtualizer-enable value to true"
  sed -i 's|virtualizer-enable value="false"|virtualizer-enable value="true"|g' $FILE
elif [ "`grep_prop dolby.virtualizer $OPTIONALS`" == 0 ]; then
  ui_print "- Changing all virtualizer-enable value to false"
  sed -i 's|virtualizer-enable value="true"|virtualizer-enable value="false"|g' $FILE
fi
if [ "`grep_prop dolby.volumeleveler $OPTIONALS`" == def ]; then
  ui_print "- Using default settings of volume-leveler"
elif [ "`grep_prop dolby.volumeleveler $OPTIONALS`" == 1 ]; then
  ui_print "- Changing all volume-leveler-enable value to true"
  sed -i 's|volume-leveler-enable value="false"|volume-leveler-enable value="true"|g' $FILE
else
  ui_print "- Changing all volume-leveler-enable value to false"
  sed -i 's|volume-leveler-enable value="true"|volume-leveler-enable value="false"|g' $FILE
fi
if [ "`grep_prop dolby.deepbass $OPTIONALS`" == 1 ]; then
  ui_print "- Using deeper bass GEQ frequency"
  sed -i 's|frequency="47"|frequency="0"|g' $FILE
  sed -i 's|frequency="141"|frequency="47"|g' $FILE
  sed -i 's|frequency="234"|frequency="141"|g' $FILE
  sed -i 's|frequency="328"|frequency="234"|g' $FILE
  sed -i 's|frequency="469"|frequency="328"|g' $FILE
  sed -i 's|frequency="656"|frequency="469"|g' $FILE
  sed -i 's|frequency="844"|frequency="656"|g' $FILE
  sed -i 's|frequency="1031"|frequency="844"|g' $FILE
  sed -i 's|frequency="1313"|frequency="1031"|g' $FILE
  sed -i 's|frequency="1688"|frequency="1313"|g' $FILE
  sed -i 's|frequency="2250"|frequency="1688"|g' $FILE
  sed -i 's|frequency="3000"|frequency="2250"|g' $FILE
  sed -i 's|frequency="3750"|frequency="3000"|g' $FILE
  sed -i 's|frequency="4688"|frequency="3750"|g' $FILE
  sed -i 's|frequency="5813"|frequency="4688"|g' $FILE
  sed -i 's|frequency="7125"|frequency="5813"|g' $FILE
  sed -i 's|frequency="9000"|frequency="7125"|g' $FILE
  sed -i 's|frequency="11250"|frequency="9000"|g' $FILE
  sed -i 's|frequency="13875"|frequency="11250"|g' $FILE
  sed -i 's|frequency="19688"|frequency="13875"|g' $FILE
fi
ui_print " "
}

# settings
if [ $DOLBY == true ]; then
  sed -i 's|persist.sony.effect.dolby_atmos false|persist.sony.effect.dolby_atmos true|g' $MODPATH/service.sh
  dolby_settings
fi

# check
NAME=dsee_hx_state
FILE=$VENDOR/lib*/hw/audio.primary.*.so
if grep -q "$NAME" $FILE ; then
  ui_print "- Detected DSEEHX support in"
  ui_print "$FILE"
  sed -i 's|ro.somc.dseehx.supported true|ro.somc.dseehx.supported false|g' $MODPATH/service.sh
  ui_print " "
fi

# function
file_check_apex_for_vendor() {
for FILE in $FILES; do
  DESS="/apex$FILE $SYSTEM/apex$FILE"
  for DES in $DESS; do
    if [ -f $DES ]; then
      ui_print "- Detected"
      ui_print "$DES"
      NAME=`basename $FILE`
      if echo $FILE | grep -q lib64; then
        rm -f $MODPATH/system/vendor/lib64/$NAME
      else
        rm -f $MODPATH/system/vendor/lib/$NAME
      fi
      ui_print " "
    fi
  done
done
}
file_check_system_for_vendor() {
for FILE in $FILES; do
  DESS="$SYSTEM$FILE $SYSTEM_EXT$FILE"
  for DES in $DESS; do
    if [ -f $DES ]; then
      ui_print "- Detected"
      ui_print "$DES"
      NAME=`basename $FILE`
      if echo $FILE | grep -q lib64; then
        rm -f $MODPATH/system/vendor/lib64/$NAME
      else
        rm -f $MODPATH/system/vendor/lib/$NAME
      fi
      ui_print " "
    fi
  done
done
}
file_check_system() {
for FILE in $FILES; do
  DESS="$SYSTEM$FILE $SYSTEM_EXT$FILE"
  for DES in $DESS; do
    if [ -f $DES ]; then
      ui_print "- Detected"
      ui_print "$DES"
      rm -f $MODPATH/system$FILE
      ui_print " "
    fi
  done
done
}
file_check_vendor() {
for FILE in $FILES; do
  DESS="$VENDOR$FILE $ODM$FILE"
  for DES in $DESS; do
    if [ -f $DES ]; then
      ui_print "- Detected"
      ui_print "$DES"
      rm -f $MODPATH/system/vendor$FILE
      ui_print " "
    fi
  done
done
}

# check
if [ "$IS64BIT" == true ]; then
  FILES=/lib64/libaudio-resampler.so
  file_check_system
  FILES="/lib64/libAlacSwDec.so
         /lib64/libOmxAlacDec.so
         /lib64/libOmxAlacDecSw.so"
  file_check_vendor
fi
if [ "$ABILIST32" ]; then
  FILES=/lib/libaudio-resampler.so
  file_check_system
  FILES="/lib/libAlacSwDec.so
         /lib/libOmxAlacDec.so
         /lib/libOmxAlacDecSw.so
         /lib/libstagefright_soft_somcalacdec.so"
  file_check_vendor
fi
FILES=/etc/media_codecs_somc_audio.xml
file_check_vendor
if [ $DOLBY == true ]; then
  if [ "$IS64BIT" == true ]; then
    FILES=/*vndk*/lib64/libsqlite.so
    file_check_apex_for_vendor
    FILES=/lib64/vndk-*/libsqlite.so
    file_check_system_for_vendor
    FILES="/lib64/libsqlite.so
           /lib64/libstagefrightdolby.so"
    file_check_vendor
  fi
  if [ "$ABILIST32" ]; then
    FILES="/lib/libstagefrightdolby.so
           /lib/libstagefright_soft_ddpdec.so
           /lib/libstagefright_soft_ac4dec.so"
    file_check_vendor
  fi
  FILES=/etc/media_codecs_dolby_audio.xml
  file_check_vendor
fi

# function
rename_file() {
if [ -f $FILE ]; then
  ui_print "- Renaming"
  ui_print "$FILE"
  ui_print "  to"
  ui_print "$MODFILE"
  mv -f $FILE $MODFILE
  ui_print " "
fi
}
change_name() {
if grep -q $NAME $FILE; then
  ui_print "- Changing $NAME to $NAME2 at"
  ui_print "$FILE"
  ui_print "  Please wait..."
  sed -i "s|$NAME|$NAME2|g" $FILE
  ui_print " "
fi
}
patch_file() {
if grep -q libvndksupport.so /system/etc/*.txt; then
  NAME=libhidlbase.so
  NAME2=libhidldlbs.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/lib/$NAME
    MODFILE=$MODPATH/system/vendor/lib/$NAME2
    rename_file
  fi
  if [ -f $MODPATH/system/vendor/lib64/$NAME2 ]\
  || [ -f $MODPATH/system/vendor/lib/$NAME2 ]; then
  FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*.so"
    change_name
  fi
  NAME=libutils.so
  NAME2=libutdlb.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/lib/$NAME
    MODFILE=$MODPATH/system/vendor/lib/$NAME2
    rename_file
  fi
  if [ -f $MODPATH/system/vendor/lib64/$NAME2 ]\
  || [ -f $MODPATH/system/vendor/lib/$NAME2 ]; then
    FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/hw/android.hardware.audio.effect@*.0-impl.so
$MODPATH/system/vendor/lib*/libhidldlbs.so
$MODPATH/system/vendor/lib*/libsqlite.so
$MODPATH/system/vendor/lib*/soundfx/lib*wdap*.so
$MODPATH/system/vendor/lib*/soundfx/libswvqe*.so
$MODPATH/system/vendor/lib*/soundfx/libswgamedap*.so
$MODPATH/system/vendor/lib*/libdapparamstorage*.so
$MODPATH/system/vendor/lib*/libdlbdsservice*.so
$MODPATH/system/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*.so
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*-impl.so
$MODPATH/system/vendor/lib*/libdeccfg*.so
$MODPATH/system/vendor/lib*/libstagefright_foundation.so
$MODPATH/system/vendor/lib*/libstagefrightdolby.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ddpdec*.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ac4dec*.so"
    change_name
  fi
fi
NAME=libstagefright_foundation.so
NAME2=libstagefright_fdtn_dolby.so
if [ "$IS64BIT" == true ]; then
  FILE=$MODPATH/system/vendor/lib64/$NAME
  MODFILE=$MODPATH/system/vendor/lib64/$NAME2
  rename_file
fi
if [ "$ABILIST32" ]; then
  FILE=$MODPATH/system/vendor/lib/$NAME
  MODFILE=$MODPATH/system/vendor/lib/$NAME2
  rename_file
fi
FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/libdlbdsservice*.so
$MODPATH/system/vendor/lib*/libstagefrightdolby.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ddpdec*.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ac4dec*.so"
change_name
if [ "`grep_prop dolby.mod $OPTIONALS`" != 0 ]; then
  NAME=dax-default.xml
  NAME2=dap-default.xml
  FILE=$MODPATH/system/vendor/etc/dolby/$NAME
  MODFILE=$MODPATH/system/vendor/etc/dolby/$NAME2
  rename_file
  FILE=$MODPATH/system/vendor/lib*/libdlbdsservice*.so
  change_name
  NAME=dax_sqlite3.db
  NAME2=dap_sqlite3.db
  change_name
  NAME=libswdap.so
  NAME2=libswdlb.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/vendor/lib64/soundfx/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/soundfx/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/vendor/lib/soundfx/$NAME
    MODFILE=$MODPATH/system/vendor/lib/soundfx/$NAME2
    rename_file
  fi
  FILE="$MODPATH/system/vendor/lib*/soundfx/$NAME2
$MODPATH/.aml.sh"
  change_name
  NAME=libdlbdsservice.so
  NAME2=libdapdsservice.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/vendor/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*-impl.so
$MODPATH/system/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service"
  change_name
  NAME=libdapparamstorage.so
  NAME2=libdaxparamstorage.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/vendor/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/vendor/lib/$NAME
    MODFILE=$MODPATH/system/vendor/lib/$NAME2
    rename_file
  fi
  FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/soundfx/lib*wdlb*.so
$MODPATH/system/vendor/lib*/libdapdsservice*.so
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*-impl.so
$MODPATH/system/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service
$MODPATH/system/vendor/lib*/libstagefright_soft_ddpdec*.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ac4dec*.so"
  change_name
  NAME=vendor.dolby.hardware.dms@1.0.so
  NAME2=vendor.dlbds.hardware.dms@1.0.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/vendor/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/vendor/lib/$NAME
    MODFILE=$MODPATH/system/vendor/lib/$NAME2
    rename_file
  fi
  FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/lib*/soundfx/lib*wdlb*.so
$MODPATH/system/vendor/lib*/libdapdsservice*.so
$MODPATH/system/vendor/lib*/vendor.dolby*.hardware.dms*@*-impl.so
$MODPATH/system/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service
$MODPATH/system/vendor/lib*/libstagefright_soft_ddpdec*.so
$MODPATH/system/vendor/lib*/libstagefright_soft_ac4dec*.so"
  change_name
  NAME=vendor.dolby.hardware.dms@1.0-impl.so
  NAME2=vendor.dlbds.hardware.dms@1.0-impl.so
  if [ "$IS64BIT" == true ]; then
    FILE=$MODPATH/system/vendor/lib64/$NAME
    MODFILE=$MODPATH/system/vendor/lib64/$NAME2
    rename_file
  fi
  if [ "$ABILIST32" ]; then
    FILE=$MODPATH/system/vendor/lib/$NAME
    MODFILE=$MODPATH/system/vendor/lib/$NAME2
    rename_file
  fi
  FILE="$MODPATH/system/vendor/lib*/$NAME2
$MODPATH/system/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service"
  change_name
  sed -i 's|ro.dolby.mod_uuid false|ro.dolby.mod_uuid true|g' $MODPATH/service.sh
  NAME=$'\x39\x53\x7a\x04\xbc\xaa'
  NAME2=_ryuki
  FILE=$MODPATH/system/vendor/lib*/soundfx/libswdlb.so
  change_name
  NAME=$'\x45\x27\x99\x21\x85\x39'
  FILE=$MODPATH/system/vendor/lib*/soundfx/libswdlb.so
  change_name
  NAME=$'\xd5\x3e\x26\xda\x02\x53'
  FILE=$MODPATH/system/vendor/lib*/soundfx/libhwdlb.so
  change_name
  NAME=$'\xef\x93\x7f\x67\x55\x87'
  FILE=$MODPATH/system/vendor/lib*/soundfx/lib*wdlb.so
  change_name
  NAME=39537a04bcaa
  NAME2=5f7279756b69
  FILE="$MODPATH/.aml.sh
$MODPATH/acdb.conf"
  change_name
  NAME=452799218539
  change_name
  NAME=d53e26da0253
  change_name
fi
}

# mod
if [ $DOLBY == true ]; then
  patch_file
fi

# fix sensor
if [ $DOLBY == true ]\
&& [ "`grep_prop dolby.fix.sensor $OPTIONALS`" == 1 ]; then
  ui_print "- Fixing sensors issue"
  ui_print "  This causes bootloop in some ROMs"
  sed -i 's|#x||g' $MODPATH/service.sh
  ui_print " "
fi

# audio rotation
FILE=$MODPATH/service.sh
if [ "`grep_prop audio.rotation $OPTIONALS`" == 1 ]; then
  ui_print "- Enables ro.audio.monitorRotation=true"
  sed -i '1i\
resetprop -n ro.audio.monitorRotation true\
resetprop -n ro.audio.monitorWindowRotation true' $FILE
  ui_print " "
fi

# raw
FILE=$MODPATH/.aml.sh
if [ "`grep_prop disable.raw $OPTIONALS`" == 0 ]; then
  ui_print "- Does not disable Ultra Low Latency (Raw) playback"
  ui_print " "
else
  sed -i 's|#u||g' $FILE
fi

# vendor_overlay
DIR=/product/vendor_overlay
if [ "`grep_prop fix.vendor_overlay $OPTIONALS`" == 1 ]\
&& [ $DOLBY == true ] && [ -d $DIR ]; then
  ui_print "- Fixing $DIR mount..."
  cp -rf $DIR/*/* $MODPATH/system/vendor
  ui_print " "
fi

# run
MODSYSTEM=/system
. $MODPATH/copy.sh
. $MODPATH/.aml.sh

# unmount
unmount_mirror

# note
ui_print "- If Sound Enhancement FX doesn't work, then type:"
ui_print " "
ui_print "  su"
ui_print "  sefx"
ui_print " "
ui_print "  at Terminal/Termux app while playing music"
ui_print " "




















================================================
FILE: function.sh
================================================
# function
remove_cache() {
FILES=`find $MODPATH -type f -name *.apk | sed 's|.apk||g'`
APPS=`for FILE in $FILES; do basename $FILE; done`
for APP in $APPS; do
  rm -f `find /data/system/package_cache\
   /data/dalvik-cache /data/resource-cache\
   -type f -name *$APP*`
done
}
mount_partitions_in_recovery() {
if [ "$BOOTMODE" != true ]; then
  BLOCK=/dev/block/bootdevice/by-name
  BLOCK2=/dev/block/mapper
  ui_print "- Recommended to mount all partitions first"
  ui_print "  before installing this module"
  ui_print " "
  DIR=/vendor
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR$SLOT $DIR\
    || mount -o rw -t auto $BLOCK2$DIR$SLOT $DIR\
    || mount -o rw -t auto $BLOCK/cust $DIR\
    || mount -o rw -t auto $BLOCK2/cust $DIR
  fi
  DIR=/product
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR$SLOT $DIR\
    || mount -o rw -t auto $BLOCK2$DIR$SLOT $DIR
  fi
  DIR=/system_ext
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR$SLOT $DIR\
    || mount -o rw -t auto $BLOCK2$DIR$SLOT $DIR
  fi
  DIR=/odm
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR$SLOT $DIR\
    || mount -o rw -t auto $BLOCK2$DIR$SLOT $DIR
  fi
  DIR=/my_product
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR $DIR\
    || mount -o rw -t auto $BLOCK2$DIR $DIR
  fi
  DIR=/data
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK/userdata $DIR\
    || mount -o rw -t auto $BLOCK2/userdata $DIR
  fi
  DIR=/cache
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR $DIR\
    || mount -o rw -t auto $BLOCK2$DIR $DIR
  fi
  DIR=/persist
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR $DIR\
    || mount -o rw -t auto $BLOCK2$DIR $DIR
  fi
  DIR=/metadata
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR $DIR\
    || mount -o rw -t auto $BLOCK2$DIR $DIR
  fi
  DIR=/cust
  if [ -d $DIR ] && ! is_mounted $DIR; then
    mount -o rw -t auto $BLOCK$DIR $DIR\
    || mount -o rw -t auto $BLOCK2$DIR $DIR
  fi
fi
}
get_device() {
DEV="`cat /proc/self/mountinfo | awk '{ if ( $5 == "'$1'" ) print $3 }' | head -1 | sed 's/:/ /g'`"
}
mount_mirror() {
RAN="`head -c6 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9'`"
while [ -e /dev/$RAN ]; do
  RAN="`head -c6 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9'`"
done
mknod /dev/$RAN b `get_device "$1"; echo $DEV`
if mount -t ext4 -o ro /dev/$RAN "$2"\
|| mount -t erofs -o ro /dev/$RAN "$2"\
|| mount -t f2fs -o ro /dev/$RAN "$2"\
|| mount -t auto -o ro /dev/$RAN "$2"; then
  blockdev --setrw /dev/$RAN
  rm -f /dev/$RAN
  return 0
fi
rm -f /dev/$RAN
return 1
}
unmount_mirror() {
if [ "$BOOTMODE" == true ]\
&& [ "$HASMIRROR" == false ]; then
  FOLDS="$MIRROR/* $MIRROR"
  for FOLD in $FOLDS; do
    umount $FOLD
  done
  rm -rf $MIRROR/*
fi
}
remount_partitions() {
PARS="/ /system /vendor /product /system_ext /odm /my_product"
for PAR in $PARS; do
  mount -o ro,remount $PAR
done
}
mount_system_to_mirror() {
DIR=/system
if [ ! -d $MIRROR$DIR ]; then
  HASMIRROR=false
  remount_partitions
  unmount_mirror
  ui_print "- Mounting $MIRROR$DIR..."
  if [ "$SYSTEM_ROOT" == true ]\
  || [ "$SYSTEM_AS_ROOT" == true ]; then
    mkdir -p $MIRROR/system_root
    if mount_mirror / $MIRROR/system_root; then
      rm -rf $MIRROR$DIR
      ln -sf $MIRROR/system_root$DIR $MIRROR
    else
      ui_print "  ! Failed"
      ui_print "    Try to reboot device first"
      rm -rf $MIRROR/system_root
      abort
    fi
  else
    mkdir -p $MIRROR$DIR
    if ! mount_mirror $DIR $MIRROR$DIR; then
      ui_print "  ! Failed"
      ui_print "    Try to reboot device first"
      rm -rf $MIRROR$DIR
      abort
    fi
  fi
  ui_print " "
else
  HASMIRROR=true
fi
}
mount_vendor_to_mirror() {
DIR=/vendor
if [ -d $DIR ] && [ ! -d $MIRROR$DIR ]; then
  ui_print "- Mounting $MIRROR$DIR..."
  mkdir -p $MIRROR$DIR
  if ! mount_mirror $DIR $MIRROR$DIR; then
    ui_print "  Creating symlink instead"
    rm -rf $MIRROR$DIR
    if [ -d $MIRROR/system$DIR ]; then
      ln -sf $MIRROR/system$DIR $MIRROR
    fi
  fi
  ui_print " "
fi
}
mount_product_to_mirror() {
DIR=/product
if [ -d $DIR ] && [ ! -d $MIRROR$DIR ]; then
  ui_print "- Mounting $MIRROR$DIR..."
  mkdir -p $MIRROR$DIR
  if ! mount_mirror $DIR $MIRROR$DIR; then
    ui_print "  Creating symlink instead"
    rm -rf $MIRROR$DIR
    if [ -d $MIRROR/system$DIR ]; then
      ln -sf $MIRROR/system$DIR $MIRROR
    fi
  fi
  ui_print " "
fi
}
mount_system_ext_to_mirror() {
DIR=/system_ext
if [ -d $DIR ] && [ ! -d $MIRROR$DIR ]; then
  ui_print "- Mounting $MIRROR$DIR..."
  mkdir -p $MIRROR$DIR
  if ! mount_mirror $DIR $MIRROR$DIR; then
    ui_print "  Creating symlink instead"
    rm -rf $MIRROR$DIR
    if [ -d $MIRROR/system$DIR ]; then
      ln -sf $MIRROR/system$DIR $MIRROR
    fi
  fi
  ui_print " "
fi
}
mount_odm_to_mirror() {
DIR=/odm
if [ -d $DIR ] && [ ! -d $MIRROR$DIR ]; then
  ui_print "- Mounting $MIRROR$DIR..."
  mkdir -p $MIRROR$DIR
  if ! mount_mirror $DIR $MIRROR$DIR; then
    ui_print "  Creating symlink instead"
    rm -rf $MIRROR$DIR
    if [ -d $MIRROR/system_root$DIR ]; then
      ln -sf $MIRROR/system_root$DIR $MIRROR
    elif [ -d $MIRROR/vendor$DIR ]; then
      ln -sf $MIRROR/vendor$DIR $MIRROR
    elif [ -d $MIRROR/system/vendor$DIR ]; then
      ln -sf $MIRROR/system/vendor$DIR $MIRROR
    fi
  fi
  ui_print " "
fi
}
mount_my_product_to_mirror() {
DIR=/my_product
if [ -d $DIR ] && [ ! -d $MIRROR$DIR ]; then
  ui_print "- Mounting $MIRROR$DIR..."
  mkdir -p $MIRROR$DIR
  if ! mount_mirror $DIR $MIRROR$DIR; then
    ui_print "  Creating symlink instead"
    rm -rf $MIRROR$DIR
    if [ -d $MIRROR/system_root$DIR ]; then
      ln -sf $MIRROR/system_root$DIR $MIRROR
    fi
  fi
  ui_print " "
fi
}
mount_partitions_to_mirror() {
mount_system_to_mirror
mount_vendor_to_mirror
mount_product_to_mirror
mount_system_ext_to_mirror
mount_odm_to_mirror
mount_my_product_to_mirror
}
magisk_setup() {
MAGISKTMP=`magisk --path`
if [ "$BOOTMODE" == true ]; then
  if [ "$MAGISKTMP" ]; then
    mount -o rw,remount $MAGISKTMP
    INTERNALDIR=$MAGISKTMP/.magisk
    MIRROR=$INTERNALDIR/mirror
  else
    INTERNALDIR=/mnt
    mount -o rw,remount $INTERNALDIR
    MIRROR=$INTERNALDIR/mirror
  fi
  mount_partitions_to_mirror
fi
}
remove_sepolicy_rule() {
rm -rf /metadata/magisk/"$MODID"\
 /mnt/vendor/persist/magisk/"$MODID"\
 /persist/magisk/"$MODID"\
 /data/unencrypted/magisk/"$MODID"\
 /cache/magisk/"$MODID"\
 /cust/magisk/"$MODID"
}
set_read_write() {
for NAME in $NAMES; do
  if [ -e $DIR$NAME ]; then
    blockdev --setrw $DIR$NAME
  fi
done
}
remount_rw() {
DIR=/dev/block/bootdevice/by-name
NAMES="/vendor$SLOT /cust /system$SLOT /system_ext$SLOT"
set_read_write
DIR=/dev/block/mapper
set_read_write
if [ "$BOOTMODE" == true ]; then
  DIR=$INTERNALDIR/block
  NAMES="/vendor /system_root /system /system_ext"
  set_read_write
  mount -o rw,remount $MIRROR/system
  mount -o rw,remount $MIRROR/system_root
  mount -o rw,remount $MIRROR/system_ext
  mount -o rw,remount $MIRROR/vendor
  mount -o rw,remount /
else
  mount -o rw,remount /system_root
fi
mount -o rw,remount /system
mount -o rw,remount /system_ext
mount -o rw,remount /vendor
}
remount_ro() {
if [ "$BOOTMODE" == true ]; then
  mount -o ro,remount $MIRROR/system
  mount -o ro,remount $MIRROR/system_root
  mount -o ro,remount $MIRROR/system_ext
  mount -o ro,remount $MIRROR/vendor
  mount -o ro,remount /
  mount -o ro,remount /system
  mount -o ro,remount /system_ext
  mount -o ro,remount /vendor
fi
}




================================================
FILE: module.prop
================================================
id=SoundEnhancement
name=Sound Enhancement Sony Xperia 10
version=v1.1.9
versionCode=119
author=Rei Ryuki the Fixer
description=Equalizers global type sound effect ported from Sony Xperia 10 (I4113) for any armeabi-v7a or arm64-v8a architecture, Android 10 (SDK 29) and up.




================================================
FILE: package-dolby.txt
================================================
com.sonyericsson.soundenhancement
com.sonymobile.audioutil
com.reiryuki.soundenhancementlauncher
com.dolby.daxappui
com.dolby.daxservice


================================================
FILE: package.txt
================================================
com.sonyericsson.soundenhancement
com.sonymobile.audioutil
com.reiryuki.soundenhancementlauncher


================================================
FILE: post-fs-data.sh
================================================
mount -o rw,remount /data
MODPATH=${0%/*}

# log
exec 2>$MODPATH/debug-pfsd.log
set -x

# var
ABI=`getprop ro.product.cpu.abi`
if [ ! -d $MODPATH/vendor ]\
|| [ -L $MODPATH/vendor ]; then
  MODSYSTEM=/system
fi

# function
permissive() {
if [ "`toybox cat $FILE`" = 1 ]; then
  chmod 640 $FILE
  chmod 440 $FILE2
  echo 0 > $FILE
fi
}
magisk_permissive() {
if [ "`toybox cat $FILE`" = 1 ]; then
  if [ -x "`command -v magiskpolicy`" ]; then
	magiskpolicy --live "permissive *"
  else
	$MODPATH/$ABI/libmagiskpolicy.so --live "permissive *"
  fi
fi
}
sepolicy_sh() {
if [ -f $FILE ]; then
  if [ -x "`command -v magiskpolicy`" ]; then
    magiskpolicy --live --apply $FILE 2>/dev/null
  else
    $MODPATH/$ABI/libmagiskpolicy.so --live --apply $FILE 2>/dev/null
  fi
fi
}

# selinux
FILE=/sys/fs/selinux/enforce
FILE2=/sys/fs/selinux/policy
#1permissive
chmod 0755 $MODPATH/*/libmagiskpolicy.so
#2magisk_permissive
FILE=$MODPATH/sepolicy.rule
#ksepolicy_sh
FILE=$MODPATH/sepolicy.pfsd
sepolicy_sh

# run
. $MODPATH/copy.sh

# conflict
AML=/data/adb/modules/aml
ACDB=/data/adb/modules/acdb
if [ -d $ACDB ] && [ ! -f $ACDB/disable ]; then
  if [ ! -d $AML ] || [ -f $AML/disable ]; then
    rm -f `find $MODPATH/system/etc $MODPATH/vendor/etc\
     $MODPATH/system/vendor/etc -maxdepth 1 -type f -name\
     *audio*effects*.conf -o -name *audio*effects*.xml`
  fi
fi

# run
. $MODPATH/.aml.sh

# directory
DIR=/data/mediaserver
mkdir -p $DIR

# function
dolby_data() {
DIR=/data/vendor/dolby
mkdir -p $DIR
chmod 0770 $DIR
chown 1013.1013 $DIR
chcon u:object_r:vendor_data_file:s0 $DIR
}

# directory
#ddolby_data

# permission
chmod 0751 $MODPATH/system/bin
FILES=`find $MODPATH/system/bin -type f`
for FILE in $FILES; do
  chmod 0755 $FILE
done
chown -R 0.2000 $MODPATH/system/bin
DIRS=`find $MODPATH/vendor\
           $MODPATH/system/vendor -type d`
for DIR in $DIRS; do
  chown 0.2000 $DIR
done
chcon -R u:object_r:system_lib_file:s0 $MODPATH/system/lib*
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH/system/odm/etc
chmod 0751 $MODPATH$MODSYSTEM/vendor/bin
chmod 0751 $MODPATH$MODSYSTEM/vendor/bin/hw
chmod 0755 $MODPATH$MODSYSTEM/vendor/odm/bin
chmod 0755 $MODPATH$MODSYSTEM/vendor/odm/bin/hw
FILES=`find $MODPATH$MODSYSTEM/vendor/bin\
            $MODPATH$MODSYSTEM/vendor/odm/bin -type f`
for FILE in $FILES; do
  chmod 0755 $FILE
  chown 0.2000 $FILE
done
FILES=`find $MODPATH$MODSYSTEM/vendor/lib* -type f`
for FILE in $FILES; do
  chmod 0644 $FILE
  chown 0.0 $FILE
done
chcon -R u:object_r:vendor_file:s0 $MODPATH$MODSYSTEM/vendor
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH$MODSYSTEM/vendor/etc
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH$MODSYSTEM/vendor/odm/etc
chcon u:object_r:vendor_hal_file:s0 $MODPATH$MODSYSTEM/vendor/lib*/hw
#chcon u:object_r:hal_dms_default_exec:s0 $MODPATH$MODSYSTEM/vendor/bin/hw/vendor.dolby*.hardware.dms*@*-service
#chcon u:object_r:hal_dms_default_exec:s0 $MODPATH$MODSYSTEM/vendor/odm/bin/hw/vendor.dolby*.hardware.dms*@*-service

# function
mount_odm() {
DIR=$MODPATH/system/odm
FILES=`find $DIR -type f -name $AUD`
for FILE in $FILES; do
  DES=/odm`echo $FILE | sed "s|$DIR||g"`
  if [ -f $DES ]; then
    umount $DES
    mount -o bind $FILE $DES
  fi
done
}
mount_my_product() {
DIR=$MODPATH/system/my_product
FILES=`find $DIR -type f -name $AUD`
for FILE in $FILES; do
  DES=/my_product`echo $FILE | sed "s|$DIR||g"`
  if [ -f $DES ]; then
    umount $DES
    mount -o bind $FILE $DES
  fi
done
}

# mount
if [ -d /odm ] && [ "`realpath /odm/etc`" == /odm/etc ]\
&& ! grep /odm /data/adb/magisk/magisk\
&& ! grep /odm /data/adb/magisk/magisk64\
&& ! grep /odm /data/adb/magisk/magisk32; then
  mount_odm
fi
if [ -d /my_product ]\
&& ! grep /my_product /data/adb/magisk/magisk\
&& ! grep /my_product /data/adb/magisk/magisk64\
&& ! grep /my_product /data/adb/magisk/magisk32; then
  mount_my_product
fi

# function
dolby_manifest() {
M=/system/etc/vintf/manifest.xml
rm -f $MODPATH$M
FILE="/*/etc/vintf/manifest.xml /*/*/etc/vintf/manifest.xml
      /*/etc/vintf/manifest/*.xml /*/*/etc/vintf/manifest/*.xml"
if ! grep -A2 vendor.dolby.hardware.dms $FILE | grep 1.0; then
  cp -af $M $MODPATH$M
  if [ -f $MODPATH$M ]; then
    sed -i '/<manifest/a\
    <hal format="hidl">\
        <name>vendor.dolby.hardware.dms</name>\
        <transport>hwbinder</transport>\
        <fqname>@1.0::IDms/default</fqname>\
    </hal>' $MODPATH$M
    umount $M
    mount -o bind $MODPATH$M $M
    killall hwservicemanager
  fi
  sed -i 's|description=Equalizer|description=BUGGY MODE. Equalizer|g' $MODPATH/module.prop
else
  sed -i 's|BUGGY MODE. ||g' $MODPATH/module.prop
fi
}

# manifest
#ddolby_manifest

# function
mount_bind_file() {
for FILE in $FILES; do
  umount $FILE
  mount -o bind $MODFILE $FILE
done
}
mount_bind_to_apex() {
for NAME in $NAMES; do
  MODFILE=$MODPATH/system/lib64/$NAME
  if [ -f $MODFILE ]; then
    FILES=`find /apex /system/apex -path *lib64/* -type f -name $NAME`
    mount_bind_file
  fi
  MODFILE=$MODPATH/system/lib/$NAME
  if [ -f $MODFILE ]; then
    FILES=`find /apex /system/apex -path *lib/* -type f -name $NAME`
    mount_bind_file
  fi
done
}

# mount
NAMES="libhidlbase.so libutils.so"
mount_bind_to_apex

# cleaning
FILE=$MODPATH/cleaner.sh
if [ -f $FILE ]; then
  . $FILE
  mv -f $FILE $FILE.txt
fi














================================================
FILE: sepolicy.rule
================================================
## Dolby

# debug
allow system_server system_file file write

# context
create { system_lib_file vendor_file vendor_configs_file vendor_data_file vendor_media_data_file hal_dms_default_exec }
allow { system_file system_lib_file vendor_file vendor_configs_file vendor_data_file vendor_media_data_file hal_dms_default_exec } labeledfs filesystem associate
allow init { system_file system_lib_file vendor_file vendor_configs_file vendor_data_file vendor_media_data_file } { dir file } relabelfrom
allow init hal_dms_default_exec file relabelfrom

# hwservice_manager
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app hal_audio_default mtk_hal_audio audioserver } { default_android_hwservice hal_dms_hwservice dms_hwservice } hwservice_manager find

# service_manager
allow daxservice_app { permission_checker_service game_service netstats_service content_capture_service } service_manager find

# binder
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } hal_dms_default binder call

# file
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { hal_dms_default_exec vendor_displayfeature_prop } file getattr
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { bluetooth_prop vendor_displayfeature_prop qemu_hw_prop } file map
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { vendor_default_prop vendor_audio_prop debug_mtk_gpud_prop audio_config_prop } file { read open getattr map }
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } qemu_hw_prop file { read open getattr }
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { vendor_displayfeature_prop mcd_data_file sysfs_migt migt_file } file { read open }
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } proc_mi_log file write
allow { hal_audio_default mtk_hal_audio audioserver } vendor_dolby_loglevel_prop file { read open getattr }
allow zygote { device unlabeled } file write
allow zygote zygote_tmpfs file { create open }
allow init system_file file mounton
allow daxservice_app default_prop file read

# chr_file
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } device chr_file { read write open getattr ioctl }

# dir
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { migt_file mcd_data_file } dir search
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } system_file dir write
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } data_log_file dir { search getattr }

# unix_stream_socket
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } zygote unix_stream_socket getopt

# capability
allow system_app system_app capability { dac_read_search dac_override sys_resource }
allow platform_app platform_app capability { dac_read_search dac_override sys_resource }
allow priv_app priv_app capability { dac_read_search dac_override sys_resource }
allow untrusted_app_29 untrusted_app_29 capability { dac_read_search dac_override sys_resource }
allow untrusted_app_27 untrusted_app_27 capability { dac_read_search dac_override sys_resource }
allow untrusted_app untrusted_app capability { dac_read_search dac_override sys_resource }

# additional
allow { hal_audio_default mtk_hal_audio audioserver } { system_suspend_hwservice default_android_hwservice } hwservice_manager find
allow { hal_audio_default mtk_hal_audio audioserver } default_android_hwservice hwservice_manager add
allow { hal_audio_default mtk_hal_audio audioserver } hal_system_suspend_service service_manager find
allow { hal_audio_default mtk_hal_audio audioserver } { default_prop boottime_prop audio_prop radio_prop vendor_pd_locater_dbg_prop } file { read open getattr map }
allow { hal_audio_default mtk_hal_audio audioserver } { mnt_vendor_file system_prop vendor_default_prop } file { read open getattr }
allow { hal_audio_default mtk_hal_audio audioserver } sysfs_wake_lock file { write open }
allow { hal_audio_default mtk_hal_audio audioserver } { sysfs sysfs_boot_mode bluetooth_prop } file { read open }
allow { hal_audio_default mtk_hal_audio audioserver } bluetooth_prop file getattr
allow { hal_audio_default mtk_hal_audio audioserver } system_prop file map
allow { hal_audio_default mtk_hal_audio audioserver } boot_status_prop file read
allow { hal_audio_default mtk_hal_audio audioserver } { sysfs_net debugfs_ion } dir search
allow { hal_audio_default mtk_hal_audio audioserver } { sysfs_net sysfs } dir { read open }
allow { hal_audio_default mtk_hal_audio audioserver } logd_socket sock_file write
allow { hal_audio_default mtk_hal_audio audioserver } logd unix_stream_socket connectto
allow { hal_audio_default mtk_hal_audio audioserver } vendor_diag-router unix_stream_socket connectto
allow { hal_audio_default mtk_hal_audio audioserver } { diag_device vendor_diag_device } chr_file { read write open ioctl getattr }
allow { hal_audio_default mtk_hal_audio audioserver } device chr_file { read write }
allow { hal_audio_default mtk_hal_audio audioserver } system_suspend binder call
allow { hal_audio_default mtk_hal_audio audioserver } { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } fifo_file write
allow hal_audio_default hal_audio_default capability2 block_suspend
allow mtk_hal_audio mtk_hal_audio capability2 block_suspend
allow audioserver audioserver capability2 block_suspend
allow hal_audio_default hal_audio_default capability { sys_nice dac_override sys_admin dac_read_search }
allow mtk_hal_audio mtk_hal_audio capability { sys_nice dac_override sys_admin dac_read_search }
allow audioserver audioserver capability { sys_nice dac_override sys_admin dac_read_search }
allow hal_audio_default hal_audio_default tcp_socket create
allow mtk_hal_audio mtk_hal_audio tcp_socket create
allow audioserver audioserver tcp_socket create


## Sound Enhancement

# context
create audio_hweffect_device
allow audio_hweffect_device tmpfs filesystem associate
allow init audio_hweffect_device chr_file relabelfrom

# service_manager
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } default_android_service service_manager find

# chr_file
allow { hal_audio_default mtk_hal_audio audioserver } audio_hweffect_device chr_file { read write }
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } migt_dev chr_file { read write }


## Extended Audio Service

# dir
allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } unlabeled dir search









================================================
FILE: service.sh
================================================
MODPATH=${0%/*}

# log
LOGFILE=$MODPATH/debug.log
exec 2>$LOGFILE
set -x

# var
API=`getprop ro.build.version.sdk`
if [ ! -d $MODPATH/vendor ]\
|| [ -L $MODPATH/vendor ]; then
  MODSYSTEM=/system
fi

# function
dolby_prop() {
resetprop -n ro.odm.build.SomcCntrl.manufacture Sony
resetprop -n ro.odm.build.SomcCntrl.Brand Sony
resetprop -n ro.odm.build.SomcCntrl.Model Pdx203
resetprop -n ro.odm.build.SomcCntrl.device pdx203
resetprop -n ro.product.manufacturer Sony
resetprop -n ro.dolby.mod_uuid false
resetprop -n ro.dolby.music_stream false
resetprop -n vendor.audio.dolby.ds2.enabled false
resetprop -n vendor.audio.dolby.ds2.hardbypass false
#resetprop -p --delete persist.vendor.dolby.loglevel
#resetprop -n persist.vendor.dolby.loglevel 0
#resetprop -n vendor.dolby.dap.param.tee false
#resetprop -n vendor.dolby.mi.metadata.log false
}

# property
resetprop -n ro.audio.ignore_effects false
resetprop -n ro.sony.global.effect true
resetprop -n ro.semc.product.model I4113
resetprop -n ro.semc.ms_type_id PM-1181-BV
resetprop -n ro.semc.version.fs GENERIC
resetprop -n ro.semc.product.name "Xperia 10"
resetprop -n ro.semc.product.device I41
#resetprop -n ro.boot.hardware.sku I4113
resetprop -n audio.sony.effect.use.proxy true
resetprop -n vendor.audio.sony.effect.use.proxy true
resetprop -n vendor.audio.sony.effect.custom.sp_bundle 0x122
resetprop -n vendor.audio.sony.effect.custom.caplus_hs 0x298
resetprop -n vendor.audio.sony.effect.custom.caplus_sp 0x2B8
#resetprop -n vendor.audio.sony.effect.wait_ef_off_ms 500
#resetprop -n vendor.audio.sony.effect.wait_conv_on_ms 500
#resetprop -n vendor.audio.sony.effect.cpu_min_freq_little 600
#resetprop -n vendor.audio.sony.effect.cpu_min_freq_big 600
resetprop -n ro.somc.dseehx.supported true
resetprop -p --delete persist.sony.effect.ahc
resetprop -n persist.sony.effect.ahc true
resetprop -p --delete persist.sony.mono_speaker
resetprop -n persist.sony.mono_speaker false
resetprop -p --delete persist.sony.effect.dolby_atmos
resetprop -n persist.sony.effect.dolby_atmos false
resetprop -p --delete persist.sony.enable.dolby_auto_mode
resetprop -n persist.sony.enable.dolby_auto_mode true
resetprop -p --delete persist.sony.effect.clear_audio_plus
resetprop -n persist.sony.effect.clear_audio_plus true
resetprop -n vendor.audio.use.sw.alac.decoder true
#ddolby_prop

# special file
FILE=/dev/sony_hweffect_params
FILE2=/dev/msm_hweffects
if [ ! -e $FILE ]; then
  if [ -e $FILE2 ]; then
    MM=`stat -c "%t %T" $FILE2 | { read major minor; printf "%d %d\n" 0x$major 0x$minor; }`
  fi
  if [ "$MM" ]; then
    mknod $FILE c $MM
    chmod 0660 $FILE
    chown 1000.1005 $FILE
#    chcon u:object_r:audio_hweffect_device:s0 $FILE
  fi
fi

# restart
if [ "$API" -ge 24 ]; then
  SERVER=audioserver
else
  SERVER=mediaserver
fi
killall $SERVER\
 android.hardware.audio@4.0-service-mediatek\
 android.hardware.audio.service

# unused
#NAMES=vendor.semc.system.idd-1-0
#SERVICES="idds `realpath /vendor`/bin/idd-logreader
#          `realpath /vendor`/bin/hw/vendor.semc.system.idd@1.0-service"

# function
dolby_service() {
# stop
NAMES="dms-hal-1-0 dms-hal-2-0"
for NAME in $NAMES; do
  if [ "`getprop init.svc.$NAME`" == running ]\
  || [ "`getprop init.svc.$NAME`" == restarting ]; then
    stop $NAME
  fi
done
# mount
DIR=/odm/bin/hw
FILES=$DIR/vendor.dolby.hardware.dms@2.0-service
if [ "`realpath $DIR`" == $DIR ]; then
  for FILE in $FILES; do
    [ -f $FILE ] && mount -o bind $MODPATH$MODSYSTEM/vendor$FILE $FILE
  done
fi
# permission
chmod 0755 $MODPATH$MODSYSTEM/vendor/bin/hw/*
chown 0.2000 $MODPATH$MODSYSTEM/vendor/bin/hw/*
# run
SERVICES=`realpath /vendor`/bin/hw/vendor.dolby.hardware.dms@1.0-service
for SERVICE in $SERVICES; do
  killall $SERVICE
  $SERVICE &
  PID=`pidof $SERVICE`
done
# restart
killall vendor.qti.hardware.vibrator.service\
 vendor.qti.hardware.vibrator.service.oneplus9\
 vendor.qti.hardware.vibrator.service.oplus\
 android.hardware.camera.provider@2.4-service_64\
 vendor.mediatek.hardware.mtkpower@1.0-service\
 android.hardware.usb@1.0-service\
 android.hardware.usb@1.0-service.basic\
 android.hardware.light-service.mt6768\
 android.hardware.lights-service.xiaomi_mithorium\
 vendor.samsung.hardware.light-service\
 vendor.qti.hardware.lights.service\
 android.hardware.lights-service.qti
if grep 'BUGGY MODE' $MODPATH/module.prop; then
  killall vendor.qti.hardware.display.allocator-service\
   vendor.qti.hardware.display.composer-service\
   camerahalserver qcrilNrd mtkfusionrild
fi
#xkillall android.hardware.sensors@1.0-service\
#x android.hardware.sensors@2.0-service\
#x android.hardware.sensors@2.0-service-mediatek\
#x android.hardware.sensors@2.0-service.multihal\
#x android.hardware.sensors@2.0-service.multihal-mediatek
}

# dolby
#ddolby_service

# wait
sleep 20

# aml fix
AML=/data/adb/modules/aml
DIR=$AML$MODSYSTEM/vendor/odm/etc
if [ -d $DIR ] && [ ! -f $AML/disable ]; then
  chcon -R u:object_r:vendor_configs_file:s0 $DIR
fi
AUD=`grep AUD= $MODPATH/copy.sh | sed -e 's|AUD=||g' -e 's|"||g'`
DIR=$AML$MODSYSTEM/vendor
FILES=`find $DIR -type f -name $AUD`
if [ -d $AML ] && [ ! -f $AML/disable ]\
&& find $DIR -type f -name $AUD; then
  if ! grep '/odm' $AML/post-fs-data.sh && [ -d /odm ]\
  && [ "`realpath /odm/etc`" == /odm/etc ]; then
    for FILE in $FILES; do
      DES=/odm`echo $FILE | sed "s|$DIR||g"`
      if [ -f $DES ]; then
        umount $DES
        mount -o bind $FILE $DES
      fi
    done
  fi
  if ! grep '/my_product' $AML/post-fs-data.sh\
  && [ -d /my_product ]; then
    for FILE in $FILES; do
      DES=/my_product`echo $FILE | sed "s|$DIR||g"`
      if [ -f $DES ]; then
        umount $DES
        mount -o bind $FILE $DES
      fi
    done
  fi
fi

# wait
until [ "`getprop sys.boot_completed`" == 1 ]; do
  sleep 10
done

# list
PKGS=`cat $MODPATH/package.txt`
#dPKGS=`cat $MODPATH/package-dolby.txt`
for PKG in $PKGS; do
  magisk --denylist rm $PKG 2>/dev/null
  magisk --sulist add $PKG 2>/dev/null
done
if magisk magiskhide sulist; then
  for PKG in $PKGS; do
    magisk magiskhide add $PKG
  done
else
  for PKG in $PKGS; do
    magisk magiskhide rm $PKG
  done
fi

# settings
settings put global 5pole_accessory_detect 2
settings put global dnc_num_modes 3
settings put global dnc_mode_name_0 Bus/Train
settings put global dnc_mode_name_1 Airplane
settings put global dnc_mode_name_2 Office

# grant
PKG=com.sonyericsson.soundenhancement
if appops get $PKG > /dev/null 2>&1; then
  pm grant --all-permissions $PKG
  appops set $PKG SYSTEM_ALERT_WINDOW allow
  appops set $PKG TAKE_AUDIO_FOCUS allow
  if [ "$API" -ge 30 ]; then
    appops set $PKG AUTO_REVOKE_PERMISSIONS_IF_UNUSED ignore
  fi
  if [ "$API" -ge 33 ]; then
    appops set $PKG ACCESS_RESTRICTED_SETTINGS allow
  fi
  PKGOPS=`appops get $PKG`
  UID=`dumpsys package $PKG 2>/dev/null | grep -m 1 Id= | sed -e 's|    userId=||g' -e 's|    appId=||g'`
  if [ "$UID" ] && [ "$UID" -gt 9999 ]; then
    UIDOPS=`appops get --uid "$UID"`
  fi
fi

# allow
PKG=com.dolby.daxappui
if appops get $PKG > /dev/null 2>&1; then
  if [ "$API" -ge 30 ]; then
    appops set $PKG AUTO_REVOKE_PERMISSIONS_IF_UNUSED ignore
  fi
  PKGOPS=`appops get $PKG`
  UID=`dumpsys package $PKG 2>/dev/null | grep -m 1 Id= | sed -e 's|    userId=||g' -e 's|    appId=||g'`
  if [ "$UID" ] && [ "$UID" -gt 9999 ]; then
    UIDOPS=`appops get --uid "$UID"`
  fi
fi

# allow
PKG=com.dolby.daxservice
if appops get $PKG > /dev/null 2>&1; then
  if [ "$API" -ge 30 ]; then
    appops set $PKG AUTO_REVOKE_PERMISSIONS_IF_UNUSED ignore
  fi
  PKGOPS=`appops get $PKG`
  UID=`dumpsys package $PKG 2>/dev/null | grep -m 1 Id= | sed -e 's|    userId=||g' -e 's|    appId=||g'`
  if [ "$UID" ] && [ "$UID" -gt 9999 ]; then
    UIDOPS=`appops get --uid "$UID"`
  fi
fi

# allow
PKG=com.reiryuki.soundenhancementlauncher
if appops get $PKG > /dev/null 2>&1; then
  appops set $PKG SYSTEM_ALERT_WINDOW allow
  if [ "$API" -ge 33 ]; then
    pm revoke $PKG android.permission.POST_NOTIFICATIONS
    appops set $PKG ACCESS_RESTRICTED_SETTINGS allow
  fi
fi

# function
stop_log() {
SIZE=`du $LOGFILE | sed "s|$LOGFILE||g"`
if [ "$LOG" != stopped ] && [ "$SIZE" -gt 50 ]; then
  exec 2>/dev/null
  set +x
  LOG=stopped
fi
}
check_audioserver() {
if [ "$NEXTPID" ]; then
  PID=$NEXTPID
else
  PID=`pidof $SERVER`
fi
sleep 15
stop_log
NEXTPID=`pidof $SERVER`
[ "$PID" != "$NEXTPID" ] && killall $PROC
check_audioserver
}
check_service() {
for SERVICE in $SERVICES; do
  if ! pidof $SERVICE; then
    $SERVICE &
    PID=`pidof $SERVICE`
  fi
done
}

# check
#dcheck_service
PROC=com.sonyericsson.soundenhancement
#dPROC="com.sonyericsson.soundenhancement com.dolby.daxservice com.dolby.daxappui"
killall $PROC
check_audioserver












================================================
FILE: system/bin/sefx
================================================
#!/bin/sh

# function
start_broadcast() {
am broadcast -a android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION --es android.media.extra.PACKAGE_NAME $PKG --ei android.media.extra.AUDIO_SESSION $SESSION --ei android.media.extra.CONTENT_TYPE $TYPE
}
start_activity() {
am start-activity -a android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL -c android.intent.category.DEFAULT -p $EQPKG
}
sefx_result() {
echo "Package Name = $PKG"
[ "$PID" ] && echo "Process ID = $PID"
if [ "$SESSION" ]; then
  echo "Audio Session = $SESSION"
  echo "Content Type = $TYPE ($TYPENAME)"
  if [ "$SESSION" -lt 0 ]; then
    echo "Unsupported music player"
  else
    FILE=/sys/fs/selinux/enforce
    FILE2=/sys/fs/selinux/policy
    if ! start_broadcast; then
      if [ "`toybox cat $FILE`" = 1 ]; then
        chmod 640 $FILE
        chmod 440 $FILE2
        echo 0 > $FILE
        start_broadcast
        echo 1 > $FILE
      fi
    fi
    WARN=0
    if ! start_activity; then
      if [ "`toybox cat $FILE`" = 1 ]; then
        chmod 640 $FILE
        chmod 440 $FILE2
        echo 0 > $FILE
        start_activity
        echo 1 > $FILE
      fi
    fi
  fi
fi
}
run_sefx() {
PKGS=`dumpsys media_session | sed 's| |\n|g' | grep packages= | sed 's|packages=||g'`
unset PKG
if [ "$PKGS" ]; then
  for PKG in $PKGS; do
    PIDS=`ps -A | awk -v pkg="$PKG" '$0 ~ pkg {print $2}'`
    unset SESSION
    unset TYPE
    unset TYPENAME
    if [ "$PIDS" ]; then
      for PID in $PIDS; do
        DUMP=`dumpsys audio | grep "$PID" | grep sessionId: | sed 's| |\n|g'`
        if [ "$DUMP" ]; then
          SESSIONS=`echo "$DUMP" | grep sessionId: | sed 's|sessionId:||g'`
          for SESSION in $SESSIONS; do
            CONTENT=`echo "$DUMP" | grep content= | sed 's|content=||g'`
            if echo "$CONTENT" | grep -q MUSIC; then
              TYPE=2
              TYPENAME=Music
            elif echo "$CONTENT" | grep -q MOVIE; then
              TYPE=3
              TYPENAME=Movie
            elif echo "$CONTENT" | grep -q SONIFICATION; then
              TYPE=4
              TYPENAME=Sonification
            elif echo "$CONTENT" | grep -q SPEECH; then
              TYPE=1
              TYPENAME=Speech
            elif echo "$CONTENT" | grep -q ULTRASOUND; then
              TYPE=1997
              TYPENAME=Ultrasound
            elif echo "$CONTENT" | grep -q UNKNOWN; then
              TYPE=0
              TYPENAME=Unknown
            else
              TYPE=-1
              TYPENAME=Undefined
            fi
            sefx_result
          done
          [ ! "$SESSION" ] && sefx_result
        else
          sefx_result
        fi
      done
    else
      sefx_result
    fi
  done
fi
}

# check
if [ "`whoami`" == root ]; then
  EQPKG=com.sonyericsson.soundenhancement
  WARN=1
  run_sefx
  [ "$WARN" == 1 ] && echo "Please play music first!"
else
  echo "Please type su first!"
fi


================================================
FILE: system/etc/default-permissions/default-com.sonyericsson.soundenhancement.xml
================================================
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<exceptions>
    <exception package="com.sonyericsson.soundenhancement">
        <permission name="android.permission.RECORD_AUDIO" fixed="false"/>
    </exception>
</exceptions>


================================================
FILE: system/etc/permissions/com.sonyericsson.idd.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <library name="com.sonyericsson.idd"
        file="/system/framework/com.sonyericsson.idd_impl.jar"/>
    <library name="com.sonyericsson.idd_2"
        file="/system/framework/com.sonyericsson.idd_impl.jar"/>
    <library name="com.sonyericsson.idd_3"
        file="/system/framework/com.sonyericsson.idd_impl.jar"/>
</permissions>


================================================
FILE: system/etc/permissions/com.sonymobile.getmore.api.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <library name="com.sonymobile.getmore.api"
        file="/system/framework/com.sonymobile.getmore.api.jar"/>
</permissions>


================================================
FILE: system/etc/permissions/privapp-com.sonyericsson.soundenhancement.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <privapp-permissions package="com.sonyericsson.soundenhancement">
        <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
        <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
        <permission name="android.permission.READ_SEARCH_INDEXABLES"/>
        <permission name="android.permission.INTERACT_ACROSS_USERS"/>
        <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
        <permission name="android.permission.MANAGE_USERS"/>
    </privapp-permissions>
</permissions>


================================================
FILE: system/etc/permissions/privapp-com.sonymobile.audioutil.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <privapp-permissions package="com.sonymobile.audioutil">
        <permission name="android.permission.MODIFY_AUDIO_ROUTING"/>
        <permission name="android.permission.INTERACT_ACROSS_USERS"/>
        <permission name="android.permission.MANAGE_USERS"/>
    </privapp-permissions>
</permissions>


================================================
FILE: system/etc/permissions/semc_audioeffectif.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <library name="semc_audioeffectif"
        file="/system/framework/semc_audioeffectif.jar"/>
    <library name="com.sonymobile.audioeffect"
        file="/system/framework/semc_audioeffectif.jar"/>
    <library name="com.sonymobile.audioeffect_2"
        file="/system/framework/semc_audioeffectif.jar"/>
    <library name="com.sonymobile.audioeffect_3"
        file="/system/framework/semc_audioeffectif.jar"/>
    <library name="com.sonymobile.audioeffect_4"
        file="/system/framework/semc_audioeffectif.jar"/>
    <library name="com.sonymobile.audioeffect_5"
        file="/system/framework/semc_audioeffectif.jar"/>
</permissions>


================================================
FILE: system/etc/permissions/sonyaudioeffect.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <library name="sonyaudioeffect"
        file="/system/framework/sonyaudioeffect.jar"/>
</permissions>


================================================
FILE: system/etc/sysconfig/config-com.sonyericsson.soundenhancement.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<config>
    <hidden-api-whitelisted-app package="com.sonyericsson.soundenhancement"/>
    <allow-in-power-save package="com.sonyericsson.soundenhancement"/>
    <allow-implicit-broadcast action="com.sonyericsson.soundenhancement.AHC_USER_SWAP"/>
    <allow-implicit-broadcast action="dolby_dap_params_update"/>
    <allow-implicit-broadcast action="android.media.AUDIO_BECOMING_NOISY"/>
</config>


================================================
FILE: system/etc/sysconfig/config-com.sonymobile.audioutil.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<config>
    <hidden-api-whitelisted-app package="com.sonymobile.audioutil"/>
</config>


================================================
FILE: system/vendor/etc/media_codecs_somc_audio.xml
================================================
<?xml version="1.0" encoding="utf-8" ?>
<Included>
    <Decoders>
        <MediaCodec name="OMX.somc.alac.decoder" type="audio/alac" >
            <Limit name="channel-count" max="6" />
            <Limit name="sample-rate" ranges="8000,16000,22050,24000,32000,44100,48000,88200,96000,176400,192000" />
        </MediaCodec>
    </Decoders>
</Included>


================================================
FILE: system/vendor/etc/sony_effect/effect_params.data
================================================
xloud_strength:1,
ca_chsep_coef:-83,
ca_plus_sp_eq_coefs:0,0,0,0,0,0,



================================================
FILE: system.prop
================================================
# prevent bootloop
ro.control_privapp_permissions=log


================================================
FILE: system_dolby/etc/permissions/dolby_dax.xml
================================================
<?xml version="1.0" encoding="utf-8" ?>
<permissions>
    <library name="dolby_dax"
        file="/system/framework/dolby_dax.jar"/>
</permissions>


================================================
FILE: system_dolby/etc/permissions/privapp-com.dolby.daxservice.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <privapp-permissions package="com.dolby.daxservice">
        <permission name="android.permission.INTERACT_ACROSS_USERS"/>
        <permission name="android.permission.MANAGE_USERS"/>
        <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
        <permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
    </privapp-permissions>
</permissions>


================================================
FILE: system_dolby/etc/sysconfig/config-com.dolby.daxappui.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<config>
    <hidden-api-whitelisted-app package="com.dolby.daxappui"/>
</config>


================================================
FILE: system_dolby/etc/sysconfig/config-com.dolby.daxservice.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<config>
    <hidden-api-whitelisted-app package="com.dolby.daxservice"/>
</config>


================================================
FILE: system_dolby/vendor/etc/dolby/dax-default.xml
================================================
<?xml version='1.0' encoding='UTF-8'?>
<device_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <format_version major="3" minor="2" maintenance="0"/>
  <tool_version major="3" minor="1" maintenance="0"/>
  <preset id="ieq_detailed" type="ieq">
    <data>
      <ieq-bands>
        <band_ieq frequency="47" target="-419"/>
        <band_ieq frequency="141" target="-102"/>
        <band_ieq frequency="234" target="79"/>
        <band_ieq frequency="328" target="114"/>
        <band_ieq frequency="469" target="113"/>
        <band_ieq frequency="656" target="160"/>
        <band_ieq frequency="844" target="164"/>
        <band_ieq frequency="1031" target="102"/>
        <band_ieq frequency="1313" target="67"/>
        <band_ieq frequency="1688" target="73"/>
        <band_ieq frequency="2250" target="95"/>
        <band_ieq frequency="3000" target="114"/>
        <band_ieq frequency="3750" target="64"/>
        <band_ieq frequency="4688" target="67"/>
        <band_ieq frequency="5813" target="39"/>
        <band_ieq frequency="7125" target="-66"/>
        <band_ieq frequency="9000" target="-34"/>
        <band_ieq frequency="11250" target="-104"/>
        <band_ieq frequency="13875" target="-236"/>
        <band_ieq frequency="19688" target="-411"/>
      </ieq-bands>
    </data>
  </preset>
  <preset id="ieq_balanced" type="ieq">
    <data>
      <ieq-bands>
        <band_ieq frequency="47" target="157"/>
        <band_ieq frequency="141" target="167"/>
        <band_ieq frequency="234" target="218"/>
        <band_ieq frequency="328" target="218"/>
        <band_ieq frequency="469" target="203"/>
        <band_ieq frequency="656" target="188"/>
        <band_ieq frequency="844" target="192"/>
        <band_ieq frequency="1031" target="192"/>
        <band_ieq frequency="1313" target="205"/>
        <band_ieq frequency="1688" target="213"/>
        <band_ieq frequency="2250" target="218"/>
        <band_ieq frequency="3000" target="209"/>
        <band_ieq frequency="3750" target="193"/>
        <band_ieq frequency="4688" target="159"/>
        <band_ieq frequency="5813" target="134"/>
        <band_ieq frequency="7125" target="97"/>
        <band_ieq frequency="9000" target="71"/>
        <band_ieq frequency="11250" target="22"/>
        <band_ieq frequency="13875" target="-90"/>
        <band_ieq frequency="19688" target="-283"/>
      </ieq-bands>
    </data>
  </preset>
  <preset id="ieq_warm" type="ieq">
    <data>
      <ieq-bands>
        <band_ieq frequency="47" target="67"/>
        <band_ieq frequency="141" target="99"/>
        <band_ieq frequency="234" target="171"/>
        <band_ieq frequency="328" target="163"/>
        <band_ieq frequency="469" target="168"/>
        <band_ieq frequency="656" target="199"/>
        <band_ieq frequency="844" target="189"/>
        <band_ieq frequency="1031" target="228"/>
        <band_ieq frequency="1313" target="210"/>
        <band_ieq frequency="1688" target="213"/>
        <band_ieq frequency="2250" target="195"/>
        <band_ieq frequency="3000" target="183"/>
        <band_ieq frequency="3750" target="165"/>
        <band_ieq frequency="4688" target="136"/>
        <band_ieq frequency="5813" target="100"/>
        <band_ieq frequency="7125" target="59"/>
        <band_ieq frequency="9000" target="34"/>
        <band_ieq frequency="11250" target="7"/>
        <band_ieq frequency="13875" target="-54"/>
        <band_ieq frequency="19688" target="-235"/>
      </ieq-bands>
    </data>
  </preset>
  <preset id="0" type="geq">
    <data>
      <graphic-equalizer-bands>
        <band_geq frequency="47" gain="0"/>
        <band_geq frequency="141" gain="0"/>
        <band_geq frequency="234" gain="0"/>
        <band_geq frequency="328" gain="0"/>
        <band_geq frequency="469" gain="0"/>
        <band_geq frequency="656" gain="0"/>
        <band_geq frequency="844" gain="0"/>
        <band_geq frequency="1031" gain="0"/>
        <band_geq frequency="1313" gain="0"/>
        <band_geq frequency="1688" gain="0"/>
        <band_geq frequency="2250" gain="0"/>
        <band_geq frequency="3000" gain="0"/>
        <band_geq frequency="3750" gain="0"/>
        <band_geq frequency="4688" gain="0"/>
        <band_geq frequency="5813" gain="0"/>
        <band_geq frequency="7125" gain="0"/>
        <band_geq frequency="9000" gain="0"/>
        <band_geq frequency="11250" gain="0"/>
        <band_geq frequency="13875" gain="0"/>
        <band_geq frequency="19688" gain="0"/>
      </graphic-equalizer-bands>
    </data>
  </preset>
  <preset id="1" type="geq">
    <data>
      <graphic-equalizer-bands>
        <band_geq frequency="47" gain="0"/>
        <band_geq frequency="141" gain="0"/>
        <band_geq frequency="234" gain="0"/>
        <band_geq frequency="328" gain="0"/>
        <band_geq frequency="469" gain="0"/>
        <band_geq frequency="656" gain="0"/>
        <band_geq frequency="844" gain="0"/>
        <band_geq frequency="1031" gain="0"/>
        <band_geq frequency="1313" gain="0"/>
        <band_geq frequency="1688" gain="0"/>
        <band_geq frequency="2250" gain="0"/>
        <band_geq frequency="3000" gain="0"/>
        <band_geq frequency="3750" gain="0"/>
        <band_geq frequency="4688" gain="0"/>
        <band_geq frequency="5813" gain="0"/>
        <band_geq frequency="7125" gain="0"/>
        <band_geq frequency="9000" gain="0"/>
        <band_geq frequency="11250" gain="0"/>
        <band_geq frequency="13875" gain="0"/>
        <band_geq frequency="19688" gain="0"/>
      </graphic-equalizer-bands>
    </data>
  </preset>
  <preset id="2" type="geq">
    <data>
      <graphic-equalizer-bands>
        <band_geq frequency="47" gain="0"/>
        <band_geq frequency="141" gain="0"/>
        <band_geq frequency="234" gain="0"/>
        <band_geq frequency="328" gain="0"/>
        <band_geq frequency="469" gain="0"/>
        <band_geq frequency="656" gain="0"/>
        <band_geq frequency="844" gain="0"/>
        <band_geq frequency="1031" gain="0"/>
        <band_geq frequency="1313" gain="0"/>
        <band_geq frequency="1688" gain="0"/>
        <band_geq frequency="2250" gain="0"/>
        <band_geq frequency="3000" gain="0"/>
        <band_geq frequency="3750" gain="0"/>
        <band_geq frequency="4688" gain="0"/>
        <band_geq frequency="5813" gain="0"/>
        <band_geq frequency="7125" gain="0"/>
        <band_geq frequency="9000" gain="0"/>
        <band_geq frequency="11250" gain="0"/>
        <band_geq frequency="13875" gain="0"/>
        <band_geq frequency="19688" gain="0"/>
      </graphic-equalizer-bands>
    </data>
  </preset>
  <preset id="3" type="geq">
    <data>
      <graphic-equalizer-bands>
        <band_geq frequency="47" gain="0"/>
        <band_geq frequency="141" gain="0"/>
        <band_geq frequency="234" gain="0"/>
        <band_geq frequency="328" gain="0"/>
        <band_geq frequency="469" gain="0"/>
        <band_geq frequency="656" gain="0"/>
        <band_geq frequency="844" gain="0"/>
        <band_geq frequency="1031" gain="0"/>
        <band_geq frequency="1313" gain="0"/>
        <band_geq frequency="1688" gain="0"/>
        <band_geq frequency="2250" gain="0"/>
        <band_geq frequency="3000" gain="0"/>
        <band_geq frequency="3750" gain="0"/>
        <band_geq frequency="4688" gain="0"/>
        <band_geq frequency="5813" gain="0"/>
        <band_geq frequency="7125" gain="0"/>
        <band_geq frequency="9000" gain="0"/>
        <band_geq frequency="11250" gain="0"/>
        <band_geq frequency="13875" gain="0"/>
        <band_geq frequency="19688" gain="0"/>
      </graphic-equalizer-bands>
    </data>
  </preset>
  <profile id="0" name="Dynamic">
    <data>
      <ieq-enable value="true"/>
      <ieq-amount value="6"/>
      <mi-dialog-enhancer-steering-enable value="true"/>
      <mi-dv-leveler-steering-enable value="true"/>
      <mi-ieq-steering-enable value="true"/>
      <mi-surround-compressor-steering-enable value="true"/>
      <mi-adaptive-virtualizer-steering-enable value="true"/>
      <volume-modeler-enable value="false"/>
      <endpoint_type id="speaker">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="96"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="5"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="true"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="headphone">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="96"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="5"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="true"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="other">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="10"/>
        <dialog-enhancer-ducking value="0"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="0"/>
        <volmax-boost value="96"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="7"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
    </data>
    <include preset="ieq_balanced"/>
  </profile>
  <profile id="1" name="Movie">
    <data>
      <ieq-enable value="false"/>
      <ieq-amount value="6"/>
      <mi-dialog-enhancer-steering-enable value="false"/>
      <mi-dv-leveler-steering-enable value="false"/>
      <mi-ieq-steering-enable value="false"/>
      <mi-surround-compressor-steering-enable value="false"/>
      <mi-adaptive-virtualizer-steering-enable value="false"/>
      <volume-modeler-enable value="false"/>
      <endpoint_type id="speaker">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="96"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="4"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="true"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="headphone">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="96"/>
        <volmax-boost value="64"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="5"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="true"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="other">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="true"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="0"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="0"/>
        <volmax-boost value="96"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="7"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
    </data>
    <include preset="ieq_balanced"/>
  </profile>
  <profile id="2" name="Music">
    <data>
      <ieq-enable value="true"/>
      <ieq-amount value="6"/>
      <mi-dialog-enhancer-steering-enable value="false"/>
      <mi-dv-leveler-steering-enable value="false"/>
      <mi-ieq-steering-enable value="false"/>
      <mi-surround-compressor-steering-enable value="false"/>
      <mi-adaptive-virtualizer-steering-enable value="false"/>
      <volume-modeler-enable value="false"/>
      <endpoint_type id="speaker">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="0"/>
        <volmax-boost value="64"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="2"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="headphone">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="48"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="2"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="other">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="7"/>
        <dialog-enhancer-ducking value="0"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="0"/>
        <volmax-boost value="96"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="4"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
    </data>
    <include preset="ieq_balanced"/>
  </profile>
  <profile id="3" name="Custom">
    <data>
      <ieq-enable value="false"/>
      <ieq-amount value="6"/>
      <mi-dialog-enhancer-steering-enable value="false"/>
      <mi-dv-leveler-steering-enable value="false"/>
      <mi-ieq-steering-enable value="false"/>
      <mi-surround-compressor-steering-enable value="false"/>
      <mi-adaptive-virtualizer-steering-enable value="false"/>
      <volume-modeler-enable value="false"/>
      <endpoint_type id="speaker">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="48"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="0"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="headphone">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="2"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="48"/>
        <volmax-boost value="80"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="0"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
      <endpoint_type id="other">
        <calibration-boost value="0"/>
        <dialog-enhancer-enable value="false"/>
        <dialog-enhancer-amount value="6"/>
        <dialog-enhancer-ducking value="0"/>
        <surround-decoder-enable value="true"/>
        <surround-boost value="0"/>
        <volmax-boost value="96"/>
        <volume-leveler-enable value="true"/>
        <volume-leveler-amount value="0"/>
        <volume-leveler-in-target value="-320"/>
        <volume-leveler-out-target value="-320"/>
        <graphic-equalizer-enable value="true"/>
        <virtualizer-enable value="false"/>
        <bass-enhancer-enable value="false"/>
        <virtual-bass-process-enable value="false"/>
      </endpoint_type>
    </data>
    <include preset="ieq_warm"/>
  </profile>
  <tuning name="Speaker_landscape" classification="internal_speaker" endpoint_type="speaker" mono_device="false" has_sub="false" tuned_rate="48000" operating_mode="normal" profile_restrictions="none">
    <device_id id="internal_speaker" endpoint_port="internal_speaker"/>
    <device_id id="Speaker_landscape" endpoint_port="internal_speaker"/>
    <data>
      <audio-optimizer-bands>
        <band_optimizer frequency="47" gain_left="-480" gain_right="-480" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="141" gain_left="16" gain_right="128" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="234" gain_left="128" gain_right="272" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="328" gain_left="176" gain_right="288" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="469" gain_left="96" gain_right="208" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="656" gain_left="48" gain_right="96" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="844" gain_left="48" gain_right="48" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1031" gain_left="32" gain_right="48" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1313" gain_left="56" gain_right="48" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1688" gain_left="48" gain_right="80" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="2250" gain_left="64" gain_right="72" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3000" gain_left="104" gain_right="80" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3750" gain_left="104" gain_right="112" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="4688" gain_left="104" gain_right="120" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="5813" gain_left="120" gain_right="104" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="7125" gain_left="120" gain_right="128" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="9000" gain_left="144" gain_right="136" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="11250" gain_left="176" gain_right="160" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="13875" gain_left="112" gain_right="96" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="19688" gain_left="16" gain_right="16" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
      </audio-optimizer-bands>
      <regulator-tuning>
        <band_regulator frequency="47" threshold_low="-1152" threshold_high="-960" isolated_band="true"/>
        <band_regulator frequency="141" threshold_low="-272" threshold_high="-80" isolated_band="false"/>
        <band_regulator frequency="234" threshold_low="-560" threshold_high="-368" isolated_band="true"/>
        <band_regulator frequency="328" threshold_low="-592" threshold_high="-400" isolated_band="true"/>
        <band_regulator frequency="469" threshold_low="-464" threshold_high="-272" isolated_band="true"/>
        <band_regulator frequency="656" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="844" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1031" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1313" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="2250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3750" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="4688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="5813" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="7125" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="9000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="11250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="13875" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="19688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
      </regulator-tuning>
      <bass-enhancer-boost value="192"/>
      <bass-enhancer-cutoff-frequency value="300"/>
      <bass-enhancer-width value="16"/>
      <bass-extraction-cutoff-frequency value="200"/>
      <complex-equalizer-tuning-left value="0,18021,0,18021,0,13805,-11584,13805,-11584,18021,0,19552,2055,18019,314,16709,6751,16197,7900,16197,7900,13805,11584,13805,11584,12290,13180,12290,13180,15060,15060,15060,15060,9477,11295,17446,12216,18474,6724,16361,857,18021,0,18021,0,19660,0,16383,0,18021,0,19552,-2055,15667,-4790,16463,-7330,16709,-6751,16197,-7900,18805,-9999,15283,-9550,13805,-11584,11173,-11982,10962,-12175,12058,-13392,13901,-13901,12058,-13392,12743,-12743,13901,-13901,10426,-10426,10242,-10606,10962,-12175,9815,-15114,5870,-20473,0,-22936,-4267,-12392,-5761,-13572,-4790,-15667,-6751,-16709,-6724,-18474,-8322,-19605,-9329,-20953,-9206,-22785,-8322,-19605,-11120,-20061,-15975,-22814,-20009,-23845,-23570,-22761,-14745,-25539,-13501,-22469,-12216,-17446,-10748,-12364,-10056,-10783,-8770,-9740,-7217,-8912,-6578,-9394,-5209,-8336,-6413,-9507,-6077,-9725,-6553,-11350,-5761,-13572,-7182,-14725,-2055,-19552,13384,-20610,25640,-5450,26213,0"/>
      <complex-equalizer-tuning-right value="0,18207,0,18046,2419,13603,12102,13603,12102,18055,2657,17574,-2260,18257,-4085,17917,-7286,16557,-8114,14609,-8543,13895,-11765,13895,-11765,12392,-13339,12392,-13339,10364,-12378,13581,-16492,9857,-11983,13075,-9159,18530,-8864,15645,-3960,18273,-3396,17793,-1244,20055,-64,16521,511,15649,2187,18768,4995,17907,8132,16821,7747,16943,7343,15639,8180,18203,10518,14310,10874,12902,12002,11150,12168,11599,13460,11654,13149,12260,14229,12836,14467,13067,13264,12048,12348,12399,12456,11520,12023,10669,12365,9230,14507,5461,19207,-2495,22057,-3442,9494,-4775,10866,-5823,13429,-6659,16270,-7830,18880,-9672,21888,-11711,24640,-13261,26172,-6471,12427,-7072,12462,-9015,12841,-12616,13795,-16527,15717,-14235,19743,-11598,18662,-11671,15329,-11965,13261,-12075,12426,-11769,12427,-10993,12677,-10157,12846,-9562,13027,-9238,13442,-9207,14371,-9431,15988,-9860,18233,-10555,20804,-3759,23480,10758,17098,15717,4774,15072,0"/>
      <height-filter-mode value="1"/>
      <output-mode>
        <orientation value="1"/>
        <output_channels value="2"/>
        <mix_matrix>
          <element value="16384"/>
          <element value="0"/>
          <element value="0"/>
          <element value="16384"/>
          <element value="11583"/>
          <element value="11583"/>
          <element value="8192"/>
          <element value="8192"/>
          <element value="16384"/>
          <element value="0"/>
          <element value="0"/>
          <element value="16384"/>
          <element value="16384"/>
          <element value="0"/>
          <element value="0"/>
          <element value="16384"/>
        </mix_matrix>
      </output-mode>
      <regulator-overdrive value="0"/>
      <regulator-timbre-preservation value="12"/>
      <regulator-relaxation-amount value="96"/>
      <virtual-bass-mode value="3"/>
      <virtual-bass-overall-gain value="0"/>
      <virtual-bass-slope-gain value="0"/>
      <virtual-bass-mix-freqs frequency_low="94" frequency_high="469"/>
      <virtual-bass-src-freqs frequency_low="35" frequency_high="160"/>
      <virtual-bass-subgains harmonic_2="-32" harmonic_3="-144" harmonic_4="-192"/>
      <virtualizer-front-speaker-angle value="10"/>
      <virtualizer-height-speaker-angle value="10"/>
      <virtualizer-surround-speaker-angle value="10"/>
      <volume-modeler-calibration value="0"/>
      <audio-optimizer-enable value="true"/>
      <bass-extraction-enable value="false"/>
      <complex-equalizer-enable value="true"/>
      <regulator-enable value="true"/>
      <regulator-speaker-dist-enable value="true"/>
    </data>
  </tuning>
  <tuning name="Speaker_portrait" classification="internal_speaker" endpoint_type="speaker" mono_device="false" has_sub="false" tuned_rate="48000" operating_mode="normal" profile_restrictions="none">
    <device_id id="Speaker_portrait" endpoint_port="internal_speaker"/>
    <data>
      <audio-optimizer-bands>
        <band_optimizer frequency="47" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="141" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="234" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="328" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="469" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="656" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="844" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1031" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1313" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="2250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3750" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="4688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="5813" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="7125" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="9000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="11250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="13875" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="19688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
      </audio-optimizer-bands>
      <regulator-tuning>
        <band_regulator frequency="47" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="141" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="234" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="328" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="469" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="656" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="844" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1031" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1313" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="2250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3750" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="4688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="5813" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="7125" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="9000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="11250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="13875" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="19688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
      </regulator-tuning>
      <bass-enhancer-boost value="192"/>
      <bass-enhancer-cutoff-frequency value="200"/>
      <bass-enhancer-width value="16"/>
      <bass-extraction-cutoff-frequency value="200"/>
      <complex-equalizer-tuning-left value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <complex-equalizer-tuning-right value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <height-filter-mode value="1"/>
      <output-mode>
        <orientation value="0"/>
        <output_channels value="2"/>
        <mix_matrix>
          <element value="16384"/>
          <element value="16384"/>
        </mix_matrix>
      </output-mode>
      <regulator-overdrive value="0"/>
      <regulator-timbre-preservation value="12"/>
      <regulator-relaxation-amount value="96"/>
      <virtual-bass-mode value="3"/>
      <virtual-bass-overall-gain value="0"/>
      <virtual-bass-slope-gain value="0"/>
      <virtual-bass-mix-freqs frequency_low="94" frequency_high="469"/>
      <virtual-bass-src-freqs frequency_low="35" frequency_high="160"/>
      <virtual-bass-subgains harmonic_2="-32" harmonic_3="-144" harmonic_4="-192"/>
      <virtualizer-front-speaker-angle value="10"/>
      <virtualizer-height-speaker-angle value="10"/>
      <virtualizer-surround-speaker-angle value="10"/>
      <volume-modeler-calibration value="0"/>
      <audio-optimizer-enable value="true"/>
      <bass-extraction-enable value="false"/>
      <complex-equalizer-enable value="false"/>
      <regulator-enable value="true"/>
      <regulator-speaker-dist-enable value="true"/>
    </data>
  </tuning>
  <tuning name="Headphone" classification="unknown_headphone" endpoint_type="headphone" mono_device="false" has_sub="false" tuned_rate="48000" operating_mode="normal" profile_restrictions="none">
    <device_id id="headphone_port" endpoint_port="headphone_port"/>
    <device_id id="headphone_bluetooth" endpoint_port="bluetooth"/>
    <device_id id="bluetooth" endpoint_port="bluetooth"/>
    <device_id id="headphone_usb" endpoint_port="usb"/>
    <device_id id="usb" endpoint_port="usb"/>
    <data>
      <audio-optimizer-bands>
        <band_optimizer frequency="47" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="141" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="234" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="328" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="469" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="656" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="844" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1031" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1313" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="2250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3750" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="4688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="5813" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="7125" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="9000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="11250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="13875" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="19688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
      </audio-optimizer-bands>
      <regulator-tuning>
        <band_regulator frequency="47" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="141" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="234" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="328" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="469" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="656" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="844" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1031" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1313" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="2250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3750" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="4688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="5813" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="7125" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="9000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="11250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="13875" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="19688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
      </regulator-tuning>
      <bass-enhancer-boost value="96"/>
      <bass-enhancer-cutoff-frequency value="160"/>
      <bass-enhancer-width value="16"/>
      <bass-extraction-cutoff-frequency value="200"/>
      <complex-equalizer-tuning-left value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <complex-equalizer-tuning-right value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <height-filter-mode value="2"/>
      <output-mode>
        <orientation value="2"/>
        <output_channels value="2"/>
        <mix_matrix/>
      </output-mode>
      <regulator-overdrive value="0"/>
      <regulator-timbre-preservation value="12"/>
      <regulator-relaxation-amount value="96"/>
      <virtual-bass-mode value="3"/>
      <virtual-bass-overall-gain value="0"/>
      <virtual-bass-slope-gain value="0"/>
      <virtual-bass-mix-freqs frequency_low="99" frequency_high="281"/>
      <virtual-bass-src-freqs frequency_low="30" frequency_high="90"/>
      <virtual-bass-subgains harmonic_2="-48" harmonic_3="-480" harmonic_4="-240"/>
      <virtualizer-front-speaker-angle value="10"/>
      <virtualizer-height-speaker-angle value="10"/>
      <virtualizer-surround-speaker-angle value="10"/>
      <volume-modeler-calibration value="160"/>
      <audio-optimizer-enable value="false"/>
      <bass-extraction-enable value="false"/>
      <complex-equalizer-enable value="false"/>
      <regulator-enable value="true"/>
      <regulator-speaker-dist-enable value="false"/>
    </data>
  </tuning>
  <tuning name="Unknown" classification="unknown_default" endpoint_type="other" mono_device="false" has_sub="false" tuned_rate="48000" operating_mode="normal" profile_restrictions="none">
    <device_id id="hdmi" endpoint_port="hdmi"/>
    <device_id id="miracast" endpoint_port="miracast"/>
    <data>
      <audio-optimizer-bands>
        <band_optimizer frequency="47" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="141" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="234" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="328" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="469" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="656" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="844" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1031" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1313" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="1688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="2250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="3750" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="4688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="5813" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="7125" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="9000" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="11250" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="13875" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
        <band_optimizer frequency="19688" gain_left="0" gain_right="0" gain_center="0" gain_lfe="0" gain_left_surround="0" gain_right_surround="0" gain_left_rear_surround="0" gain_right_rear_surround="0" gain_left_top_middle="0" gain_right_top_middle="0"/>
      </audio-optimizer-bands>
      <regulator-tuning>
        <band_regulator frequency="47" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="141" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="234" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="328" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="469" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="656" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="844" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1031" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1313" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="1688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="2250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="3750" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="4688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="5813" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="7125" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="9000" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="11250" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="13875" threshold_low="-192" threshold_high="0" isolated_band="false"/>
        <band_regulator frequency="19688" threshold_low="-192" threshold_high="0" isolated_band="false"/>
      </regulator-tuning>
      <bass-enhancer-boost value="192"/>
      <bass-enhancer-cutoff-frequency value="200"/>
      <bass-enhancer-width value="16"/>
      <bass-extraction-cutoff-frequency value="200"/>
      <complex-equalizer-tuning-left value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <complex-equalizer-tuning-right value="0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0,32767,0"/>
      <height-filter-mode value="0"/>
      <output-mode>
        <orientation value="2"/>
        <output_channels value="2"/>
        <mix_matrix/>
      </output-mode>
      <regulator-overdrive value="0"/>
      <regulator-timbre-preservation value="12"/>
      <regulator-relaxation-amount value="96"/>
      <virtual-bass-mode value="3"/>
      <virtual-bass-overall-gain value="0"/>
      <virtual-bass-slope-gain value="0"/>
      <virtual-bass-mix-freqs frequency_low="94" frequency_high="469"/>
      <virtual-bass-src-freqs frequency_low="35" frequency_high="160"/>
      <virtual-bass-subgains harmonic_2="-32" harmonic_3="-144" harmonic_4="-192"/>
      <virtualizer-front-speaker-angle value="10"/>
      <virtualizer-height-speaker-angle value="10"/>
      <virtualizer-surround-speaker-angle value="10"/>
      <volume-modeler-calibration value="0"/>
      <audio-optimizer-enable value="false"/>
      <bass-extraction-enable value="false"/>
      <complex-equalizer-enable value="false"/>
      <regulator-enable value="true"/>
      <regulator-speaker-dist-enable value="false"/>
    </data>
  </tuning>
  <authorized_technologies sku_name="DAX3 Android" device="dax3_android" bundle="DAPv2 2.7.x"/>
</device_data>


================================================
FILE: system_dolby/vendor/etc/media_codecs_dolby_audio.xml
================================================
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.

     This file was modified by Dolby Laboratories, Inc. The portions of the
     code that are surrounded by "DOLBY..." are copyrighted and
     licensed separately, as follows:

     (C) 2018 Dolby Laboratories, Inc.
     All rights reserved.

     This program is protected under international and U.S. Copyright laws as
     an unpublished work. This program is confidential and proprietary to the
     copyright owners. Reproduction or disclosure, in whole or in part, or the
     production of derivative works therefrom without the express permission of
     the copyright owners is prohibited.
-->

<Included>
    <Decoders>
        <!-- DOLBY_UDC -->
        <MediaCodec name="OMX.dolby.ac3.decoder" type="audio/ac3">
            <Limit name="channel-count" max="6" />
            <Limit name="sample-rate" ranges="32000,44100,48000" />
            <Limit name="bitrate" range="32000-640000" />
        </MediaCodec>
        <MediaCodec name="OMX.dolby.eac3.decoder" type="audio/eac3">
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="32000,44100,48000" />
            <Limit name="bitrate" range="32000-6144000" />
        </MediaCodec>
        <MediaCodec name="OMX.dolby.eac3_joc.decoder" type="audio/eac3-joc">
            <Limit name="channel-count" max="8" />
            <Limit name="sample-rate" ranges="48000" />
            <Limit name="bitrate" range="32000-6144000" />
        </MediaCodec>
        <!-- DOLBY_UDC END -->
        <!-- DOLBY_AC4 -->
        <MediaCodec name="OMX.dolby.ac4.decoder" type="audio/ac4">
            <Limit name="channel-count" max="2" />
            <Limit name="sample-rate" ranges="48000" />
            <Limit name="bitrate" range="16000-2688000" />
        </MediaCodec>
        <!-- DOLBY_AC4 END -->
    </Decoders>
</Included>


================================================
FILE: uninstall.sh
================================================
mount -o rw,remount /data
[ ! "$MODPATH" ] && MODPATH=${0%/*}
[ ! "$MODID" ] && MODID=`basename "$MODPATH"`
UID=`id -u`
[ ! "$UID" ] && UID=0

# log
exec 2>/data/adb/$MODID\_uninstall.log
set -x

# run
. $MODPATH/function.sh

# cleaning
remove_cache
PKGS=`cat $MODPATH/package.txt`
#dPKGS=`cat $MODPATH/package-dolby.txt`
for PKG in $PKGS; do
  rm -rf /data/user*/"$UID"/$PKG
done
remove_sepolicy_rule
#drm -f /data/vendor/dolby/dax_sqlite3.db
#dresetprop -p --delete persist.vendor.dolby.loglevel
resetprop -p --delete persist.sony.effect.ahc
resetprop -p --delete persist.sony.mono_speaker
resetprop -p --delete persist.sony.effect.dolby_atmos
resetprop -p --delete persist.sony.enable.dolby_auto_mode
resetprop -p --delete persist.sony.effect.clear_audio_plus









================================================
FILE: unused/vendor/etc/init/vendor.dolby.hardware.dms@1.0-service.rc
================================================
service dms-hal-1-0 /vendor/bin/hw/vendor.dolby.hardware.dms@1.0-service
    class hal
    user media
    group audio media
on boot
    mkdir /data/vendor/dolby 0770 media media


================================================
FILE: unused/vendor/etc/media_codecs.xml
================================================
<?xml version="1.0" encoding="utf-8" ?>
<MediaCodecs>
    <Include href="media_codecs_somc_audio.xml" />
    <Include href="media_codecs_dolby_audio.xml" />
</MediaCodecs>


================================================
FILE: unused/vendor/etc/selinux/vendor_file_contexts
================================================
/(vendor|system/vendor)/bin/hw/vendor\.dolby\.hardware\.dms@1\.0-service		u:object_r:hal_dms_default_exec:s0
/data/vendor/dolby(/.*)?		u:object_r:vendor_data_file:s0

================================================
FILE: unused/vendor/etc/selinux/vendor_hwservice_contexts
================================================
vendor.dolby.hardware.dms::IDms          u:object_r:hal_dms_hwservice:s0

================================================
FILE: update.sh
================================================
copy_library() {
DIR=`find /data/app -type d -name *$PKG*`
DES=$DIR/lib/$ARCH
if [ "$ARCH" ]; then
  if echo "$ABI" | grep 64; then
    if echo $DES | grep $PKG; then
      mkdir -p $DES
      for NAMES in $NAME; do
        if [ -f /system/lib64/$NAMES ]; then
          cp -f /system/lib64/$NAMES $DES
        else
          cp -f /system/apex/*/lib64/$NAMES $DES
          cp -f /apex/*/lib64/$NAMES $DES
        fi
      done
      chmod 0755 $DIR/*
      chown -R 1000.1000 $DIR/lib
    fi
  else
    if echo $DES | grep $PKG; then
      mkdir -p $DES
      for NAMES in $NAME; do
        if [ -f /system/lib/$NAMES ]; then
          cp -f /system/lib/$NAMES $DES
        else
          cp -f /system/apex/*/lib/$NAMES $DES
          cp -f /apex/*/lib/$NAMES $DES
        fi
      done
      chmod 0755 $DIR/*
      chown -R 1000.1000 $DIR/lib
    fi
  fi
fi
}

ABI=`getprop ro.product.cpu.abi`
if [ "$ABI" == arm64-v8a ]; then
  ARCH=arm64
elif [ "$ABI" == armeabi-v7a ] || [ "$ABI" == armeabi ]; then
  ARCH=arm
elif [ "$ABI" == x86_64 ]; then
  ARCH=x64
elif [ "$ABI" == x86 ]; then
  ARCH=x86
elif [ "$ABI" == mips64 ]; then
  ARCH=mips64
elif [ "$ABI" == mips ]; then
  ARCH=mips
fi
PKG=com.sonyericsson.soundenhancement
NAME="libhscomp_jni.so libhscomp.so"
copy_library




Download .txt
gitextract_4il4hl4e/

├── .github/
│   └── FUNDING.yml
├── LICENSE
├── META-INF/
│   └── com/
│       └── google/
│           └── android/
│               ├── update-binary
│               └── updater-script
├── README.md
├── acdb.conf
├── action.sh
├── aml.sh
├── cleaner.sh
├── copy.sh
├── customize.sh
├── function.sh
├── module.prop
├── package-dolby.txt
├── package.txt
├── post-fs-data.sh
├── sepolicy.rule
├── service.sh
├── system/
│   ├── bin/
│   │   └── sefx
│   ├── etc/
│   │   ├── default-permissions/
│   │   │   └── default-com.sonyericsson.soundenhancement.xml
│   │   ├── permissions/
│   │   │   ├── com.sonyericsson.idd.xml
│   │   │   ├── com.sonymobile.getmore.api.xml
│   │   │   ├── privapp-com.sonyericsson.soundenhancement.xml
│   │   │   ├── privapp-com.sonymobile.audioutil.xml
│   │   │   ├── semc_audioeffectif.xml
│   │   │   └── sonyaudioeffect.xml
│   │   └── sysconfig/
│   │       ├── config-com.sonyericsson.soundenhancement.xml
│   │       └── config-com.sonymobile.audioutil.xml
│   ├── framework/
│   │   ├── com.sonyericsson.idd_impl.jar
│   │   ├── com.sonymobile.getmore.api.jar
│   │   ├── semc_audioeffectif.jar
│   │   └── sonyaudioeffect.jar
│   ├── priv-app/
│   │   ├── AudioSettings/
│   │   │   └── AudioSettings.apk
│   │   ├── ExtendedAudioService/
│   │   │   └── ExtendedAudioService.apk
│   │   └── SoundEnhancement/
│   │       └── SoundEnhancement.apk
│   └── vendor/
│       └── etc/
│           ├── media_codecs_somc_audio.xml
│           └── sony_effect/
│               └── effect_params.data
├── system.prop
├── system_dolby/
│   ├── etc/
│   │   ├── permissions/
│   │   │   ├── dolby_dax.xml
│   │   │   └── privapp-com.dolby.daxservice.xml
│   │   └── sysconfig/
│   │       ├── config-com.dolby.daxappui.xml
│   │       └── config-com.dolby.daxservice.xml
│   ├── framework/
│   │   └── dolby_dax.jar
│   ├── priv-app/
│   │   ├── DaxUI/
│   │   │   └── DaxUI.apk
│   │   └── daxService/
│   │       └── daxService.apk
│   └── vendor/
│       ├── bin/
│       │   └── hw/
│       │       └── vendor.dolby.hardware.dms@1.0-service
│       └── etc/
│           ├── dolby/
│           │   └── dax-default.xml
│           └── media_codecs_dolby_audio.xml
├── system_dolby_36dB/
│   └── priv-app/
│       └── DaxUI/
│           └── DaxUI.apk
├── uninstall.sh
├── unused/
│   └── vendor/
│       └── etc/
│           ├── init/
│           │   └── vendor.dolby.hardware.dms@1.0-service.rc
│           ├── media_codecs.xml
│           └── selinux/
│               ├── vendor_file_contexts
│               └── vendor_hwservice_contexts
└── update.sh
Condensed preview — 55 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (181K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 861,
    "preview": "# These are supported funding model platforms\n\ngithub: reiryuki # Replace with up to 4 GitHub Sponsors-enabled usernames"
  },
  {
    "path": "LICENSE",
    "chars": 1066,
    "preview": "MIT License\n\nCopyright (c) 2020 Rei Ryuki\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n"
  },
  {
    "path": "META-INF/com/google/android/update-binary",
    "chars": 612,
    "preview": "#!/sbin/sh\n\n#################\n# Initialization\n#################\n\numask 022\n\n# echo before loading util_functions\nui_pri"
  },
  {
    "path": "META-INF/com/google/android/updater-script",
    "chars": 8,
    "preview": "#MAGISK\n"
  },
  {
    "path": "README.md",
    "chars": 4346,
    "preview": "# Sound Enhancement & Dolby Atmos Sony Xperia 10 Magisk Module\n\n## DISCLAIMER\n- Dolby & Sony apps and blobs are owned by"
  },
  {
    "path": "acdb.conf",
    "chars": 528,
    "preview": "\n# Audio Configuration Database\n# gh\n\n\n# acdb.conf is a module configuration file sourced by the ACDB module to add or r"
  },
  {
    "path": "action.sh",
    "chars": 207,
    "preview": "MODPATH=${0%/*}\n\n# info\necho \"- Apps caches from this module will be re-cleaned\"\necho \"  at the next boot.\"\necho \" \"\n\n# "
  },
  {
    "path": "aml.sh",
    "chars": 15879,
    "preview": "[ ! \"$MODPATH\" ] && MODPATH=${0%/*}\n\n# destination\n[ ! \"$libdir\" ] && libdir=/vendor\nMODAECS=`find $MODPATH -type f -nam"
  },
  {
    "path": "cleaner.sh",
    "chars": 247,
    "preview": "[ ! \"$MODPATH\" ] && MODPATH=${0%/*}\nUID=`id -u`\n\n# run\n. $MODPATH/function.sh\n\n# cleaning\nremove_cache\nPKGS=`cat $MODPAT"
  },
  {
    "path": "copy.sh",
    "chars": 721,
    "preview": "[ ! \"$MODPATH\" ] && MODPATH=${0%/*}\n\n# function\ncopy_dir_file() {\n  mkdir -p `dirname \"$2\"`\n  cp -af \"$1\" \"$2\"\n}\n\n# audi"
  },
  {
    "path": "customize.sh",
    "chars": 40501,
    "preview": "# space\nui_print \" \"\n\n# var\nUID=`id -u`\n[ ! \"$UID\" ] && UID=0\nFIRARCH=`grep_get_prop ro.bionic.arch`\nSECARCH=`grep_get_p"
  },
  {
    "path": "function.sh",
    "chars": 7636,
    "preview": "# function\nremove_cache() {\nFILES=`find $MODPATH -type f -name *.apk | sed 's|.apk||g'`\nAPPS=`for FILE in $FILES; do bas"
  },
  {
    "path": "module.prop",
    "chars": 276,
    "preview": "id=SoundEnhancement\nname=Sound Enhancement Sony Xperia 10\nversion=v1.1.9\nversionCode=119\nauthor=Rei Ryuki the Fixer\ndesc"
  },
  {
    "path": "package-dolby.txt",
    "chars": 137,
    "preview": "com.sonyericsson.soundenhancement\ncom.sonymobile.audioutil\ncom.reiryuki.soundenhancementlauncher\ncom.dolby.daxappui\ncom."
  },
  {
    "path": "package.txt",
    "chars": 97,
    "preview": "com.sonyericsson.soundenhancement\ncom.sonymobile.audioutil\ncom.reiryuki.soundenhancementlauncher\n"
  },
  {
    "path": "post-fs-data.sh",
    "chars": 5311,
    "preview": "mount -o rw,remount /data\nMODPATH=${0%/*}\n\n# log\nexec 2>$MODPATH/debug-pfsd.log\nset -x\n\n# var\nABI=`getprop ro.product.cp"
  },
  {
    "path": "sepolicy.rule",
    "chars": 6870,
    "preview": "## Dolby\n\n# debug\nallow system_server system_file file write\n\n# context\ncreate { system_lib_file vendor_file vendor_conf"
  },
  {
    "path": "service.sh",
    "chars": 8716,
    "preview": "MODPATH=${0%/*}\n\n# log\nLOGFILE=$MODPATH/debug.log\nexec 2>$LOGFILE\nset -x\n\n# var\nAPI=`getprop ro.build.version.sdk`\nif [ "
  },
  {
    "path": "system/bin/sefx",
    "chars": 2894,
    "preview": "#!/bin/sh\n\n# function\nstart_broadcast() {\nam broadcast -a android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION --es an"
  },
  {
    "path": "system/etc/default-permissions/default-com.sonyericsson.soundenhancement.xml",
    "chars": 236,
    "preview": "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<exceptions>\n    <exception package=\"com.sonyericsson.soundenha"
  },
  {
    "path": "system/etc/permissions/com.sonyericsson.idd.xml",
    "chars": 390,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <library name=\"com.sonyericsson.idd\"\n        file=\"/system/fram"
  },
  {
    "path": "system/etc/permissions/com.sonymobile.getmore.api.xml",
    "chars": 181,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <library name=\"com.sonymobile.getmore.api\"\n        file=\"/syste"
  },
  {
    "path": "system/etc/permissions/privapp-com.sonyericsson.soundenhancement.xml",
    "chars": 584,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <privapp-permissions package=\"com.sonyericsson.soundenhancement"
  },
  {
    "path": "system/etc/permissions/privapp-com.sonymobile.audioutil.xml",
    "chars": 356,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <privapp-permissions package=\"com.sonymobile.audioutil\">\n      "
  },
  {
    "path": "system/etc/permissions/semc_audioeffectif.xml",
    "chars": 698,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <library name=\"semc_audioeffectif\"\n        file=\"/system/framew"
  },
  {
    "path": "system/etc/permissions/sonyaudioeffect.xml",
    "chars": 159,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <library name=\"sonyaudioeffect\"\n        file=\"/system/framework"
  },
  {
    "path": "system/etc/sysconfig/config-com.sonyericsson.soundenhancement.xml",
    "chars": 445,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<config>\r\n    <hidden-api-whitelisted-app package=\"com.sonyericsson.soundenhance"
  },
  {
    "path": "system/etc/sysconfig/config-com.sonymobile.audioutil.xml",
    "chars": 131,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<config>\r\n    <hidden-api-whitelisted-app package=\"com.sonymobile.audioutil\"/>\r\n"
  },
  {
    "path": "system/vendor/etc/media_codecs_somc_audio.xml",
    "chars": 353,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Included>\n    <Decoders>\n        <MediaCodec name=\"OMX.somc.alac.decoder\" type="
  },
  {
    "path": "system/vendor/etc/sony_effect/effect_params.data",
    "chars": 71,
    "preview": "xloud_strength:1,\nca_chsep_coef:-83,\nca_plus_sp_eq_coefs:0,0,0,0,0,0,\n\n"
  },
  {
    "path": "system.prop",
    "chars": 54,
    "preview": "# prevent bootloop\nro.control_privapp_permissions=log\n"
  },
  {
    "path": "system_dolby/etc/permissions/dolby_dax.xml",
    "chars": 148,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<permissions>\n    <library name=\"dolby_dax\"\n        file=\"/system/framework/dolb"
  },
  {
    "path": "system_dolby/etc/permissions/privapp-com.dolby.daxservice.xml",
    "chars": 434,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<permissions>\n    <privapp-permissions package=\"com.dolby.daxservice\">\n        <p"
  },
  {
    "path": "system_dolby/etc/sysconfig/config-com.dolby.daxappui.xml",
    "chars": 125,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<config>\r\n    <hidden-api-whitelisted-app package=\"com.dolby.daxappui\"/>\r\n</conf"
  },
  {
    "path": "system_dolby/etc/sysconfig/config-com.dolby.daxservice.xml",
    "chars": 127,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<config>\r\n    <hidden-api-whitelisted-app package=\"com.dolby.daxservice\"/>\r\n</co"
  },
  {
    "path": "system_dolby/vendor/etc/dolby/dax-default.xml",
    "chars": 61248,
    "preview": "<?xml version='1.0' encoding='UTF-8'?>\n<device_data xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"htt"
  },
  {
    "path": "system_dolby/vendor/etc/media_codecs_dolby_audio.xml",
    "chars": 2495,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!-- Copyright 2016 The Android Open Source Project\n\n     Licensed under the Apa"
  },
  {
    "path": "uninstall.sh",
    "chars": 770,
    "preview": "mount -o rw,remount /data\n[ ! \"$MODPATH\" ] && MODPATH=${0%/*}\n[ ! \"$MODID\" ] && MODID=`basename \"$MODPATH\"`\nUID=`id -u`\n"
  },
  {
    "path": "unused/vendor/etc/init/vendor.dolby.hardware.dms@1.0-service.rc",
    "chars": 178,
    "preview": "service dms-hal-1-0 /vendor/bin/hw/vendor.dolby.hardware.dms@1.0-service\n    class hal\n    user media\n    group audio me"
  },
  {
    "path": "unused/vendor/etc/media_codecs.xml",
    "chars": 172,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<MediaCodecs>\n    <Include href=\"media_codecs_somc_audio.xml\" />\n    <Include hr"
  },
  {
    "path": "unused/vendor/etc/selinux/vendor_file_contexts",
    "chars": 165,
    "preview": "/(vendor|system/vendor)/bin/hw/vendor\\.dolby\\.hardware\\.dms@1\\.0-service\t\tu:object_r:hal_dms_default_exec:s0\n/data/vendo"
  },
  {
    "path": "unused/vendor/etc/selinux/vendor_hwservice_contexts",
    "chars": 72,
    "preview": "vendor.dolby.hardware.dms::IDms          u:object_r:hal_dms_hwservice:s0"
  },
  {
    "path": "update.sh",
    "chars": 1284,
    "preview": "copy_library() {\nDIR=`find /data/app -type d -name *$PKG*`\nDES=$DIR/lib/$ARCH\nif [ \"$ARCH\" ]; then\n  if echo \"$ABI\" | gr"
  }
]

// ... and 12 more files (download for full content)

About this extraction

This page contains the full source code of the reiryuki/Sound-Enhancement-Sony-Xperia-10-Magisk-Module GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 55 files (163.9 KB), approximately 54.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!