Combine checksum of all boot images.
Allows a change to be detected in more than just the first image.
Combines checksums of all boot images using xor. A better hash is left
as TODO.
Bug: 28054110
(cherry-picked from commit 4f351aae00f43dd4e3290976f249d3664cc47091)
Change-Id: Ia557e2460ca582082368ef93508c04ce32c3036a
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 17f72fe..63b1573 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -279,6 +279,8 @@
static bool DexFilenameToOdexFilename(const std::string& location,
InstructionSet isa, std::string* odex_filename, std::string* error_msg);
+ static uint32_t CalculateCombinedImageChecksum();
+
private:
struct ImageInfo {
uint32_t oat_checksum = 0;
@@ -352,6 +354,8 @@
// The caller shouldn't clean up or free the returned pointer.
const ImageInfo* GetImageInfo();
+ uint32_t GetCombinedImageChecksum();
+
// To implement Lock(), we lock a dummy file where the oat file would go
// (adding ".flock" to the target file name) and retain the lock for the
// remaining lifetime of the OatFileAssistant object.
@@ -423,6 +427,7 @@
bool image_info_load_attempted_ = false;
bool image_info_load_succeeded_ = false;
ImageInfo cached_image_info_;
+ uint32_t combined_image_checksum_ = 0;
// For debugging only.
// If this flag is set, the oat or odex file has been released to the user