Set compilation reason in vdex-only OatFile.
Test: test.py
Bug: 192408935
Merged-In: Ib87ea546876bfb4c6bf87b60f5a4f8aa306bd186
(cherry picked from commit b17c908047a2df675ecb4bd0aa2b21114376bbae)
Change-Id: I81ea447c12250c24fa88205dac9c1289b15faba8
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 49d5e61..8f653c2 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1665,13 +1665,12 @@
void SetupHeader(size_t number_of_dex_files) {
DCHECK(!IsExecutable());
- // Create a fake OatHeader with a key store containing only the compiler
- // filter (it helps debugging and is required by
- // OatHeader::GetCompilerFilter).
+ // Create a fake OatHeader with a key store to help debugging.
std::unique_ptr<const InstructionSetFeatures> isa_features =
InstructionSetFeatures::FromCppDefines();
SafeMap<std::string, std::string> store;
store.Put(OatHeader::kCompilerFilter, CompilerFilter::NameOfFilter(CompilerFilter::kVerify));
+ store.Put(OatHeader::kCompilationReasonKey, "vdex");
store.Put(OatHeader::kConcurrentCopying,
kUseReadBarrier ? OatHeader::kTrueValue : OatHeader::kFalseValue);
oat_header_.reset(OatHeader::Create(kRuntimeISA,
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index 3760885..68ae83d 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -615,7 +615,7 @@
&oat_file_assistant,
dex_location,
"verify",
- "unknown",
+ "vdex",
"up-to-date");
}
@@ -889,7 +889,7 @@
&oat_file_assistant,
dex_location,
"verify",
- "unknown",
+ "vdex",
"up-to-date");
}