Skip to content

Commit 8775832

Browse files
add secondary way of finding stock equalizers
when updating this module, the installer cant find the package because it has been overlayed to not exist already we also check the file system for a matching apk file to prevent this case
1 parent 8fc0954 commit 8775832

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

magiskmodule/customize.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,29 @@ chown -R $VIPERFXPREFSOWNER "$FOLDER"
111111

112112
for packagedata in $(sed -e 's/^\s*#.*$//' -e '/^$/d' < "$MODPATH"/stockeqpackages.csv); do
113113
package="$(echo "$packagedata" | cut -d'|' -f1)"
114-
[ -z "$(pm list packages $package)" ] && continue
115-
packagename="$(echo "$packagedata" | cut -d'|' -f2)"
116-
ui_print "- Disabling $packagename"
117-
package_apk="$(pm list packages -f $package | grep -E "package:.*=$package$" | sed "s/package:\(.*\)=$package/\1/")"
118-
package_apk_dir="$(dirname "$package_apk" | sed -e 's|^/||' -e 's|^system/||')"
119-
mkdir -p "$MODPATH"/system/"$package_apk_dir"
120-
touch "$MODPATH"/system/"$package_apk_dir"/.replace
114+
package_filename="$(echo "$packagedata" | cut -d'|' -f2)"
115+
package_friendlyname="$(echo "$packagedata" | cut -d'|' -f3)"
116+
[ -n "$(pm list packages | grep "^package:$package$")" ] && {
117+
ui_print "- Disabling $package_friendlyname (p)"
118+
package_apk="$(pm list packages -f $package | grep -E "package:.*=$package$" | sed "s/package:\(.*\)=$package/\1/")"
119+
package_apk_dir="$(dirname "$package_apk" | sed -e 's|^/||' -e 's|^system/||')"
120+
mkdir -p "$MODPATH"/system/"$package_apk_dir"
121+
touch "$MODPATH"/system/"$package_apk_dir"/"$(basename "$package_apk")"
122+
continue
123+
}
124+
package_apk_files="$(find -H \
125+
$SEARCH_ROOT/system $SEARCH_ROOT/system_ext $SEARCH_ROOT/vendor $SEARCH_ROOT/product \
126+
-type f -name "$package_filename" \
127+
| sed -e "s|^$SEARCH_ROOT||" -e 's|^/system/|/|' \
128+
| uniq )"
129+
[ -n "$package_apk_files" ] && {
130+
ui_print "- Disabling $package_friendlyname (f)"
131+
for package_apk in $package_apk_files; do
132+
package_apk_dir="$(dirname "$package_apk" | sed -e 's|^/||' -e 's|^system/||')"
133+
mkdir -p "$MODPATH"/system/"$package_apk_dir"
134+
touch "$MODPATH"/system/"$package_apk_dir"/"$(basename "$package_apk")"
135+
done
136+
}
121137
done
122138

123139
ui_print "- Setting Permissions"

magiskmodule/stockeqpackages.csv

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# This file lists stock audio equalizer packages.
1+
# This file lists stock audio equalizer packages and files.
22

3-
# Every package listed here will be queried in the package manager
4-
# and if it exists
5-
# the entire folder it is contained within will be completely removed
3+
# Format: package|filename|friendlyname
4+
# package: used for querying package manager to find apk location
5+
# filename: used for searching in root, will replace every file with this name
6+
# friendlyname: what will be shown to the user during install
7+
# found files will be replaced with an empty file
68

7-
# Format: package|friendlyname
8-
9-
org.lineageos.audiofx|LineageOS AudioFX
10-
org.lineageos.dap|Dolby Atmos
9+
org.lineageos.audiofx|AudioFX.apk|LineageOS AudioFX
10+
org.lineageos.dap|SamsungDAP.apk|Dolby Atmos

0 commit comments

Comments
 (0)