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.
merge-requests/39/head
FriendlyNeighborhoodShane 2 years ago
parent e2a130cf5c
commit 80c7c0d42e

@ -35,7 +35,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