lpdump: Add info about super partition

Currently we do not print info about super partition in lpdump.
Let's add it so we can get to know super's size and used size.
Available space can be inferred from these two.

Bug: 335891825
Test: lpdump --json
Test: atest CtsEdiHostTestCases

Change-Id: Ic3dea6346492c1f94c6432a96c55bfc6164d1b89
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
diff --git a/partition_tools/dynamic_partitions_device_info.proto b/partition_tools/dynamic_partitions_device_info.proto
index 8800dac..82d2009 100644
--- a/partition_tools/dynamic_partitions_device_info.proto
+++ b/partition_tools/dynamic_partitions_device_info.proto
@@ -20,7 +20,7 @@
 // Keep in sync with proto files on EDI backend. Otherwise, new fields will
 // go ignored.
 
-// Next: 6
+// Next: 7
 message DynamicPartitionsDeviceInfoProto {
     bool enabled = 1;
     bool retrofit = 2;
@@ -57,4 +57,14 @@
         uint64 alignment_offset = 5 [json_name = "alignment_offset"];
     }
     repeated BlockDevice block_devices = 5 [json_name = "block_devices"];
+
+    // Next: 4
+    message SuperDevice {
+        string name = 1;
+        /** Used space in bytes */
+        uint64 used_size = 2 [json_name = "used_size"];
+        /** Total size of the super in bytes */
+        uint64 total_size = 3 [json_name = "total_size"];
+    }
+    SuperDevice super_device = 6 [json_name = "super_device"];
 }
diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc
index 9768294..4c1fe95 100644
--- a/partition_tools/lpdump.cc
+++ b/partition_tools/lpdump.cc
@@ -173,6 +173,12 @@
         block_device_proto->set_alignment(info.alignment);
         block_device_proto->set_alignment_offset(info.alignment_offset);
     }
+
+    auto super_device_proto = proto->mutable_super_device();
+    super_device_proto->set_name(GetSuperPartitionName());
+    super_device_proto->set_used_size(builder->UsedSpace());
+    super_device_proto->set_total_size(GetTotalSuperPartitionSize(*metadata));
+
     return true;
 }