summaryrefslogtreecommitdiff
path: root/partition_tools
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2023-07-14 09:02:55 -0700
committerDavid Anderson <dvander@google.com>2023-07-14 09:04:48 -0700
commitb694b1dcd7b97397097d809d391b801dbced7b3b (patch)
tree28704f3577dea1e24a5ef64193d85f228f390c8a /partition_tools
parent01a3d283dffc4f24067848741a84513bfa255146 (diff)
downloadextras-b694b1dcd7b97397097d809d391b801dbced7b3b.tar.gz
lpdumpd: Add snapshotctl dump output.
This will ensure that anytime the output of "lpdump" is captured (eg for a bugreport), that "snapshotctl dump" is captured as well. Bug: 291083311 Test: lpdump Change-Id: Iab7d010a2c336a3fa0df589f183a11ad53b1be02
Diffstat (limited to 'partition_tools')
-rw-r--r--partition_tools/Android.bp14
-rw-r--r--partition_tools/lpdumpd.cc25
2 files changed, 31 insertions, 8 deletions
diff --git a/partition_tools/Android.bp b/partition_tools/Android.bp
index c2800601..074d4604 100644
--- a/partition_tools/Android.bp
+++ b/partition_tools/Android.bp
@@ -147,7 +147,11 @@ cc_binary {
cc_binary {
name: "lpdumpd",
- defaults: ["lp_defaults"],
+ defaults: [
+ "lp_defaults",
+ "libsnapshot_cow_defaults",
+ "libsnapshot_hal_deps",
+ ],
init_rc: ["lpdumpd.rc"],
shared_libs: [
"libbase",
@@ -156,8 +160,16 @@ cc_binary {
"liblp",
"liblpdump",
"liblpdump_interface-cpp",
+ "libprotobuf-cpp-lite",
"libutils",
],
+ static_libs: [
+ "libc++fs",
+ "libfs_mgr_binder",
+ "libsnapshot",
+ "libsnapshot_cow",
+ "update_metadata-protos",
+ ],
srcs: [
"lpdumpd.cc",
],
diff --git a/partition_tools/lpdumpd.cc b/partition_tools/lpdumpd.cc
index 7717e115..86f0b45d 100644
--- a/partition_tools/lpdumpd.cc
+++ b/partition_tools/lpdumpd.cc
@@ -20,12 +20,14 @@
#include <vector>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android/lpdump/BnLpdump.h>
#include <android/lpdump/ILpdump.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
+#include <libsnapshot/snapshot.h>
int LpdumpMain(int argc, char* argv[], std::ostream&, std::ostream&);
@@ -50,15 +52,24 @@ class Lpdump : public BnLpdump {
std::stringstream error;
int ret = LpdumpMain((int)local_argv.size(), local_argv.data(), output, error);
std::string error_str = error.str();
- if (ret == 0) {
- if (!error_str.empty()) {
- LOG(WARNING) << error_str;
- }
- *aidl_return = output.str();
- return Status::ok();
- } else {
+ if (ret != 0) {
return Status::fromServiceSpecificError(ret, error_str.c_str());
}
+
+ if (android::base::GetBoolProperty("ro.virtual_ab.enabled", false)) {
+ if (auto sm = android::snapshot::SnapshotManager::New()) {
+ output << "---------------\n";
+ output << "Snapshot state:\n";
+ output << "---------------\n";
+ sm->Dump(output);
+ }
+ }
+
+ if (!error_str.empty()) {
+ LOG(WARNING) << error_str;
+ }
+ *aidl_return = output.str();
+ return Status::ok();
}
};