Prevent crash caused by wakelock released by other people

This commit is contained in:
Mygod
2019-02-22 13:36:02 +08:00
parent 544340bec3
commit 664913a2ff

View File

@@ -55,7 +55,7 @@ class WifiDoubleLock(lockType: Int) : AutoCloseable {
private val power = service.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "vpnhotspot:power").apply { acquire() } private val power = service.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "vpnhotspot:power").apply { acquire() }
override fun close() { override fun close() {
wifi.release() if (wifi.isHeld) wifi.release()
power.release() if (power.isHeld) power.release()
} }
} }