Address review comments

Signed-off-by: davfsa <davfsa@gmail.com>
pull/621/head
davfsa 8 months ago
parent 6b210ba84f
commit 6c255476de
No known key found for this signature in database
GPG Key ID: 8B2D9E0036D67C1C

@ -543,7 +543,7 @@ open class UninitializedApp : Application() {
fun addUserSelectedPackage(packageName: String) {
if (packageName.isEmpty()) {
TSLog.e(TAG, "addUserDisallowedPackageName called with empty packageName")
TSLog.e(TAG, "addUserSelectedPackage called with empty packageName")
return
}
@ -558,7 +558,7 @@ open class UninitializedApp : Application() {
fun removeUserSelectedPackage(packageName: String) {
if (packageName.isEmpty()) {
TSLog.e(TAG, "removeUserDisallowedPackageName called with empty packageName")
TSLog.e(TAG, "removeUserSelectedPackage called with empty packageName")
return
}

@ -136,7 +136,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
try {
b.addAllowedApplication(name)
} catch (e: PackageManager.NameNotFoundException) {
TSLog.d(TAG, "Failed to add allowed application: $e")
TSLog.e(TAG, "Failed to add allowed application: $e")
}
}
@ -144,7 +144,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
try {
b.addDisallowedApplication(name)
} catch (e: PackageManager.NameNotFoundException) {
TSLog.d(TAG, "Failed to add disallowed application: $e")
TSLog.e(TAG, "Failed to add disallowed application: $e")
}
}
@ -179,7 +179,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
allowPackages = false
TSLog.d(TAG, "Excluded application packages were set via MDM: $mdmDisallowed")
} else {
// Otherwise, prevent user manually disallowed apps from getting their traffic + DNS routed
// Otherwise, prevent user manually disallowed apps from getting their traffic + DNS routed
// via Tailscale
packagesList = UninitializedApp.get().selectedPackageNames()
allowPackages = UninitializedApp.get().allowSelectedPackages()
@ -189,7 +189,7 @@ open class IPNService : VpnService(), libtailscale.IPNService {
if (allowPackages) {
// There always needs to be at least one allowed application for the VPN service to filter the
// traffic so add our own application by default to fulfill that requirement
packagesList += "com.tailscale.ipn"
packagesList += BuildConfig.APPLICATION_ID
for (packageName in packagesList) {
TSLog.d(TAG, "Including app: $packageName")

@ -6,6 +6,7 @@ package com.tailscale.ipn.ui.util
import android.Manifest
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import com.tailscale.ipn.BuildConfig
data class InstalledApp(val name: String, val packageName: String)
@ -26,7 +27,7 @@ class InstalledAppsManager(
}
private val appIsIncluded: (ApplicationInfo) -> Boolean = { app ->
app.packageName != "com.tailscale.ipn" &&
app.packageName != BuildConfig.APPLICATION_ID &&
// Only show apps that can access the Internet
packageManager.checkPermission(Manifest.permission.INTERNET, app.packageName) ==
PackageManager.PERMISSION_GRANTED

Loading…
Cancel
Save