Skip to content

Commit

Permalink
Add switch to disable hidden api bypass
Browse files Browse the repository at this point in the history
link #387
  • Loading branch information
MlgmXyysd committed Apr 6, 2020
1 parent c750915 commit 2d3ce83
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions edxp-core/src/main/cpp/main/src/config_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down Expand Up @@ -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_;
}
Expand Down
3 changes: 3 additions & 0 deletions edxp-core/src/main/cpp/main/src/config_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace edxp {

bool IsNoModuleLogEnabled() const;

bool IsHiddenAPIEnabled() const;

std::string GetInstallerPackageName() const;

std::string GetXposedPropPath() const;
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion edxp-core/src/main/cpp/main/src/native_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2d3ce83

Please sign in to comment.