manager: Add support to disable sucompat mode.

This commit is contained in:
weishu
2025-02-16 19:35:35 +08:00
parent 2096bd7304
commit 9bb39ff760
7 changed files with 63 additions and 1 deletions

View File

@@ -27,6 +27,8 @@
#define CMD_IS_UID_GRANTED_ROOT 12
#define CMD_IS_UID_SHOULD_UMOUNT 13
#define CMD_IS_SU_ENABLED 14
#define CMD_ENABLE_SU 15
static bool ksuctl(int cmd, void* arg1, void* arg2) {
int32_t result = 0;
@@ -84,3 +86,14 @@ bool set_app_profile(const app_profile *profile) {
bool get_app_profile(p_key_t key, app_profile *profile) {
return ksuctl(CMD_GET_APP_PROFILE, (void*) profile, nullptr);
}
bool set_su_enabled(bool enabled) {
return ksuctl(CMD_ENABLE_SU, (void*) enabled, nullptr);
}
bool is_su_enabled() {
bool enabled = true;
// if ksuctl failed, we assume su is enabled, and it cannot be disabled.
ksuctl(CMD_IS_SU_ENABLED, &enabled, nullptr);
return enabled;
}