Set the trigger to be kApexVersionMismatch when no prior cache-info.
If the APEXes are not factory-installed and there is no prior
cache-info, it means the APEXes are newly installed, so we should set
the trigger to be kApexVersionMismatch to make sure that compilation
will always be performed regardless of retry backoff time.
Bug: 215155943
Change-Id: I3a905233182f7ec9c380f63de6a382902b3e8723
Test: Run `atest odsign_e2e_tests` twice consecutively on a `user` build
device that does not allow removing compilation log due to access
restriction.
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index b8e42f3..4a489f7 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -856,10 +856,12 @@
}
if (!cache_info.has_value()) {
- // If the cache info file does not exist, it means on-device compilation has not been done
- // before.
+ // If the cache info file does not exist, it usually means on-device compilation has not been
+ // done before because the device was using the factory version of modules, or artifacts were
+ // cleared because an updated version was uninstalled. Set the trigger to be
+ // `kApexVersionMismatch` so that compilation will always be performed.
PLOG(INFO) << "No prior cache-info file: " << QuotePath(cache_info_filename_);
- metrics.SetTrigger(OdrMetrics::Trigger::kMissingArtifacts);
+ metrics.SetTrigger(OdrMetrics::Trigger::kApexVersionMismatch);
return false;
}
@@ -974,10 +976,12 @@
}
if (!cache_info.has_value()) {
- // If the cache info file does not exist, it means on-device compilation has not been done
- // before.
+ // If the cache info file does not exist, it usually means on-device compilation has not been
+ // done before because the device was using the factory version of modules, or artifacts were
+ // cleared because an updated version was uninstalled. Set the trigger to be
+ // `kApexVersionMismatch` so that compilation will always be performed.
PLOG(INFO) << "No prior cache-info file: " << QuotePath(cache_info_filename_);
- metrics.SetTrigger(OdrMetrics::Trigger::kMissingArtifacts);
+ metrics.SetTrigger(OdrMetrics::Trigger::kApexVersionMismatch);
if (artifacts_on_system_up_to_date) {
*jars_to_compile = jars_missing_artifacts_on_system;
return false;