Add parameter for serial number property to rkp tool

[Description]
1.Add patch to modify rkp_factory_extraction_tool, so
 that it can meet TV customer's factory product line.
2.Introduce a new input parameter, serialno_prop,
to the function jsonEncodeCsrWithBuild.
3.Use the new property of serialno_prop if it is set,
otherwise defaults to "ro.serialno".

Test:
1.build pass
2.AC on/off pass
3.run "rkp_factory_extraction_tool
--output_format build+csr
--serialno_prop $(customer_prop) > csr.json" pass
4.run "rkp_factory_extraction_tool
--output_format build+csr > csr.json" pass
5.VtsHalRemotelyProvisionedComponentTargetTest pass
6.libkeymint_remote_prov_support_test pass
7.VtsAidlKeyMintTargetTest pass

Bug: 313811996
Change-Id: I261f7ae1b3b4c3e2776ec4013c77b7be355477cf
This commit is contained in:
chuanchuan.gao 2023-12-07 16:47:51 +08:00 committed by Eddy-SH Chen
parent 6f80e95312
commit 8ef6d1a6be

View file

@ -42,6 +42,8 @@ DEFINE_bool(self_test, true,
"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 @@ void writeOutput(const std::string instance_name, const Array& csr) {
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);