Remove stripped-apk related logic from CLC

Stripped-apks are no longer supported by the runtime and
the current logic prevents bug fixes and code evolution.

Bug: 111442216
Test: test-art-host
Change-Id: I30d5825e4f6453981ca9165bebafe67557c28b93
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index eebe4ee..eeb2d6b 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1619,8 +1619,7 @@
       // (because the encoding adds the dex checksum...)
       // TODO(calin): consider redesigning this so we don't have to open the dex files before
       // creating the actual class loader.
-      if (!class_loader_context_->OpenDexFiles(runtime_->GetInstructionSet(),
-                                               classpath_dir_,
+      if (!class_loader_context_->OpenDexFiles(classpath_dir_,
                                                class_loader_context_fds_)) {
         // Do not abort if we couldn't open files from the classpath. They might be
         // apks without dex files and right now are opening flow will fail them.
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index 7ff6cfc..c0dd84c 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -959,55 +959,15 @@
   RunTest(context.c_str(), expected_classpath_key.c_str(), true);
 }
 
-TEST_F(Dex2oatClassLoaderContextTest, ContextWithStrippedDexFiles) {
-  std::string stripped_classpath = GetScratchDir() + "/stripped_classpath.jar";
-  Copy(GetStrippedDexSrc1(), stripped_classpath);
+TEST_F(Dex2oatClassLoaderContextTest, ContextWithResourceOnlyDexFiles) {
+  std::string resource_only_classpath = GetScratchDir() + "/resource_only_classpath.jar";
+  Copy(GetResourceOnlySrc1(), resource_only_classpath);
 
-  std::string context = "PCL[" + stripped_classpath + "]";
-  // Expect an empty context because stripped dex files cannot be open.
+  std::string context = "PCL[" + resource_only_classpath + "]";
+  // Expect an empty context because resource only dex files cannot be open.
   RunTest(context.c_str(), kEmptyClassPathKey , /*expected_success*/ true);
 }
 
-TEST_F(Dex2oatClassLoaderContextTest, ContextWithStrippedDexFilesBackedByOdex) {
-  std::string stripped_classpath = GetScratchDir() + "/stripped_classpath.jar";
-  std::string odex_for_classpath = GetOdexDir() + "/stripped_classpath.odex";
-
-  Copy(GetDexSrc1(), stripped_classpath);
-
-  ASSERT_TRUE(GenerateOdexForTest(stripped_classpath,
-                                  odex_for_classpath,
-                                  CompilerFilter::kVerify,
-                                  {},
-                                  true));
-
-  // Strip the dex file
-  Copy(GetStrippedDexSrc1(), stripped_classpath);
-
-  std::string context = "PCL[" + stripped_classpath + "]";
-  std::string expected_classpath_key;
-  {
-    // Open the oat file to get the expected classpath.
-    OatFileAssistant oat_file_assistant(stripped_classpath.c_str(), kRuntimeISA, false, false);
-    std::unique_ptr<OatFile> oat_file(oat_file_assistant.GetBestOatFile());
-    std::vector<std::unique_ptr<const DexFile>> oat_dex_files =
-        OatFileAssistant::LoadDexFiles(*oat_file, stripped_classpath.c_str());
-    expected_classpath_key = "PCL[";
-    for (size_t i = 0; i < oat_dex_files.size(); i++) {
-      if (i > 0) {
-        expected_classpath_key + ":";
-      }
-      expected_classpath_key += oat_dex_files[i]->GetLocation() + "*" +
-          std::to_string(oat_dex_files[i]->GetLocationChecksum());
-    }
-    expected_classpath_key += "]";
-  }
-
-  RunTest(context.c_str(),
-          expected_classpath_key.c_str(),
-          /*expected_success*/ true,
-          /*use_second_source*/ true);
-}
-
 TEST_F(Dex2oatClassLoaderContextTest, ContextWithNotExistentDexFiles) {
   std::string context = "PCL[does_not_exists.dex]";
   // Expect an empty context because stripped dex files cannot be open.
diff --git a/dexoptanalyzer/dexoptanalyzer_test.cc b/dexoptanalyzer/dexoptanalyzer_test.cc
index d8321d6..4fb0b9e 100644
--- a/dexoptanalyzer/dexoptanalyzer_test.cc
+++ b/dexoptanalyzer/dexoptanalyzer_test.cc
@@ -228,47 +228,12 @@
   Verify(dex_location, CompilerFilter::kEverything);
 }
 
-// Case: We have a stripped DEX file and a PIC ODEX file, but no OAT file.
-TEST_F(DexoptAnalyzerTest, StrippedDexOdexNoOat) {
-  std::string dex_location = GetScratchDir() + "/StrippedDexOdexNoOat.jar";
-  std::string odex_location = GetOdexDir() + "/StrippedDexOdexNoOat.odex";
-
-  Copy(GetDexSrc1(), dex_location);
-  GenerateOdexForTest(dex_location, odex_location, CompilerFilter::kSpeed);
-
-  // Strip the dex file
-  Copy(GetStrippedDexSrc1(), dex_location);
-
-  Verify(dex_location, CompilerFilter::kSpeed);
-}
-
-// Case: We have a stripped DEX file, a PIC ODEX file, and an out-of-date OAT file.
-TEST_F(DexoptAnalyzerTest, StrippedDexOdexOat) {
-  std::string dex_location = GetScratchDir() + "/StrippedDexOdexOat.jar";
-  std::string odex_location = GetOdexDir() + "/StrippedDexOdexOat.odex";
-
-  // Create the oat file from a different dex file so it looks out of date.
-  Copy(GetDexSrc2(), dex_location);
-  GenerateOatForTest(dex_location.c_str(), CompilerFilter::kSpeed);
-
-  // Create the odex file
-  Copy(GetDexSrc1(), dex_location);
-  GenerateOdexForTest(dex_location, odex_location, CompilerFilter::kSpeed);
-
-  // Strip the dex file.
-  Copy(GetStrippedDexSrc1(), dex_location);
-
-  Verify(dex_location, CompilerFilter::kExtract);
-  Verify(dex_location, CompilerFilter::kSpeed);
-  Verify(dex_location, CompilerFilter::kEverything);
-}
-
 // Case: We have a stripped (or resource-only) DEX file, no ODEX file and no
 // OAT file. Expect: The status is kNoDexOptNeeded.
 TEST_F(DexoptAnalyzerTest, ResourceOnlyDex) {
   std::string dex_location = GetScratchDir() + "/ResourceOnlyDex.jar";
 
-  Copy(GetStrippedDexSrc1(), dex_location);
+  Copy(GetResourceOnlySrc1(), dex_location);
 
   Verify(dex_location, CompilerFilter::kSpeed);
   Verify(dex_location, CompilerFilter::kExtract);
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc
index d17c61e..a35559e 100644
--- a/libdexfile/dex/art_dex_file_loader.cc
+++ b/libdexfile/dex/art_dex_file_loader.cc
@@ -250,6 +250,18 @@
   return OpenWithMagic(magic, fd, location, verify, verify_checksum, error_msg, dex_files);
 }
 
+bool ArtDexFileLoader::Open(const char* filename,
+                            int fd,
+                            const std::string& location,
+                            bool verify,
+                            bool verify_checksum,
+                            std::string* error_msg,
+                            std::vector<std::unique_ptr<const DexFile>>* dex_files) const {
+  return fd == -1
+      ? Open(filename, location, verify, verify_checksum, error_msg, dex_files)
+      : Open(fd, location, verify, verify_checksum, error_msg, dex_files);
+}
+
 bool ArtDexFileLoader::OpenWithMagic(uint32_t magic,
                                      int fd,
                                      const std::string& location,
diff --git a/libdexfile/dex/art_dex_file_loader.h b/libdexfile/dex/art_dex_file_loader.h
index bf38527..05ed8bd 100644
--- a/libdexfile/dex/art_dex_file_loader.h
+++ b/libdexfile/dex/art_dex_file_loader.h
@@ -86,6 +86,16 @@
             bool verify_checksum,
             std::string* error_msg,
             std::vector<std::unique_ptr<const DexFile>>* dex_files) const;
+  // Opens all .dex files found in the file, guessing the container format based on file magic.
+  // If the fd is -1 then the dex files are opened using the filename; otherwise they are
+  // opened using the fd.
+  bool Open(const char* filename,
+            int fd,
+            const std::string& location,
+            bool verify,
+            bool verify_checksum,
+            std::string* error_msg,
+            std::vector<std::unique_ptr<const DexFile>>* dex_files) const;
 
   // Open a single dex file from an fd. This function closes the fd.
   std::unique_ptr<const DexFile> OpenDex(int fd,
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 74f464c..34a1722 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -399,10 +399,8 @@
   return first.release();
 }
 
-// Opens requested class path files and appends them to opened_dex_files. If the dex files have
-// been stripped, this opens them from their oat files (which get added to opened_oat_files).
-bool ClassLoaderContext::OpenDexFiles(InstructionSet isa,
-                                      const std::string& classpath_dir,
+// Opens requested class path files and appends them to opened_dex_files.
+bool ClassLoaderContext::OpenDexFiles(const std::string& classpath_dir,
                                       const std::vector<int>& fds) {
   if (dex_files_open_attempted_) {
     // Do not attempt to re-open the files if we already tried.
@@ -460,40 +458,14 @@
       // contents. So pass true to verify_checksum.
       // We don't need to do structural dex file verification, we only need to
       // check the checksum, so pass false to verify.
-      if (fd < 0) {
-        if (!dex_file_loader.Open(location.c_str(),
-                                  location.c_str(),
-                                  /*verify=*/ false,
-                                  /*verify_checksum=*/ true,
-                                  &error_msg,
-                                  &info->opened_dex_files)) {
-          // If we fail to open the dex file because it's been stripped, try to
-          // open the dex file from its corresponding oat file.
-          // This could happen when we need to recompile a pre-build whose dex
-          // code has been stripped (for example, if the pre-build is only
-          // quicken and we want to re-compile it speed-profile).
-          // TODO(calin): Use the vdex directly instead of going through the oat file.
-          OatFileAssistant oat_file_assistant(location.c_str(), isa, false);
-          std::unique_ptr<OatFile> oat_file(oat_file_assistant.GetBestOatFile());
-          std::vector<std::unique_ptr<const DexFile>> oat_dex_files;
-          if (oat_file != nullptr &&
-              OatFileAssistant::LoadDexFiles(*oat_file, location, &oat_dex_files)) {
-            info->opened_oat_files.push_back(std::move(oat_file));
-            info->opened_dex_files.insert(info->opened_dex_files.end(),
-                                          std::make_move_iterator(oat_dex_files.begin()),
-                                          std::make_move_iterator(oat_dex_files.end()));
-          } else {
-            LOG(WARNING) << "Could not open dex files from location: " << location;
-            dex_files_open_result_ = false;
-          }
-        }
-      } else if (!dex_file_loader.Open(fd,
-                                       location.c_str(),
-                                       /*verify=*/ false,
-                                       /*verify_checksum=*/ true,
-                                       &error_msg,
-                                       &info->opened_dex_files)) {
-        LOG(WARNING) << "Could not open dex files from fd " << fd << " for location: " << location;
+      if (!dex_file_loader.Open(location.c_str(),
+                                fd,
+                                location.c_str(),
+                                /*verify=*/ false,
+                                /*verify_checksum=*/ true,
+                                &error_msg,
+                                &info->opened_dex_files)) {
+        LOG(WARNING) << "Could not open dex files for location " << location << ", fd=" << fd;
         dex_files_open_result_ = false;
       }
     }
diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h
index d564ec8..a5eb2f1 100644
--- a/runtime/class_loader_context.h
+++ b/runtime/class_loader_context.h
@@ -81,8 +81,7 @@
   // TODO(calin): we're forced to complicate the flow in this class with a different
   // OpenDexFiles step because the current dex2oat flow requires the dex files be opened before
   // the class loader is created. Consider reworking the dex2oat part.
-  bool OpenDexFiles(InstructionSet isa,
-                    const std::string& classpath_dir,
+  bool OpenDexFiles(const std::string& classpath_dir = "",
                     const std::vector<int>& context_fds = std::vector<int>());
 
   // Remove the specified compilation sources from all classpaths present in this context.
diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc
index 2447616..987f0d1 100644
--- a/runtime/class_loader_context_test.cc
+++ b/runtime/class_loader_context_test.cc
@@ -401,7 +401,7 @@
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("PCL[does_not_exist.dex]");
   VerifyContextSize(context.get(), 1);
-  ASSERT_FALSE(context->OpenDexFiles(InstructionSet::kArm, "."));
+  ASSERT_FALSE(context->OpenDexFiles("."));
 }
 
 TEST_F(ClassLoaderContextTest, OpenValidDexFiles) {
@@ -415,7 +415,7 @@
           "PCL[" + multidex_name + ":" + myclass_dex_name + "];" +
           "DLC[" + dex_name + "]");
 
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, /*classpath_dir=*/ ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   VerifyContextSize(context.get(), 2);
 
@@ -465,7 +465,7 @@
           "PCL[" + multidex_name + ":" + myclass_dex_name + "];" +
           "DLC[" + dex_name + "]");
 
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, /*classpath_dir=*/ ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> all_dex_files0 = OpenTestDexFiles("MultiDex");
   std::vector<std::unique_ptr<const DexFile>> myclass_dex_files = OpenTestDexFiles("MyClass");
@@ -499,7 +499,7 @@
           "PCL[" + multidex_name + ":" + myclass_dex_name + "];" +
           "DLC[" + dex_name + "]");
 
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, cwd_buf));
+  ASSERT_TRUE(context->OpenDexFiles(cwd_buf));
 
   VerifyContextSize(context.get(), 2);
   std::vector<std::unique_ptr<const DexFile>> all_dex_files0 = OpenTestDexFiles("MultiDex");
@@ -517,7 +517,7 @@
   std::string dex_name = GetTestDexFileName("Main");
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("PCL[does_not_exist.dex];DLC[" + dex_name + "]");
-  ASSERT_FALSE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_FALSE(context->OpenDexFiles());
 }
 
 TEST_F(ClassLoaderContextTest, OpenDexFilesForIMCFails) {
@@ -526,14 +526,14 @@
 
   context = ParseContextWithChecksums("IMC[<unknown>*111]");
   VerifyContextSize(context.get(), 1);
-  ASSERT_FALSE(context->OpenDexFiles(InstructionSet::kArm, "."));
+  ASSERT_FALSE(context->OpenDexFiles("."));
 }
 
 TEST_F(ClassLoaderContextTest, CreateClassLoader) {
   std::string dex_name = GetTestDexFileName("Main");
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("PCL[" + dex_name + "]");
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> classpath_dex = OpenTestDexFiles("Main");
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -570,7 +570,7 @@
 TEST_F(ClassLoaderContextTest, CreateClassLoaderWithEmptyContext) {
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("");
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
 
@@ -597,7 +597,7 @@
 TEST_F(ClassLoaderContextTest, CreateClassLoaderWithSharedLibraryContext) {
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create("&");
 
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
 
@@ -635,7 +635,7 @@
       "PCL[" + CreateClassPath(classpath_dex_d) + "]";
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_spec);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   // Setup the compilation sources.
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -705,7 +705,7 @@
       "PCL[" + CreateClassPath(classpath_dex_d) + "]}";
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_spec);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   // Setup the compilation sources.
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -793,7 +793,7 @@
       "PCL[" + CreateClassPath(classpath_dex_d) + "]}";
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_spec);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   // Setup the compilation sources.
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -893,7 +893,7 @@
       "PCL[" + CreateClassPath(classpath_dex_d) + "]";
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_spec);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   // Setup the compilation sources.
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -1008,7 +1008,7 @@
       "PCL[" + CreateClassPath(classpath_dex_b) + "]}";
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_spec);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   // Setup the compilation sources.
   std::vector<std::unique_ptr<const DexFile>> compilation_sources = OpenTestDexFiles("MultiDex");
@@ -1085,7 +1085,7 @@
   std::string dex2_name = GetTestDexFileName("MyClass");
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("PCL[" + dex1_name + ":" + dex2_name + "]");
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> dex1 = OpenTestDexFiles("Main");
   std::vector<std::unique_ptr<const DexFile>> dex2 = OpenTestDexFiles("MyClass");
@@ -1100,7 +1100,7 @@
   jobject class_loader_b = LoadDexInInMemoryDexClassLoader("MyClass", class_loader_a);
 
   std::unique_ptr<ClassLoaderContext> context = CreateContextForClassLoader(class_loader_b);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::vector<std::unique_ptr<const DexFile>> dex1 = OpenTestDexFiles("Main");
   std::vector<std::unique_ptr<const DexFile>> dex2 = OpenTestDexFiles("MyClass");
@@ -1117,7 +1117,7 @@
   std::string dex2_name = GetTestDexFileName("MultiDex");
   std::unique_ptr<ClassLoaderContext> context =
       ClassLoaderContext::Create("PCL[" + dex1_name + ":" + dex2_name + "]");
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::string encoding = context->EncodeContextForDex2oat("");
   std::string expected_encoding = "PCL[" + dex1_name + ":" + dex2_name + "]";
@@ -1129,7 +1129,7 @@
   jobject class_loader_b = LoadDexInInMemoryDexClassLoader("MyClass", class_loader_a);
 
   std::unique_ptr<ClassLoaderContext> context = CreateContextForClassLoader(class_loader_b);
-  ASSERT_TRUE(context->OpenDexFiles(InstructionSet::kArm, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::string encoding = context->EncodeContextForDex2oat("");
   std::string expected_encoding = "IMC[<unknown>];PCL[" + GetTestDexFileName("Main") + "]";
diff --git a/runtime/dex2oat_environment_test.h b/runtime/dex2oat_environment_test.h
index 8182e16..b180873 100644
--- a/runtime/dex2oat_environment_test.h
+++ b/runtime/dex2oat_environment_test.h
@@ -75,11 +75,11 @@
       << "Expected pre-compiled boot image to be at: " << GetSystemImageFile();
     ASSERT_TRUE(OS::FileExists(GetDexSrc1().c_str()))
       << "Expected dex file to be at: " << GetDexSrc1();
-    ASSERT_TRUE(OS::FileExists(GetStrippedDexSrc1().c_str()))
-      << "Expected stripped dex file to be at: " << GetStrippedDexSrc1();
+    ASSERT_TRUE(OS::FileExists(GetResourceOnlySrc1().c_str()))
+      << "Expected stripped dex file to be at: " << GetResourceOnlySrc1();
     ASSERT_FALSE(
-        dex_file_loader.GetMultiDexChecksums(GetStrippedDexSrc1().c_str(), &checksums, &error_msg))
-      << "Expected stripped dex file to be stripped: " << GetStrippedDexSrc1();
+        dex_file_loader.GetMultiDexChecksums(GetResourceOnlySrc1().c_str(), &checksums, &error_msg))
+      << "Expected stripped dex file to be stripped: " << GetResourceOnlySrc1();
     ASSERT_TRUE(OS::FileExists(GetDexSrc2().c_str()))
       << "Expected dex file to be at: " << GetDexSrc2();
 
@@ -145,7 +145,7 @@
 
   // Returns the path to a dex file equivalent to GetDexSrc1, but with the dex
   // file stripped.
-  std::string GetStrippedDexSrc1() const {
+  std::string GetResourceOnlySrc1() const {
     return GetTestDexFileName("MainStripped");
   }
 
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index d2b5edf..8bb8ce8 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -333,7 +333,7 @@
   constexpr const char* kBaseDir = "";
   std::unique_ptr<ClassLoaderContext> context =
   ClassLoaderContext::CreateContextForClassLoader(class_loader, dex_elements);
-  if (context == nullptr || !context->OpenDexFiles(kRuntimeISA, kBaseDir)) {
+  if (context == nullptr || !context->OpenDexFiles(kBaseDir)) {
     LOG(WARNING) << "Could not establish class loader context";
     return nullptr;
   }
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 8e8dc89..d7cf513 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -572,25 +572,10 @@
       required_dex_checksums_found_ = true;
       has_original_dex_files_ = true;
     } else {
-      // This can happen if the original dex file has been stripped from the
-      // apk.
-      VLOG(oat) << "OatFileAssistant: " << error_msg;
+      // The only valid case here is for APKs without dex files.
+      required_dex_checksums_found_ = false;
       has_original_dex_files_ = false;
-
-      // Get the checksums from the odex if we can.
-      const OatFile* odex_file = odex_.GetFile();
-      if (odex_file != nullptr) {
-        required_dex_checksums_found_ = true;
-        for (size_t i = 0; i < odex_file->GetOatHeader().GetDexFileCount(); i++) {
-          std::string dex = DexFileLoader::GetMultiDexLocation(i, dex_location_.c_str());
-          const OatDexFile* odex_dex_file = odex_file->GetOatDexFile(dex.c_str(), nullptr);
-          if (odex_dex_file == nullptr) {
-            required_dex_checksums_found_ = false;
-            break;
-          }
-          cached_required_dex_checksums_.push_back(odex_dex_file->GetDexFileLocationChecksum());
-        }
-      }
+      VLOG(oat) << "Could not get required checksum: " << error_msg;
     }
   }
   return required_dex_checksums_found_ ? &cached_required_dex_checksums_ : nullptr;
@@ -890,7 +875,7 @@
       ? oat_file_assistant_->dex_location_.substr(0, dir_index)
       : "";
 
-  if (!context->OpenDexFiles(oat_file_assistant_->isa_, classpath_dir, context_fds)) {
+  if (!context->OpenDexFiles(classpath_dir, context_fds)) {
     VLOG(oat) << "ClassLoaderContext check failed: dex files from the context could not be opened";
     return false;
   }
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index 223b6f4..a1aa643 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -177,7 +177,7 @@
   std::string context_str = "PCL[" + context_location + "]";
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_str);
   ASSERT_TRUE(context != nullptr);
-  ASSERT_TRUE(context->OpenDexFiles(kRuntimeISA, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::string error_msg;
   std::vector<std::string> args;
@@ -204,7 +204,7 @@
   std::string context_str = "PCL[" + context_location + "]";
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_str);
   ASSERT_TRUE(context != nullptr);
-  ASSERT_TRUE(context->OpenDexFiles(kRuntimeISA, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::string error_msg;
   std::vector<std::string> args;
@@ -851,7 +851,7 @@
 TEST_F(OatFileAssistantTest, ResourceOnlyDex) {
   std::string dex_location = GetScratchDir() + "/ResourceOnlyDex.jar";
 
-  Copy(GetStrippedDexSrc1(), dex_location);
+  Copy(GetResourceOnlySrc1(), dex_location);
 
   // Verify the status.
   OatFileAssistant oat_file_assistant(dex_location.c_str(), kRuntimeISA, true);
@@ -1293,7 +1293,7 @@
 
   std::unique_ptr<ClassLoaderContext> context = ClassLoaderContext::Create(context_str);
   ASSERT_TRUE(context != nullptr);
-  ASSERT_TRUE(context->OpenDexFiles(kRuntimeISA, ""));
+  ASSERT_TRUE(context->OpenDexFiles());
 
   std::string error_msg;
   std::vector<std::string> args;
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index 8c6d872..1c71581 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -553,7 +553,7 @@
     LOG(ERROR) << "Could not create class loader context for " << vdex_path;
     return dex_files;
   }
-  DCHECK(context->OpenDexFiles(kRuntimeISA, ""))
+  DCHECK(context->OpenDexFiles())
       << "Context created from already opened dex files should not attempt to open again";
 
   // Check that we can use the vdex against this boot class path and in this class loader context.