Deprecate support of extracting BCP from boot image
Bug: 188905361
Test: m
Change-Id: I2820eb0d60ba6eedee3c67800f884512a638bacb
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 2573b3a..91cbd67 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -148,7 +148,6 @@
#include "native_stack_dump.h"
#include "nativehelper/scoped_local_ref.h"
#include "oat.h"
-#include "oat_file.h"
#include "oat_file_manager.h"
#include "oat_quick_method_header.h"
#include "object_callbacks.h"
@@ -1403,48 +1402,8 @@
DCHECK(boot_class_path_locations_.empty() ||
boot_class_path_locations_.size() == boot_class_path_.size());
if (boot_class_path_.empty()) {
- // Try to extract the boot class path from the system boot image.
- if (image_locations_.empty()) {
- LOG(ERROR) << "Empty boot class path, cannot continue without image.";
- return false;
- }
- std::string system_oat_filename = ImageHeader::GetOatLocationFromImageLocation(
- GetSystemImageFilename(image_locations_[0].c_str(), instruction_set_));
- std::string system_oat_location = ImageHeader::GetOatLocationFromImageLocation(
- image_locations_[0]);
-
- if (deny_art_apex_data_files_ && (LocationIsOnArtApexData(system_oat_filename) ||
- LocationIsOnArtApexData(system_oat_location))) {
- // This code path exists for completeness, but we don't expect it to be hit.
- //
- // `deny_art_apex_data_files` defaults to false unless set at the command-line. The image
- // locations come from the -Ximage argument and it would need to be specified as being on
- // the ART APEX data directory. This combination of flags would say apexdata is compromised,
- // use apexdata to load image files, which is obviously not a good idea.
- LOG(ERROR) << "Could not open boot oat file from untrusted location: " << system_oat_filename;
- return false;
- }
-
- std::string error_msg;
- std::unique_ptr<OatFile> oat_file(OatFile::Open(/*zip_fd=*/ -1,
- system_oat_filename,
- system_oat_location,
- /*executable=*/ false,
- /*low_4gb=*/ false,
- &error_msg));
- if (oat_file == nullptr) {
- LOG(ERROR) << "Could not open boot oat file for extracting boot class path: " << error_msg;
- return false;
- }
- const OatHeader& oat_header = oat_file->GetOatHeader();
- const char* oat_boot_class_path = oat_header.GetStoreValueByKey(OatHeader::kBootClassPathKey);
- if (oat_boot_class_path != nullptr) {
- Split(oat_boot_class_path, ':', &boot_class_path_);
- }
- if (boot_class_path_.empty()) {
- LOG(ERROR) << "Boot class path missing from boot image oat file " << oat_file->GetLocation();
- return false;
- }
+ LOG(ERROR) << "Boot classpath is empty";
+ return false;
}
boot_class_path_fds_ = runtime_options.ReleaseOrDefault(Opt::BootClassPathFds);