Commit 51e57528 authored by Mygod's avatar Mygod

Bugfix

parent fa1d1626
......@@ -126,14 +126,14 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
@TargetApi(28)
private val defaultNetworkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
setUnderlyingNetworks(arrayOf(network))
underlyingNetwork = network
}
override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities?) {
// it's a good idea to refresh capabilities
setUnderlyingNetworks(arrayOf(network))
underlyingNetwork = network
}
override fun onLost(network: Network) {
setUnderlyingNetworks(null)
underlyingNetwork = null
}
}
private var listeningForDefaultNetwork = false
......
......@@ -59,10 +59,9 @@ val URLConnection.responseLength: Long
inline fun <reified T> Context.systemService() = ContextCompat.getSystemService(this, T::class.java)!!
fun ContentResolver.openBitmap(uri: Uri): Bitmap? {
return if (Build.VERSION.SDK_INT >= 28) ImageDecoder.decodeBitmap(ImageDecoder.createSource(this, uri))
fun ContentResolver.openBitmap(uri: Uri) =
if (Build.VERSION.SDK_INT >= 28) ImageDecoder.decodeBitmap(ImageDecoder.createSource(this, uri))
else BitmapFactory.decodeStream(openInputStream(uri))
}
val PackageInfo.signaturesCompat get() =
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