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:
@@ -312,7 +312,8 @@ Java_com_sukisu_ultra_Natives_isKPMEnabled(JNIEnv *env, jobject) {
|
|||||||
return is_KPM_enable();
|
return is_KPM_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
Java_com_sukisu_ultra_Natives_getHookType(JNIEnv *env, jobject) {
|
Java_com_sukisu_ultra_Natives_getHookType(JNIEnv *env, jobject) {
|
||||||
return get_hook_type();
|
const char* hook_type = get_hook_type();
|
||||||
|
return env->NewStringUTF(hook_type);
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,13 @@ bool is_KPM_enable() {
|
|||||||
return ksuctl(CMD_ENABLE_KPM, &enabled, nullptr), enabled;
|
return ksuctl(CMD_ENABLE_KPM, &enabled, nullptr), enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_hook_type() {
|
const char* get_hook_type() {
|
||||||
bool enabled = false;
|
static char hook_type[16] = {0};
|
||||||
return ksuctl(CMD_HOOK_TYPE, &enabled, nullptr), enabled;
|
if (hook_type[0] == '\0') {
|
||||||
|
if (ksuctl(CMD_HOOK_TYPE, hook_type, nullptr)) {
|
||||||
|
return hook_type;
|
||||||
|
}
|
||||||
|
strcpy(hook_type, "Unknown");
|
||||||
|
}
|
||||||
|
return hook_type;
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,6 @@ bool is_su_enabled();
|
|||||||
|
|
||||||
bool is_KPM_enable();
|
bool is_KPM_enable();
|
||||||
|
|
||||||
bool get_hook_type();
|
const char* get_hook_type();
|
||||||
|
|
||||||
#endif //KERNELSU_KSU_H
|
#endif //KERNELSU_KSU_H
|
||||||
@@ -69,7 +69,7 @@ object Natives {
|
|||||||
external fun isSuEnabled(): Boolean
|
external fun isSuEnabled(): Boolean
|
||||||
external fun setSuEnabled(enabled: Boolean): Boolean
|
external fun setSuEnabled(enabled: Boolean): Boolean
|
||||||
external fun isKPMEnabled(): Boolean
|
external fun isKPMEnabled(): Boolean
|
||||||
external fun getHookType(): Boolean
|
external fun getHookType(): String
|
||||||
|
|
||||||
private const val NON_ROOT_DEFAULT_PROFILE_KEY = "$"
|
private const val NON_ROOT_DEFAULT_PROFILE_KEY = "$"
|
||||||
private const val NOBODY_UID = 9999
|
private const val NOBODY_UID = 9999
|
||||||
|
|||||||
@@ -725,38 +725,45 @@ private fun InfoCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!isSimpleMode) && (!isHideSusfsStatus)) {
|
if (!isSimpleMode && !isHideSusfsStatus &&
|
||||||
if (systemInfo.suSFSStatus == "Supported") {
|
systemInfo.suSFSStatus == "Supported" &&
|
||||||
if (systemInfo.suSFSVersion.isNotEmpty()) {
|
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}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoCardItem(
|
val infoText = SuSFSInfoText(systemInfo)
|
||||||
stringResource(R.string.home_susfs_version),
|
|
||||||
infoText,
|
InfoCardItem(
|
||||||
icon = Icons.Default.Storage
|
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> {
|
fun getManagerVersion(context: Context): Pair<String, Long> {
|
||||||
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!!
|
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!!
|
||||||
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo)
|
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user