aboutsummaryrefslogtreecommitdiff
path: root/update_verifier/update_verifier.cpp
diff options
context:
space:
mode:
authorJulian Veit <Claymore1298@gmail.com>2024-06-13 08:17:58 +0200
committerJulian Veit <Claymore1298@gmail.com>2024-06-13 08:17:58 +0200
commit090e278f122777078f470fe87e11ad1212db90ef (patch)
tree5473ec2fd9a90bdf60757ffcb5ade48b088cb4ed /update_verifier/update_verifier.cpp
parent6d486b1f5660f2a9fc3f4559c03d9d4989af2c99 (diff)
parent8904d2a254c5263caded20af8fde209f8b37f22d (diff)
Merge branch 'lineage-20.0' of https://github.com/LineageOS/android_bootable_recovery into HEADHEADt13.0
Change-Id: Ic0aae25ab32e81f4ebf802693f8c9a2fdc283beb
Diffstat (limited to 'update_verifier/update_verifier.cpp')
-rw-r--r--update_verifier/update_verifier.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index a042f900..88fcfa50 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -52,6 +52,7 @@
#include <future>
#include <thread>
+#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
@@ -188,7 +189,28 @@ bool UpdateVerifier::ReadBlocks(const std::string partition_name,
return ret;
}
+bool UpdateVerifier::CheckVerificationStatus() {
+ auto client =
+ android::snapshot::SnapuserdClient::Connect(android::snapshot::kSnapuserdSocket, 5s);
+ if (!client) {
+ LOG(ERROR) << "Unable to connect to snapuserd";
+ return false;
+ }
+
+ return client->QueryUpdateVerification();
+}
+
bool UpdateVerifier::VerifyPartitions() {
+ const bool userspace_snapshots =
+ android::base::GetBoolProperty("ro.virtual_ab.userspace.snapshots.enabled", false);
+
+ if (userspace_snapshots && CheckVerificationStatus()) {
+ LOG(INFO) << "Partitions verified by snapuserd daemon";
+ return true;
+ }
+
+ LOG(INFO) << "Partitions not verified by snapuserd daemon";
+
auto dm_block_devices = FindDmPartitions();
if (dm_block_devices.empty()) {
LOG(ERROR) << "No dm-enabled block device is found.";