summaryrefslogtreecommitdiffstats
path: root/update_verifier/include
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-09-14 21:52:02 +0200
committerTianjie Xu <xunchang@google.com>2018-10-05 01:42:57 +0200
commit9eed65e1db49abe44daedc2f569acff6ce861035 (patch)
tree6003da94d6b463b32981b0d74b02658ac8e24268 /update_verifier/include
parentMerge "Reland: "recovery_test_component: Add libbinderthreadstate as static dependency."" (diff)
downloadandroid_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar.gz
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar.bz2
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar.lz
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar.xz
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.tar.zst
android_bootable_recovery-9eed65e1db49abe44daedc2f569acff6ce861035.zip
Diffstat (limited to 'update_verifier/include')
-rw-r--r--update_verifier/include/update_verifier/update_verifier.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/update_verifier/include/update_verifier/update_verifier.h b/update_verifier/include/update_verifier/update_verifier.h
index bdfabed0c..b00890e82 100644
--- a/update_verifier/include/update_verifier/update_verifier.h
+++ b/update_verifier/include/update_verifier/update_verifier.h
@@ -16,6 +16,7 @@
#pragma once
+#include <functional>
#include <map>
#include <string>
#include <vector>
@@ -37,15 +38,18 @@ int update_verifier(int argc, char** argv);
// it should skip the verification to avoid bricking the device.
class UpdateVerifier {
public:
+ UpdateVerifier();
+
// This function tries to process the care_map.pb as protobuf message; and falls back to use
- // care_map.txt if the pb format file doesn't exist. If the parsing succeeds, put the result of
- // the pair <partition_name, ranges> into the |partition_map_|.
- bool ParseCareMap(const std::string& file_name = "");
+ // care_map.txt if the pb format file doesn't exist. If the parsing succeeds, put the result
+ // of the pair <partition_name, ranges> into the |partition_map_|.
+ bool ParseCareMap();
// Verifies the new boot by reading all the cared blocks for partitions in |partition_map_|.
bool VerifyPartitions();
private:
+ friend class UpdateVerifierTest;
// Parses the legacy care_map.txt in plain text format.
bool ParseCareMapPlainText(const std::string& content);
@@ -56,5 +60,15 @@ class UpdateVerifier {
bool ReadBlocks(const std::string partition_name, const std::string& dm_block_device,
const RangeSet& ranges);
+ // Functions to override the care_map_prefix_ and property_reader_, used in test only.
+ void set_care_map_prefix(const std::string& prefix);
+ void set_property_reader(const std::function<std::string(const std::string&)>& property_reader);
+
std::map<std::string, RangeSet> partition_map_;
+ // The path to the care_map excluding the filename extension; default value:
+ // "/data/ota_package/care_map"
+ std::string care_map_prefix_;
+
+ // The function to read the device property; default value: android::base::GetProperty()
+ std::function<std::string(const std::string&)> property_reader_;
};