package com.github.kr328.clash import android.app.Application import android.content.Context import com.github.kr328.clash.common.Global import com.github.kr328.clash.common.compat.currentProcessName import com.github.kr328.clash.common.log.Log import com.github.kr328.clash.remote.Remote import com.github.kr328.clash.service.util.sendServiceRecreated @Suppress("unused") class MainApplication : Application() { override fun attachBaseContext(base: Context?) { super.attachBaseContext(base) Global.init(this) } override fun onCreate() { super.onCreate() val processName = currentProcessName Log.d("Process $processName started") if (processName == packageName) { Remote.launch() } else { sendServiceRecreated() } } fun finalize() { Global.destroy() } }