Refine code style
This commit is contained in:
@@ -69,7 +69,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden">
|
android:windowSoftInputMode="stateAlwaysHidden">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
|
|||||||
val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName
|
val safeModeConfigurable get() = Build.VERSION.SDK_INT >= 29 && hasP2pValidateName
|
||||||
val safeMode get() = Build.VERSION.SDK_INT >= 29 &&
|
val safeMode get() = Build.VERSION.SDK_INT >= 29 &&
|
||||||
(!hasP2pValidateName || app.pref.getBoolean(KEY_SAFE_MODE, true))
|
(!hasP2pValidateName || app.pref.getBoolean(KEY_SAFE_MODE, true))
|
||||||
private val mNetworkName by lazy { UnblockCentral.WifiP2pConfig_Builder_mNetworkName }
|
@get:RequiresApi(29)
|
||||||
|
private val mNetworkName by lazy @TargetApi(29) { UnblockCentral.WifiP2pConfig_Builder_mNetworkName }
|
||||||
|
|
||||||
var networkName: String?
|
var networkName: String?
|
||||||
get() = app.pref.getString(KEY_NETWORK_NAME, null)
|
get() = app.pref.getString(KEY_NETWORK_NAME, null)
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ open class Client(val mac: MacAddressCompat, val iface: String) {
|
|||||||
* we hijack the get title process to check if we need to perform MacLookup,
|
* we hijack the get title process to check if we need to perform MacLookup,
|
||||||
* as record might not be initialized in other more appropriate places
|
* as record might not be initialized in other more appropriate places
|
||||||
*/
|
*/
|
||||||
SpannableStringBuilder(if (record.nickname.isEmpty()) {
|
SpannableStringBuilder(record.nickname.ifEmpty {
|
||||||
if (record.macLookupPending) MacLookup.perform(mac)
|
if (record.macLookupPending) MacLookup.perform(mac)
|
||||||
macIface
|
macIface
|
||||||
} else record.nickname).apply {
|
}).apply {
|
||||||
if (record.blocked) setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
|
if (record.blocked) setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,9 +225,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
|||||||
yield(SoftApCapability.featureLookup(bit, true))
|
yield(SoftApCapability.featureLookup(bit, true))
|
||||||
features = features and bit.inv()
|
features = features and bit.inv()
|
||||||
}
|
}
|
||||||
}.joinToSpanned().let {
|
}.joinToSpanned().ifEmpty { parent.getText(R.string.tethering_manage_wifi_no_features) })
|
||||||
if (it.isEmpty()) parent.getText(R.string.tethering_manage_wifi_no_features) else it
|
|
||||||
})
|
|
||||||
if (Build.VERSION.SDK_INT >= 31) {
|
if (Build.VERSION.SDK_INT >= 31) {
|
||||||
val list = SoftApConfigurationCompat.BAND_TYPES.map { band ->
|
val list = SoftApConfigurationCompat.BAND_TYPES.map { band ->
|
||||||
val channels = capability.getSupportedChannelList(band)
|
val channels = capability.getSupportedChannelList(band)
|
||||||
|
|||||||
@@ -182,14 +182,14 @@ class TetheringFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClick
|
|||||||
R.id.configuration -> item.subMenu.run {
|
R.id.configuration -> item.subMenu.run {
|
||||||
findItem(R.id.configuration_repeater).isNotGone = Services.p2p != null
|
findItem(R.id.configuration_repeater).isNotGone = Services.p2p != null
|
||||||
findItem(R.id.configuration_temp_hotspot).isNotGone =
|
findItem(R.id.configuration_temp_hotspot).isNotGone =
|
||||||
adapter.localOnlyHotspotManager.binder?.configuration != null
|
Build.VERSION.SDK_INT >= 26 && adapter.localOnlyHotspotManager.binder?.configuration != null
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.configuration_repeater -> {
|
R.id.configuration_repeater -> {
|
||||||
adapter.repeaterManager.configure()
|
adapter.repeaterManager.configure()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.configuration_temp_hotspot -> {
|
R.id.configuration_temp_hotspot -> @TargetApi(26) {
|
||||||
WifiApDialogFragment().apply {
|
WifiApDialogFragment().apply {
|
||||||
arg(WifiApDialogFragment.Arg(adapter.localOnlyHotspotManager.binder?.configuration ?: return false,
|
arg(WifiApDialogFragment.Arg(adapter.localOnlyHotspotManager.binder?.configuration ?: return false,
|
||||||
readOnly = true))
|
readOnly = true))
|
||||||
@@ -239,7 +239,7 @@ class TetheringFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClick
|
|||||||
if (which == DialogInterface.BUTTON_POSITIVE) viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
if (which == DialogInterface.BUTTON_POSITIVE) viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
||||||
val configuration = ret!!.configuration
|
val configuration = ret!!.configuration
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
if (Build.VERSION.SDK_INT in 28 until 30 &&
|
if (Build.VERSION.SDK_INT >= 28 && Build.VERSION.SDK_INT < 30 &&
|
||||||
configuration.isAutoShutdownEnabled != TetherTimeoutMonitor.enabled) try {
|
configuration.isAutoShutdownEnabled != TetherTimeoutMonitor.enabled) try {
|
||||||
TetherTimeoutMonitor.setEnabled(configuration.isAutoShutdownEnabled)
|
TetherTimeoutMonitor.setEnabled(configuration.isAutoShutdownEnabled)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ object TetheringManager {
|
|||||||
Class.forName("android.net.ConnectivityManager\$OnStartTetheringCallback")
|
Class.forName("android.net.ConnectivityManager\$OnStartTetheringCallback")
|
||||||
}
|
}
|
||||||
@get:RequiresApi(24)
|
@get:RequiresApi(24)
|
||||||
private val startTetheringLegacy by lazy {
|
private val startTetheringLegacy by lazy @TargetApi(24) {
|
||||||
ConnectivityManager::class.java.getDeclaredMethod("startTethering",
|
ConnectivityManager::class.java.getDeclaredMethod("startTethering",
|
||||||
Int::class.java, Boolean::class.java, classOnStartTetheringCallback, Handler::class.java)
|
Int::class.java, Boolean::class.java, classOnStartTetheringCallback, Handler::class.java)
|
||||||
}
|
}
|
||||||
@@ -206,34 +206,36 @@ object TetheringManager {
|
|||||||
Class.forName("android.net.TetheringManager\$TetheringRequest\$Builder")
|
Class.forName("android.net.TetheringManager\$TetheringRequest\$Builder")
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val newTetheringRequestBuilder by lazy { classTetheringRequestBuilder.getConstructor(Int::class.java) }
|
private val newTetheringRequestBuilder by lazy @TargetApi(30) {
|
||||||
|
classTetheringRequestBuilder.getConstructor(Int::class.java)
|
||||||
|
}
|
||||||
// @get:RequiresApi(30)
|
// @get:RequiresApi(30)
|
||||||
// private val setStaticIpv4Addresses by lazy {
|
// private val setStaticIpv4Addresses by lazy {
|
||||||
// classTetheringRequestBuilder.getDeclaredMethod("setStaticIpv4Addresses",
|
// classTetheringRequestBuilder.getDeclaredMethod("setStaticIpv4Addresses",
|
||||||
// LinkAddress::class.java, LinkAddress::class.java)
|
// LinkAddress::class.java, LinkAddress::class.java)
|
||||||
// }
|
// }
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setExemptFromEntitlementCheck by lazy {
|
private val setExemptFromEntitlementCheck by lazy @TargetApi(30) {
|
||||||
classTetheringRequestBuilder.getDeclaredMethod("setExemptFromEntitlementCheck", Boolean::class.java)
|
classTetheringRequestBuilder.getDeclaredMethod("setExemptFromEntitlementCheck", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setShouldShowEntitlementUi by lazy {
|
private val setShouldShowEntitlementUi by lazy @TargetApi(30) {
|
||||||
classTetheringRequestBuilder.getDeclaredMethod("setShouldShowEntitlementUi", Boolean::class.java)
|
classTetheringRequestBuilder.getDeclaredMethod("setShouldShowEntitlementUi", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val build by lazy { classTetheringRequestBuilder.getDeclaredMethod("build") }
|
private val build by lazy @TargetApi(30) { classTetheringRequestBuilder.getDeclaredMethod("build") }
|
||||||
|
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val interfaceStartTetheringCallback by lazy {
|
private val interfaceStartTetheringCallback by lazy {
|
||||||
Class.forName("android.net.TetheringManager\$StartTetheringCallback")
|
Class.forName("android.net.TetheringManager\$StartTetheringCallback")
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val startTethering by lazy {
|
private val startTethering by lazy @TargetApi(30) {
|
||||||
clazz.getDeclaredMethod("startTethering", Class.forName("android.net.TetheringManager\$TetheringRequest"),
|
clazz.getDeclaredMethod("startTethering", Class.forName("android.net.TetheringManager\$TetheringRequest"),
|
||||||
Executor::class.java, interfaceStartTetheringCallback)
|
Executor::class.java, interfaceStartTetheringCallback)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val stopTethering by lazy { clazz.getDeclaredMethod("stopTethering", Int::class.java) }
|
private val stopTethering by lazy @TargetApi(30) { clazz.getDeclaredMethod("stopTethering", Int::class.java) }
|
||||||
|
|
||||||
@Deprecated("Legacy API")
|
@Deprecated("Legacy API")
|
||||||
@RequiresApi(24)
|
@RequiresApi(24)
|
||||||
@@ -498,11 +500,11 @@ object TetheringManager {
|
|||||||
Class.forName("android.net.TetheringManager\$TetheringEventCallback")
|
Class.forName("android.net.TetheringManager\$TetheringEventCallback")
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val registerTetheringEventCallback by lazy {
|
private val registerTetheringEventCallback by lazy @TargetApi(30) {
|
||||||
clazz.getDeclaredMethod("registerTetheringEventCallback", Executor::class.java, interfaceTetheringEventCallback)
|
clazz.getDeclaredMethod("registerTetheringEventCallback", Executor::class.java, interfaceTetheringEventCallback)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val unregisterTetheringEventCallback by lazy {
|
private val unregisterTetheringEventCallback by lazy @TargetApi(30) {
|
||||||
clazz.getDeclaredMethod("unregisterTetheringEventCallback", interfaceTetheringEventCallback)
|
clazz.getDeclaredMethod("unregisterTetheringEventCallback", interfaceTetheringEventCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,7 +623,7 @@ object TetheringManager {
|
|||||||
"TETHER_ERROR_UNSUPPORTED", "TETHER_ERROR_UNAVAIL_IFACE", "TETHER_ERROR_MASTER_ERROR",
|
"TETHER_ERROR_UNSUPPORTED", "TETHER_ERROR_UNAVAIL_IFACE", "TETHER_ERROR_MASTER_ERROR",
|
||||||
"TETHER_ERROR_TETHER_IFACE_ERROR", "TETHER_ERROR_UNTETHER_IFACE_ERROR", "TETHER_ERROR_ENABLE_NAT_ERROR",
|
"TETHER_ERROR_TETHER_IFACE_ERROR", "TETHER_ERROR_UNTETHER_IFACE_ERROR", "TETHER_ERROR_ENABLE_NAT_ERROR",
|
||||||
"TETHER_ERROR_DISABLE_NAT_ERROR", "TETHER_ERROR_IFACE_CFG_ERROR", "TETHER_ERROR_PROVISION_FAILED",
|
"TETHER_ERROR_DISABLE_NAT_ERROR", "TETHER_ERROR_IFACE_CFG_ERROR", "TETHER_ERROR_PROVISION_FAILED",
|
||||||
"TETHER_ERROR_DHCPSERVER_ERROR", "TETHER_ERROR_ENTITLEMENT_UNKNOWN") { clazz }
|
"TETHER_ERROR_DHCPSERVER_ERROR", "TETHER_ERROR_ENTITLEMENT_UNKNOWN") @TargetApi(30) { clazz }
|
||||||
@RequiresApi(30)
|
@RequiresApi(30)
|
||||||
const val TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION = 14
|
const val TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION = 14
|
||||||
|
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ abstract class IpMonitor {
|
|||||||
try {
|
try {
|
||||||
RootManager.use { server ->
|
RootManager.use { server ->
|
||||||
// while we only need to use this server once, we need to also keep the server alive
|
// while we only need to use this server once, we need to also keep the server alive
|
||||||
handleChannel(server.create(ProcessListener(errorMatcher, Routing.IP, "monitor", monitoredObject),
|
handleChannel(server.create(ProcessListener(errorMatcher,
|
||||||
this))
|
Routing.IP, "monitor", monitoredObject), this))
|
||||||
}
|
}
|
||||||
} catch (_: CancellationException) {
|
} catch (_: CancellationException) {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ class TetherTimeoutMonitor(private val timeout: Long = 0,
|
|||||||
} else {
|
} else {
|
||||||
val info = WifiApManager.resolvedActivity.activityInfo
|
val info = WifiApManager.resolvedActivity.activityInfo
|
||||||
val resources = app.packageManager.getResourcesForApplication(info.applicationInfo)
|
val resources = app.packageManager.getResourcesForApplication(info.applicationInfo)
|
||||||
resources.getInteger(resources.findIdentifier("config_wifiFrameworkSoftApShutDownTimeoutMilliseconds",
|
resources.getInteger(resources.findIdentifier(
|
||||||
"integer", WifiApManager.RESOURCES_PACKAGE, info.packageName))
|
"config_wifiFrameworkSoftApShutDownTimeoutMilliseconds", "integer",
|
||||||
|
WifiApManager.RESOURCES_PACKAGE, info.packageName))
|
||||||
}
|
}
|
||||||
} catch (e: RuntimeException) {
|
} catch (e: RuntimeException) {
|
||||||
Timber.w(e)
|
Timber.w(e)
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ data class SoftApConfigurationCompat(
|
|||||||
/**
|
/**
|
||||||
* Based on:
|
* Based on:
|
||||||
* https://elixir.bootlin.com/linux/v5.12.8/source/net/wireless/util.c#L75
|
* https://elixir.bootlin.com/linux/v5.12.8/source/net/wireless/util.c#L75
|
||||||
* TODO: update for Android 12
|
* https://cs.android.com/android/platform/superproject/+/master:packages/modules/Wifi/framework/java/android/net/wifi/ScanResult.java;l=789;drc=71d758698c45984d3f8de981bf98e56902480f16
|
||||||
* https://cs.android.com/android/platform/superproject/+/master:frameworks/base/wifi/java/android/net/wifi/ScanResult.java;l=624;drc=f7ccda05642b55700d67a288462bada488fc7f5e
|
|
||||||
*/
|
*/
|
||||||
fun channelToFrequency(band: Int, chan: Int) = when (band) {
|
fun channelToFrequency(band: Int, chan: Int) = when (band) {
|
||||||
BAND_2GHZ -> when (chan) {
|
BAND_2GHZ -> when (chan) {
|
||||||
@@ -211,23 +210,23 @@ data class SoftApConfigurationCompat(
|
|||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val newBuilder by lazy @TargetApi(30) { classBuilder.getConstructor(SoftApConfiguration::class.java) }
|
private val newBuilder by lazy @TargetApi(30) { classBuilder.getConstructor(SoftApConfiguration::class.java) }
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val build by lazy { classBuilder.getDeclaredMethod("build") }
|
private val build by lazy @TargetApi(30) { classBuilder.getDeclaredMethod("build") }
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setAllowedClientList by lazy {
|
private val setAllowedClientList by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setAllowedClientList", java.util.List::class.java)
|
classBuilder.getDeclaredMethod("setAllowedClientList", java.util.List::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setAutoShutdownEnabled by lazy {
|
private val setAutoShutdownEnabled by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setAutoShutdownEnabled", Boolean::class.java)
|
classBuilder.getDeclaredMethod("setAutoShutdownEnabled", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setBand by lazy { classBuilder.getDeclaredMethod("setBand", Int::class.java) }
|
private val setBand by lazy @TargetApi(30) { classBuilder.getDeclaredMethod("setBand", Int::class.java) }
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setBlockedClientList by lazy {
|
private val setBlockedClientList by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setBlockedClientList", java.util.List::class.java)
|
classBuilder.getDeclaredMethod("setBlockedClientList", java.util.List::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(31)
|
@get:RequiresApi(31)
|
||||||
private val setBridgedModeOpportunisticShutdownEnabled by lazy {
|
private val setBridgedModeOpportunisticShutdownEnabled by lazy @TargetApi(31) {
|
||||||
classBuilder.getDeclaredMethod("setBridgedModeOpportunisticShutdownEnabled", Boolean::class.java)
|
classBuilder.getDeclaredMethod("setBridgedModeOpportunisticShutdownEnabled", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
@@ -235,41 +234,43 @@ data class SoftApConfigurationCompat(
|
|||||||
classBuilder.getDeclaredMethod("setBssid", MacAddress::class.java)
|
classBuilder.getDeclaredMethod("setBssid", MacAddress::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setChannel by lazy {
|
private val setChannel by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setChannel", Int::class.java, Int::class.java)
|
classBuilder.getDeclaredMethod("setChannel", Int::class.java, Int::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(31)
|
@get:RequiresApi(31)
|
||||||
private val setChannels by lazy {
|
private val setChannels by lazy @TargetApi(31) {
|
||||||
classBuilder.getDeclaredMethod("setChannels", SparseIntArray::class.java)
|
classBuilder.getDeclaredMethod("setChannels", SparseIntArray::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setClientControlByUserEnabled by lazy {
|
private val setClientControlByUserEnabled by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setClientControlByUserEnabled", Boolean::class.java)
|
classBuilder.getDeclaredMethod("setClientControlByUserEnabled", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setHiddenSsid by lazy { classBuilder.getDeclaredMethod("setHiddenSsid", Boolean::class.java) }
|
private val setHiddenSsid by lazy @TargetApi(30) {
|
||||||
|
classBuilder.getDeclaredMethod("setHiddenSsid", Boolean::class.java)
|
||||||
|
}
|
||||||
@get:RequiresApi(31)
|
@get:RequiresApi(31)
|
||||||
private val setIeee80211axEnabled by lazy {
|
private val setIeee80211axEnabled by lazy @TargetApi(31) {
|
||||||
classBuilder.getDeclaredMethod("setIeee80211axEnabled", Boolean::class.java)
|
classBuilder.getDeclaredMethod("setIeee80211axEnabled", Boolean::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(31)
|
@get:RequiresApi(31)
|
||||||
private val setMacRandomizationSetting by lazy {
|
private val setMacRandomizationSetting by lazy @TargetApi(31) {
|
||||||
classBuilder.getDeclaredMethod("setMacRandomizationSetting", Int::class.java)
|
classBuilder.getDeclaredMethod("setMacRandomizationSetting", Int::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setMaxNumberOfClients by lazy {
|
private val setMaxNumberOfClients by lazy @TargetApi(31) {
|
||||||
classBuilder.getDeclaredMethod("setMaxNumberOfClients", Int::class.java)
|
classBuilder.getDeclaredMethod("setMaxNumberOfClients", Int::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setPassphrase by lazy {
|
private val setPassphrase by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setPassphrase", String::class.java, Int::class.java)
|
classBuilder.getDeclaredMethod("setPassphrase", String::class.java, Int::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setShutdownTimeoutMillis by lazy {
|
private val setShutdownTimeoutMillis by lazy @TargetApi(30) {
|
||||||
classBuilder.getDeclaredMethod("setShutdownTimeoutMillis", Long::class.java)
|
classBuilder.getDeclaredMethod("setShutdownTimeoutMillis", Long::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val setSsid by lazy { classBuilder.getDeclaredMethod("setSsid", String::class.java) }
|
private val setSsid by lazy @TargetApi(30) { classBuilder.getDeclaredMethod("setSsid", String::class.java) }
|
||||||
@get:RequiresApi(31)
|
@get:RequiresApi(31)
|
||||||
private val setUserConfiguration by lazy @TargetApi(31) { UnblockCentral.setUserConfiguration(classBuilder) }
|
private val setUserConfiguration by lazy @TargetApi(31) { UnblockCentral.setUserConfiguration(classBuilder) }
|
||||||
|
|
||||||
@@ -350,7 +351,7 @@ data class SoftApConfigurationCompat(
|
|||||||
if (channel == 0) setBand(builder, band) else setChannel(builder, channel, band)
|
if (channel == 0) setBand(builder, band) else setChannel(builder, channel, band)
|
||||||
} else setChannels(builder, channels)
|
} else setChannels(builder, channels)
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val staticBuilder by lazy { classBuilder.newInstance() }
|
private val staticBuilder by lazy @TargetApi(30) { classBuilder.newInstance() }
|
||||||
@RequiresApi(30)
|
@RequiresApi(30)
|
||||||
fun testPlatformValidity(channels: SparseIntArray) = setChannelsCompat(staticBuilder, channels)
|
fun testPlatformValidity(channels: SparseIntArray) = setChannelsCompat(staticBuilder, channels)
|
||||||
@RequiresApi(30)
|
@RequiresApi(30)
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
channels2G + (15..165).map { ChannelOption(SoftApConfigurationCompat.BAND_5GHZ, it) }
|
channels2G + (15..165).map { ChannelOption(SoftApConfigurationCompat.BAND_5GHZ, it) }
|
||||||
}
|
}
|
||||||
private val p2pSafeOptions by lazy { genAutoOptions(SoftApConfigurationCompat.BAND_LEGACY) + channels5G }
|
private val p2pSafeOptions by lazy { genAutoOptions(SoftApConfigurationCompat.BAND_LEGACY) + channels5G }
|
||||||
@get:RequiresApi(30)
|
|
||||||
private val softApOptions by lazy {
|
private val softApOptions by lazy {
|
||||||
when (Build.VERSION.SDK_INT) {
|
when (Build.VERSION.SDK_INT) {
|
||||||
in 30..Int.MAX_VALUE -> {
|
in 30..Int.MAX_VALUE -> {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class UpstreamsPreference(context: Context, attrs: AttributeSet) : Preference(co
|
|||||||
if (internet) SpannableStringBuilder(ifname).apply {
|
if (internet) SpannableStringBuilder(ifname).apply {
|
||||||
setSpan(StyleSpan(Typeface.BOLD), 0, length, 0)
|
setSpan(StyleSpan(Typeface.BOLD), 0, length, 0)
|
||||||
} else ifname
|
} else ifname
|
||||||
}.joinTo(SpannableStringBuilder()).let { if (it.isEmpty()) "∅" else it }
|
}.joinTo(SpannableStringBuilder()).ifEmpty { "∅" }
|
||||||
|
|
||||||
override fun onAvailable(properties: LinkProperties?) {
|
override fun onAvailable(properties: LinkProperties?) {
|
||||||
val result = mutableMapOf<String, Boolean>()
|
val result = mutableMapOf<String, Boolean>()
|
||||||
|
|||||||
Reference in New Issue
Block a user