summaryrefslogtreecommitdiffstats
path: root/update_verifier/update_verifier.cpp
diff options
context:
space:
mode:
authorAkilesh Kailash <akailash@google.com>2022-06-10 01:45:04 +0200
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-10 01:45:04 +0200
commitb53f8264cebf70bbb38d31ebbf17cf0f49e888ea (patch)
tree020a41f7c2f77488b991fd1b48a24743eb613288 /update_verifier/update_verifier.cpp
parent[automerger skipped] Merge "Import translations. DO NOT MERGE ANYWHERE" am: 94bb8a80c7 -s ours am: 03ddefaaca -s ours (diff)
parentMerge "update_verifier: Verify blocks" am: 5614437de3 (diff)
downloadandroid_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar.gz
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar.bz2
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar.lz
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar.xz
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.tar.zst
android_bootable_recovery-b53f8264cebf70bbb38d31ebbf17cf0f49e888ea.zip
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 a042f9008..88fcfa502 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.";