From 24b9d29d6d7d7c8a81b84c9f5417c565e993014b Mon Sep 17 00:00:00 2001 From: Chris Kuiper Date: Mon, 3 May 2021 14:30:52 -0700 Subject: [PATCH] dumpstate: Add USF registry dump. This collects the output of "usf_reg_edit save -" and adds it to the bugreport. It is only done on userbuilds for PROTO* and EVT* devices. Bug: 187081112 Test: Run "adb bugreport " and verify it contains the output from "usf_reg_edit save -". Change-Id: Ie68b56a3bb211840f33bdb5afbc31b0759641c8e --- dumpstate/DumpstateDevice.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index aa2c2c98..8b49a36c 100644 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -49,6 +49,8 @@ #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" +#define HW_REVISION "ro.boot.hardware.revision" + using android::os::dumpstate::CommandOptions; using android::os::dumpstate::DumpFileToFd; using android::os::dumpstate::PropertiesHelper; @@ -765,6 +767,17 @@ void DumpstateDevice::dumpSensorsUSFSection(int fd) { RunCommandToFd(fd, "USF statistics", {"/vendor/bin/sh", "-c", "usf_stats get --all"}, options); + if (!PropertiesHelper::IsUserBuild()) { + // Not a user build, if this is also not a production device dump the USF registry. + std::string hwRev = android::base::GetProperty(HW_REVISION, ""); + if (hwRev.find("PROTO") != std::string::npos || + hwRev.find("EVT") != std::string::npos || + hwRev.find("DVT") != std::string::npos) { + RunCommandToFd(fd, "USF Registry", + {"/vendor/bin/sh", "-c", "usf_reg_edit save -"}, + options); + } + } } struct abl_log_header {