summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-01-26 11:39:39 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2021-04-23 14:04:43 +0000
commita12667f26c63227a0e92295205deea3cf209a4f5 (patch)
tree25286752ab63aea0f1419e11c729bfd1438bcf39 /android/src
parent856c5d5b7470066c26e04a83f56d9ccb299c42fd (diff)
downloadmullvadvpn-a12667f26c63227a0e92295205deea3cf209a4f5.tar.xz
mullvadvpn-a12667f26c63227a0e92295205deea3cf209a4f5.zip
Remove `ServiceInstance`
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt27
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/ServiceInstance.kt5
2 files changed, 3 insertions, 29 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
index 0d477769d5..a4685b6dd8 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt
@@ -18,7 +18,6 @@ import net.mullvad.mullvadvpn.service.notifications.AccountExpiryNotification
import net.mullvad.mullvadvpn.service.tunnelstate.TunnelStateUpdater
import net.mullvad.mullvadvpn.ui.MainActivity
import net.mullvad.talpid.TalpidVpnService
-import net.mullvad.talpid.util.EventNotifier
class MullvadVpnService : TalpidVpnService() {
companion object {
@@ -44,8 +43,6 @@ class MullvadVpnService : TalpidVpnService() {
Stopped,
}
- private val serviceNotifier = EventNotifier<ServiceInstance?>(null)
-
private val connectionProxy
get() = endpoint.connectionProxy
@@ -53,10 +50,6 @@ class MullvadVpnService : TalpidVpnService() {
private var setUpDaemonJob: Job? = null
- private var instance by observable<ServiceInstance?>(null) { _, _, newInstance ->
- serviceNotifier.notifyIfChanged(newInstance)
- }
-
private lateinit var accountExpiryNotification: AccountExpiryNotification
private lateinit var daemonInstance: DaemonInstance
private lateinit var endpoint: ServiceEndpoint
@@ -65,12 +58,8 @@ class MullvadVpnService : TalpidVpnService() {
private lateinit var tunnelStateUpdater: TunnelStateUpdater
private var pendingAction by observable<PendingAction?>(null) { _, _, _ ->
- // The service instance awaits the split tunneling initialization, which also starts the
- // endpoint. So if the instance is not null, the endpoint has certainly been initialized.
- if (instance != null) {
- endpoint.settingsListener.settings?.let { settings ->
- handlePendingAction(settings)
- }
+ endpoint.settingsListener.settings?.let { settings ->
+ handlePendingAction(settings)
}
}
@@ -189,7 +178,6 @@ class MullvadVpnService : TalpidVpnService() {
accountExpiryNotification.onDestroy()
notificationManager.onDestroy()
daemonInstance.onDestroy()
- instance = null
super.onDestroy()
}
@@ -200,7 +188,6 @@ class MullvadVpnService : TalpidVpnService() {
setUpDaemonJob = setUpDaemon(daemon)
} else {
Log.d(TAG, "Daemon has stopped")
- instance = null
if (state == State.Running) {
restart()
@@ -213,21 +200,13 @@ class MullvadVpnService : TalpidVpnService() {
val settings = daemon.getSettings()
if (settings != null) {
- setUpInstance(settings)
+ handlePendingAction(settings)
} else {
restart()
}
}
}
- private suspend fun setUpInstance(settings: Settings) {
- handlePendingAction(settings)
-
- if (state == State.Running) {
- instance = ServiceInstance(endpoint.messenger)
- }
- }
-
private fun stop() {
Log.d(TAG, "Stopping service")
state = State.Stopping
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ServiceInstance.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ServiceInstance.kt
deleted file mode 100644
index a77e58447d..0000000000
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ServiceInstance.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.mullvad.mullvadvpn.service
-
-import android.os.Messenger
-
-class ServiceInstance(val messenger: Messenger)