From 2fa4a46b465cd812dc93d05a3157456a4a0c105d Mon Sep 17 00:00:00 2001 From: Akilesh Kailash Date: Wed, 23 Mar 2022 18:53:52 +0000 Subject: update_verifier: Verify blocks Check if the block verification was already done by snapuserd daemon - If so, skip the verification process. If daemon failed to verify the block, update_verifier will fallback and continue the verification. Bug: 193863442 Bug: 261913544 Test: OTA Signed-off-by: Akilesh Kailash Merged-In: I18946fb730376f19cce0738bd6765d5f5d0248b6 Change-Id: I18946fb730376f19cce0738bd6765d5f5d0248b6 --- update_verifier/Android.bp | 4 ++++ .../include/update_verifier/update_verifier.h | 5 +++++ update_verifier/update_verifier.cpp | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/update_verifier/Android.bp b/update_verifier/Android.bp index 220b007f..cb97bd1f 100644 --- a/update_verifier/Android.bp +++ b/update_verifier/Android.bp @@ -73,6 +73,10 @@ cc_library_static { "libvold_binder", ], + whole_static_libs: [ + "libsnapshot_snapuserd", + ], + shared_libs: [ "android.hardware.boot@1.0", "libbase", diff --git a/update_verifier/include/update_verifier/update_verifier.h b/update_verifier/include/update_verifier/update_verifier.h index 4c64b1ea..0cccc907 100644 --- a/update_verifier/include/update_verifier/update_verifier.h +++ b/update_verifier/include/update_verifier/update_verifier.h @@ -21,6 +21,7 @@ #include #include +#include #include "otautil/rangeset.h" // The update verifier performs verification upon the first boot to a new slot on A/B devices. @@ -68,4 +69,8 @@ class UpdateVerifier { // The function to read the device property; default value: android::base::GetProperty() std::function property_reader_; + + // Check if snapuserd daemon has already completed the update verification + // Applicable only for VABC with userspace snapshots + bool CheckVerificationStatus(); }; 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 #include +#include #include #include #include @@ -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."; -- cgit v1.2.3 From 36956e3bb8244bdaf9beb54ec8ac9d9a99257bba Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Fri, 31 Mar 2023 16:46:15 -0700 Subject: Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I14709252f2cd771891cfacbbba7ce4372c78efa9 --- tools/recovery_l10n/res/values-te/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/recovery_l10n/res/values-te/strings.xml b/tools/recovery_l10n/res/values-te/strings.xml index 57470752..513ae9d5 100644 --- a/tools/recovery_l10n/res/values-te/strings.xml +++ b/tools/recovery_l10n/res/values-te/strings.xml @@ -6,7 +6,7 @@ "ఆదేశం లేదు" "ఎర్రర్ ఏర్పడింది!" "సెక్యూరిటీ అప్‌డేట్‌ను ఇన్‌స్టాల్ చేస్తోంది" - "Android సిస్టమ్‌ని లోడ్ చేయడం సాధ్యం కాదు. మీ డేటా పాడై ఉండవచ్చు. మీకు ఈ మెసేజ్‌ వస్తూనే ఉంటే, మీరు ఫ్యాక్టరీ డేటా రీసెట్ చేసి, పరికరంలో నిల్వ అయిన వినియోగదారు డేటా మొత్తాన్ని తొలగించాల్సి రావచ్చు." + "Android సిస్టమ్‌ని లోడ్ చేయడం సాధ్యం కాదు. మీ డేటా పాడై ఉండవచ్చు. మీకు ఈ మెసేజ్‌ వస్తూనే ఉంటే, మీరు ఫ్యాక్టరీ డేటా రీసెట్ చేసి, పరికరంలో స్టోరేజ్‌ అయిన వినియోగదారు డేటా మొత్తాన్ని తొలగించాల్సి రావచ్చు." "మళ్లీ ప్రయత్నించు" "ఫ్యాక్టరీ డేటా రీసెట్" "వినియోగదారు డేటా మొత్తాన్ని తొలగించాలా?\n\n ఈ చర్యను రద్దు చేయలేరు!" -- cgit v1.2.3