Simplify WifiDoubleLock invocations
This commit is contained in:
@@ -15,7 +15,6 @@ import android.os.Looper
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.getSystemService
|
||||
import be.mygod.vpnhotspot.App.Companion.app
|
||||
import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
|
||||
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper
|
||||
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
|
||||
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.netId
|
||||
@@ -133,7 +132,6 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
|
||||
}
|
||||
}
|
||||
private var routingManager: RoutingManager? = null
|
||||
private var locked = false
|
||||
|
||||
var status = Status.IDLE
|
||||
private set(value) {
|
||||
@@ -277,9 +275,6 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
|
||||
* startService Step 3
|
||||
*/
|
||||
private fun doStart(group: WifiP2pGroup) {
|
||||
check(!locked)
|
||||
WifiDoubleLock.acquire()
|
||||
locked = true
|
||||
binder.group = group
|
||||
check(routingManager == null)
|
||||
routingManager = RoutingManager.LocalOnly(this, group.`interface`!!).apply { initRouting() }
|
||||
@@ -316,10 +311,6 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, SharedPrefere
|
||||
unregisterReceiver()
|
||||
routingManager?.stop()
|
||||
routingManager = null
|
||||
if (locked) {
|
||||
WifiDoubleLock.release()
|
||||
locked = false
|
||||
}
|
||||
status = Status.IDLE
|
||||
ServiceNotification.stopForeground(this)
|
||||
stopSelf()
|
||||
|
||||
Reference in New Issue
Block a user