Add installd support to dex2oat

Change-Id: Id1a64403ccea7dc2c1e8b8340d33d383d4045a33
diff --git a/src/dex_file.cc b/src/dex_file.cc
index a45455d..81a60fc 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -187,9 +187,13 @@
     LOG(ERROR) << "Failed to open " << filename << " when looking for classes.dex";
     return NULL;
   }
-  UniquePtr<ZipEntry> zip_entry(zip_archive->Find(kClassesDex));
+  return DexFile::Open(*zip_archive.get(), location);
+}
+
+const DexFile* DexFile::Open(const ZipArchive& zip_archive, const std::string& location) {
+  UniquePtr<ZipEntry> zip_entry(zip_archive.Find(kClassesDex));
   if (zip_entry.get() == NULL) {
-    LOG(ERROR) << "Failed to find classes.dex within " << filename;
+    LOG(ERROR) << "Failed to find classes.dex within " << location;
     return NULL;
   }
 
@@ -199,14 +203,14 @@
                                              length,
                                              PROT_READ | PROT_WRITE));
   if (map.get() == NULL) {
-    LOG(ERROR) << "mmap classes.dex for \"" << filename << "\" failed";
+    LOG(ERROR) << "mmap classes.dex for \"" << location << "\" failed";
     return NULL;
   }
 
   // Extract classes.dex
   bool success = zip_entry->ExtractToMemory(*map.get());
   if (!success) {
-    LOG(ERROR) << "Failed to extract classes.dex from '" << filename << "' to memory";
+    LOG(ERROR) << "Failed to extract classes.dex from '" << location << "' to memory";
     return NULL;
   }