diff --git a/core/src/main/cpp/main/src/config_manager.cpp b/core/src/main/cpp/main/src/config_manager.cpp index 0a9446c7..70f4ad48 100644 --- a/core/src/main/cpp/main/src/config_manager.cpp +++ b/core/src/main/cpp/main/src/config_manager.cpp @@ -139,15 +139,9 @@ namespace lspd { return true; } - if (white_list_enable_) { - auto res = white_list_.count(package_name); - LOGD("using whitelist, %s -> %s", package_name.c_str(), BoolToString(res)); - return res; - } else { - auto res = !black_list_.count(package_name); - LOGD("using blacklist, %s -> %s", package_name.c_str(), BoolToString(res)); - return res; - } + auto res = white_list_.count(package_name); + LOGD("should hook %s -> %s", package_name.c_str(), BoolToString(res)); + return res; } ConfigManager::ConfigManager(uid_t user, bool initialized) : @@ -157,19 +151,16 @@ namespace lspd { base_config_path_(RetrieveBaseConfigPath()), initialized_(initialized || InitConfigPath()), installer_pkg_name_(RetrieveInstallerPkgName()), - white_list_enable_(path_exists(GetConfigPath("usewhitelist"))), deopt_boot_image_enabled_(path_exists(GetConfigPath("deoptbootimage"))), no_module_log_enabled_(path_exists(GetConfigPath("disable_modules_log"))), resources_hook_enabled_(path_exists(GetConfigPath("enable_resources"))), white_list_(GetAppList(GetConfigPath("whitelist/"))), - black_list_(GetAppList(GetConfigPath("blacklist/"))), modules_list_(GetModuleList()), last_write_time_(GetLastWriteTime()), variant_(GetVariant(GetMiscPath() / "variant")) { // use_white_list snapshot LOGI("base config path: %s", base_config_path_.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(" no module log: %s", BoolToString(no_module_log_enabled_)); LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_)); @@ -179,12 +170,6 @@ namespace lspd { std::ostream_iterator(join, "\n")); return join.str(); })().c_str()); - LOGI(" black list: \n %s", ([this]() { - std::ostringstream join; - std::copy(black_list_.begin(), black_list_.end(), - std::ostream_iterator(join, "\n")); - return join.str(); - })().c_str()); LOGI(" module list: \n %s", ([this]() { std::ostringstream join; std::vector module_list; @@ -255,7 +240,7 @@ namespace lspd { std::vector ConfigManager::GetAppModuleList(const std::string &pkg_name) const { std::vector app_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); } return app_modules_list; diff --git a/core/src/main/cpp/main/src/config_manager.h b/core/src/main/cpp/main/src/config_manager.h index aaa8ea98..84377fa0 100644 --- a/core/src/main/cpp/main/src/config_manager.h +++ b/core/src/main/cpp/main/src/config_manager.h @@ -118,13 +118,11 @@ namespace lspd { const std::filesystem::path base_config_path_; // /data/misc/lspd_xxxx/{user} const bool initialized_ = false; const std::filesystem::path installer_pkg_name_; - const bool white_list_enable_ = false; const bool deopt_boot_image_enabled_ = false; const bool no_module_log_enabled_ = false; const bool resources_hook_enabled_ = false; // snapshot at boot const std::unordered_set white_list_; - const std::unordered_set black_list_; const std::unordered_map>> modules_list_;