mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-12 14:55:20 +00:00
Refactor sepolicy.rules resolve native
Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
@@ -505,3 +505,15 @@ string find_apk_path(const char *pkg) {
|
||||
string path(buf);
|
||||
return path.append("/base.apk");
|
||||
}
|
||||
|
||||
string find_rules_dir(const char *base_dir) {
|
||||
string rules_dir = base_dir;
|
||||
if (access((rules_dir + "/unencrypted").data(), F_OK) == 0) {
|
||||
rules_dir += "/unencrypted/magisk";
|
||||
} else if (access((rules_dir + "/adb").data(), F_OK) == 0) {
|
||||
rules_dir += "/adb/modules";
|
||||
} else {
|
||||
rules_dir += "/magisk";
|
||||
}
|
||||
return rules_dir;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ void frm_rf(int dirfd);
|
||||
void clone_dir(int src, int dest);
|
||||
std::vector<mount_info> parse_mount_info(const char *pid);
|
||||
std::string find_apk_path(const char *pkg);
|
||||
std::string find_rules_dir(const char *base_dir);
|
||||
|
||||
using sFILE = std::unique_ptr<FILE, decltype(&fclose)>;
|
||||
using sDIR = std::unique_ptr<DIR, decltype(&closedir)>;
|
||||
|
||||
Reference in New Issue
Block a user