ART: Fix core image detection
Accept any .art name starting with "core-." Correctly detects
images with multiple dashes.
Bug: 64382372
Test: mmma art
Test: art/test/testrunner/testrunner.py -b --host
Test: Device boots
Change-Id: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 682cf16..a5462ee 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -378,11 +378,11 @@
if (!android::base::EndsWith(boot_image_filename, ".art")) {
return false;
}
- size_t dash_pos = boot_image_filename.find_last_of("-/");
- if (dash_pos == std::string::npos || boot_image_filename[dash_pos] != '-') {
- return false;
+ size_t slash_pos = boot_image_filename.rfind('/');
+ if (slash_pos == std::string::npos) {
+ return android::base::StartsWith(boot_image_filename, "core-");
}
- return (dash_pos >= 4u) && (boot_image_filename.compare(dash_pos - 4u, 4u, "core") == 0);
+ return boot_image_filename.compare(slash_pos + 1, 5u, "core-") == 0;
}
optimizer::DexToDexCompiler& GetDexToDexCompiler() {