diff options
| author | 2021-04-19 07:50:35 +0000 | |
|---|---|---|
| committer | 2021-04-19 13:35:47 +0000 | |
| commit | 525fa42b13863305bc7cad34bba1c9ab5567894e (patch) | |
| tree | 0315618e0f82b8ac3d272328f6beca1bdef10398 /runtime/native/dalvik_system_DexFile.cc | |
| parent | 0744d72e304fddd5453d05f8e06fa85c0467e86d (diff) | |
Revert "Revert "Integrate ClassLoaderContext check in OatFileAssistant::GetBestOatFile.""
This reverts commit 656fdcd7f2aa9920ecd464dbb59d284e17969baa.
Bug: 176960283
Reason for revert: Racy code fixed in https://android-review.googlesource.com/c/platform/art/+/1678727
Change-Id: I7561aa8fad060bd076006dd4b1fbffc076834635
Diffstat (limited to 'runtime/native/dalvik_system_DexFile.cc')
| -rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index 1c4adab426..f8ad7f1b7a 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -18,6 +18,7 @@ #include <sstream> +#include "android-base/file.h" #include "android-base/stringprintf.h" #include "base/casts.h" @@ -541,22 +542,26 @@ static jint GetDexOptNeeded(JNIEnv* env, env->ThrowNew(iae.get(), message.c_str()); return -1; } + std::vector<int> context_fds; + context->OpenDexFiles(android::base::Dirname(filename), + context_fds, + /*only_read_checksums*/ true); } // TODO: Verify the dex location is well formed, and throw an IOException if // not? - OatFileAssistant oat_file_assistant(filename, target_instruction_set, false); + OatFileAssistant oat_file_assistant(filename, + target_instruction_set, + context.get(), + /* load_executable= */ false); // Always treat elements of the bootclasspath as up-to-date. if (oat_file_assistant.IsInBootClassPath()) { return OatFileAssistant::kNoDexOptNeeded; } - std::vector<int> context_fds; return oat_file_assistant.GetDexOptNeeded(filter, - context.get(), - context_fds, profile_changed, downgrade); } @@ -584,7 +589,9 @@ static jstring DexFile_getDexFileStatus(JNIEnv* env, return nullptr; } - OatFileAssistant oat_file_assistant(filename.c_str(), target_instruction_set, + OatFileAssistant oat_file_assistant(filename.c_str(), + target_instruction_set, + /* context= */ nullptr, /* load_executable= */ false); return env->NewStringUTF(oat_file_assistant.GetStatusDump().c_str()); } @@ -691,7 +698,10 @@ static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename return JNI_FALSE; } - OatFileAssistant oat_file_assistant(filename, kRuntimeISA, false); + OatFileAssistant oat_file_assistant(filename, + kRuntimeISA, + /* context= */ nullptr, + /* load_executable= */ false); return oat_file_assistant.IsUpToDate() ? JNI_FALSE : JNI_TRUE; } @@ -828,10 +838,11 @@ static jobjectArray DexFile_getDexFileOutputPaths(JNIEnv* env, } } - // If did not find a boot classpath oat file, lookup the oat file for an app. + // If we did not find a boot classpath oat file, lookup the oat file for an app. if (oat_filename.empty()) { OatFileAssistant oat_file_assistant(filename.c_str(), target_instruction_set, + /* context= */ nullptr, /* load_executable= */ false); std::unique_ptr<OatFile> best_oat_file = oat_file_assistant.GetBestOatFile(); |