Make system use patchoat to relocate during runtime.
Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.
Bug: 15358152
(cherry picked from commit 6e183f2e973a20f2eaca135c240908e1bf98c5d0)
Change-Id: Ib21f4f41b6cbf18094e3ca1a30d65a3b197b71b0
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 1bb1635..8c09042 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -274,12 +274,18 @@
std::vector<const DexFile*>* dex_files)
LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
+ // Returns true if the given oat file has the same image checksum as the image it is paired with.
+ static bool VerifyOatImageChecksum(const OatFile* oat_file, const InstructionSet instruction_set);
+ // Returns true if the oat file checksums match with the image and the offsets are such that it
+ // could be loaded with it.
+ static bool VerifyOatChecksums(const OatFile* oat_file, const InstructionSet instruction_set,
+ std::string* error_msg);
// Returns true if oat file contains the dex file with the given location and checksum.
- static bool VerifyOatFileChecksums(const OatFile* oat_file,
- const char* dex_location,
- uint32_t dex_location_checksum,
- InstructionSet instruction_set,
- std::string* error_msg);
+ static bool VerifyOatAndDexFileChecksums(const OatFile* oat_file,
+ const char* dex_location,
+ uint32_t dex_location_checksum,
+ InstructionSet instruction_set,
+ std::string* error_msg);
// TODO: replace this with multiple methods that allocate the correct managed type.
template <class T>