chore: add framework version to debug ui

This commit is contained in:
ACh Sulfate
2024-07-23 22:03:17 +08:00
parent 74d3203216
commit 958ab830cc

View File

@@ -172,13 +172,7 @@ class TroubleshootFragment : BaseRootLayoutFragment() {
})
},
CategoryItem("调试信息") {
val statusInfo = "PID: " + android.os.Process.myPid() +
", UID: " + android.os.Process.myUid() +
", " + (if (android.os.Process.is64Bit()) "64 bit" else "32 bit") + "\n" +
"Xposed API version: " + StartupInfo.requireHookBridge().apiLevel + "\n" +
"module: " + StartupInfo.getModulePath() + "\n" +
"ctx.dataDir: " + hostInfo.application.dataDir
description(statusInfo, isTextSelectable = true)
description(generateStatusText(), isTextSelectable = true)
description(generateDebugInfo(), isTextSelectable = true)
}
)
@@ -482,6 +476,25 @@ class TroubleshootFragment : BaseRootLayoutFragment() {
startActivity(intent)
}
private fun generateStatusText(): String {
val loader = StartupInfo.getLoaderInfo()
val hook = StartupInfo.requireHookBridge()
var statusInfo = "PID: " + android.os.Process.myPid() +
", UID: " + android.os.Process.myUid() +
", " + (if (android.os.Process.is64Bit()) "64 bit" else "32 bit") + "\n" +
"Xposed API version: " + hook.apiLevel + "\n" +
"module: " + StartupInfo.getModulePath() + "\n" +
"ctx.dataDir: " + hostInfo.application.dataDir + "\n"
statusInfo += "entry: " + loader.entryPointName + "\n"
var xp = loader.queryExtension("GetXposedBridgeClass") as Class<*>?
if (xp == null) {
xp = loader.queryExtension("GetXposedInterfaceClass") as Class<*>?
}
statusInfo += "XposedBridge: " + (if (xp != null) xp.name else "null") + "\n"
statusInfo += hook.frameworkName + " " + hook.frameworkVersion + " (" + hook.frameworkVersionCode + ")\n"
return statusInfo
}
private fun generateDebugInfo(): CharSequence {
val ctx = requireContext()
val colorError: Int = ThemeAttrUtils.resolveColorOrDefaultColorInt(ctx, R.attr.unusableColor, Color.RED)