diff options
| author | 2021-03-29 10:41:39 +0100 | |
|---|---|---|
| committer | 2021-03-31 12:50:36 +0000 | |
| commit | 9bc364bdda8955f35e8cc4c42312ec411403a995 (patch) | |
| tree | 8f0dd9a6874e883292571ff5a37e0be089190ca3 /runtime/native/dalvik_system_DexFile.cc | |
| parent | dbcf4a2a597309f33914fb60dc09e1056032794a (diff) | |
Support background verification of secondary dex files.
Re-use the infrastructure for background verification of in-memory dex
files to also trigger for secondary dex files.
Test: 692-vdex-secondary-loader
Bug: 160294863
Change-Id: I754d519b6a903c51e439ccab100d2d8f22f45df3
Diffstat (limited to 'runtime/native/dalvik_system_DexFile.cc')
| -rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index 3811ed9c6b..1c4adab426 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -326,27 +326,10 @@ static jobject DexFile_openDexFileNative(JNIEnv* env, return CreateCookieFromOatFileManagerResult(env, dex_files, oat_file, error_msgs); } -static jstring DexFile_getClassLoaderContext(JNIEnv* env, - jclass, - jobject class_loader, - jobjectArray dex_elements) { - CHECK(class_loader != nullptr); - constexpr const char* kBaseDir = ""; - std::unique_ptr<ClassLoaderContext> context = - ClassLoaderContext::CreateContextForClassLoader(class_loader, dex_elements); - if (context == nullptr || !context->OpenDexFiles(kBaseDir)) { - LOG(WARNING) << "Could not establish class loader context"; - return nullptr; - } - std::string str_context = context->EncodeContextForOatFile(kBaseDir); - return env->NewStringUTF(str_context.c_str()); -} - static void DexFile_verifyInBackgroundNative(JNIEnv* env, jclass, jobject cookie, - jobject class_loader, - jstring class_loader_context) { + jobject class_loader) { CHECK(cookie != nullptr); CHECK(class_loader != nullptr); @@ -359,17 +342,10 @@ static void DexFile_verifyInBackgroundNative(JNIEnv* env, } CHECK(oat_file == nullptr) << "Called verifyInBackground on a dex file backed by oat"; - ScopedUtfChars class_loader_context_utf(env, class_loader_context); - if (env->ExceptionCheck()) { - LOG(ERROR) << "Failed to unwrap class loader context string"; - return; - } - // Hand over to OatFileManager to spawn a verification thread. Runtime::Current()->GetOatFileManager().RunBackgroundVerification( dex_files, - class_loader, - class_loader_context_utf.c_str()); + class_loader); } static jboolean DexFile_closeDexFile(JNIEnv* env, jclass, jobject cookie) { @@ -954,14 +930,9 @@ static JNINativeMethod gMethods[] = { "Ljava/lang/ClassLoader;" "[Ldalvik/system/DexPathList$Element;" ")Ljava/lang/Object;"), - NATIVE_METHOD(DexFile, getClassLoaderContext, - "(Ljava/lang/ClassLoader;" - "[Ldalvik/system/DexPathList$Element;" - ")Ljava/lang/String;"), NATIVE_METHOD(DexFile, verifyInBackgroundNative, "(Ljava/lang/Object;" "Ljava/lang/ClassLoader;" - "Ljava/lang/String;" ")V"), NATIVE_METHOD(DexFile, isValidCompilerFilter, "(Ljava/lang/String;)Z"), NATIVE_METHOD(DexFile, isProfileGuidedCompilerFilter, "(Ljava/lang/String;)Z"), |