diff options
author | pacien | 2019-09-15 04:05:34 +0200 |
---|---|---|
committer | pacien | 2019-09-15 04:05:34 +0200 |
commit | 5de0313f16382ab97c14661222d8be51c5fc6e72 (patch) | |
tree | 284c88e9b160179ca598f7816601f1067e0d6120 /app/src/main/java | |
parent | 6e32d202f1232dcf11561ce4e45d158a3a2ee8fe (diff) | |
download | tincapp-5de0313f16382ab97c14661222d8be51c5fc6e72.tar.gz |
fix daemon startup for android 10
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt index 18388f6..263fea4 100644 --- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt +++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt | |||
@@ -125,10 +125,13 @@ class TincVpnService : VpnService() { | |||
125 | } | 125 | } |
126 | 126 | ||
127 | val deviceFd = try { | 127 | val deviceFd = try { |
128 | Builder().setSession(netName) | 128 | val appContextFd = Builder().setSession(netName) |
129 | .applyCfg(interfaceCfg) | 129 | .applyCfg(interfaceCfg) |
130 | .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } | 130 | .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } |
131 | .establish()!! | 131 | .establish()!! |
132 | val daemonContextFd = appContextFd.dup() // necessary since Android 10 | ||
133 | appContextFd.close() | ||
134 | daemonContextFd | ||
132 | } catch (e: IllegalArgumentException) { | 135 | } catch (e: IllegalArgumentException) { |
133 | return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") | 136 | return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") |
134 | } catch (e: NullPointerException) { | 137 | } catch (e: NullPointerException) { |