Add switch to disable hidden api bypass

link #387
This commit is contained in:
Jim Wu 2020-04-06 15:01:18 +08:00
parent c7509151fb
commit 00e18cf3b6
3 changed files with 12 additions and 1 deletions

View File

@ -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::IsHiddenAPIBypassEnabled() const {
return hidden_api_bypass_enabled_;
}
ALWAYS_INLINE std::string ConfigManager::GetInstallerPackageName() const {
return installer_pkg_name_;
}

View File

@ -32,6 +32,8 @@ namespace edxp {
bool IsNoModuleLogEnabled() const;
bool IsHiddenAPIBypassEnabled() 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;

View File

@ -83,7 +83,9 @@ namespace edxp {
if (art_hooks_installed) {
return;
}
art::hidden_api::DisableHiddenApi(art_handle, hook_func);
if (ConfigManager::GetInstance() -> IsHiddenAPIBypassEnabled()) {
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);