allow dumpstate to execute files under vendor/bin/dump

Bug: 240530709
Test: adb bugreport has the same result
Change-Id: I6927c3ab64369f1e3c30842d571f66374dd544ac
This commit is contained in:
Adam Shih 2022-09-16 11:29:12 +08:00
parent 7a25196bf5
commit 552fe66f7f
3 changed files with 19 additions and 8 deletions

View file

@ -266,7 +266,6 @@ DumpstateDevice::DumpstateDevice()
{ "aoc", [this](int fd) { dumpAoCSection(fd); } },
{ "ramdump", [this](int fd) { dumpRamdumpSection(fd); } },
{ "misc", [this](int fd) { dumpMiscSection(fd); } },
{ "dump", [this](int fd) { dumpSection(fd); } },
{ "camera", [this](int fd) { dumpCameraSection(fd); } },
{ "trusty", [this](int fd) { dumpTrustySection(fd); } },
{ "modem", [this](int fd) { dumpModemSection(fd); } },
@ -290,6 +289,24 @@ void DumpstateDevice::dumpTextSection(int fd, const std::string &sectionName) {
}
}
// Execute all programs under vendor/bin/dump/
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/vendor/bin/dump"), closedir);
if (!dir) {
ALOGE("Fail To Open Dir vendor/bin/dump/");
} else {
dirent *entry;
while ((entry = readdir(dir.get())) != nullptr) {
// Skip '.', '..'
if (entry->d_name[0] == '.') {
continue;
}
std::string bin(entry->d_name);
auto startTime = startSection(fd, "/vendor/bin/dump/"+bin);
RunCommandToFd(fd, "/vendor/bin/dump/"+bin, {"/vendor/bin/dump/"+bin});
endSection(fd, "/vendor/bin/dump/"+bin, startTime);
}
}
if (dumpAll) {
return;
}
@ -1062,11 +1079,6 @@ void DumpstateDevice::dumpMiscSection(int fd) {
DumpFileToFd(fd, "VENDOR PROC DUMP", "/proc/vendor_sched/dump_task");
}
// Dump scripts under vendor/bin/dump
void DumpstateDevice::dumpSection(int fd) {
RunCommandToFd(fd, "dump", {"/vendor/bin/dump/dump_gsc.sh"});
}
// Dump essential camera debugging logs
void DumpstateDevice::dumpCameraSection(int fd) {
RunCommandToFd(fd, "Camera HAL Graph State Dump", {"/vendor/bin/sh", "-c",