Target SDK 29 for more efficient netlink

This commit is contained in:
Mygod
2020-06-11 06:59:18 +08:00
parent c20298e13a
commit eec7f2517d
2 changed files with 6 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ plugins {
android { android {
val javaVersion = JavaVersion.VERSION_1_8 val javaVersion = JavaVersion.VERSION_1_8
val targetSdk = 29
compileOptions { compileOptions {
isCoreLibraryDesugaringEnabled = true isCoreLibraryDesugaringEnabled = true
sourceCompatibility = javaVersion sourceCompatibility = javaVersion
@@ -23,7 +24,7 @@ android {
defaultConfig { defaultConfig {
applicationId = "be.mygod.vpnhotspot" applicationId = "be.mygod.vpnhotspot"
minSdkVersion(21) minSdkVersion(21)
targetSdkVersion(30) targetSdkVersion(targetSdk)
resConfigs(listOf("it", "ru", "zh-rCN", "zh-rTW")) resConfigs(listOf("it", "ru", "zh-rCN", "zh-rTW"))
versionCode = 224 versionCode = 224
versionName = "2.9.1" versionName = "2.9.1"
@@ -32,6 +33,7 @@ android {
"room.incremental" to "true", "room.incremental" to "true",
"room.schemaLocation" to "$projectDir/schemas")) "room.schemaLocation" to "$projectDir/schemas"))
buildConfigField("boolean", "DONATIONS", "true") buildConfigField("boolean", "DONATIONS", "true")
buildConfigField("int", "TARGET_SDK", targetSdk.toString())
} }
buildFeatures { buildFeatures {
dataBinding = true dataBinding = true

View File

@@ -5,6 +5,7 @@ import android.system.ErrnoException
import android.system.OsConstants import android.system.OsConstants
import androidx.core.content.edit import androidx.core.content.edit
import be.mygod.vpnhotspot.App.Companion.app import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.BuildConfig
import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.util.RootSession import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.widget.SmartSnackbar import be.mygod.vpnhotspot.widget.SmartSnackbar
@@ -24,7 +25,8 @@ abstract class IpMonitor : Runnable {
"Dump (was interrupted and may be inconsistent.|terminated)$)").toRegex() "Dump (was interrupted and may be inconsistent.|terminated)$)").toRegex()
var currentMode: Mode var currentMode: Mode
get() { get() {
val defaultMode = if (Build.VERSION.SDK_INT < 30) @Suppress("DEPRECATION") { val isLegacy = Build.VERSION.SDK_INT < 30 || BuildConfig.TARGET_SDK < 30
val defaultMode = if (isLegacy) @Suppress("DEPRECATION") {
Mode.Poll Mode.Poll
} else Mode.MonitorRoot } else Mode.MonitorRoot
return Mode.valueOf(app.pref.getString(KEY, defaultMode.toString()) ?: "") return Mode.valueOf(app.pref.getString(KEY, defaultMode.toString()) ?: "")