Fix android vpn issues

This commit is contained in:
chen08209
2024-07-15 16:18:25 +08:00
parent 1c54db6bf3
commit 5292f34e8d

View File

@@ -174,19 +174,19 @@ class FlClashVpnService : VpnService() {
inner class LocalBinder : Binder() {
fun getService(): FlClashVpnService = this@FlClashVpnService
// override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
// try {
// val isSuccess = super.onTransact(code, data, reply, flags)
// if (!isSuccess) {
// CoroutineScope(Dispatchers.Main).launch {
// GlobalState.getCurrentTitlePlugin()?.handleStop()
// }
// }
// return isSuccess
// } catch (e: RemoteException) {
// throw e
// }
// }
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
try {
val isSuccess = super.onTransact(code, data, reply, flags)
if (!isSuccess) {
CoroutineScope(Dispatchers.Main).launch {
GlobalState.getCurrentTitlePlugin()?.handleStop()
}
}
return isSuccess
} catch (e: RemoteException) {
throw e
}
}
}
@@ -195,7 +195,6 @@ class FlClashVpnService : VpnService() {
}
override fun onUnbind(intent: Intent?): Boolean {
GlobalState.getCurrentTitlePlugin()?.handleStop()
return super.onUnbind(intent)
}