odrefresh: bug fix for first compilation log entry
The first log entry was incorrectly logged as having zero as a version
number.
The test for this follows in commit
Iadbe30203df626708f2c7408c3eb1ec7cfa971d4 which lands later as ART
prebuilts do not include prebuilts for tests today.
(cherry picked from commit 20b3c57170206febd53a20287bf6b7d5e620b62d)
Bug: 192647837
Test: atest odsign_e2e_tests
Test: atest art_odrefresh_tests
Merged-In: Iefb0fbbca119ed3e47bc17caa2ef8467b241b26c
Change-Id: I8c33735f27cb57628bc93a88ef9f7c99a880811e
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index d3af247..cda39ee 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -501,6 +501,21 @@
return cleanup_return(ExitCode::kCompilationRequired);
}
+ // Generate current module info for the current ART APEX.
+ const auto current_info = GenerateArtModuleInfo();
+ if (!current_info.has_value()) {
+ // This should never happen, further up-to-date checks are not possible if it does.
+ LOG(ERROR) << "Failed to generate cache provenance.";
+ metrics.SetTrigger(OdrMetrics::Trigger::kUnknown);
+ return cleanup_return(ExitCode::kCompilationRequired);
+ }
+
+ // Record ART APEX version for metrics reporting.
+ metrics.SetArtApexVersion(current_info->getVersionCode());
+
+ // Record ART APEX last update milliseconds (used in compilation log).
+ metrics.SetArtApexLastUpdateMillis(current_info->getLastUpdateMillis());
+
if (apex_info->getIsFactory()) {
// Remove any artifacts on /data as they are not necessary and no compilation is necessary.
LOG(INFO) << "Factory APEX mounted.";
@@ -524,21 +539,6 @@
return cleanup_return(ExitCode::kCompilationRequired);
}
- // Generate current module info for the current ART APEX.
- const auto current_info = GenerateArtModuleInfo();
- if (!current_info.has_value()) {
- // This should never happen, further up-to-date checks are not possible if it does.
- LOG(ERROR) << "Failed to generate cache provenance.";
- metrics.SetTrigger(OdrMetrics::Trigger::kUnknown);
- return cleanup_return(ExitCode::kCompilationRequired);
- }
-
- // Record ART APEX version for metrics reporting.
- metrics.SetArtApexVersion(current_info->getVersionCode());
-
- // Record ART APEX last update milliseconds (used in compilation log).
- metrics.SetArtApexLastUpdateMillis(current_info->getLastUpdateMillis());
-
// Check whether the current cache ART module info differs from the current ART module info.
// Always check APEX version.
const auto cached_info = cache_info->getFirstArtModuleInfo();