Commit 51e57528 authored by Mygod's avatar Mygod

Bugfix

parent fa1d1626
...@@ -126,14 +126,14 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface { ...@@ -126,14 +126,14 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
@TargetApi(28) @TargetApi(28)
private val defaultNetworkCallback = object : ConnectivityManager.NetworkCallback() { private val defaultNetworkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) { override fun onAvailable(network: Network) {
setUnderlyingNetworks(arrayOf(network)) underlyingNetwork = network
} }
override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities?) { override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities?) {
// it's a good idea to refresh capabilities // it's a good idea to refresh capabilities
setUnderlyingNetworks(arrayOf(network)) underlyingNetwork = network
} }
override fun onLost(network: Network) { override fun onLost(network: Network) {
setUnderlyingNetworks(null) underlyingNetwork = null
} }
} }
private var listeningForDefaultNetwork = false private var listeningForDefaultNetwork = false
......
...@@ -59,10 +59,9 @@ val URLConnection.responseLength: Long ...@@ -59,10 +59,9 @@ val URLConnection.responseLength: Long
inline fun <reified T> Context.systemService() = ContextCompat.getSystemService(this, T::class.java)!! inline fun <reified T> Context.systemService() = ContextCompat.getSystemService(this, T::class.java)!!
fun ContentResolver.openBitmap(uri: Uri): Bitmap? { fun ContentResolver.openBitmap(uri: Uri) =
return if (Build.VERSION.SDK_INT >= 28) ImageDecoder.decodeBitmap(ImageDecoder.createSource(this, uri)) if (Build.VERSION.SDK_INT >= 28) ImageDecoder.decodeBitmap(ImageDecoder.createSource(this, uri))
else BitmapFactory.decodeStream(openInputStream(uri)) else BitmapFactory.decodeStream(openInputStream(uri))
}
val PackageInfo.signaturesCompat get() = val PackageInfo.signaturesCompat get() =
if (Build.VERSION.SDK_INT >= 28) signingInfo.apkContentsSigners else @Suppress("DEPRECATION") signatures if (Build.VERSION.SDK_INT >= 28) signingInfo.apkContentsSigners else @Suppress("DEPRECATION") signatures
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment