Skip to content

Commit 3718c2c

Browse files
Disable battery optimization
This disables battery optimization on API>=30. This will prevent the system from displaying a notification like "ViPER4Android is still active [and consuming battery]" Thanks to @binarynoise for helping to google the correct things.
1 parent e73afb8 commit 3718c2c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

magiskmodule/customize.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ set_perm_recursive "$FOLDER" "$VIPERFXPREFSOWNER" sdcard_rw 771 660 u:object_r:s
133133
pm revoke $VIPERFXPACKAGE android.permission.POST_NOTIFICATIONS
134134
pm set-permission-flags $VIPERFXPACKAGE android.permission.POST_NOTIFICATIONS user-fixed
135135
}
136+
# this disables battery optimization
137+
[ $API -ge 30 ] && dumpsys deviceidle whitelist +$VIPERFXPACKAGE >/dev/null
136138

137139
for packagedata in $(sed -e 's/^\s*#.*$//' -e '/^$/d' < "$MODPATH"/stockeqpackages.csv); do
138140
package="$(echo "$packagedata" | cut -d'|' -f1)"

0 commit comments

Comments
 (0)