Do not check for collision if we only extracted the apk

There is no need to check for collisions or verify the class loader
context if the verification is not enabled for the oat file.

This prevents the collision checks or dex2oat reruns when we only
extracted the dex files from apk and fixes.

Test: test-art-host
Bug: 147208643
Change-Id: I84e77baa89fe36705cc650ff21f95b244e7941d4
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 28984fd..96df61e 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -893,17 +893,23 @@
 
 bool OatFileAssistant::OatFileInfo::ClassLoaderContextIsOkay(ClassLoaderContext* context,
                                                              const std::vector<int>& context_fds) {
-  if (context == nullptr) {
-    VLOG(oat) << "ClassLoaderContext check ignored: null context";
-    return true;
-  }
-
   const OatFile* file = GetFile();
   if (file == nullptr) {
     // No oat file means we have nothing to verify.
     return true;
   }
 
+  if (!CompilerFilter::IsVerificationEnabled(file->GetCompilerFilter())) {
+    // If verification is not enabled we don't need to verify the class loader context and we
+    // assume it's ok.
+    return true;
+  }
+
+  if (context == nullptr) {
+    VLOG(oat) << "ClassLoaderContext check ignored: null context";
+    return true;
+  }
+
   size_t dir_index = oat_file_assistant_->dex_location_.rfind('/');
   std::string classpath_dir = (dir_index != std::string::npos)
       ? oat_file_assistant_->dex_location_.substr(0, dir_index)