OatFileAssistant: look at vdex file for IsDexOptNeeded
Even if the oat file cannot be opened, there may be a vdex file that
contains valid dex code. The oat file assistant should take this into
account when determining the dexopt status.
Bug: 34339100
Test: oat_file_assistant_test, with new tests added.
Test: install an app, dumpsys package to show app status,
delete app's oat file, dumpsys package to show status as vdex only,
cmd package compile -r install app, verify in log that input vdex fd is
provided to dex2oat.
Change-Id: Iab43e617a899773b318d61adeb117ed2cec085da
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 588a698..6d47ad2 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -379,6 +379,16 @@
// Return info for the best oat file.
OatFileInfo& GetBestInfo();
+ // Returns true if the dex checksums in the given vdex file are up to date
+ // with respect to the dex location. If the dex checksums are not up to
+ // date, error_msg is updated with a message describing the problem.
+ bool DexChecksumUpToDate(const VdexFile& file, std::string* error_msg);
+
+ // Returns true if the dex checksums in the given oat file are up to date
+ // with respect to the dex location. If the dex checksums are not up to
+ // date, error_msg is updated with a message describing the problem.
+ bool DexChecksumUpToDate(const OatFile& file, std::string* error_msg);
+
// Return the status for a given opened oat file with respect to the dex
// location.
OatStatus GivenOatFileStatus(const OatFile& file);