diff options
| author | David Göransson <david.goransson90@gmail.com> | 2023-09-11 15:59:09 +0200 |
|---|---|---|
| committer | David Göransson <david.goransson90@gmail.com> | 2023-09-12 11:22:16 +0200 |
| commit | d63db4ab40c71b07368f7778d8fb0f23392352e2 (patch) | |
| tree | a9392bfc7a24f5fa6f595b9d35cfd8c97951d142 /android/lib | |
| parent | fa733200f25e9ef89f138f848af2b0be9eba2e2b (diff) | |
| download | mullvadvpn-d63db4ab40c71b07368f7778d8fb0f23392352e2.tar.xz mullvadvpn-d63db4ab40c71b07368f7778d8fb0f23392352e2.zip | |
Perform AS Code Cleanup
Diffstat (limited to 'android/lib')
6 files changed, 11 insertions, 15 deletions
diff --git a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Event.kt b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Event.kt index 9ce1ccc698..c5ede20327 100644 --- a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Event.kt +++ b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Event.kt @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.model.VoucherSubmissionResult // Events that can be sent from the service sealed class Event : Message.EventMessage() { - protected override val messageKey = MESSAGE_KEY + override val messageKey = MESSAGE_KEY @Parcelize data class AccountCreationEvent(val result: AccountCreationResult) : Event() diff --git a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Request.kt b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Request.kt index ad91632cbf..2a8636fa95 100644 --- a/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Request.kt +++ b/android/lib/ipc/src/main/kotlin/net/mullvad/mullvadvpn/lib/ipc/Request.kt @@ -12,7 +12,7 @@ import net.mullvad.mullvadvpn.model.WireguardConstraints // Requests that the service can handle sealed class Request : Message.RequestMessage() { - protected override val messageKey = MESSAGE_KEY + override val messageKey = MESSAGE_KEY @Parcelize @Deprecated("Use SetDnsOptions") diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Constraint.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Constraint.kt index c6dc2bb091..d9ca22b164 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Constraint.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Constraint.kt @@ -3,10 +3,8 @@ package net.mullvad.mullvadvpn.model import android.os.Parcelable import kotlinx.parcelize.Parcelize -sealed class Constraint<T>() : Parcelable { - @Parcelize - @Suppress("PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY") - class Any<T>() : Constraint<T>() +sealed class Constraint<T> : Parcelable { + @Parcelize @Suppress("PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY") class Any<T> : Constraint<T>() @Parcelize data class Only<T : Parcelable>(val value: T) : Constraint<T>() } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/CustomTunnelEndpoint.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/CustomTunnelEndpoint.kt index 05dd38a80b..72276c65e4 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/CustomTunnelEndpoint.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/CustomTunnelEndpoint.kt @@ -1,3 +1,3 @@ package net.mullvad.mullvadvpn.model -class CustomTunnelEndpoint() +class CustomTunnelEndpoint diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt index 92f0621e6e..4918ee0832 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt @@ -15,9 +15,7 @@ data class Device(val id: String, val name: String, val pubkey: ByteArray, val c if (id != other.id) return false if (name != other.name) return false - if (!pubkey.contentEquals(other.pubkey)) return false - - return true + return pubkey.contentEquals(other.pubkey) } // Generated by Android Studio diff --git a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt index caa8f11447..1d43b6f9f9 100644 --- a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt +++ b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt @@ -82,7 +82,7 @@ open class TalpidVpnService : VpnService() { } private fun createTun(config: TunConfig): CreateTunResult { - if (VpnService.prepare(this) != null) { + if (prepare(this) != null) { // VPN permission wasn't granted return CreateTunResult.PermissionDenied } @@ -126,7 +126,7 @@ open class TalpidVpnService : VpnService() { waitForTunnelUp(tunFd, config.routes.any { route -> route.isIpv6 }) - if (!invalidDnsServerAddresses.isEmpty()) { + if (invalidDnsServerAddresses.isNotEmpty()) { return CreateTunResult.InvalidDnsServers(invalidDnsServerAddresses, tunFd) } @@ -138,9 +138,9 @@ open class TalpidVpnService : VpnService() { } private fun prefixForAddress(address: InetAddress): Int { - when (address) { - is Inet4Address -> return 32 - is Inet6Address -> return 128 + return when (address) { + is Inet4Address -> 32 + is Inet6Address -> 128 else -> throw RuntimeException("Invalid IP address (not IPv4 nor IPv6)") } } |
