Ignore the optimized location passed to DexFile.loadDex()
This ensures that apps don't trigger dex2oat to locations
that are not recognized (anymore) by the runtime.
The background compilation job will takes care of optimizing
the dex files loaded via DexClassLoader.
Test: m test-art-host
Bug: 36824842
Change-Id: I6883740407203b4aa9511e7d15a8201db3df1168
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 0e61cf6..0617dae 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -254,10 +254,11 @@
return CreateSingleDexFileCookie(env, std::move(dex_mem_map));
}
+// TODO(calin): clean up the unused parameters (here and in libcore).
static jobject DexFile_openDexFileNative(JNIEnv* env,
jclass,
jstring javaSourceName,
- jstring javaOutputName,
+ jstring javaOutputName ATTRIBUTE_UNUSED,
jint flags ATTRIBUTE_UNUSED,
jobject class_loader,
jobjectArray dex_elements) {
@@ -265,10 +266,7 @@
if (sourceName.c_str() == nullptr) {
return 0;
}
- NullableScopedUtfChars outputName(env, javaOutputName);
- if (env->ExceptionCheck()) {
- return 0;
- }
+
Runtime* const runtime = Runtime::Current();
ClassLinker* linker = runtime->GetClassLinker();
std::vector<std::unique_ptr<const DexFile>> dex_files;
@@ -276,7 +274,6 @@
const OatFile* oat_file = nullptr;
dex_files = runtime->GetOatFileManager().OpenDexFilesFromOat(sourceName.c_str(),
- outputName.c_str(),
class_loader,
dex_elements,
/*out*/ &oat_file,