Update Utils.kt

This commit is contained in:
OTKUSteyler 2026-09-05 12:43:04 +02:00 • committed by GitHub
parent 14a8067aea
commit 4599c2d96f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,10 @@
package GoonXposed.xposed
import android.app.AlertDialog
import android.app.Application
import android.content.Context
import android.content.Intent
import de.robv.android.xposed.AndroidAppHelper
import de.robv.android.xposed.XposedHelpers
import GoonXposed.xposed.modules.UpdaterModule
import kotlinx.serialization.json.Json
import java.io.File
@ -14,7 +15,9 @@ class Utils {
val JSON = Json { ignoreUnknownKeys = true }
fun reloadApp() {
val application = AndroidAppHelper.currentApplication()
val activityThread = XposedHelpers.findClass("android.app.ActivityThread", null)
val application =
XposedHelpers.callStaticMethod(activityThread, "currentApplication") as? Application ?: return
val intent = application.packageManager.getLaunchIntentForPackage(application.packageName)
application.startActivity(Intent.makeRestartActivityTask(intent!!.component))
exitProcess(0)
@ -50,4 +53,3 @@ class Utils {
fun w(msg: String) = android.util.Log.w(Constants.LOG_TAG, msg)
fun w(msg: String, throwable: Throwable) = android.util.Log.w(Constants.LOG_TAG, msg, throwable)
}
}