Allow UpdateAttempterAndroid to override otacerts path
For unittest to override otacerts on device, provide a small interface
Test: th
Change-Id: I9e156cbf7135f1afd13a9a7aa23a5245898023e5
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index f2ec2a5..4e609d4 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -775,7 +775,8 @@
boot_control_,
hardware_,
fetcher, // passes ownership
- true /* interactive */);
+ true /* interactive */,
+ update_certificates_path_);
download_action->set_delegate(this);
download_action->set_base_offset(base_offset_);
auto filesystem_verifier_action = std::make_unique<FilesystemVerifierAction>(
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index 7fa01e8..5d832e0 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -133,6 +133,11 @@
// 3. When user called |ResetStatus()|
bool ClearUpdateCompletedMarker();
+ void set_update_certificates_path(
+ const std::string& update_certificates_path) {
+ update_certificates_path_ = update_certificates_path;
+ }
+
private:
friend class UpdateAttempterAndroidTest;
@@ -274,6 +279,9 @@
// CleanupPreviousUpdateAction has not been executed.
std::optional<ErrorCode> cleanup_previous_update_code_{std::nullopt};
+ // The path to the zip file with X509 certificates.
+ std::string update_certificates_path_{constants::kUpdateCertificatesPath};
+
DISALLOW_COPY_AND_ASSIGN(UpdateAttempterAndroid);
};