Assorted fixes

- Match ClassLinker::oat_files_ against cached oat file locations
- Have DexFile_isDexOptNeeded do checksum comparsion of oat to dex
- Complete TODO in Heap::Lock to use TryLock before switching to kVmWait
- Fix ThrowNew to use Throwable constructor without String when no msg is available

Change-Id: Ie9d7bfef9e80b77e5f7625a4d7c9c4a23c7b30b5
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc
index e6d45e3..9b29d25 100644
--- a/src/dalvik_system_DexFile.cc
+++ b/src/dalvik_system_DexFile.cc
@@ -184,11 +184,17 @@
     return JNI_TRUE;
   }
 
-  UniquePtr<const OatFile> oat_file(class_linker->FindOatFile(*dex_file.get()));
-  if (oat_file.get() == NULL) {
+  const OatFile* oat_file = class_linker->FindOatFile(*dex_file.get());
+  if (oat_file == NULL) {
     return JNI_TRUE;
   }
-
+  const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(dex_file->GetLocation());
+  if (oat_dex_file == NULL) {
+    return JNI_TRUE;
+  }
+  if (oat_dex_file->GetDexFileChecksum() != dex_file->GetHeader().checksum_) {
+    return JNI_TRUE;
+  }
   return JNI_FALSE;
 }