summaryrefslogtreecommitdiffhomepage
path: root/android/app
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2023-07-25 14:40:22 +0200
committerAlbin <albin@mullvad.net>2023-07-25 14:40:22 +0200
commit3fb0a7b1928bd32b4454cca74a258820dce5cd15 (patch)
tree3e14dd1501f1669b109abbc272cef7028ac2ea51 /android/app
parent2db0704b43b17defa9af36c8b1459f2cab7d1b18 (diff)
parent256426268b5c0f821d64a9985a5c962d9e5ce7e5 (diff)
downloadmullvadvpn-3fb0a7b1928bd32b4454cca74a258820dce5cd15.tar.xz
mullvadvpn-3fb0a7b1928bd32b4454cca74a258820dce5cd15.zip
Merge branch 'move-talpid-classes-its-own-module-droid-221'
Diffstat (limited to 'android/app')
-rw-r--r--android/app/build.gradle.kts1
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadTileService.kt1
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt1
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt1
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ErrorStateExtension.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SdkUtils.kt7
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt69
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/CreateTunResult.kt23
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt150
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationEndpoint.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationType.kt9
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt10
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt11
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt10
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt11
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorState.kt6
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorStateCause.kt32
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifier.kt76
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifierExtensions.kt9
-rw-r--r--android/app/src/main/kotlin/net/mullvad/talpid/util/InetAddressExt.kt10
23 files changed, 4 insertions, 469 deletions
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index b40bab7c92..ec787deeaa 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -209,6 +209,7 @@ play {
dependencies {
implementation(project(Dependencies.Mullvad.endpointLib))
+ implementation(project(Dependencies.Mullvad.talpidLib))
implementation(Dependencies.androidMaterial)
implementation(Dependencies.commonsValidator)
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadTileService.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadTileService.kt
index 96630a2cec..723bcd9166 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadTileService.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadTileService.kt
@@ -10,7 +10,6 @@ import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
-import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
index e33e3d028f..7f5254c41b 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt
@@ -6,7 +6,6 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ClosedReceiveChannelException
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.trySendBlocking
-import kotlinx.coroutines.flow.collect
import net.mullvad.mullvadvpn.ipc.Event
import net.mullvad.mullvadvpn.ipc.Request
import net.mullvad.mullvadvpn.model.AccountCreationResult
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt
index 7b0d419b45..54ffd654be 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt
@@ -9,7 +9,6 @@ import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.trySendBlocking
import kotlinx.coroutines.delay
-import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.receiveAsFlow
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ErrorStateExtension.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ErrorStateExtension.kt
index 9c25a194af..54d676a9e7 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ErrorStateExtension.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/ErrorStateExtension.kt
@@ -13,7 +13,9 @@ fun ErrorState.getErrorNotificationResources(context: Context): ErrorNotificatio
ErrorNotificationMessage(
R.string.blocking_internet,
cause.errorMessageId(),
- cause.addresses.joinToString { address -> address.addressString() }
+ (cause as ErrorStateCause.InvalidDnsServers).addresses.joinToString { address ->
+ address.addressString()
+ }
)
}
cause is ErrorStateCause.VpnPermissionDenied -> {
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SdkUtils.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SdkUtils.kt
index cb631d8af6..e8dc6a3c35 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SdkUtils.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/SdkUtils.kt
@@ -5,7 +5,6 @@ import android.app.PendingIntent
import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
-import android.net.VpnService
import android.os.Build
import android.service.quicksettings.Tile
@@ -24,12 +23,6 @@ object SdkUtils {
PackageManager.PERMISSION_GRANTED
}
- fun VpnService.Builder.setMeteredIfSupported(isMetered: Boolean) {
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
- this.setMetered(isMetered)
- }
- }
-
fun Tile.setSubtitleIfSupported(subtitleText: CharSequence) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
this.subtitle = subtitleText
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt b/android/app/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt
deleted file mode 100644
index de56ebb878..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/ConnectivityListener.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.mullvad.talpid
-
-import android.content.Context
-import android.net.ConnectivityManager
-import android.net.ConnectivityManager.NetworkCallback
-import android.net.Network
-import android.net.NetworkCapabilities
-import android.net.NetworkRequest
-import kotlin.properties.Delegates.observable
-import net.mullvad.talpid.util.EventNotifier
-
-class ConnectivityListener {
- private val availableNetworks = HashSet<Network>()
-
- private val callback =
- object : NetworkCallback() {
- override fun onAvailable(network: Network) {
- availableNetworks.add(network)
- isConnected = true
- }
-
- override fun onLost(network: Network) {
- availableNetworks.remove(network)
- isConnected = !availableNetworks.isEmpty()
- }
- }
-
- private lateinit var connectivityManager: ConnectivityManager
-
- val connectivityNotifier = EventNotifier(false)
-
- var isConnected by
- observable(false) { _, oldValue, newValue ->
- if (newValue != oldValue) {
- if (senderAddress != 0L) {
- notifyConnectivityChange(newValue, senderAddress)
- }
-
- connectivityNotifier.notify(newValue)
- }
- }
-
- var senderAddress = 0L
-
- fun register(context: Context) {
- val request =
- NetworkRequest.Builder()
- .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
- .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
- .build()
-
- connectivityManager =
- context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-
- connectivityManager.registerNetworkCallback(request, callback)
- }
-
- fun unregister() {
- connectivityManager.unregisterNetworkCallback(callback)
- }
-
- private fun finalize() {
- destroySender(senderAddress)
- senderAddress = 0L
- }
-
- private external fun notifyConnectivityChange(isConnected: Boolean, senderAddress: Long)
- private external fun destroySender(senderAddress: Long)
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/CreateTunResult.kt b/android/app/src/main/kotlin/net/mullvad/talpid/CreateTunResult.kt
deleted file mode 100644
index 33f62026d6..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/CreateTunResult.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.mullvad.talpid
-
-import java.net.InetAddress
-
-sealed class CreateTunResult {
- open val isOpen
- get() = false
-
- class Success(val tunFd: Int) : CreateTunResult() {
- override val isOpen
- get() = true
- }
-
- class InvalidDnsServers(val addresses: ArrayList<InetAddress>, val tunFd: Int) :
- CreateTunResult() {
- override val isOpen
- get() = true
- }
-
- object PermissionDenied : CreateTunResult()
-
- object TunnelDeviceError : CreateTunResult()
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt b/android/app/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt
deleted file mode 100644
index 9f5e4a67a6..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-package net.mullvad.talpid
-
-import android.net.VpnService
-import android.os.ParcelFileDescriptor
-import java.net.Inet4Address
-import java.net.Inet6Address
-import java.net.InetAddress
-import kotlin.properties.Delegates.observable
-import net.mullvad.mullvadvpn.util.SdkUtils.setMeteredIfSupported
-import net.mullvad.talpid.tun_provider.TunConfig
-
-open class TalpidVpnService : VpnService() {
- private var activeTunStatus by
- observable<CreateTunResult?>(null) { _, oldTunStatus, _ ->
- val oldTunFd =
- when (oldTunStatus) {
- is CreateTunResult.Success -> oldTunStatus.tunFd
- is CreateTunResult.InvalidDnsServers -> oldTunStatus.tunFd
- else -> null
- }
-
- if (oldTunFd != null) {
- ParcelFileDescriptor.adoptFd(oldTunFd).close()
- }
- }
-
- private val tunIsOpen
- get() = activeTunStatus?.isOpen ?: false
-
- private var currentTunConfig = defaultTunConfig()
- private var tunIsStale = false
-
- protected var disallowedApps: List<String>? = null
-
- val connectivityListener = ConnectivityListener()
-
- override fun onCreate() {
- connectivityListener.register(this)
- }
-
- override fun onDestroy() {
- connectivityListener.unregister()
- }
-
- fun getTun(config: TunConfig): CreateTunResult {
- synchronized(this) {
- val tunStatus = activeTunStatus
-
- if (config == currentTunConfig && tunIsOpen && !tunIsStale) {
- return tunStatus!!
- } else {
- val newTunStatus = createTun(config)
-
- currentTunConfig = config
- activeTunStatus = newTunStatus
- tunIsStale = false
-
- return newTunStatus
- }
- }
- }
-
- fun createTun() {
- synchronized(this) { activeTunStatus = createTun(currentTunConfig) }
- }
-
- fun recreateTunIfOpen(config: TunConfig) {
- synchronized(this) {
- if (tunIsOpen) {
- currentTunConfig = config
- activeTunStatus = createTun(config)
- }
- }
- }
-
- fun closeTun() {
- synchronized(this) { activeTunStatus = null }
- }
-
- fun markTunAsStale() {
- synchronized(this) { tunIsStale = true }
- }
-
- private fun createTun(config: TunConfig): CreateTunResult {
- if (VpnService.prepare(this) != null) {
- // VPN permission wasn't granted
- return CreateTunResult.PermissionDenied
- }
-
- var invalidDnsServerAddresses = ArrayList<InetAddress>()
-
- val builder =
- Builder().apply {
- for (address in config.addresses) {
- addAddress(address, prefixForAddress(address))
- }
-
- for (dnsServer in config.dnsServers) {
- try {
- addDnsServer(dnsServer)
- } catch (exception: IllegalArgumentException) {
- invalidDnsServerAddresses.add(dnsServer)
- }
- }
-
- for (route in config.routes) {
- addRoute(route.address, route.prefixLength.toInt())
- }
-
- disallowedApps?.let { apps ->
- for (app in apps) {
- addDisallowedApplication(app)
- }
- }
- setMtu(config.mtu)
- setBlocking(false)
- setMeteredIfSupported(false)
- }
-
- val vpnInterface = builder.establish()
- val tunFd = vpnInterface?.detachFd()
-
- if (tunFd == null) {
- return CreateTunResult.TunnelDeviceError
- }
-
- waitForTunnelUp(tunFd, config.routes.any { route -> route.isIpv6 })
-
- if (!invalidDnsServerAddresses.isEmpty()) {
- return CreateTunResult.InvalidDnsServers(invalidDnsServerAddresses, tunFd)
- }
-
- return CreateTunResult.Success(tunFd)
- }
-
- fun bypass(socket: Int): Boolean {
- return protect(socket)
- }
-
- private fun prefixForAddress(address: InetAddress): Int {
- when (address) {
- is Inet4Address -> return 32
- is Inet6Address -> return 128
- else -> throw RuntimeException("Invalid IP address (not IPv4 nor IPv6)")
- }
- }
-
- private external fun defaultTunConfig(): TunConfig
- private external fun waitForTunnelUp(tunFd: Int, isIpv6Enabled: Boolean)
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt b/android/app/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt
deleted file mode 100644
index 8937bd0122..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/net/Endpoint.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.mullvad.talpid.net
-
-import android.os.Parcelable
-import java.net.InetSocketAddress
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-data class Endpoint(val address: InetSocketAddress, val protocol: TransportProtocol) : Parcelable
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationEndpoint.kt b/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationEndpoint.kt
deleted file mode 100644
index 9ec96b1494..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationEndpoint.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.mullvad.talpid.net
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-data class ObfuscationEndpoint(val endpoint: Endpoint, val obfuscationType: ObfuscationType) :
- Parcelable
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationType.kt b/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationType.kt
deleted file mode 100644
index 72409d9026..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/net/ObfuscationType.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.mullvad.talpid.net
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-enum class ObfuscationType : Parcelable {
- Udp2Tcp
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt b/android/app/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt
deleted file mode 100644
index 89fdedaba1..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/net/TransportProtocol.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.mullvad.talpid.net
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-enum class TransportProtocol : Parcelable {
- Tcp,
- Udp
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt b/android/app/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt
deleted file mode 100644
index 9c45833eb2..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/net/TunnelEndpoint.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.mullvad.talpid.net
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-data class TunnelEndpoint(
- val endpoint: Endpoint,
- val quantumResistant: Boolean,
- val obfuscation: ObfuscationEndpoint?
-) : Parcelable
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt
deleted file mode 100644
index a8490b48bf..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/InetNetwork.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.mullvad.talpid.tun_provider
-
-import java.net.Inet6Address
-import java.net.InetAddress
-
-data class InetNetwork(val address: InetAddress, val prefixLength: Short) {
- val isIpv6 = address is Inet6Address
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt
deleted file mode 100644
index 7efd3f7763..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tun_provider/TunConfig.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.mullvad.talpid.tun_provider
-
-import java.net.InetAddress
-
-data class TunConfig(
- val addresses: ArrayList<InetAddress>,
- val dnsServers: ArrayList<InetAddress>,
- val routes: ArrayList<InetNetwork>,
- val mtu: Int
-)
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt
deleted file mode 100644
index a62abaacd0..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ActionAfterDisconnect.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.mullvad.talpid.tunnel
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize
-enum class ActionAfterDisconnect : Parcelable {
- Nothing,
- Block,
- Reconnect
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorState.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorState.kt
deleted file mode 100644
index 070d190beb..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorState.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package net.mullvad.talpid.tunnel
-
-import android.os.Parcelable
-import kotlinx.parcelize.Parcelize
-
-@Parcelize data class ErrorState(val cause: ErrorStateCause, val isBlocking: Boolean) : Parcelable
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorStateCause.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorStateCause.kt
deleted file mode 100644
index 5096e5c693..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ErrorStateCause.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.mullvad.talpid.tunnel
-
-import android.os.Parcelable
-import java.net.InetAddress
-import kotlinx.parcelize.Parcelize
-
-private const val AUTH_FAILED_REASON_EXPIRED_ACCOUNT = "[EXPIRED_ACCOUNT]"
-
-sealed class ErrorStateCause : Parcelable {
- @Parcelize
- class AuthFailed(private val reason: String?) : ErrorStateCause() {
- fun isCausedByExpiredAccount(): Boolean {
- return reason == AUTH_FAILED_REASON_EXPIRED_ACCOUNT
- }
- }
-
- @Parcelize object Ipv6Unavailable : ErrorStateCause()
-
- @Parcelize object SetFirewallPolicyError : ErrorStateCause()
-
- @Parcelize object SetDnsError : ErrorStateCause()
-
- @Parcelize class InvalidDnsServers(val addresses: ArrayList<InetAddress>) : ErrorStateCause()
-
- @Parcelize object StartTunnelError : ErrorStateCause()
-
- @Parcelize class TunnelParameterError(val error: ParameterGenerationError) : ErrorStateCause()
-
- @Parcelize object IsOffline : ErrorStateCause()
-
- @Parcelize object VpnPermissionDenied : ErrorStateCause()
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt b/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt
deleted file mode 100644
index b1504c676f..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/tunnel/ParameterGenerationError.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.mullvad.talpid.tunnel
-
-enum class ParameterGenerationError {
- NoMatchingRelay,
- NoMatchingBridgeRelay,
- NoWireguardKey,
- CustomTunnelHostResultionError
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifier.kt b/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifier.kt
deleted file mode 100644
index 148b56eb45..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifier.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package net.mullvad.talpid.util
-
-import kotlin.properties.Delegates.observable
-
-// Manages listeners interested in receiving events of type T
-//
-// The listeners subscribe using an ID object. This ID is used later on for unsubscribing. The only
-// requirement is that the object uses the default implementation of the `hashCode` and `equals`
-// methods inherited from `Any` (or `Object` in Java).
-//
-// If the ID object class (or any of its super-classes) overrides `hashCode` or `equals`,
-// unsubscribe might not work correctly.
-class EventNotifier<T>(private val initialValue: T) {
- private val listeners = LinkedHashMap<Any, (T) -> Unit>()
-
- var latestEvent = initialValue
- private set
-
- fun notify(event: T) {
- synchronized(this) {
- latestEvent = event
-
- for (listener in listeners.values) {
- listener(event)
- }
- }
- }
-
- fun notifyIfChanged(event: T) {
- synchronized(this) {
- if (latestEvent != event) {
- notify(event)
- }
- }
- }
-
- fun subscribe(id: Any, listener: (T) -> Unit) {
- subscribe(id, true, listener)
- }
-
- fun subscribe(id: Any, startWithLatestEvent: Boolean, listener: (T) -> Unit) {
- synchronized(this) {
- listeners.put(id, listener)
- if (startWithLatestEvent) listener(latestEvent)
- }
- }
-
- fun hasListeners(): Boolean {
- synchronized(this) {
- return !listeners.isEmpty()
- }
- }
-
- fun unsubscribe(id: Any) {
- synchronized(this) { listeners.remove(id) }
- }
-
- fun unsubscribeAll() {
- synchronized(this) { listeners.clear() }
- }
-
- fun notifiable() = observable(latestEvent) { _, _, newValue -> notify(newValue) }
-}
-
-fun <T> autoSubscribable(id: Any, fallback: T, listener: (T) -> Unit) =
- observable<EventNotifier<T>?>(null) { _, old, new ->
- if (old != new) {
- old?.unsubscribe(id)
-
- if (new == null) {
- listener.invoke(fallback)
- } else {
- new.subscribe(id, listener)
- }
- }
- }
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifierExtensions.kt b/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifierExtensions.kt
deleted file mode 100644
index add362fcb1..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/util/EventNotifierExtensions.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.mullvad.talpid.util
-
-import kotlinx.coroutines.channels.awaitClose
-import kotlinx.coroutines.flow.callbackFlow
-
-fun <T> EventNotifier<T>.callbackFlowFromSubscription(id: Any) = callbackFlow {
- this@callbackFlowFromSubscription.subscribe(id) { this.trySend(it) }
- awaitClose { this@callbackFlowFromSubscription.unsubscribe(id) }
-}
diff --git a/android/app/src/main/kotlin/net/mullvad/talpid/util/InetAddressExt.kt b/android/app/src/main/kotlin/net/mullvad/talpid/util/InetAddressExt.kt
deleted file mode 100644
index d310deb884..0000000000
--- a/android/app/src/main/kotlin/net/mullvad/talpid/util/InetAddressExt.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.mullvad.talpid.util
-
-import java.net.InetAddress
-
-fun InetAddress.addressString(): String {
- val hostNameAndAddress = this.toString().split('/', limit = 2)
- val address = hostNameAndAddress[1]
-
- return address
-}