Support oat files compiled with partial boot class path.

Test: oat_file_assistant_test
Bug: 119868597
Bug: 122937705
Change-Id: I07c59957983c0ec61ade5215bb83c41e7cb4b672
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 8b81bb9..80ac01f 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -563,8 +563,17 @@
 bool OatFileAssistant::ImageInfo::ValidateBootClassPathChecksums(const OatFile& oat_file) const {
   const char* oat_boot_class_path_checksums =
       oat_file.GetOatHeader().GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey);
-  return oat_boot_class_path_checksums != nullptr &&
-         oat_boot_class_path_checksums == boot_class_path_checksums;
+  if (oat_boot_class_path_checksums == nullptr) {
+    return false;
+  }
+  // The checksums can be either the same or a prefix of the expected checksums,
+  // ending before the ':' delimiter.
+  size_t length = strlen(oat_boot_class_path_checksums);
+  if (length > boot_class_path_checksums.length() ||
+      (length < boot_class_path_checksums.length() && boot_class_path_checksums[length] != ':')) {
+    return false;
+  }
+  return boot_class_path_checksums.compare(0u, length, oat_boot_class_path_checksums) == 0;
 }
 
 std::unique_ptr<OatFileAssistant::ImageInfo>