Fix lint and incorrect lifecycle owner

This commit is contained in:
Mygod
2020-06-11 03:51:12 +08:00
parent b9994bda9e
commit b20e3ab4a7
11 changed files with 34 additions and 23 deletions

View File

@@ -59,8 +59,8 @@ enum class TetherType(@DrawableRes val icon: Int) {
}
@RequiresApi(30)
override fun onTetherableInterfaceRegexpsChanged() {
Timber.i("onTetherableInterfaceRegexpsChanged")
override fun onTetherableInterfaceRegexpsChanged(args: Array<out Any?>?) {
Timber.i("onTetherableInterfaceRegexpsChanged: ${args?.contentToString()}")
TetheringManager.unregisterTetheringEventCallback(this)
requiresUpdate = true
listener()

View File

@@ -333,7 +333,7 @@ object TetheringManager {
* *@param reg The new regular expressions.
* @hide
*/
fun onTetherableInterfaceRegexpsChanged() {}
fun onTetherableInterfaceRegexpsChanged(args: Array<out Any?>?) {}
/**
* Called when there was a change in the list of tetherable interfaces. Tetherable
@@ -437,7 +437,7 @@ object TetheringManager {
callback?.onUpstreamChanged(args!![0] as Network?)
}
"onTetherableInterfaceRegexpsChanged" -> {
if (regexpsSent) callback?.onTetherableInterfaceRegexpsChanged()
if (regexpsSent) callback?.onTetherableInterfaceRegexpsChanged(args)
regexpsSent = true
}
"onTetherableInterfacesChanged" -> {

View File

@@ -1,5 +1,6 @@
package be.mygod.vpnhotspot.net.wifi
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.net.MacAddress
import android.net.wifi.SoftApConfiguration
@@ -237,6 +238,7 @@ data class SoftApConfigurationCompat(
* https://android.googlesource.com/platform/packages/apps/Settings/+/android-5.0.0_r1/src/com/android/settings/wifi/WifiApDialog.java#88
* https://android.googlesource.com/platform/packages/apps/Settings/+/b1af85d/src/com/android/settings/wifi/tether/WifiTetherSettings.java#162
*/
@SuppressLint("NewApi") // https://android.googlesource.com/platform/frameworks/base/+/android-5.0.0_r1/wifi/java/android/net/wifi/WifiConfiguration.java#1385
@Deprecated("Class deprecated in framework")
@Suppress("DEPRECATION")
fun toWifiConfiguration(): android.net.wifi.WifiConfiguration {