manager: implement app profile api call
This commit is contained in:
@@ -22,17 +22,8 @@
|
||||
#define CMD_GET_DENY_LIST 6
|
||||
#define CMD_CHECK_SAFEMODE 9
|
||||
|
||||
#define CMD_GET_WORK_MODE 10
|
||||
#define CMD_SET_WORK_MODE 11
|
||||
#define CMD_IN_ALLOW_LIST 12
|
||||
#define CMD_IN_DENY_LIST 13
|
||||
#define CMD_ADD_ALLOW_LIST 14
|
||||
#define CMD_REMOVE_ALLOW_LIST 15
|
||||
#define CMD_ADD_DENY_LIST 16
|
||||
#define CMD_REMOVE_DENY_LIST 17
|
||||
|
||||
#define CMD_GET_APP_PROFILE 18
|
||||
#define CMD_SET_APP_PROFILE 19
|
||||
#define CMD_GET_APP_PROFILE 10
|
||||
#define CMD_SET_APP_PROFILE 11
|
||||
|
||||
static bool ksuctl(int cmd, void* arg1, void* arg2) {
|
||||
int32_t result = 0;
|
||||
@@ -82,50 +73,6 @@ bool set_app_profile(const app_profile *profile) {
|
||||
return ksuctl(CMD_SET_APP_PROFILE, (void*) profile, nullptr);
|
||||
}
|
||||
|
||||
bool get_app_profile(int32_t key, app_profile *profile) {
|
||||
bool get_app_profile(p_key_t key, app_profile *profile) {
|
||||
return ksuctl(CMD_GET_APP_PROFILE, (void*) profile, nullptr);
|
||||
}
|
||||
|
||||
bool get_default_non_root_app_profile(app_profile *profile) {
|
||||
return get_app_profile(DEFAULT_NON_ROOT_PROFILE_KEY, profile);
|
||||
}
|
||||
|
||||
bool get_default_root_app_profile(app_profile *profile) {
|
||||
return get_app_profile(DEFAULT_ROOT_PROFILE_KEY, profile);
|
||||
}
|
||||
|
||||
bool is_allowlist_mode() {
|
||||
int32_t mode = -1;
|
||||
ksuctl(CMD_GET_WORK_MODE, &mode, nullptr);
|
||||
// for kernel that doesn't support allowlist mode, return -1 and it is always allowlist mode
|
||||
return mode <= 0;
|
||||
}
|
||||
|
||||
bool set_allowlist_mode(bool allowlist_mode) {
|
||||
int32_t mode = allowlist_mode ? 0 : 1;
|
||||
return ksuctl(CMD_SET_WORK_MODE, &mode, nullptr);
|
||||
}
|
||||
|
||||
bool is_in_allow_list(int uid) {
|
||||
return ksuctl(CMD_IN_ALLOW_LIST, &uid, nullptr);
|
||||
}
|
||||
|
||||
bool is_in_deny_list(int uid) {
|
||||
return ksuctl(CMD_IN_DENY_LIST, &uid, nullptr);
|
||||
}
|
||||
|
||||
bool add_to_allow_list(int uid) {
|
||||
return ksuctl(CMD_ADD_ALLOW_LIST, &uid, nullptr);
|
||||
}
|
||||
|
||||
bool remove_from_allow_list(int uid) {
|
||||
return ksuctl(CMD_REMOVE_ALLOW_LIST, &uid, nullptr);
|
||||
}
|
||||
|
||||
bool add_to_deny_list(int uid) {
|
||||
return ksuctl(CMD_ADD_DENY_LIST, &uid, nullptr);
|
||||
}
|
||||
|
||||
bool remove_from_deny_list(int uid) {
|
||||
return ksuctl(CMD_REMOVE_DENY_LIST, &uid, nullptr);
|
||||
}
|
||||
Reference in New Issue
Block a user