Skip to content

Commit

Permalink
ui: alpha for apps with no-internet permission
Browse files Browse the repository at this point in the history
Consider non-apps as apps with internet as the entry would
have made when there is a connection request from that
uid.
  • Loading branch information
hussainmohd-a committed Jul 23, 2024
1 parent bc651c2 commit 1ac241c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class FirewallAppListAdapter(
if (appInfo.hasInternetPermission(packageManager)) {
b.firewallAppLabelTv.alpha = 1f
} else {
b.firewallAppLabelTv.alpha = 0.6f
b.firewallAppLabelTv.alpha = 0.4f
}
b.firewallAppToggleOther.text = getFirewallText(appStatus, connStatus)
displayIcon(
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/celzero/bravedns/database/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class AppInfo {
}

fun hasInternetPermission(packageManager: PackageManager): Boolean {
if (packageName.startsWith("no_package_")) return true

// INTERNET permission if defined, can not be denied so this is safe to use
return packageManager.checkPermission(Manifest.permission.INTERNET, packageName) == PackageManager.PERMISSION_GRANTED
}
Expand Down

0 comments on commit 1ac241c

Please sign in to comment.