Rollback partial modification

This commit is contained in:
chen08209
2024-07-15 16:14:19 +08:00
parent a4b5f4abdb
commit 1c54db6bf3
5 changed files with 22 additions and 18 deletions

View File

@@ -44,7 +44,7 @@ object GlobalState {
fun initServiceEngine(context: Context) {
if (serviceEngine != null) return
lock.withLock {
if (serviceEngine != null) return
destroyServiceEngine()
serviceEngine = FlutterEngine(context)
serviceEngine?.plugins?.add(ProxyPlugin())
serviceEngine?.plugins?.add(AppPlugin())

View File

@@ -174,16 +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 {
CoroutineScope(Dispatchers.Main).launch {
GlobalState.getCurrentTitlePlugin()?.handleStop()
}
try {
return super.onTransact(code, data, reply, flags)
} 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
// }
// }
}