Remove blacklist and force module to have scope
This commit is contained in:
parent
583e24b757
commit
17291dbe51
|
|
@ -139,15 +139,9 @@ namespace lspd {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (white_list_enable_) {
|
auto res = white_list_.count(package_name);
|
||||||
auto res = white_list_.count(package_name);
|
LOGD("should hook %s -> %s", package_name.c_str(), BoolToString(res));
|
||||||
LOGD("using whitelist, %s -> %s", package_name.c_str(), BoolToString(res));
|
return res;
|
||||||
return res;
|
|
||||||
} else {
|
|
||||||
auto res = !black_list_.count(package_name);
|
|
||||||
LOGD("using blacklist, %s -> %s", package_name.c_str(), BoolToString(res));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigManager::ConfigManager(uid_t user, bool initialized) :
|
ConfigManager::ConfigManager(uid_t user, bool initialized) :
|
||||||
|
|
@ -157,19 +151,16 @@ namespace lspd {
|
||||||
base_config_path_(RetrieveBaseConfigPath()),
|
base_config_path_(RetrieveBaseConfigPath()),
|
||||||
initialized_(initialized || InitConfigPath()),
|
initialized_(initialized || InitConfigPath()),
|
||||||
installer_pkg_name_(RetrieveInstallerPkgName()),
|
installer_pkg_name_(RetrieveInstallerPkgName()),
|
||||||
white_list_enable_(path_exists(GetConfigPath("usewhitelist"))),
|
|
||||||
deopt_boot_image_enabled_(path_exists(GetConfigPath("deoptbootimage"))),
|
deopt_boot_image_enabled_(path_exists(GetConfigPath("deoptbootimage"))),
|
||||||
no_module_log_enabled_(path_exists(GetConfigPath("disable_modules_log"))),
|
no_module_log_enabled_(path_exists(GetConfigPath("disable_modules_log"))),
|
||||||
resources_hook_enabled_(path_exists(GetConfigPath("enable_resources"))),
|
resources_hook_enabled_(path_exists(GetConfigPath("enable_resources"))),
|
||||||
white_list_(GetAppList(GetConfigPath("whitelist/"))),
|
white_list_(GetAppList(GetConfigPath("whitelist/"))),
|
||||||
black_list_(GetAppList(GetConfigPath("blacklist/"))),
|
|
||||||
modules_list_(GetModuleList()),
|
modules_list_(GetModuleList()),
|
||||||
last_write_time_(GetLastWriteTime()),
|
last_write_time_(GetLastWriteTime()),
|
||||||
variant_(GetVariant(GetMiscPath() / "variant")) {
|
variant_(GetVariant(GetMiscPath() / "variant")) {
|
||||||
// use_white_list snapshot
|
// use_white_list snapshot
|
||||||
LOGI("base config path: %s", base_config_path_.c_str());
|
LOGI("base config path: %s", base_config_path_.c_str());
|
||||||
LOGI(" using installer package name: %s", installer_pkg_name_.c_str());
|
LOGI(" using installer package name: %s", installer_pkg_name_.c_str());
|
||||||
LOGI(" using whitelist: %s", BoolToString(white_list_enable_));
|
|
||||||
LOGI(" deopt boot image: %s", BoolToString(deopt_boot_image_enabled_));
|
LOGI(" deopt boot image: %s", BoolToString(deopt_boot_image_enabled_));
|
||||||
LOGI(" no module log: %s", BoolToString(no_module_log_enabled_));
|
LOGI(" no module log: %s", BoolToString(no_module_log_enabled_));
|
||||||
LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_));
|
LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_));
|
||||||
|
|
@ -179,12 +170,6 @@ namespace lspd {
|
||||||
std::ostream_iterator<std::string>(join, "\n"));
|
std::ostream_iterator<std::string>(join, "\n"));
|
||||||
return join.str();
|
return join.str();
|
||||||
})().c_str());
|
})().c_str());
|
||||||
LOGI(" black list: \n %s", ([this]() {
|
|
||||||
std::ostringstream join;
|
|
||||||
std::copy(black_list_.begin(), black_list_.end(),
|
|
||||||
std::ostream_iterator<std::string>(join, "\n"));
|
|
||||||
return join.str();
|
|
||||||
})().c_str());
|
|
||||||
LOGI(" module list: \n %s", ([this]() {
|
LOGI(" module list: \n %s", ([this]() {
|
||||||
std::ostringstream join;
|
std::ostringstream join;
|
||||||
std::vector<std::string> module_list;
|
std::vector<std::string> module_list;
|
||||||
|
|
@ -255,7 +240,7 @@ namespace lspd {
|
||||||
std::vector<std::string> ConfigManager::GetAppModuleList(const std::string &pkg_name) const {
|
std::vector<std::string> ConfigManager::GetAppModuleList(const std::string &pkg_name) const {
|
||||||
std::vector<std::string> app_modules_list;
|
std::vector<std::string> app_modules_list;
|
||||||
for (const auto&[module, scope]: modules_list_) {
|
for (const auto&[module, scope]: modules_list_) {
|
||||||
if (scope.second.empty() || scope.second.count(pkg_name))
|
if (scope.second.count(pkg_name))
|
||||||
app_modules_list.push_back(scope.first);
|
app_modules_list.push_back(scope.first);
|
||||||
}
|
}
|
||||||
return app_modules_list;
|
return app_modules_list;
|
||||||
|
|
|
||||||
|
|
@ -118,13 +118,11 @@ namespace lspd {
|
||||||
const std::filesystem::path base_config_path_; // /data/misc/lspd_xxxx/{user}
|
const std::filesystem::path base_config_path_; // /data/misc/lspd_xxxx/{user}
|
||||||
const bool initialized_ = false;
|
const bool initialized_ = false;
|
||||||
const std::filesystem::path installer_pkg_name_;
|
const std::filesystem::path installer_pkg_name_;
|
||||||
const bool white_list_enable_ = false;
|
|
||||||
const bool deopt_boot_image_enabled_ = false;
|
const bool deopt_boot_image_enabled_ = false;
|
||||||
const bool no_module_log_enabled_ = false;
|
const bool no_module_log_enabled_ = false;
|
||||||
const bool resources_hook_enabled_ = false;
|
const bool resources_hook_enabled_ = false;
|
||||||
// snapshot at boot
|
// snapshot at boot
|
||||||
const std::unordered_set<std::string> white_list_;
|
const std::unordered_set<std::string> white_list_;
|
||||||
const std::unordered_set<std::string> black_list_;
|
|
||||||
|
|
||||||
const std::unordered_map<std::string, std::pair<std::string, std::unordered_set<std::string>>> modules_list_;
|
const std::unordered_map<std::string, std::pair<std::string, std::unordered_set<std::string>>> modules_list_;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue