npem: add LOS network allowlisting

LOS now uses a new uid-based network allowlist, which seems to not grant
internet access on boot sometimes. Automate enabling access.
master
FriendlyNeighborhoodShane 1 year ago
parent cd4e235849
commit b6587525e0

@ -86,14 +86,34 @@ user_install () {
esac
}
allow_networking () {
oldlist="$(settings get global uids_allowed_on_restricted_networks)"
newlist="$(echo "${oldlist}" | sed 's|;|\n|g')"
if echo "${newlist}" | grep -q "^${2}$"; then
echo "package ${1} already in LOS networking allowlist"
return
fi
newlist="$( { echo "${newlist}"; echo "${2}"; } | sort -nu)"
newlist="$(printf '%d;' ${newlist})"
newlist="${newlist%;}"
settings put global uids_allowed_on_restricted_networks "${newlist}"
echo "package ${1} added to LOS networking allowlist"
}
[[ $(whoami) = "root" ]] || [[ $(whoami) = "shell" ]] || error "not running as either ADB or root"
gms_uid=$(get_uid ${microG})
play_uid=$(get_uid ${PlayStore})
if [ "$(getprop ro.build.version.sdk)" -ge 29 ]; then
# microG GmsCore needs to be installed as user app for all permissions to be granted
# see https://github.com/microg/android_packages_apps_GmsCore/issues/1100#issuecomment-711088518
user_install ${microG}
if settings list global | grep -q "^uids_allowed_on_restricted_networks="; then
# both need this on LOS-based ROMs in some situations like it restricting their internet for no reason
allow_networking ${microG} ${gms_uid}
allow_networking ${PlayStore} ${play_uid}
fi;
fi
# Fake Package Signature

Loading…
Cancel
Save