Don't verify dex file when the runtime is in NoVerify mode.
bug: 30972906
bug: 63920015
Test: systrace of priv-app with OOB, no verification at startup
Change-Id: I479a7ddcfa495228a379744b23c26fa8c91c3dde
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 5510743..38f59ef 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -230,7 +230,7 @@
// contents. So pass true to verify_checksum.
if (!DexFileLoader::Open(location.c_str(),
location.c_str(),
- /*verify*/ true,
+ Runtime::Current()->IsVerificationEnabled(),
/*verify_checksum*/ true,
&error_msg,
&info.opened_dex_files)) {
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index a3cbe95..940195c 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -599,7 +599,7 @@
static constexpr bool kVerifyChecksum = true;
if (!DexFileLoader::Open(dex_location,
dex_location,
- /*verify*/ true,
+ Runtime::Current()->IsVerificationEnabled(),
kVerifyChecksum,
/*out*/ &error_msg,
&dex_files)) {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index ca65478..7059653 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1030,8 +1030,12 @@
LOG(WARNING) << "Skipping non-existent dex file '" << dex_filename << "'";
continue;
}
- if (!DexFileLoader::Open(
- dex_filename, dex_location, /* verify */ true, kVerifyChecksum, &error_msg, dex_files)) {
+ if (!DexFileLoader::Open(dex_filename,
+ dex_location,
+ Runtime::Current()->IsVerificationEnabled(),
+ kVerifyChecksum,
+ &error_msg,
+ dex_files)) {
LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "': " << error_msg;
++failure_count;
}