Make timeout configurable

ContentObserver is deprecated for this feature.

Additionally repeater supports auto shutdown in older API levels as well, while temporary hotspot only auto shutdown in API 28-29 for now.
This commit is contained in:
Mygod
2020-07-02 09:06:46 +08:00
parent 4c5265f0c2
commit 0b02e7565e
8 changed files with 82 additions and 75 deletions

View File

@@ -188,7 +188,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
val networkName = RepeaterService.networkName
val passphrase = RepeaterService.passphrase
if (networkName != null && passphrase != null) {
return SoftApConfigurationCompat.empty().apply {
return SoftApConfigurationCompat().apply {
ssid = networkName
securityType = SoftApConfiguration.SECURITY_TYPE_WPA2_PSK // is not actually used
this.passphrase = passphrase
@@ -199,7 +199,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
}
} else binder?.let { binder ->
val group = binder.group ?: binder.fetchPersistentGroup().let { binder.group }
if (group != null) return SoftApConfigurationCompat.empty().run {
if (group != null) return SoftApConfigurationCompat().run {
ssid = group.networkName
securityType = SoftApConfiguration.SECURITY_TYPE_WPA2_PSK // is not actually used
band = SoftApConfigurationCompat.BAND_ANY