summaryrefslogtreecommitdiff
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 5a3a6f0cf4..3afd320f05 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -268,6 +268,7 @@ Runtime::Runtime()
do_hidden_api_checks_(true),
pending_hidden_api_warning_(false),
dedupe_hidden_api_warnings_(true),
+ always_set_hidden_api_warning_flag_(false),
dump_native_stack_on_sig_quit_(true),
pruned_dalvik_cache_(false),
// Initially assume we perceive jank in case the process state is never updated.
@@ -1171,11 +1172,15 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
target_sdk_version_ = runtime_options.GetOrDefault(Opt::TargetSdkVersion);
- // Check whether to enforce hidden API access checks. Zygote needs to be exempt
- // but checks may be enabled for forked processes (see dalvik_system_ZygoteHooks).
- if (is_zygote_ || runtime_options.Exists(Opt::NoHiddenApiChecks)) {
- do_hidden_api_checks_ = false;
- }
+ // Check whether to enforce hidden API access checks. The checks are disabled
+ // by default and we only enable them if:
+ // (a) runtime was started with a flag that enables the checks, or
+ // (b) Zygote forked a new process that is not exempt (see ZygoteHooks).
+ // TODO(dbrazdil): Turn the NoHiddenApiChecks negative flag into a positive one
+ // to clean up this logic.
+ do_hidden_api_checks_ = IsAotCompiler() && !runtime_options.Exists(Opt::NoHiddenApiChecks);
+ DCHECK(!is_zygote_ || !do_hidden_api_checks_)
+ << "Zygote should not be started with hidden API checks";
no_sig_chain_ = runtime_options.Exists(Opt::NoSigChain);
force_native_bridge_ = runtime_options.Exists(Opt::ForceNativeBridge);