Fix lint
This commit is contained in:
@@ -50,8 +50,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
|
||||
|
||||
var persistentSupported = false
|
||||
|
||||
@delegate:TargetApi(29)
|
||||
private val hasP2pValidateName by lazy {
|
||||
private val hasP2pValidateName by lazy @TargetApi(29) {
|
||||
val array = Build.VERSION.SECURITY_PATCH.split('-', limit = 3)
|
||||
val y = array.getOrNull(0)?.toIntOrNull()
|
||||
val m = array.getOrNull(1)?.toIntOrNull()
|
||||
|
||||
@@ -172,9 +172,8 @@ object TetheringManager {
|
||||
|
||||
@get:RequiresApi(30)
|
||||
private val clazz by lazy { Class.forName("android.net.TetheringManager") }
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val instance by lazy {
|
||||
private val instance by lazy @TargetApi(30) {
|
||||
@SuppressLint("WrongConstant") // hidden services are not included in constants as of R preview 4
|
||||
val service = Services.context.getSystemService(TETHERING_SERVICE)
|
||||
service
|
||||
|
||||
@@ -108,48 +108,41 @@ data class SoftApConfigurationCompat(
|
||||
android.net.wifi.WifiConfiguration::class.java.getDeclaredField("apChannel")
|
||||
}
|
||||
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val getAllowedClientList by lazy {
|
||||
private val getAllowedClientList by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("getAllowedClientList")
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val getBand by lazy { SoftApConfiguration::class.java.getDeclaredMethod("getBand") }
|
||||
@delegate:TargetApi(30)
|
||||
private val getBand by lazy @TargetApi(30) { SoftApConfiguration::class.java.getDeclaredMethod("getBand") }
|
||||
@get:RequiresApi(30)
|
||||
private val getBlockedClientList by lazy {
|
||||
private val getBlockedClientList by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("getBlockedClientList")
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val getChannel by lazy { SoftApConfiguration::class.java.getDeclaredMethod("getChannel") }
|
||||
@delegate:TargetApi(30)
|
||||
private val getChannel by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("getChannel")
|
||||
}
|
||||
@get:RequiresApi(30)
|
||||
private val getMaxNumberOfClients by lazy {
|
||||
private val getMaxNumberOfClients by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("getMaxNumberOfClients")
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val getShutdownTimeoutMillis by lazy {
|
||||
private val getShutdownTimeoutMillis by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("getShutdownTimeoutMillis")
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val isAutoShutdownEnabled by lazy {
|
||||
private val isAutoShutdownEnabled by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("isAutoShutdownEnabled")
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val isClientControlByUserEnabled by lazy {
|
||||
private val isClientControlByUserEnabled by lazy @TargetApi(30) {
|
||||
SoftApConfiguration::class.java.getDeclaredMethod("isClientControlByUserEnabled")
|
||||
}
|
||||
|
||||
@get:RequiresApi(30)
|
||||
private val classBuilder by lazy { Class.forName("android.net.wifi.SoftApConfiguration\$Builder") }
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val newBuilder by lazy { classBuilder.getConstructor(SoftApConfiguration::class.java) }
|
||||
private val newBuilder by lazy @TargetApi(30) { classBuilder.getConstructor(SoftApConfiguration::class.java) }
|
||||
@get:RequiresApi(30)
|
||||
private val build by lazy { classBuilder.getDeclaredMethod("build") }
|
||||
@get:RequiresApi(30)
|
||||
@@ -166,9 +159,10 @@ data class SoftApConfigurationCompat(
|
||||
private val setBlockedClientList by lazy {
|
||||
classBuilder.getDeclaredMethod("setBlockedClientList", java.util.List::class.java)
|
||||
}
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val setBssid by lazy { classBuilder.getDeclaredMethod("setBssid", MacAddress::class.java) }
|
||||
private val setBssid by lazy @TargetApi(30) {
|
||||
classBuilder.getDeclaredMethod("setBssid", MacAddress::class.java)
|
||||
}
|
||||
@get:RequiresApi(30)
|
||||
private val setChannel by lazy {
|
||||
classBuilder.getDeclaredMethod("setChannel", Int::class.java, Int::class.java)
|
||||
|
||||
@@ -19,9 +19,8 @@ value class SoftApInfo(val inner: Parcelable) {
|
||||
private val getBssid by lazy { clazz.getDeclaredMethod("getBssid") }
|
||||
@get:RequiresApi(31)
|
||||
private val getWifiStandard by lazy { clazz.getDeclaredMethod("getWifiStandard") }
|
||||
@delegate:TargetApi(31)
|
||||
@get:RequiresApi(31)
|
||||
private val getApInstanceIdentifier by lazy { UnblockCentral.getApInstanceIdentifier(clazz) }
|
||||
private val getApInstanceIdentifier by lazy @TargetApi(31) { UnblockCentral.getApInstanceIdentifier(clazz) }
|
||||
@get:RequiresApi(31)
|
||||
private val getAutoShutdownTimeoutMillis by lazy { clazz.getDeclaredMethod("getAutoShutdownTimeoutMillis") }
|
||||
|
||||
|
||||
@@ -42,9 +42,8 @@ object WifiApManager {
|
||||
}
|
||||
@get:RequiresApi(30)
|
||||
private val getSoftApConfiguration by lazy { WifiManager::class.java.getDeclaredMethod("getSoftApConfiguration") }
|
||||
@delegate:TargetApi(30)
|
||||
@get:RequiresApi(30)
|
||||
private val setSoftApConfiguration by lazy {
|
||||
private val setSoftApConfiguration by lazy @TargetApi(30) {
|
||||
WifiManager::class.java.getDeclaredMethod("setSoftApConfiguration", SoftApConfiguration::class.java)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@ value class WifiClient(val inner: Parcelable) {
|
||||
companion object {
|
||||
private val clazz by lazy { Class.forName("android.net.wifi.WifiClient") }
|
||||
private val getMacAddress by lazy { clazz.getDeclaredMethod("getMacAddress") }
|
||||
@delegate:TargetApi(31)
|
||||
@get:RequiresApi(31)
|
||||
private val getApInstanceIdentifier by lazy { UnblockCentral.getApInstanceIdentifier(clazz) }
|
||||
private val getApInstanceIdentifier by lazy @TargetApi(31) { UnblockCentral.getApInstanceIdentifier(clazz) }
|
||||
}
|
||||
|
||||
val macAddress get() = getMacAddress(inner) as MacAddress
|
||||
|
||||
@@ -159,8 +159,7 @@ fun NetworkInterface.formatAddresses(macOnly: Boolean = false) = SpannableString
|
||||
}
|
||||
}.trimEnd()
|
||||
|
||||
@delegate:SuppressLint("SoonBlockedPrivateApi")
|
||||
private val parseNumericAddress by lazy {
|
||||
private val parseNumericAddress by lazy @SuppressLint("SoonBlockedPrivateApi") {
|
||||
InetAddress::class.java.getDeclaredMethod("parseNumericAddress", String::class.java).apply {
|
||||
isAccessible = true
|
||||
}
|
||||
@@ -201,9 +200,8 @@ fun Resources.findIdentifier(name: String, defType: String, defPackage: String,
|
||||
if (alternativePackage != null && it == 0) getIdentifier(name, defType, alternativePackage) else it
|
||||
}
|
||||
|
||||
@delegate:TargetApi(26)
|
||||
@get:RequiresApi(26)
|
||||
private val newLookup by lazy {
|
||||
private val newLookup by lazy @TargetApi(26) {
|
||||
MethodHandles.Lookup::class.java.getDeclaredConstructor(Class::class.java, Int::class.java).apply {
|
||||
isAccessible = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user