Suppress more CancellationException

This commit is contained in:
Mygod
2020-10-02 07:05:20 +08:00
parent 2fc237913b
commit c276642161
3 changed files with 11 additions and 7 deletions

View File

@@ -23,7 +23,6 @@ import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.root.WifiApCommands
import be.mygod.vpnhotspot.util.getRootCause
import be.mygod.vpnhotspot.util.readableMessage
import be.mygod.vpnhotspot.widget.SmartSnackbar
import kotlinx.coroutines.Dispatchers
@@ -102,7 +101,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
data.notifyChange()
}
override fun onException(e: Exception) {
if (e.getRootCause() !is SecurityException) Timber.w(e)
super.onException(e)
GlobalScope.launch(Dispatchers.Main.immediate) {
val context = parent.context ?: app
Toast.makeText(context, e.readableMessage, Toast.LENGTH_LONG).show()