npem: fix false positive in permission check

Sometimes when a permission is not granted (e.g. when a default permission
to a system app is ungranted by the user), dumpsys emits two lines about
it, one with granted=true and the GRANTED_BY_DEFAULT flag.

Since we are not properly parsing flags and getting the full context, just
reverse the check to make sure the value doesn't fall through.

A 'false negative' grant won't hurt anyway.
pull/30/head
FriendlyNeighborhoodShane 2 years ago
parent 8aa22acfa0
commit 45850cebd6

@ -39,7 +39,7 @@ check_package () {
}
check_permission () {
[[ $(dumpsys package ${1} | grep -Eo "^[ ]+${2}: granted=true") ]] && return 0 || return 1
[[ $(dumpsys package ${1} | grep -Eo "^[ ]+${2}: granted=false") ]] && return 1 || return 0
}
grant_permission () {

Loading…
Cancel
Save