diff --git a/edxp-core/src/main/cpp/main/src/config_manager.cpp b/edxp-core/src/main/cpp/main/src/config_manager.cpp index 3bf8c3653..e167fc2a0 100644 --- a/edxp-core/src/main/cpp/main/src/config_manager.cpp +++ b/edxp-core/src/main/cpp/main/src/config_manager.cpp @@ -88,6 +88,7 @@ namespace edxp { deopt_boot_image_enabled_ = access(GetConfigPath("deoptbootimage").c_str(), F_OK) == 0; resources_hook_enabled_ = access(GetConfigPath("disable_resources").c_str(), F_OK) != 0; no_module_log_enabled_ = access(GetConfigPath("disable_modules_log").c_str(), F_OK) == 0; + hidden_api_bypass_enabled_ = access(GetConfigPath("disable_hidden_api_bypass").c_str(), F_OK) != 0; // use_white_list snapshot use_white_list_snapshot_ = access(use_whitelist_path_.c_str(), F_OK) == 0; @@ -98,6 +99,7 @@ namespace edxp { LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_)); LOGI(" deopt boot image: %s", BoolToString(deopt_boot_image_enabled_)); LOGI(" no module log: %s", BoolToString(no_module_log_enabled_)); + LOGI(" hidden api bypass: %s", BoolToString(hidden_api_bypass_enabled_)); if (black_white_list_enabled_) { SnapshotBlackWhiteList(); } @@ -183,6 +185,10 @@ namespace edxp { return deopt_boot_image_enabled_; } + ALWAYS_INLINE bool ConfigManager::IsHiddenAPIEnabled() const { + return hidden_api_bypass_enabled_; + } + ALWAYS_INLINE std::string ConfigManager::GetInstallerPackageName() const { return installer_pkg_name_; } diff --git a/edxp-core/src/main/cpp/main/src/config_manager.h b/edxp-core/src/main/cpp/main/src/config_manager.h index db2023fd0..6503335a1 100644 --- a/edxp-core/src/main/cpp/main/src/config_manager.h +++ b/edxp-core/src/main/cpp/main/src/config_manager.h @@ -32,6 +32,8 @@ namespace edxp { bool IsNoModuleLogEnabled() const; + bool IsHiddenAPIEnabled() const; + std::string GetInstallerPackageName() const; std::string GetXposedPropPath() const; @@ -46,6 +48,7 @@ namespace edxp { bool IsAppNeedHook(const std::string &app_data_dir); + bool hidden_api_bypass_enabled_ = false; private: inline static ConfigManager *instance_; uid_t last_user_ = false; diff --git a/edxp-core/src/main/cpp/main/src/native_hook.cpp b/edxp-core/src/main/cpp/main/src/native_hook.cpp index 4028971b6..b074ca122 100644 --- a/edxp-core/src/main/cpp/main/src/native_hook.cpp +++ b/edxp-core/src/main/cpp/main/src/native_hook.cpp @@ -83,7 +83,9 @@ namespace edxp { if (art_hooks_installed) { return; } - art::hidden_api::DisableHiddenApi(art_handle, hook_func); + if (!ConfigManager::GetInstance() -> IsHiddenAPIEnabled()) { + art::hidden_api::DisableHiddenApi(art_handle, hook_func); + } art::Runtime::Setup(art_handle, hook_func); art::gc::Heap::Setup(art_handle, hook_func); art::ClassLinker::Setup(art_handle, hook_func);