Merge "Add parameter for serial number property to rkp tool" into main am: 670aca611d

Original change: https://android-review.googlesource.com/c/platform/system/security/+/2861555

Change-Id: Ide067532b43de0eae3cc59bf9f2a15fe16e8aeb8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/provisioner/rkp_factory_extraction_tool.cpp b/provisioner/rkp_factory_extraction_tool.cpp
index 5765e05..0a3a59a 100644
--- a/provisioner/rkp_factory_extraction_tool.cpp
+++ b/provisioner/rkp_factory_extraction_tool.cpp
@@ -42,6 +42,8 @@
             "If true, this tool performs a self-test, validating the payload for correctness. "
             "This checks that the device on the factory line is producing valid output "
             "before attempting to upload the output to the device info service.");
+DEFINE_string(serialno_prop, "ro.serialno",
+              "The property of getting serial number. Defaults to 'ro.serialno'.");
 
 namespace {
 
@@ -59,7 +61,7 @@
         auto bytes = csr.encode();
         std::copy(bytes.begin(), bytes.end(), std::ostream_iterator<char>(std::cout));
     } else if (FLAGS_output_format == kBuildPlusCsr) {
-        auto [json, error] = jsonEncodeCsrWithBuild(instance_name, csr);
+        auto [json, error] = jsonEncodeCsrWithBuild(instance_name, csr, FLAGS_serialno_prop);
         if (!error.empty()) {
             std::cerr << "Error JSON encoding the output: " << error;
             exit(1);