├── .gitattributes
├── .github
└── FUNDING.yml
├── .gitignore
├── AudioModificationLibrary.sh
├── LICENSE
├── META-INF
└── com
│ └── google
│ └── android
│ ├── update-binary
│ └── updater-script
├── README.md
├── changelog.md
├── customize.sh
├── module.prop
├── post-fs-data.sh
├── sepolicy.rule
├── service.sh
├── system
└── vendor
│ └── placeholder
├── uninstall.sh
└── update.json
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Declare files that will always have LF line endings on checkout.
2 | *.sh text eol=lf
3 | *.prop text eol=lf
4 | *.md text eol=lf
5 | META-INF/** text eol=lf
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: reiryuki # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: reiryuki # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: reiryuki # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: https://www.paypal.me/reiryuki # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/AudioModificationLibrary.sh:
--------------------------------------------------------------------------------
1 | #libam3daudioenhancement.so~6723dd80-f0b7-11e0-98a2-0002a5d5c51b
2 | patch_cfgs am3daudioenhancement 6723dd80-f0b7-11e0-98a2-0002a5d5c51b am3daudioenhancement $libfile
3 | #libv4a_fx.so~41d3c987-e6cf-11e3-a88a-11aba5d5c51b
4 | patch_cfgs v4a_standard_fx 41d3c987-e6cf-11e3-a88a-11aba5d5c51b v4a_fx $libfile
5 | #libv4a_fx_ics.so~41d3c987-e6cf-11e3-a88a-11aba5d5c51b
6 | patch_cfgs v4a_standard_fx 41d3c987-e6cf-11e3-a88a-11aba5d5c51b v4a_fx $libfile
7 | #libv4a_xhifi_ics.so~d92c3a90-3e26-11e2-a25f-0800200c9a66
8 | patch_cfgs v4a_standard_xhifi d92c3a90-3e26-11e2-a25f-0800200c9a66 v4a_xhifi $libfile
9 | #libhwdax.so~9d4921da-8225-4f29-aefa-6e6f69726861
10 | patch_cfgs -pl dax 9d4921da-8225-4f29-aefa-6e6f69726861 dax_sw 6ab06da4-c516-4611-8166-6168726e6f69 $(dirname $libfile)/libswdax.so dax_hw a0c30891-8246-4aef-b8ad-696f6e726861 $libfile
11 | #libswdax.so~9d4921da-8225-4f29-aefa-6e6f69726861
12 | patch_cfgs dax 9d4921da-8225-4f29-aefa-6e6f69726861 dax $libfile
13 | #libswdap.so~9d4921da-8225-4f29-aefa-39537a04bcaa
14 | patch_cfgs dap 9d4921da-8225-4f29-aefa-39537a04bcaa dap $libfile
15 | #libhwdap.so~a0c30891-8246-4aef-b8ad-d53e26da0253
16 | patch_cfgs -pl dap 9d4921da-8225-4f29-aefa-6e6f69726861 dap_sw 6ab06da4-c516-4611-8166-452799218539 $(dirname $libfile)/libswdap.so dap_hw a0c30891-8246-4aef-b8ad-d53e26da0253 $libfile
17 | #libdseffect.so~9d4921da-8225-4f29-aefa-39537a04bcaa
18 | patch_cfgs dsplus 9d4921da-8225-4f29-aefa-39537a04bcaa ds $libfile
19 | #libswvlldp.so~3783c334-d3a0-4d13-874f-0032e5fb80e2
20 | patch_cfgs vlldp 3783c334-d3a0-4d13-874f-0032e5fb80e2 vlldp $libfile
21 | patch_cfgs -ole music atmos 9d4921da-8225-4f29-aefa-aacb40a73593 atmos $(dirname $libfile)/libatmos.so
22 | #libicepower.so~f1c02420-777f-11e3-981f-0800200c9a66
23 | patch_cfgs -l icepower $libfile
24 | patch_cfgs -e icepower_algo f1c02420-777f-11e3-981f-0800200c9a66 icepower
25 | patch_cfgs -e icepower_eq 50dbef80-4ad4-11e3-8f96-0800200c9a66 icepower
26 | patch_cfgs -e icepower_test e5456320-5391-11e3-8f96-0800200c9a66 icepower
27 | patch_cfgs -e icepower_load bf51a790-512b-11e3-8f96-0800200c9a66 icepower
28 | patch_cfgs -e icepower_null 63509430-52aa-11e3-8f96-0800200c9a66 icepower
29 | #libarkamys.so~17852d50-161e-11e2-892e-0800200c9a66
30 | patch_cfgs -ole music Arkamysfx 17852d50-161e-11e2-892e-0800200c9a66 arkamys $libfile
31 | #libdirac.so~4c6383e0-ff7d-11e0-b6d8-0002a5d5c51b
32 | patch_cfgs dirac 4c6383e0-ff7d-11e0-b6d8-0002a5d5c51b dirac $libfile
33 | patch_cfgs -e dirac_controller b437f4de-da28-449b-9673-667f8b9643fe dirac
34 | patch_cfgs -e dirac_music b437f4de-da28-449b-9673-667f8b964304 dirac
35 | #libdirac.so~e069d9e0-8329-11df-9168-0002a5d5c51b
36 | patch_cfgs -ole music dirac e069d9e0-8329-11df-9168-0002a5d5c51b dirac $libfile
37 | #libjamesdsp.so~f27317f4-c984-4de6-9a90-545759495bf2
38 | patch_cfgs jamesdsp f27317f4-c984-4de6-9a90-545759495bf2 jdsp $libfile
39 | #libmaxxeffect-cembedded.so~ae12da60-99ac-11df-b456-0002a5d5c51b
40 | patch_cfgs -ole music maxxaudio3 ae12da60-99ac-11df-b456-0002a5d5c51b maxxaudio3 $libfile
41 | #libbassboostMz.so~850b6319-bf66-4f93-bec0-dc6964367786
42 | patch_cfgs bassboostMz 850b6319-bf66-4f93-bec0-dc6964367786 bassboostMz $libfile
43 | patch_cfgs virtualizerMz 0e9779c9-4e8f-494d-b2b1-b4ad4e37c54c virtualizerMz $(dirname $libfile)/libvirtualizerMz.so
44 | patch_cfgs livemusicMz 0bbc89fe-52dc-4c40-8211-cae4da538b50 livemusicMz $(dirname $libfile)/liblivemusicMz.so
45 | patch_cfgs equalizerMz 9626da93-9c71-4bb2-8e23-9fc707fb9703 equalizerMz $(dirname $libfile)/ibequalizerMz.so
46 | #libsonysweffect.so~50786e95-da76-4557-976b-7981bdf6feb9
47 | patch_cfgs -qle mic,camcorder ZNR b8a031e0-6bbf-11e5-b9ef-0002a5d5c51b znrwrapper $(dirname $libfile)/libznrwrapper.so
48 | patch_cfgs -pl sonyeffect af8da7e0-2ca1-11e3-b71d-0002a5d5c51b sonyeffect_sw 50786e95-da76-4557-976b-7981bdf6feb9 $libfile sonyeffect_hw f9ed8ae0-1b9c-11e4-8900-0002a5d5c51b $(dirname $libfile)/libsonypostprocbundle.so
49 | #libatmos.so~74697567-7261-6564-6864-65726f206678
50 | patch_cfgs dolbyatmos 74697567-7261-6564-6864-65726f206678 dolbyatmos $libfile
51 | osp_detect "alarm notification ring"
52 | #libswdap_ds1se.so~74697567-7261-6564-6864-65726f206678
53 | patch_cfgs dolbyatmos 74697567-7261-6564-6864-65726f206678 dolbyatmos $libfile
54 | osp_detect "alarm notification ring"
55 | #libdtsaudio.so~146edfc0-7ed2-11e4-80eb-0002a5d5c51b
56 | patch_cfgs -ole music dtsaudio 146edfc0-7ed2-11e4-80eb-0002a5d5c51b dtsaudio $libfile
57 | #libv4a_re.so~90380da3-8536-4744-a6a3-5731970e640f
58 | patch_cfgs v4a_re 90380da3-8536-4744-a6a3-5731970e640f v4a_re $libfile
59 | #end
60 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Rei Ryuki
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/update-binary:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 |
3 | #################
4 | # Initialization
5 | #################
6 |
7 | umask 022
8 |
9 | # echo before loading util_functions
10 | ui_print() { echo "$1"; }
11 |
12 | require_new_magisk() {
13 | ui_print "*******************************"
14 | ui_print " Please install Magisk v20.4+! "
15 | ui_print "*******************************"
16 | exit 1
17 | }
18 |
19 | #########################
20 | # Load util_functions.sh
21 | #########################
22 |
23 | OUTFD=$2
24 | ZIPFILE=$3
25 |
26 | mount /data 2>/dev/null
27 |
28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
29 | . /data/adb/magisk/util_functions.sh
30 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
31 |
32 | install_module
33 | exit 0
34 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/updater-script:
--------------------------------------------------------------------------------
1 | #MAGISK
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Audio Modification Library Ryuki Mod Magisk Module
2 | Audio Modification Library (AML) is a compatibility framework originally created by zackptg5 & ahrion that allows the seamless integration of multiple audio mods for Magisk installs. Enables supported audio mods to share the same needed files sudo as audio_effects. [More details in support thread](https://forum.xda-developers.com/apps/magisk/mod-audio-modification-library-t3745466).
3 | To uninstall, PLEASE REMOVE VIA MAGISK/KERNELSU APP ONLY
4 |
5 | ## Changelog
6 | * See [Changelog](changelog.md)
7 |
8 | ## Source Code
9 | * Module [GitHub](https://github.com/Zackptg5/Audio-Modification-Library)
10 |
11 | ## Ryuki Mod Version Adventages
12 | * Fix audio service restarts on some weird ROMs
13 | * /odm/etc/ & /my_product/etc/ audio files mount bind support in Magisk official
14 | * Support any module that copies audio files via post-fs-data.sh instead of customize.sh
15 | * Does not copy/modify \*audio\*effects\*spatializer\*.xml that causes conflict in audio flinger
16 | * Prevent /data modifying failure in some devices
17 | * Prevent command failure caused by selinux denial
18 | * Does not need to reinstall if Android SDK API version is changed nor if switched from Magisk official to Magisk Delta/Kitsune Mask and vice-versa
19 | * Fix bugs & permissions
20 |
21 | ## Ryuki Mod Version Download Link and Changelog
22 | * Update via Magisk/KernelSU app is still directed to official version, so the Ryuki Mod version can only be updated/downloaded from here: https://www.pling.com/p/1981006/
23 |
24 | ## Support & Bug Report
25 | - https://t.me/ryukinotes/54
26 | - If you don't do above, issues will be closed immediately
27 |
28 | ## Credits and Contributors
29 | - @ShadoV90
30 | - https://t.me/viperatmos
31 | - https://t.me/androidryukimodsdiscussions
32 | - You can contribute ideas about this Magisk Module here: https://t.me/androidappsportdevelopment
33 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | ### v5.1 - 7.15.2023
2 | * Fix for magisk delta
3 |
4 | ### v5.0 - 7.10.2023
5 | * Big thanks to @reiryuki for this update
6 | * Update to current magisk module template - minimum magisk v20.4
7 | * Context fix
8 | * Add stage_policy.conf support
9 | * Add KSU support
10 | * Add support for other partitions - requires ksu or magisk delta
11 | * Rework/simplify some scripting
12 | * Fix for disabling aml in manager
13 |
14 | ### v4.2 - 1.6.2023
15 | * Add support for V4A RE
16 |
17 | ### v4.1 - 1.31.2022
18 | * Add support for magisk 24 module update method
19 |
20 | ### v4.0 - 9.15.2020
21 | * Reworked boot scripts - no more time limitation
22 | * Misc bug fixes
23 | * Removed prop processing
24 | * Allow use of "aml.sh" in addition to ".aml.sh" scripts
25 | * Added support for another dolby mod
26 | * Updated for Android 11
27 | * Only copy files to aml if needed by other mods
28 |
29 | ### v3.5 - 4.22.2020
30 | * Fixed bug with proxy effect patching
31 |
32 | ### v3.4 - 4.9.2020
33 | * Fix perms
34 | * Bug fixes
35 |
36 | ### v3.3 - 03.26.2020
37 | * Fixes for Magisk v20.4
38 |
39 | ### v3.2 - 03.17.2020
40 | * Restructured script for better efficiency/faster running time - may fix xposed issues
41 | * Fix prop issue where non-aml supported mods were affected
42 | * Favor module .aml.sh scripts over built-ins
43 |
44 | ### v3.1 - 03.14.2020
45 | * Enhanced osp_detect - needed for some mods
46 | * Added chcon fix for Q - may fix issues some users have with v4a/jdsp
47 | * Use proper contexts for aml files
48 | * Clean up script a little bit
49 |
50 | ### v3.0 - 03.13.2020
51 | * Complete overhaul - most everything happens in the boot script now, no need for redunduncies
52 | * Added Guitardedhero's Dolby Atmos Pie/Q
53 | * Added Ainur DTS
54 | * Removed IceWizard
55 |
56 | ### v2.5 - 12.30.2019
57 | * Update to new magisk module template - compatible with magisk 19+ only
58 |
59 | ### v2.4 - 5.20.2019
60 | * Fix for DTS mod osp effect
61 |
62 | ### v2.3 - 5.10.2019
63 | * More fixes for system as root devices
64 |
65 | ### v2.2 - 5.9.2019
66 | * Fix bootmode installation for system as root devices
67 |
68 | ### v2.1 - 4.3.2019
69 | * Fixed uninstall bug
70 |
71 | ### v2.0 - 3.28.2019
72 | * Updated to new magisk template - compatible with magisk 18+ only
73 |
74 | ### v1.9.4 - 2.28.2019
75 | * Bug fixes with mod detection and whatnot
76 |
77 | ### v1.9.3 - 2.21.2019
78 | * Small bug fix
79 |
80 | ### v1.9.2 - 12.19.2018
81 | * Rework usb policy patching so it's only for separate module - not applied to add devices by default now
82 | * Various bug fixes
83 |
84 | ### v1.9.1 - 12.17.2018
85 | * Fixed old bug with upgrades
86 |
87 | ### v1.9 - 12.16.2018
88 | * Updated for magisk v18 while maintaining backwards compatibility to 15.3 for those problem devices
89 |
90 | ### v1.8.5 - 12.6.2018
91 | * Added usb fix for v4a/xhifi (and likely other audio apps as well)
92 |
93 | ### v1.8.4 - 11.28.2018
94 | * Added support for audio_platform_info xml files
95 |
96 | ### v1.8.3 - 11.5.2018
97 | * Have AML remove patches for disabled mods/not patch disabled mods
98 |
99 | ### v1.8.2 - 10.22.2018
100 | * Bug fixes for pre_processing patches
101 | * Added capability for multiple pre/post processing patches (See documentation on support thread for usage)
102 | * Proxy entries must include it's own uuid now - allows for custom UUIDs (See documentation on support thread for usage)
103 | * Added Sony Xperia XZ2
104 |
105 | ### v1.8.1 - 9.2.2018
106 | * Updated to magisk 17 template while maintaining backwards compatibility for magisk 15.3+
107 |
108 | ### v1.8 - 7.20.2018
109 | * Fix icewizard always showing error
110 | * Add capability to replace libraries and effects with patch_cfgs function (-r)
111 | * Change pre_processing patch_cfgs option to -q
112 | * Fix bug with proxy effects
113 | * Fix bugs with osp with xml files
114 | * Fix bug with squaresound
115 |
116 | ### v1.7.2 - 7.2.2018
117 | * Updated ice wizard patches
118 | * Delete osp rather than comment out
119 |
120 | ### v1.7.1 - 6.27.2018
121 | * Bug fix with osp_detect - should patch all cfgs now
122 |
123 | ### v1.7 - 6.19.2018
124 | * Added support for mixer_gains, audio_device, and sapa_feature xml files
125 | * Added RUNONCE option for custom AML scripts - allows them to only be run once instead of for each audio cfg file. Use this if your mod doesn't have cfg patches
126 | * Added COUNT variable. Can be used by custom AML scripts to determine how many times script has been run. Use this if your mod has cfg patches and other audio file patches
127 | * Fixed old bug with uninstall file restoration
128 | * Fixed bugs with boot script
129 | * Removed need to specify file with patch_cfgs function - make sure you update your aml.sh script for this
130 | * Added ainur squaresound
131 |
132 | ### v1.6.2 - 6.15.2018
133 | * Fixed mixed up libraries/effects
134 | * Fixed bug with acp
135 |
136 | ### v1.6.1 - 6.15.2018
137 | * Bug fixes for xml files
138 |
139 | ### v1.6 - 6.14.2018
140 | * Redid patching backend - huge thanks to Rezmir99 @xda-developers
141 | * Fully integrated aml.sh functionality - users can now user patch_cfgs function and LIBDIR variable like in AudioModificationLibrary.sh script - see support thread for instructions
142 |
143 | ### v1.5.7 - 4.26.2018
144 | * Add capability to import any audio mod with a ".aml.sh" file in the root of its magisk directory
145 |
146 | ### v1.5.6 - 4.12.2018
147 | * vendor file fix for devices with separate vendor partitions
148 | * misc fixes
149 |
150 | ### v1.5.5 - 4.12.2018
151 | * osp_detect fix
152 |
153 | ### v1.5.4 - 4.08.2018
154 | * dynamic effect removal fix
155 |
156 | ### v1.5.3 - 4.07.2018
157 | * V4A Fix
158 |
159 | ### v1.5.2 - 4.07.2018
160 | * Added materialized v4a
161 | * Use dynamic effect removal
162 |
163 | ### v1.5.1 - 3.30.2018
164 | * Fix effect removals
165 |
166 | ### v1.5 - 3.28.2018
167 | * Add soundalive and dha effect removal (needed for some samsung devices)
168 | * Pull ACP patch from ACP mod rather than static patch
169 | * Fine tuned osp patching
170 |
171 | ### v1.4.8 - 3.22.2018
172 | * Replaced ubdr with redone ACP
173 |
174 | ### v1.4.7 - 3.1.2018
175 | * Added new oreo Ice port
176 |
177 | ### v1.4.6 - 3.1.2018
178 | * Fixed lib directory issue with sauron
179 |
180 | ### v1.4.5 - 2.25.2018
181 | * Fixed vendor files in bootmode for devices with separate vendor partitions
182 | * Added detection of more policy files
183 |
184 | ### v1.4.4 - 2.16.2018
185 | * Fix prop logic for prop files that have empty lines in them
186 | * Fix xml file music_helper/sa3d patching
187 |
188 | ### v1.4.3 - 2.14.2018
189 | * Fix osp for htc and other weird devices
190 | * Get rid of vendor cfg creation - no need for it
191 |
192 | ### v1.4.2 - 2.12.2018
193 | * More osp fixes
194 |
195 | ### v1.4.1 - 2.9.2018
196 | * Attempt fix of osp
197 | * Added sa3d removal for samsung devices
198 |
199 | ### v1.4 - 2.9.2018
200 | * Fixed osp typo
201 |
202 | ### v1.3 - 2.8.2018
203 | * Fixed issues with output_session_processing patching
204 |
205 | ### v1.2 - 2.7.2018
206 | * Fixed janky bootmode stuff
207 | * Fix uninstall/upgrade when a supported audio mod has just been upgraded in bootmode
208 |
209 | ### v1.1 - 2.6.2018
210 | * Fixes for xml files
211 | * Various other fixes/improvements
212 |
213 | ### v1.0 - 2.5.2018
214 | * REBIRTH and initial release
215 |
--------------------------------------------------------------------------------
/customize.sh:
--------------------------------------------------------------------------------
1 | # space
2 | ui_print " "
3 |
4 | # var
5 | UID=`id -u`
6 | [ ! "$UID" ] && UID=0
7 | [ -z $NVBASE ] && NVBASE=/data/adb
8 |
9 | # log
10 | if [ "$BOOTMODE" != true ]; then
11 | FILE=/data/media/"$UID"/$MODID\_recovery.log
12 | ui_print "- Log will be saved at $FILE"
13 | exec 2>$FILE
14 | ui_print " "
15 | fi
16 |
17 | # optionals
18 | OPTIONALS=/data/media/"$UID"/optionals.prop
19 | if [ ! -f $OPTIONALS ]; then
20 | touch $OPTIONALS
21 | fi
22 |
23 | # debug
24 | if [ "`grep_prop debug.log $OPTIONALS`" == 1 ]; then
25 | ui_print "- The install log will contain detailed information"
26 | set -x
27 | ui_print " "
28 | fi
29 |
30 | # recovery
31 | if [ "$BOOTMODE" != true ]; then
32 | MODPATH_UPDATE=`echo $MODPATH | sed 's|modules/|modules_update/|g'`
33 | rm -f $MODPATH/update
34 | rm -rf $MODPATH_UPDATE
35 | fi
36 |
37 | # info
38 | MODVER=`grep_prop version $MODPATH/module.prop`
39 | MODVERCODE=`grep_prop versionCode $MODPATH/module.prop`
40 | ui_print " ID=$MODID"
41 | ui_print " Version=$MODVER"
42 | ui_print " VersionCode=$MODVERCODE"
43 | if [ "$KSU" == true ]; then
44 | ui_print " KSUVersion=$KSU_VER"
45 | ui_print " KSUVersionCode=$KSU_VER_CODE"
46 | ui_print " KSUKernelVersionCode=$KSU_KERNEL_VER_CODE"
47 | else
48 | ui_print " MagiskVersion=$MAGISK_VER"
49 | ui_print " MagiskVersionCode=$MAGISK_VER_CODE"
50 | fi
51 | ui_print " "
52 |
53 | # note
54 | ui_print "- Modules detection and patching happens at boot"
55 | ui_print " The boot script handles everything"
56 | ui_print " Disabled modules will be ignored"
57 | ui_print " "
58 |
59 | # Escape each backslash and space since shell will expand it during echo
60 | sed -i -e 's/\\/\\\\/g' -e 's/\ /\\ /g' $MODPATH/AudioModificationLibrary.sh
61 | # Separate AML into individual files for each audio mod
62 | mkdir $MODPATH/.scripts
63 | while read line; do
64 | case $line in
65 | \#*) if [ "$uuid" ]; then
66 | echo " " >> $MODPATH/.scripts/$uuid.sh
67 | fi
68 | uuid=$(echo "$line" | sed "s/#//g");;
69 | *) echo "$line" >> $MODPATH/.scripts/$uuid.sh;;
70 | esac
71 | done < $MODPATH/AudioModificationLibrary.sh
72 | rm -f $MODPATH/AudioModificationLibrary.sh
73 | # Generate libs var for faster script running
74 | for i in $MODPATH/.scripts/*; do
75 | libs="$libs-name \"$(basename $i | sed "s/~.*//g")\" "
76 | done
77 | libs="$(echo $libs | sed "s/\" /\" -o /g")"
78 | sed -i -e "s||$libs|g" $MODPATH/service.sh
79 |
80 | # Set vars in script
81 | [ -z $SERVICED ] && SERVICED=$NVBASE/service.d
82 | amldir=$NVBASE/aml
83 | for i in amldir; do
84 | for j in post-fs-data service uninstall; do
85 | sed -i "s|$i=|$i=$(eval echo \$$i)|g" $MODPATH/$j.sh
86 | done
87 | done
88 |
89 | # Place fallback script in the event idiot user deletes aml module in file explorer
90 | mkdir $SERVICED 2>/dev/null
91 | cp -f $MODPATH/uninstall.sh $SERVICED/aml.sh
92 | chmod 0755 $SERVICED/aml.sh
93 | sed -i -e "3a[ -d \"\$moddir/$MODID\" -a ! -f \"\$moddir/$MODID/disable\" ] && exit 0" -e "s|^moddir=.*|moddir=$NVBASE/modules|g" $SERVICED/aml.sh
94 | echo 'rm -f $0' >> $SERVICED/aml.sh
95 |
96 | rm -f $MODPATH/install.zip
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/module.prop:
--------------------------------------------------------------------------------
1 | id=aml
2 | name=Audio Modification Library Ryuki Mod
3 | version=v5.1_ryukimod.6
4 | versionCode=59
5 | author=Rei Ryuki the Fixer
6 | description=Audio Modification Library (AML) is a framework originally created by zackptg5 & ahrion that allows the seamless integration of multiple audio mods in Magisk. Ryuki Mod version has advantages that are not or have not been owned by the official version.
7 | support=https://forum.xda-developers.com/apps/magisk/module-audio-modification-library-t3579612
8 | updateJson=https://raw.githubusercontent.com/Zackptg5/Audio-Modification-Library/master/update.json
9 |
--------------------------------------------------------------------------------
/post-fs-data.sh:
--------------------------------------------------------------------------------
1 | # Some devices fails to modify /data at this time without remounting
2 | mount -o rw,remount /data
3 |
4 | # Variables
5 | MODPATH="${0%/*}"
6 | amldir=
7 | API="$(getprop ro.build.version.sdk)"
8 | filenames="*audio*effects*.conf -o -name *audio*effects*.xml\
9 | -o -name *policy*.conf -o -name *policy*.xml\
10 | -o -name *mixer*paths*.xml -o -name *mixer*gains*.xml\
11 | -o -name *audio*device*.xml -o -name *sapa*feature*.xml\
12 | -o -name *audio*platform*info*.xml -o -name *audio*configs*.xml"
13 |
14 | # Functions
15 | set_perm() {
16 | chown $2:$3 $1 || return 1
17 | chmod $4 $1 || return 1
18 | CON=$5
19 | [ -z $CON ] && CON=u:object_r:system_file:s0
20 | chcon $CON $1 || return 1
21 | }
22 | set_perm_recursive() {
23 | find $1 -type d 2>/dev/null | while read dir; do
24 | set_perm $dir $2 $3 $4 $6
25 | done
26 | find $1 -type f -o -type l 2>/dev/null | while read file; do
27 | set_perm $file $2 $3 $5 $6
28 | done
29 | }
30 | cp_mv() {
31 | mkdir -p "$(dirname "$3")"
32 | cp -af "$2" "$3"
33 | [ "$1" == "-m" ] && rm -f $2 || true
34 | }
35 | osp_detect() {
36 | local spaces effects type="$1"
37 | local files=$(find $MODPATH -type f -name "*audio*effects*.conf" -o -name "*audio*effects*.xml")
38 | for file in $files; do
39 | for osp in $type; do
40 | case $file in
41 | *.conf) spaces=$(sed -n "/^output_session_processing {/,/^}/ {/^ *$osp {/p}" $file | sed -r "s/( *).*/\1/g")
42 | effects=$(sed -n "/^output_session_processing {/,/^}/ {/^$spaces\$osp {/,/^$spaces}/p}" $file | grep -E "^$spaces +[A-Za-z]+" | sed -r "s/( *.*) .*/\1/g")
43 | for effect in ${effects}; do
44 | spaces=$(sed -n "/^effects {/,/^}/ {/^ *$effect {/p}" $file | sed -r "s/( *).*/\1/g")
45 | [ "$effect" != "atmos" -a "$effect" != "dtsaudio" ] && sed -i "/^effects {/,/^}/ {/^$spaces$effect {/,/^$spaces}/d}" $file
46 | done
47 | ;;
48 | *.xml) effects=$(sed -n "/^ *$/,/^ *<\/postprocess>$/ {/^ *$/,/^ *<\/stream>$/ {//d; /<\/stream>/d; s///g; s/ *//g; p}}" $file)
49 | for effect in ${effects}; do
50 | [ "$effect" != "atmos" -a "$effect" != "dtsaudio" ] && sed -i "/^\( *\)/d" $file
51 | done
52 | ;;
53 | esac
54 | done
55 | done
56 | return 0
57 | }
58 |
59 | # Debug
60 | exec 2>$MODPATH/debug-pfsd.log
61 | set -x
62 |
63 | # Restore and reset
64 | . $MODPATH/uninstall.sh
65 | moddir="$(dirname $MODPATH)" # Changed by uninstall script
66 | rm -rf $amldir $(find $MODPATH/system $MODPATH/vendor -type f) $MODPATH/errors.txt $MODPATH/system.prop 2>/dev/null
67 | [ -f "$moddir/acdb/post-fs-data.sh" ] && mv -f $moddir/acdb/post-fs-data.sh $moddir/acdb/post-fs-data.sh.bak
68 | mkdir $amldir
69 | # Don't follow symlinks
70 | files="$(find /system /odm /my_product -type f -name $filenames)"
71 | for file in $files; do
72 | name=$(echo "$file" | sed 's|/system||g')
73 | cp_mv -c $file $MODPATH/system$name
74 | done
75 | files="$(find /vendor -type f -name $filenames)"
76 | if [ -L $MODPATH/system/vendor ]; then
77 | mkdir -p $MODPATH/vendor
78 | fi
79 | for file in $files; do
80 | if [ -L $MODPATH/system/vendor ]; then
81 | cp_mv -c $file $MODPATH$file
82 | else
83 | cp_mv -c $file $MODPATH/system$file
84 | fi
85 | done
86 | rm -f `find $MODPATH -type f -name *audio*effects*spatializer*.xml`
87 | osp_detect "music"
88 |
89 | # Detect/move audio mod files
90 | for mod in $(find $moddir/* -maxdepth 0 -type d ! -name aml -a ! -name 'lost+found'); do
91 | modname="$(basename $mod)"
92 | [ -f "$mod/disable" ] && continue
93 | # Move files
94 | files="$(find $mod -type f -name $filenames 2>/dev/null)"
95 | [ "$files" ] && echo "$modname" >> $amldir/modlist || continue
96 | for file in $files; do
97 | cp_mv -m $file $amldir/$modname$(echo "$file" | sed "s|$mod||g")
98 | done
99 | # Chcon fix for Android O+
100 | if [ "$API" -ge 26 ]; then
101 | if [ -L $mod/system/vendor ] && [ -d $mod/vendor ]; then
102 | chcon -R u:object_r:vendor_file:s0 $mod/vendor/lib*/soundfx 2>/dev/null
103 | else
104 | chcon -R u:object_r:vendor_file:s0 $mod/system/vendor/lib*/soundfx 2>/dev/null
105 | fi
106 | fi
107 | done
108 |
109 | # Set perms and such
110 | if [ "$API" -ge 26 ]; then
111 | set_perm_recursive $MODPATH/system/odm/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0
112 | if [ -L $MODPATH/system/vendor ]; then
113 | set_perm_recursive $MODPATH/vendor 0 2000 0755 0644 u:object_r:vendor_file:s0
114 | set_perm_recursive $MODPATH/vendor/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0
115 | set_perm_recursive $MODPATH/vendor/odm/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0
116 | else
117 | set_perm_recursive $MODPATH/system/vendor 0 2000 0755 0644 u:object_r:vendor_file:s0
118 | set_perm_recursive $MODPATH/system/vendor/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0
119 | set_perm_recursive $MODPATH/system/vendor/odm/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0
120 | fi
121 | fi
122 | exit 0
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/sepolicy.rule:
--------------------------------------------------------------------------------
1 | # log
2 | allow system_server system_file file write
3 |
4 | # context
5 | create { system_lib_file vendor_file vendor_configs_file }
6 | allow { system_file system_lib_file vendor_file vendor_configs_file } labeledfs filesystem associate
7 | allow init { system_file system_lib_file vendor_file vendor_configs_file } { dir file } relabelfrom
8 |
9 | # additional
10 | allow { hal_audio_default mtk_hal_audio audioserver } system_suspend_hwservice hwservice_manager find
11 | allow { hal_audio_default mtk_hal_audio audioserver } hal_system_suspend_service service_manager find
12 | 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 }
13 | allow { hal_audio_default mtk_hal_audio audioserver } { mnt_vendor_file system_prop vendor_default_prop } file { read open getattr }
14 | allow { hal_audio_default mtk_hal_audio audioserver } sysfs_wake_lock file { write open }
15 | allow { hal_audio_default mtk_hal_audio audioserver } { sysfs sysfs_boot_mode } file { read open }
16 | allow { hal_audio_default mtk_hal_audio audioserver } system_prop file map
17 | allow { hal_audio_default mtk_hal_audio audioserver } sysfs_net dir search
18 | allow { hal_audio_default mtk_hal_audio audioserver } { sysfs_net sysfs } dir { read open }
19 | allow { hal_audio_default mtk_hal_audio audioserver } logd_socket sock_file write
20 | allow { hal_audio_default mtk_hal_audio audioserver } logd unix_stream_socket connectto
21 | allow { hal_audio_default mtk_hal_audio audioserver } { diag_device vendor_diag_device } chr_file { read write open ioctl getattr }
22 | allow { hal_audio_default mtk_hal_audio audioserver } device chr_file { read write }
23 | allow { hal_audio_default mtk_hal_audio audioserver } system_suspend binder call
24 | 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
25 | allow hal_audio_default hal_audio_default capability2 block_suspend
26 | allow mtk_hal_audio mtk_hal_audio capability2 block_suspend
27 | allow audioserver audioserver capability2 block_suspend
28 | allow hal_audio_default hal_audio_default capability { sys_nice dac_override sys_admin dac_read_search }
29 | allow mtk_hal_audio mtk_hal_audio capability { sys_nice dac_override sys_admin dac_read_search }
30 | allow audioserver audioserver capability { sys_nice dac_override sys_admin dac_read_search }
31 | allow hal_audio_default hal_audio_default tcp_socket create
32 | allow mtk_hal_audio mtk_hal_audio tcp_socket create
33 | allow audioserver audioserver tcp_socket create
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/service.sh:
--------------------------------------------------------------------------------
1 | # Variables
2 | MODPATH="${0%/*}"
3 | moddir="$(dirname $MODPATH)"
4 | amldir=
5 | API="$(getprop ro.build.version.sdk)"
6 | [ "$API" -ge 26 ] && libdir="/vendor" || libdir="/system"
7 |
8 | # Functions
9 | cp_mv() {
10 | mkdir -p "$(dirname "$3")"
11 | cp -af "$2" "$3"
12 | [ "$1" == "-m" ] && rm -f $2 || true
13 | }
14 | osp_detect() {
15 | local spaces effects type="$1"
16 | local files=$(find $MODPATH -type f -name "*audio*effects*.conf" -o -name "*audio*effects*.xml")
17 | for file in $files; do
18 | for osp in $type; do
19 | case $file in
20 | *.conf) spaces=$(sed -n "/^output_session_processing {/,/^}/ {/^ *$osp {/p}" $file | sed -r "s/( *).*/\1/g")
21 | effects=$(sed -n "/^output_session_processing {/,/^}/ {/^$spaces\$osp {/,/^$spaces}/p}" $file | grep -E "^$spaces +[A-Za-z]+" | sed -r "s/( *.*) .*/\1/g")
22 | for effect in ${effects}; do
23 | spaces=$(sed -n "/^effects {/,/^}/ {/^ *$effect {/p}" $file | sed -r "s/( *).*/\1/g")
24 | [ "$effect" != "atmos" -a "$effect" != "dtsaudio" ] && sed -i "/^effects {/,/^}/ {/^$spaces$effect {/,/^$spaces}/d}" $file
25 | done
26 | ;;
27 | *.xml) effects=$(sed -n "/^ *$/,/^ *<\/postprocess>$/ {/^ *$/,/^ *<\/stream>$/ {//d; /<\/stream>/d; s///g; s/ *//g; p}}" $file)
28 | for effect in ${effects}; do
29 | [ "$effect" != "atmos" -a "$effect" != "dtsaudio" ] && sed -i "/^\( *\)/d" $file
30 | done
31 | ;;
32 | esac
33 | done
34 | done
35 | return 0
36 | }
37 | patch_cfgs() {
38 | local first=true files="" file lib=false effect=false outsp=false proxy=false replace=false libname libpath effname uid libname_sw uid_sw libname_hw uid_hw libpathsw libpathhw conf xml
39 | local opt=`getopt :fleoqpr "$@"`
40 | eval set -- "$opt"
41 | while true; do
42 | case "$1" in
43 | -f) files="placeholder"; shift;;
44 | -l) lib=true; first=false; shift;;
45 | -e) effect=true; first=false; shift;;
46 | -o) outsp=true; conf=output_session_processing; xml=postprocess; first=false; shift;;
47 | -q) outsp=true; conf=pre_processing; xml=preprocess; first=false; shift;;
48 | -p) proxy=true; effect=false; outsp=false; first=false; shift;;
49 | -r) replace=true; shift;;
50 | --) shift; break;;
51 | *) return 1;;
52 | esac
53 | done
54 | [ -z "$files" ] && files="$(find $MODPATH -type f -name "*audio*effects*.conf" -o -name "*audio*effects*.xml")" || { files="$1"; shift; }
55 | $first && { lib=true; effect=true; }
56 | if $proxy; then
57 | effname=$1; uid=${2:?}; shift 2
58 | libname_sw=$1; uid_sw=${2:?}; shift 2
59 | $lib && { libpathsw=$1; shift; }
60 | libname_hw=$1; uid_hw=${2:?}; shift 2
61 | $lib && { libpathhw=${1:?}; shift; }
62 | else
63 | $outsp && { type=${1:?}; shift; }
64 | { $effect || $outsp; } && { effname=${1:?}; shift; }
65 | $effect && { uid=${1:?}; shift; }
66 | { $lib || $effect; } && { libname=${1:?}; shift; }
67 | $lib && { libpath=${1:?}; shift; }
68 | fi
69 | for file in $files; do
70 | case "$file" in
71 | *.conf)
72 | if $proxy; then
73 | if $replace && [ "$(sed -n "/^effects {/,/^}/ {/^ $effname {/,/^ }/p}" $file)" ]; then
74 | spaces=$(sed -n "/^effects {/,/^}/ {/^ *$effname {/p}" $file | sed -r "s/( *).*/\1/g")
75 | sed -i "/^effects {/,/^}/ {/^$spaces$effname {/,/^$spaces}/d}" $file
76 | fi
77 | [ ! "$(sed -n "/^effects {/,/^}/ {/^ $effname {/,/^ }/p}" $file)" ] && sed -i "s/^effects {/effects {\n $effname {\n library proxy\n uuid $uid\n\n libsw {\n library $libname_sw\n uuid $uid_sw\n }\n\n libhw {\n library $libname_hw\n uuid $uid_hw\n }\n }/g" $file
78 | if $lib; then
79 | patch_cfgs -fl "$file" "proxy" "$libdir/lib/soundfx/libeffectproxy.so"
80 | if $replace; then
81 | patch_cfgs -frl "$file" "$libname_sw" "$libpathsw"
82 | patch_cfgs -frl "$file" "$libname_hw" "$libpathhw"
83 | else
84 | patch_cfgs -fl "$file" "$libname_sw" "$libpathsw"
85 | patch_cfgs -fl "$file" "$libname_hw" "$libpathhw"
86 | fi
87 | fi
88 | else
89 | if $lib; then
90 | if $replace && [ "$(sed -n "/^libraries {/,/^}/ {/^ *$libname {/,/}/p}" $file)" ]; then
91 | spaces=$(sed -n "/^libraries {/,/^}/ {/^ *$libname {/p}" $file | sed -r "s/( *).*/\1/g")
92 | sed -i "/^libraries {/,/^}/ {/^$spaces$libname {/,/^$spaces}/d}" $file
93 | fi
94 | [ ! "$(sed -n "/^libraries {/,/^}/ {/^ *$libname {/,/}/p}" $file)" ] && sed -i "s|^libraries {|libraries {\n $libname {\n path $libpath\n }|g" $file
95 | fi
96 | if $effect; then
97 | if $replace && [ "$(sed -n "/^effects {/,/^}/ {/^ *$effname {/,/}/p}" $file)" ]; then
98 | spaces=$(sed -n "/^effects {/,/^}/ {/^ *$effname {/p}" $file | sed -r "s/( *).*/\1/g")
99 | sed -i "/^effects {/,/^}/ {/^$spaces$effname {/,/^$spaces}/d}" $file
100 | fi
101 | [ ! "$(sed -n "/^effects {/,/^}/ {/^ *$effname {/,/}/p}" $file)" ] && sed -i "s|^effects {|effects {\n $effname {\n library $libname\n uuid $uid\n }|g" $file
102 | fi
103 | if $outsp && [ "$API" -ge 26 ]; then
104 | local OIFS=$IFS; local IFS=','
105 | for i in $type; do
106 | if [ ! "$(sed -n "/^$conf {/,/^}/p" $file)" ]; then
107 | echo -e "\n$conf {\n $i {\n $effname {\n }\n }\n}" >> $file
108 | elif [ ! "$(sed -n "/^$conf {/,/^}/ {/$i {/,/^ }/p}" $file)" ]; then
109 | sed -i "/^$conf {/,/^}/ s/$conf {/$conf {\n $i {\n $effname {\n }\n }/g" $file
110 | elif [ ! "$(sed -n "/^$conf {/,/^}/ {/$i {/,/^ }/ {/$effname {/,/}/p}}" $file)" ]; then
111 | sed -i "/^$conf {/,/^}/ {/$i {/,/^ }/ s/$i {/$i {\n $effname {\n }/}" $file
112 | fi
113 | done
114 | local IFS=$OIFS
115 | fi
116 | fi
117 | ;;
118 | *.xml)
119 | if $proxy; then
120 | if $replace && [ "$(sed -n "//,/<\/effects>/ {/^ */,/^ *<\/effectProxy>/p}" $file)" -o "$(sed -n "//,/<\/effects>/ {/^ */p}" $file)" ]; then
121 | sed -i "//,/<\/effects>/ {/^ */,/^ *<\/effectProxy>/d}" $file
122 | sed -i "//,/<\/effects>/ {/^ */d}" $file
123 | fi
124 | [ ! "$(sed -n "//,/<\/effects>/ {/^ */,/^ *<\/effectProxy>/p}" $file)" -a ! "$(sed -n "//,/<\/effects>/ {/^ */,/^ *\/>/p}" $file)" ] && sed -i -e "// a\ \n \n \n <\/effectProxy>" $file
125 | if $lib; then
126 | patch_cfgs -fl "$file" "proxy" "$libdir/lib/soundfx/libeffectproxy.so"
127 | if $replace; then
128 | patch_cfgs -frl "$file" "$libname_sw" "$libpathsw"
129 | patch_cfgs -frl "$file" "$libname_hw" "$libpathhw"
130 | else
131 | patch_cfgs -fl "$file" "$libname_sw" "$libpathsw"
132 | patch_cfgs -fl "$file" "$libname_hw" "$libpathhw"
133 | fi
134 | fi
135 | else
136 | if $lib; then
137 | if $replace && [ "$(sed -n "//,/<\/libraries>/ {/^ */p}" $file)" ]; then
138 | sed -i "//,/<\/libraries>/ {/^ */d}" $file
139 | fi
140 | [ ! "$(sed -n "//,/<\/libraries>/ {/^ */p}" $file)" ] && sed -i "// a\ " $file
141 | fi
142 | if $effect; then
143 | if $replace && [ "$(sed -n "//,/<\/effects>/ {/^ */p}" $file)" -o "$(sed -n "//,/<\/effects>/ {/^ */,/^ *<\/effectProxy>/p}" $file)" ]; then
144 | sed -i "//,/<\/effects>/ {/^ */d}" $file
145 | sed -i "//,/<\/effects>/ {/^ */,/^ *<\/effectProxy>/d}" $file
146 | fi
147 | [ ! "$(sed -n "//,/<\/effects>/ {/^ */p}" $file)" ] && sed -i "// a\ " $file
148 | fi
149 | if $outsp && [ "$API" -ge 26 ]; then
150 | local OIFS=$IFS; local IFS=','
151 | for i in $type; do
152 | if [ ! "$(sed -n "/^ *<$xml>/,/^ *<\/$xml>/p" $file)" ]; then
153 | sed -i "/<\/audio_effects_conf>/i\ <$xml>\n \n \n <\/stream>\n <\/$xml>" $file
154 | elif [ ! "$(sed -n "/^ *<$xml>/,/^ *<\/$xml>/ {//,/<\/stream>/p}" $file)" ]; then
155 | sed -i "/^ *<$xml>/,/^ *<\/$xml>/ s/ <$xml>/ <$xml>\n \n \n <\/stream>/g" $file
156 | elif [ ! "$(sed -n "/^ *<$xml>/,/^ *<\/$xml>/ {//,/<\/stream>/ {/^ */p}}" $file)" ]; then
157 | sed -i "/^ *<$xml>/,/^ *<\/$xml>/ {//,/<\/stream>/ s//\n /}" $file
158 | fi
159 | done
160 | local IFS=$OIFS
161 | fi
162 | fi
163 | ;;
164 | esac
165 | done
166 | return 0
167 | }
168 | legacy_script() {
169 | local RUNONCE=false COUNT=1 LIBDIR=$libdir/lib/soundfx MOD=$mod
170 | (. $mod/.aml.sh) || echo "Error in $modname aml.sh script" >> $MODPATH/errors.txt
171 | for file in $files; do
172 | local NAME=$(echo "$file" | sed "s|$mod|system|g")
173 | $RUNONCE || { case $file in
174 | *audio*effects*) (. $mod/.aml.sh) || [ "$(grep -x "$modname" $MODPATH/errors.txt)" ] || echo "Error in $modname aml.sh script" >> $MODPATH/errors.txt; COUNT=$(($COUNT + 1));;
175 | esac; }
176 | done
177 | }
178 |
179 | (
180 | # Debug
181 | exec 2>$MODPATH/debug.log
182 | set -x
183 |
184 | # Detect/install audio mods
185 | for mod in $(find $moddir/* -maxdepth 0 -type d ! -name aml); do
186 | modname="$(basename $mod)"
187 | [ -f "$mod/disable" ] && continue
188 | [ -f "$mod/aml.sh" ] && cp -f $mod/aml.sh $mod/.aml.sh
189 | # .aml.sh file should take precedence
190 | if [ -f "$mod/.aml.sh" ]; then
191 | grep -qx "$modname" $amldir/modlist || echo "$modname" >> $amldir/modlist
192 | if grep -qE '\$MODPATH/\$NAME|RUNONCE=|COUNT=' $mod/.aml.sh; then
193 | legacy_script
194 | else
195 | (. $mod/.aml.sh) || echo "Error in $modname aml.sh script" >> $MODPATH/errors.txt
196 | fi
197 | else
198 | # Favor vendor libs over system ones, no aml builtins are 64bit only - use 32bit lib dir
199 | if [ -L $MODPATH/system/vendor ]; then
200 | libs="$(find $mod/vendor/lib/soundfx $mod/system/lib/soundfx -type f 2>/dev/null)"
201 | else
202 | libs="$(find $mod/system/vendor/lib/soundfx $mod/system/lib/soundfx -type f 2>/dev/null)"
203 | fi
204 | for lib in $libs; do
205 | for audmod in $MODPATH/.scripts/$(basename $lib)~*; do
206 | uuid=$(basename $audmod | sed -r "s/.*~(.*).sh/\1/g")
207 | hexuuid="$(echo $uuid | sed -r -e "s/^(..)(..)(..)(..)-(..)(..)-(..)(..)-/\4\3\2\1\6\5\8\7-/g" -e "s/-(..)(..)-(............)$/\2\1\3/g")"
208 | xxd -p $lib | tr -d '\n' | grep -q "$hexuuid" || continue
209 | $(grep -xq "$modname" $amldir/modlist 2>/dev/null) || echo "$modname" >> $amldir/modlist
210 | libfile="$(echo $lib | sed -e "s|$mod||g" -e 's|/system/vendor|/vendor|g')"
211 | . $audmod
212 | done
213 | done
214 | fi
215 | done
216 |
217 | # Reload patched files - original mounted files are seemingly deleted and replaced by sed
218 | for i in $(find $MODPATH/system $MODPATH/vendor -type f); do
219 | j="$(echo $i | sed -e "s|$MODPATH||g" -e 's|/system/odm|/odm|g' -e 's|/system/my_product|/my_product|g')"
220 | umount $j
221 | mount -o bind $i $j
222 | done
223 | [ "$API" -ge 24 ] && killall audioserver || killall mediaserver
224 | # vendor.audio-hal-4-0 is not listed yet in
225 | # /system/etc/init/audioserver.rc on some weird ROMs, so
226 | # android.hardware.audio@4.0-service-mediatek has to be
227 | # restarted here.
228 | # vendor.audio-hal service is not restarted after audioserver
229 | # restarts in some weird ROMs, so
230 | # android.hardware.audio.service has to be restarted here
231 | # too.
232 | killall android.hardware.audio@4.0-service-mediatek android.hardware.audio.service
233 | exit 0
234 | )&
235 |
236 |
237 |
238 |
239 |
240 |
241 |
--------------------------------------------------------------------------------
/system/vendor/placeholder:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/uninstall.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | moddir=$(dirname ${0%/*})
3 | amldir=
4 | if [ -s $amldir/modlist ]; then
5 | while read mod; do
6 | [ -d "$moddir/$mod" ] || continue
7 | for file in $(find $amldir/$mod -type f 2>/dev/null | sed "s|$amldir/||g"); do
8 | [ -f "$moddir/$file" ] || mkdir -p "$(dirname "$moddir/$file")" && cp -af $amldir/$file $moddir/$file
9 | done
10 | done < $amldir/modlist
11 | fi
12 | rm -rf $amldir
13 | [ -f "$moddir/acdb/post-fs-data.sh.bak" ] && mv -f $moddir/acdb/post-fs-data.sh.bak $moddir/acdb/post-fs-data.sh
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/update.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "v5.1",
3 | "versionCode": 59,
4 | "zipUrl": "https://raw.githubusercontent.com/Zackptg5/Audio-Modification-Library/master/install.zip",
5 | "changelog": "https://raw.githubusercontent.com/Zackptg5/Audio-Modification-Library/master/changelog.md"
6 | }
--------------------------------------------------------------------------------