dex2oat invoked by system if it can't find an oat file for a dex file.

This allows the old dalvik tests to be run without ever explicitly
running dex2oat on anything. Just upload the jar files and the system
will take care of generating the files it needs.

Change-Id: Iad553bf6f57e28da4edb8eb0df47e62e08a0be44
diff --git a/src/utils.cc b/src/utils.cc
index ceaf7cd..bfd7e79 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -514,7 +514,7 @@
   return art_cache;
 }
 
-std::string GetArtCacheOatFilenameOrDie(const std::string& location) {
+std::string GetArtCacheFilenameOrDie(const std::string& location) {
   std::string art_cache = GetArtCacheOrDie();
   CHECK_EQ(location[0], '/');
   std::string cache_file(location, 1); // skip leading slash
@@ -522,6 +522,22 @@
   return art_cache + "/" + cache_file;
 }
 
+bool IsValidZipFilename(const std::string& filename) {
+  if (filename.size() < 4) {
+    return false;
+  }
+  std::string suffix(filename.substr(filename.size() - 4));
+  return (suffix == ".zip" || suffix == ".jar" || suffix == ".apk");
+}
+
+bool IsValidDexFilename(const std::string& filename) {
+  if (filename.size() < 4) {
+    return false;
+  }
+  std::string suffix(filename.substr(filename.size() - 4));
+  return (suffix == ".dex");
+}
+
 }  // namespace art
 
 // Neither bionic nor glibc exposes gettid(2).