|
|
|
@ -22,11 +22,10 @@
|
|
|
|
|
#include <android-base/stringprintf.h>
|
|
|
|
|
#include <android-base/properties.h>
|
|
|
|
|
#include <android-base/unique_fd.h>
|
|
|
|
|
#include <hidl/HidlBinderSupport.h>
|
|
|
|
|
#include <log/log.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
#include "DumpstateDevice.h"
|
|
|
|
|
#include "Dumpstate.h"
|
|
|
|
|
|
|
|
|
|
#include "DumpstateUtil.h"
|
|
|
|
|
|
|
|
|
@ -56,11 +55,10 @@ using android::os::dumpstate::DumpFileToFd;
|
|
|
|
|
using android::os::dumpstate::PropertiesHelper;
|
|
|
|
|
using android::os::dumpstate::RunCommandToFd;
|
|
|
|
|
|
|
|
|
|
namespace aidl {
|
|
|
|
|
namespace android {
|
|
|
|
|
namespace hardware {
|
|
|
|
|
namespace dumpstate {
|
|
|
|
|
namespace V1_1 {
|
|
|
|
|
namespace implementation {
|
|
|
|
|
|
|
|
|
|
#define GPS_LOG_PREFIX "gl-"
|
|
|
|
|
#define GPS_MCU_LOG_PREFIX "esw-"
|
|
|
|
@ -74,7 +72,7 @@ typedef std::chrono::time_point<std::chrono::steady_clock> timepoint_t;
|
|
|
|
|
|
|
|
|
|
const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled";
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum,
|
|
|
|
|
void Dumpstate::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum,
|
|
|
|
|
const char *logPrefix) {
|
|
|
|
|
struct dirent **dirent_list = NULL;
|
|
|
|
|
int num_entries = scandir(srcDir.c_str(),
|
|
|
|
@ -120,11 +118,11 @@ void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir,
|
|
|
|
|
free(dirent_list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpRilLogs(int fd, std::string destDir) {
|
|
|
|
|
void Dumpstate::dumpRilLogs(int fd, std::string destDir) {
|
|
|
|
|
std::string rilLogDir =
|
|
|
|
|
android::base::GetProperty(RIL_LOG_DIRECTORY_PROPERTY, RIL_LOG_DIRECTORY);
|
|
|
|
|
::android::base::GetProperty(RIL_LOG_DIRECTORY_PROPERTY, RIL_LOG_DIRECTORY);
|
|
|
|
|
|
|
|
|
|
int maxFileNum = android::base::GetIntProperty(RIL_LOG_NUMBER_PROPERTY, 50);
|
|
|
|
|
int maxFileNum = ::android::base::GetIntProperty(RIL_LOG_NUMBER_PROPERTY, 50);
|
|
|
|
|
|
|
|
|
|
const std::string currentLogDir = rilLogDir + "/cur";
|
|
|
|
|
const std::string previousLogDir = rilLogDir + "/prev";
|
|
|
|
@ -191,11 +189,11 @@ void dumpModemEFS(std::string destDir) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpGpsLogs(int fd, const std::string &destDir) {
|
|
|
|
|
void Dumpstate::dumpGpsLogs(int fd, const std::string &destDir) {
|
|
|
|
|
const std::string gpsLogDir = GPS_LOG_DIRECTORY;
|
|
|
|
|
const std::string gpsTmpLogDir = gpsLogDir + "/.tmp";
|
|
|
|
|
const std::string gpsDestDir = destDir + "/gps";
|
|
|
|
|
int maxFileNum = android::base::GetIntProperty(GPS_LOG_NUMBER_PROPERTY, 20);
|
|
|
|
|
int maxFileNum = ::android::base::GetIntProperty(GPS_LOG_NUMBER_PROPERTY, 20);
|
|
|
|
|
|
|
|
|
|
RunCommandToFd(fd, "MKDIR GPS LOG", {"/vendor/bin/mkdir", "-p", gpsDestDir.c_str()},
|
|
|
|
|
CommandOptions::WithTimeout(2).Build());
|
|
|
|
@ -205,7 +203,7 @@ void DumpstateDevice::dumpGpsLogs(int fd, const std::string &destDir) {
|
|
|
|
|
dumpLogs(fd, gpsLogDir, gpsDestDir, maxFileNum, GPS_LOG_PREFIX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpCameraLogs(int fd, const std::string &destDir) {
|
|
|
|
|
void Dumpstate::dumpCameraLogs(int fd, const std::string &destDir) {
|
|
|
|
|
static const std::string kCameraLogDir = "/data/vendor/camera/profiler";
|
|
|
|
|
const std::string cameraDestDir = destDir + "/camera";
|
|
|
|
|
RunCommandToFd(fd, "MKDIR CAMERA LOG", {"/vendor/bin/mkdir", "-p", cameraDestDir.c_str()},
|
|
|
|
@ -219,7 +217,7 @@ void DumpstateDevice::dumpCameraLogs(int fd, const std::string &destDir) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timepoint_t startSection(int fd, const std::string §ionName) {
|
|
|
|
|
android::base::WriteStringToFd(
|
|
|
|
|
::android::base::WriteStringToFd(
|
|
|
|
|
"\n"
|
|
|
|
|
"------ Section start: " + sectionName + " ------\n"
|
|
|
|
|
"\n", fd);
|
|
|
|
@ -231,7 +229,7 @@ void endSection(int fd, const std::string §ionName, timepoint_t startTime) {
|
|
|
|
|
auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>
|
|
|
|
|
(endTime - startTime).count();
|
|
|
|
|
|
|
|
|
|
android::base::WriteStringToFd(
|
|
|
|
|
::android::base::WriteStringToFd(
|
|
|
|
|
"\n"
|
|
|
|
|
"------ Section end: " + sectionName + " ------\n"
|
|
|
|
|
"Elapsed msec: " + std::to_string(elapsedMsec) + "\n"
|
|
|
|
@ -243,13 +241,13 @@ void endSection(int fd, const std::string §ionName, timepoint_t startTime) {
|
|
|
|
|
// related to each other - for instance, for a Foo peripheral - please add them
|
|
|
|
|
// to a new dump function and include it in this table so it can be accessed from the
|
|
|
|
|
// command line, e.g.:
|
|
|
|
|
// lshal debug android.hardware.dumpstate@1.0::IDumpstateDevice/default foo
|
|
|
|
|
// dumpsys android.hardware.dumpstate.IDumpstateDevice/default foo
|
|
|
|
|
//
|
|
|
|
|
// However, if your addition generates attachments and/or binary data for the
|
|
|
|
|
// bugreport (i.e. if it requires two file descriptors to execute), it must not be
|
|
|
|
|
// added to this table and should instead be added to dumpstateBoard() below.
|
|
|
|
|
|
|
|
|
|
DumpstateDevice::DumpstateDevice()
|
|
|
|
|
Dumpstate::Dumpstate()
|
|
|
|
|
: mTextSections{
|
|
|
|
|
{ "wlan", [this](int fd) { dumpWlanSection(fd); } },
|
|
|
|
|
{ "soc", [this](int fd) { dumpSocSection(fd); } },
|
|
|
|
@ -270,9 +268,9 @@ DumpstateDevice::DumpstateDevice()
|
|
|
|
|
} {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump data requested by an argument to the "debug" HAL interface, or help info
|
|
|
|
|
// Dump data requested by an argument to the "dump" interface, or help info
|
|
|
|
|
// if the specified section is not supported.
|
|
|
|
|
void DumpstateDevice::dumpTextSection(int fd, const std::string §ionName) {
|
|
|
|
|
void Dumpstate::dumpTextSection(int fd, const std::string §ionName) {
|
|
|
|
|
bool dumpAll = (sectionName == kAllSections);
|
|
|
|
|
|
|
|
|
|
for (const auto §ion : mTextSections) {
|
|
|
|
@ -292,17 +290,17 @@ void DumpstateDevice::dumpTextSection(int fd, const std::string §ionName) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// An unsupported section was requested on the command line
|
|
|
|
|
android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd);
|
|
|
|
|
android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd);
|
|
|
|
|
::android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd);
|
|
|
|
|
::android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd);
|
|
|
|
|
for (const auto §ion : mTextSections) {
|
|
|
|
|
android::base::WriteStringToFd(" " + section.first, fd);
|
|
|
|
|
::android::base::WriteStringToFd(" " + section.first, fd);
|
|
|
|
|
}
|
|
|
|
|
android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are"
|
|
|
|
|
::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are"
|
|
|
|
|
"not avalable from the command line.\n", fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to wlan
|
|
|
|
|
void DumpstateDevice::dumpWlanSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpWlanSection(int fd) {
|
|
|
|
|
RunCommandToFd(fd, "WLAN Debug Dump", {"/vendor/bin/sh", "-c",
|
|
|
|
|
"cat /sys/wifi/dump_start"});
|
|
|
|
|
|
|
|
|
@ -311,7 +309,7 @@ void DumpstateDevice::dumpWlanSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to power and battery
|
|
|
|
|
void DumpstateDevice::dumpPowerSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpPowerSection(int fd) {
|
|
|
|
|
struct stat buffer;
|
|
|
|
|
|
|
|
|
|
RunCommandToFd(fd, "Power Stats Times", {"/vendor/bin/sh", "-c",
|
|
|
|
@ -490,7 +488,7 @@ void DumpstateDevice::dumpPowerSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to thermal
|
|
|
|
|
void DumpstateDevice::dumpThermalSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpThermalSection(int fd) {
|
|
|
|
|
RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c",
|
|
|
|
|
"for f in /sys/class/thermal/thermal* ; do "
|
|
|
|
|
"type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; "
|
|
|
|
@ -522,7 +520,7 @@ void DumpstateDevice::dumpThermalSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to touch
|
|
|
|
|
void DumpstateDevice::dumpTouchSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpTouchSection(int fd) {
|
|
|
|
|
const char stm_cmd_path[4][50] = {"/sys/class/spi_master/spi11/spi11.0",
|
|
|
|
|
"/proc/fts/driver_test",
|
|
|
|
|
"/sys/class/spi_master/spi6/spi6.0",
|
|
|
|
@ -820,7 +818,7 @@ void DumpstateDevice::dumpTouchSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to SoC
|
|
|
|
|
void DumpstateDevice::dumpSocSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpSocSection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "AP HW TUNE", "/sys/devices/system/chip-id/ap_hw_tune_str");
|
|
|
|
|
DumpFileToFd(fd, "EVT VERSION", "/sys/devices/system/chip-id/evt_ver");
|
|
|
|
|
DumpFileToFd(fd, "LOT ID", "/sys/devices/system/chip-id/lot_id");
|
|
|
|
@ -830,7 +828,7 @@ void DumpstateDevice::dumpSocSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to CPUs
|
|
|
|
|
void DumpstateDevice::dumpCpuSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpCpuSection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present");
|
|
|
|
|
DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online");
|
|
|
|
|
RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c",
|
|
|
|
@ -850,7 +848,7 @@ void DumpstateDevice::dumpCpuSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to Devfreq & BTS
|
|
|
|
|
void DumpstateDevice::dumpDevfreqSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpDevfreqSection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "MIF DVFS",
|
|
|
|
|
"/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/time_in_state");
|
|
|
|
|
DumpFileToFd(fd, "INT DVFS",
|
|
|
|
@ -871,7 +869,7 @@ void DumpstateDevice::dumpDevfreqSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to memory
|
|
|
|
|
void DumpstateDevice::dumpMemorySection(int fd) {
|
|
|
|
|
void Dumpstate::dumpMemorySection(int fd) {
|
|
|
|
|
RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c",
|
|
|
|
|
"for d in $(ls -d /d/ion/*); do "
|
|
|
|
|
"if [ -f $d ]; then "
|
|
|
|
@ -945,13 +943,13 @@ static void DumpUFS(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to storage
|
|
|
|
|
void DumpstateDevice::dumpStorageSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpStorageSection(int fd) {
|
|
|
|
|
DumpF2FS(fd);
|
|
|
|
|
DumpUFS(fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to display
|
|
|
|
|
void DumpstateDevice::dumpDisplaySection(int fd) {
|
|
|
|
|
void Dumpstate::dumpDisplaySection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "CRTC-0 underrun count", "/sys/kernel/debug/dri/0/crtc-0/underrun_cnt");
|
|
|
|
|
DumpFileToFd(fd, "CRTC-0 crc count", "/sys/kernel/debug/dri/0/crtc-0/crc_cnt");
|
|
|
|
|
DumpFileToFd(fd, "CRTC-0 ecc count", "/sys/kernel/debug/dri/0/crtc-0/ecc_cnt");
|
|
|
|
@ -971,7 +969,7 @@ void DumpstateDevice::dumpDisplaySection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to AoC
|
|
|
|
|
void DumpstateDevice::dumpAoCSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpAoCSection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "AoC Service Status", "/sys/devices/platform/19000000.aoc/services");
|
|
|
|
|
DumpFileToFd(fd, "AoC Restarts", "/sys/devices/platform/19000000.aoc/restart_count");
|
|
|
|
|
DumpFileToFd(fd, "AoC Coredumps", "/sys/devices/platform/19000000.aoc/coredump_count");
|
|
|
|
@ -1001,14 +999,14 @@ void DumpstateDevice::dumpAoCSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to sensors usf.
|
|
|
|
|
void DumpstateDevice::dumpSensorsUSFSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpSensorsUSFSection(int fd) {
|
|
|
|
|
CommandOptions options = CommandOptions::WithTimeout(2).Build();
|
|
|
|
|
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, "");
|
|
|
|
|
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) {
|
|
|
|
@ -1021,7 +1019,7 @@ void DumpstateDevice::dumpSensorsUSFSection(int fd) {
|
|
|
|
|
|
|
|
|
|
// Gzip binary data and dump to fd in base64 format. Cmd to decode is also attached.
|
|
|
|
|
void dumpGzippedFileInBase64ToFd(int fd, const char* title, const char* file_path) {
|
|
|
|
|
auto cmd = android::base::StringPrintf("echo 'base64 -d <<EOF | gunzip' ; "
|
|
|
|
|
auto cmd = ::android::base::StringPrintf("echo 'base64 -d <<EOF | gunzip' ; "
|
|
|
|
|
"/vendor/bin/gzip < \"%s\" | /vendor/bin/base64 ; "
|
|
|
|
|
"echo 'EOF'", file_path);
|
|
|
|
|
RunCommandToFd(fd, title,
|
|
|
|
@ -1036,15 +1034,15 @@ struct abl_log_header {
|
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
|
|
// Dump items related to ramdump.
|
|
|
|
|
void DumpstateDevice::dumpRamdumpSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpRamdumpSection(int fd) {
|
|
|
|
|
std::string abl_log;
|
|
|
|
|
if (android::base::ReadFileToString("/mnt/vendor/ramdump/abl.log", &abl_log)) {
|
|
|
|
|
if (::android::base::ReadFileToString("/mnt/vendor/ramdump/abl.log", &abl_log)) {
|
|
|
|
|
const struct abl_log_header *header = (const struct abl_log_header*) abl_log.c_str();
|
|
|
|
|
android::base::WriteStringToFd(android::base::StringPrintf(
|
|
|
|
|
::android::base::WriteStringToFd(::android::base::StringPrintf(
|
|
|
|
|
"------ Ramdump misc file: abl.log (i:0x%" PRIx64 " size:0x%" PRIx64 ") ------\n%s\n",
|
|
|
|
|
header->i, header->size, std::string(header->buf, header->i).c_str()), fd);
|
|
|
|
|
} else {
|
|
|
|
|
android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd);
|
|
|
|
|
::android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd);
|
|
|
|
|
}
|
|
|
|
|
dumpGzippedFileInBase64ToFd(
|
|
|
|
|
fd, "Ramdump misc file: acpm.lst (gzipped in base64)", "/mnt/vendor/ramdump/acpm.lst");
|
|
|
|
@ -1053,23 +1051,23 @@ void DumpstateDevice::dumpRamdumpSection(int fd) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items that don't fit well into any other section
|
|
|
|
|
void DumpstateDevice::dumpMiscSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpMiscSection(int fd) {
|
|
|
|
|
RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"});
|
|
|
|
|
DumpFileToFd(fd, "VENDOR PROC DUMP", "/proc/vendor_sched/dump_task");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dump items related to GSC
|
|
|
|
|
void DumpstateDevice::dumpGscSection(int fd) {
|
|
|
|
|
void Dumpstate::dumpGscSection(int fd) {
|
|
|
|
|
RunCommandToFd(fd, "Citadel VERSION", {"vendor/bin/hw/citadel_updater", "-lv"});
|
|
|
|
|
RunCommandToFd(fd, "Citadel STATS", {"vendor/bin/hw/citadel_updater", "--stats"});
|
|
|
|
|
RunCommandToFd(fd, "GSC DEBUG DUMP", {"vendor/bin/hw/citadel_updater", "-D"});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpTrustySection(int fd) {
|
|
|
|
|
void Dumpstate::dumpTrustySection(int fd) {
|
|
|
|
|
DumpFileToFd(fd, "Trusty TEE0 Logs", "/dev/trusty-log0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DumpstateDevice::dumpModem(int fd, int fdModem)
|
|
|
|
|
void Dumpstate::dumpModem(int fd, int fdModem)
|
|
|
|
|
{
|
|
|
|
|
std::string modemLogDir = MODEM_LOG_DIRECTORY;
|
|
|
|
|
std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY;
|
|
|
|
@ -1092,29 +1090,29 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
|
|
|
|
|
RunCommandToFd(fd, "MKDIR MODEM LOG", {"/vendor/bin/mkdir", "-p", modemLogAllDir.c_str()}, CommandOptions::WithTimeout(2).Build());
|
|
|
|
|
|
|
|
|
|
if (!PropertiesHelper::IsUserBuild()) {
|
|
|
|
|
bool modemLogEnabled = android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false);
|
|
|
|
|
bool gpsLogEnabled = android::base::GetBoolProperty(GPS_LOGGING_STATUS_PROPERTY, false);
|
|
|
|
|
bool tcpdumpEnabled = android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false);
|
|
|
|
|
bool cameraLogsEnabled = android::base::GetBoolProperty(
|
|
|
|
|
bool modemLogEnabled = ::android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false);
|
|
|
|
|
bool gpsLogEnabled = ::android::base::GetBoolProperty(GPS_LOGGING_STATUS_PROPERTY, false);
|
|
|
|
|
bool tcpdumpEnabled = ::android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false);
|
|
|
|
|
bool cameraLogsEnabled = ::android::base::GetBoolProperty(
|
|
|
|
|
"vendor.camera.debug.camera_performance_analyzer.attach_to_bugreport", true);
|
|
|
|
|
int maxFileNum = android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100);
|
|
|
|
|
int maxFileNum = ::android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100);
|
|
|
|
|
|
|
|
|
|
if (tcpdumpEnabled) {
|
|
|
|
|
dumpLogs(fd, tcpdumpLogDir, modemLogAllDir, android::base::GetIntProperty(TCPDUMP_NUMBER_BUGREPORT, 5), TCPDUMP_LOG_PREFIX);
|
|
|
|
|
dumpLogs(fd, tcpdumpLogDir, modemLogAllDir, ::android::base::GetIntProperty(TCPDUMP_NUMBER_BUGREPORT, 5), TCPDUMP_LOG_PREFIX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (modemLogEnabled) {
|
|
|
|
|
bool modemLogStarted = android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false);
|
|
|
|
|
bool modemLogStarted = ::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false);
|
|
|
|
|
|
|
|
|
|
if (modemLogStarted) {
|
|
|
|
|
android::base::SetProperty(MODEM_LOGGING_PROPERTY, "false");
|
|
|
|
|
::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "false");
|
|
|
|
|
ALOGD("Stopping modem logging...\n");
|
|
|
|
|
} else {
|
|
|
|
|
ALOGD("modem logging is not running\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 30; i++) {
|
|
|
|
|
if (!android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false)) {
|
|
|
|
|
if (!::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false)) {
|
|
|
|
|
ALOGD("modem logging stopped\n");
|
|
|
|
|
sleep(1);
|
|
|
|
|
break;
|
|
|
|
@ -1126,7 +1124,7 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
|
|
|
|
|
|
|
|
|
|
if (modemLogStarted) {
|
|
|
|
|
ALOGD("Restarting modem logging...\n");
|
|
|
|
|
android::base::SetProperty(MODEM_LOGGING_PROPERTY, "true");
|
|
|
|
|
::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "true");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1150,7 +1148,7 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
|
|
|
|
|
RunCommandToFd(fd, "CHG PERM", {"/vendor/bin/chmod", "a+w", modemLogCombined.c_str()}, CommandOptions::WithTimeout(2).Build());
|
|
|
|
|
|
|
|
|
|
std::vector<uint8_t> buffer(65536);
|
|
|
|
|
android::base::unique_fd fdLog(TEMP_FAILURE_RETRY(open(modemLogCombined.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK)));
|
|
|
|
|
::android::base::unique_fd fdLog(TEMP_FAILURE_RETRY(open(modemLogCombined.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK)));
|
|
|
|
|
|
|
|
|
|
if (fdLog >= 0) {
|
|
|
|
|
while (1) {
|
|
|
|
@ -1178,89 +1176,79 @@ void DumpstateDevice::dumpModem(int fd, int fdModem)
|
|
|
|
|
endSection(fd, sectionName, startTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
|
|
|
|
|
Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle &handle) {
|
|
|
|
|
// Ignore return value, just return an empty status.
|
|
|
|
|
dumpstateBoard_1_1(handle, DumpstateMode::DEFAULT, 30 * 1000 /* timeoutMillis */);
|
|
|
|
|
return Void();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow.
|
|
|
|
|
Return<DumpstateStatus> DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& handle,
|
|
|
|
|
const DumpstateMode mode,
|
|
|
|
|
const uint64_t timeoutMillis) {
|
|
|
|
|
ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
|
|
|
|
|
IDumpstateDevice::DumpstateMode in_mode,
|
|
|
|
|
int64_t in_timeoutMillis) {
|
|
|
|
|
// Unused arguments.
|
|
|
|
|
(void) timeoutMillis;
|
|
|
|
|
(void) in_timeoutMillis;
|
|
|
|
|
|
|
|
|
|
if (handle == nullptr || handle->numFds < 1) {
|
|
|
|
|
if (in_fds.size() < 1) {
|
|
|
|
|
ALOGE("no FDs\n");
|
|
|
|
|
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
|
|
|
|
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
|
|
|
|
|
"No file descriptor");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fd = handle->data[0];
|
|
|
|
|
int fd = in_fds[0].get();
|
|
|
|
|
if (fd < 0) {
|
|
|
|
|
ALOGE("invalid FD: %d\n", handle->data[0]);
|
|
|
|
|
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
|
|
|
|
ALOGE("invalid FD: %d\n", fd);
|
|
|
|
|
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
|
|
|
|
|
"Invalid file descriptor");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mode == DumpstateMode::WEAR) {
|
|
|
|
|
if (in_mode == IDumpstateDevice::DumpstateMode::WEAR) {
|
|
|
|
|
// We aren't a Wear device.
|
|
|
|
|
ALOGE("Unsupported mode: %d\n", mode);
|
|
|
|
|
return DumpstateStatus::UNSUPPORTED_MODE;
|
|
|
|
|
} else if (mode < DumpstateMode::FULL || mode > DumpstateMode::PROTO) {
|
|
|
|
|
ALOGE("Invalid mode: %d\n", mode);
|
|
|
|
|
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
|
|
|
|
ALOGE("Unsupported mode: %d\n", in_mode);
|
|
|
|
|
return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ERROR_UNSUPPORTED_MODE,
|
|
|
|
|
"Unsupported mode");
|
|
|
|
|
} else if (in_mode < IDumpstateDevice::DumpstateMode::FULL || in_mode > IDumpstateDevice::DumpstateMode::PROTO) {
|
|
|
|
|
ALOGE("Invalid mode: %d\n", in_mode);
|
|
|
|
|
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
|
|
|
|
|
"Invalid mode");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dumpTextSection(fd, kAllSections);
|
|
|
|
|
|
|
|
|
|
if (handle->numFds < 2) {
|
|
|
|
|
ALOGE("no FD for modem\n");
|
|
|
|
|
if (in_fds.size() < 1) {
|
|
|
|
|
ALOGE("no FD for modem\n");
|
|
|
|
|
} else {
|
|
|
|
|
int fdModem = handle->data[1];
|
|
|
|
|
dumpModem(fd, fdModem);
|
|
|
|
|
int fdModem = in_fds[1].get();
|
|
|
|
|
dumpModem(fd, fdModem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DumpstateStatus::OK;
|
|
|
|
|
return ndk::ScopedAStatus::ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Return<void> DumpstateDevice::setVerboseLoggingEnabled(const bool enable) {
|
|
|
|
|
::android::base::SetProperty(kVerboseLoggingProperty, enable ? "true" : "false");
|
|
|
|
|
return Void();
|
|
|
|
|
ndk::ScopedAStatus Dumpstate::setVerboseLoggingEnabled(bool in_enable) {
|
|
|
|
|
::android::base::SetProperty(kVerboseLoggingProperty, in_enable ? "true" : "false");
|
|
|
|
|
return ndk::ScopedAStatus::ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Return<bool> DumpstateDevice::getVerboseLoggingEnabled() {
|
|
|
|
|
return ::android::base::GetBoolProperty(kVerboseLoggingProperty, false);
|
|
|
|
|
ndk::ScopedAStatus Dumpstate::getVerboseLoggingEnabled(bool* _aidl_return) {
|
|
|
|
|
*_aidl_return = ::android::base::GetBoolProperty(kVerboseLoggingProperty, false);
|
|
|
|
|
return ndk::ScopedAStatus::ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Since HALs that support the debug() interface are automatically invoked during
|
|
|
|
|
// Since AIDLs that support the dump() interface are automatically invoked during
|
|
|
|
|
// bugreport generation and we don't want to generate a second copy of the same
|
|
|
|
|
// data that will go into dumpstate_board.txt, this function will only do
|
|
|
|
|
// something if it is called with an option, e.g.
|
|
|
|
|
// lshal debug android.hardware.dumpstate@1.0::IDumpstateDevice/default all
|
|
|
|
|
// dumpsys android.hardware.dumpstate.IDumpstateDevice/default all
|
|
|
|
|
//
|
|
|
|
|
// Also, note that sections which generate attachments and/or binary data when
|
|
|
|
|
// included in a bugreport are not available through the debug() interface.
|
|
|
|
|
Return<void> DumpstateDevice::debug(const hidl_handle &handle, const hidl_vec<hidl_string> &args) {
|
|
|
|
|
// Exit when dump is completed since this is a lazy HAL.
|
|
|
|
|
addPostCommandTask([]() {
|
|
|
|
|
exit(0);
|
|
|
|
|
});
|
|
|
|
|
// included in a bugreport are not available through the dump() interface.
|
|
|
|
|
binder_status_t Dumpstate::dump(int fd, const char** args, uint32_t numArgs) {
|
|
|
|
|
|
|
|
|
|
if (handle == nullptr || handle->numFds < 1 || args.size() != 1) {
|
|
|
|
|
return Void();
|
|
|
|
|
if (numArgs != 1) {
|
|
|
|
|
return STATUS_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fd = handle->data[0];
|
|
|
|
|
dumpTextSection(fd, static_cast<std::string>(args[0]));
|
|
|
|
|
|
|
|
|
|
fsync(fd);
|
|
|
|
|
return Void();
|
|
|
|
|
return STATUS_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace implementation
|
|
|
|
|
} // namespace V1_1
|
|
|
|
|
} // namespace dumpstate
|
|
|
|
|
} // namespace hardware
|
|
|
|
|
} // namespace android
|
|
|
|
|
} // namespace aidl
|