manager: Modifying the getHookType function to return a string type

Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
Co-authored-by: rifsxd <rifat.44.azad.rifs@gmail.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
ShirkNeko
2025-06-13 15:36:15 +08:00
parent 2d9783e3d4
commit d7a5e80d34
5 changed files with 47 additions and 33 deletions

View File

@@ -69,7 +69,7 @@ object Natives {
external fun isSuEnabled(): Boolean
external fun setSuEnabled(enabled: Boolean): Boolean
external fun isKPMEnabled(): Boolean
external fun getHookType(): Boolean
external fun getHookType(): String
private const val NON_ROOT_DEFAULT_PROFILE_KEY = "$"
private const val NOBODY_UID = 9999

View File

@@ -725,38 +725,45 @@ private fun InfoCard(
}
}
if ((!isSimpleMode) && (!isHideSusfsStatus)) {
if (systemInfo.suSFSStatus == "Supported") {
if (systemInfo.suSFSVersion.isNotEmpty()) {
val isSUS_SU = systemInfo.suSFSFeatures == "CONFIG_KSU_SUSFS_SUS_SU"
val infoText = buildString {
append(systemInfo.suSFSVersion)
append(if (isSUS_SU && !Natives.getHookType()) " (${systemInfo.suSFSVariant})" else {
if (Natives.getHookType()) {
" (${stringResource(R.string.manual_hook)})"
} else {
"Unknown"
}
})
if (isSUS_SU) {
if (systemInfo.susSUMode.isNotEmpty()) {
append(" ${stringResource(R.string.sus_su_mode)} ${systemInfo.susSUMode}")
}
}
}
if (!isSimpleMode && !isHideSusfsStatus &&
systemInfo.suSFSStatus == "Supported" &&
systemInfo.suSFSVersion.isNotEmpty()) {
InfoCardItem(
stringResource(R.string.home_susfs_version),
infoText,
icon = Icons.Default.Storage
)
}
}
val infoText = SuSFSInfoText(systemInfo)
InfoCardItem(
stringResource(R.string.home_susfs_version),
infoText,
icon = Icons.Default.Storage
)
}
}
}
}
@Composable
private fun SuSFSInfoText(systemInfo: HomeViewModel.SystemInfo): String = buildString {
append(systemInfo.suSFSVersion)
val isSUS_SU = systemInfo.suSFSFeatures == "CONFIG_KSU_SUSFS_SUS_SU"
val isKprobesHook = Natives.getHookType() == "Kprobes"
when {
isSUS_SU && isKprobesHook -> {
append(" (${systemInfo.suSFSVariant})")
if (systemInfo.susSUMode.isNotEmpty()) {
append(" ${stringResource(R.string.sus_su_mode)} ${systemInfo.susSUMode}")
}
}
Natives.getHookType() == "Manual" -> {
append(" (${stringResource(R.string.manual_hook)})")
}
else -> {
append(" (${Natives.getHookType()})")
}
}
}
fun getManagerVersion(context: Context): Pair<String, Long> {
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!!
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo)