Skip to content

Commit 00e18cf

Browse files
committed
Add switch to disable hidden api bypass
link #387
1 parent c750915 commit 00e18cf

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

edxp-core/src/main/cpp/main/src/config_manager.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ namespace edxp {
8888
deopt_boot_image_enabled_ = access(GetConfigPath("deoptbootimage").c_str(), F_OK) == 0;
8989
resources_hook_enabled_ = access(GetConfigPath("disable_resources").c_str(), F_OK) != 0;
9090
no_module_log_enabled_ = access(GetConfigPath("disable_modules_log").c_str(), F_OK) == 0;
91+
hidden_api_bypass_enabled_ = access(GetConfigPath("disable_hidden_api_bypass").c_str(), F_OK) != 0;
9192

9293
// use_white_list snapshot
9394
use_white_list_snapshot_ = access(use_whitelist_path_.c_str(), F_OK) == 0;
@@ -98,6 +99,7 @@ namespace edxp {
9899
LOGI(" resources hook: %s", BoolToString(resources_hook_enabled_));
99100
LOGI(" deopt boot image: %s", BoolToString(deopt_boot_image_enabled_));
100101
LOGI(" no module log: %s", BoolToString(no_module_log_enabled_));
102+
LOGI(" hidden api bypass: %s", BoolToString(hidden_api_bypass_enabled_));
101103
if (black_white_list_enabled_) {
102104
SnapshotBlackWhiteList();
103105
}
@@ -183,6 +185,10 @@ namespace edxp {
183185
return deopt_boot_image_enabled_;
184186
}
185187

188+
ALWAYS_INLINE bool ConfigManager::IsHiddenAPIBypassEnabled() const {
189+
return hidden_api_bypass_enabled_;
190+
}
191+
186192
ALWAYS_INLINE std::string ConfigManager::GetInstallerPackageName() const {
187193
return installer_pkg_name_;
188194
}

edxp-core/src/main/cpp/main/src/config_manager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ namespace edxp {
3232

3333
bool IsNoModuleLogEnabled() const;
3434

35+
bool IsHiddenAPIBypassEnabled() const;
36+
3537
std::string GetInstallerPackageName() const;
3638

3739
std::string GetXposedPropPath() const;
@@ -46,6 +48,7 @@ namespace edxp {
4648

4749
bool IsAppNeedHook(const std::string &app_data_dir);
4850

51+
bool hidden_api_bypass_enabled_ = false;
4952
private:
5053
inline static ConfigManager *instance_;
5154
uid_t last_user_ = false;

edxp-core/src/main/cpp/main/src/native_hook.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ namespace edxp {
8383
if (art_hooks_installed) {
8484
return;
8585
}
86-
art::hidden_api::DisableHiddenApi(art_handle, hook_func);
86+
if (ConfigManager::GetInstance() -> IsHiddenAPIBypassEnabled()) {
87+
art::hidden_api::DisableHiddenApi(art_handle, hook_func);
88+
}
8789
art::Runtime::Setup(art_handle, hook_func);
8890
art::gc::Heap::Setup(art_handle, hook_func);
8991
art::ClassLinker::Setup(art_handle, hook_func);

0 commit comments

Comments
 (0)