diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index bcb788cc..5cc86995 100644 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -199,6 +199,17 @@ void DumpstateDevice::dumpGpsLogs(int fd, std::string destDir) { dumpLogs(fd, gpsLogDir, destDir, maxFileNum, GPS_LOG_PREFIX); } +void DumpstateDevice::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()}, + CommandOptions::WithTimeout(2).Build()); + // Attach multiple latest sessions (in case the user is running concurrent + // sessions or starts a new session after the one with performance issues). + dumpLogs(fd, kCameraLogDir, cameraDestDir, 10, "session-ended-"); + dumpLogs(fd, kCameraLogDir, cameraDestDir, 5, "high-drop-rate-"); +} + timepoint_t startSection(int fd, const std::string §ionName) { android::base::WriteStringToFd( "\n" @@ -877,6 +888,8 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) 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); if (tcpdumpEnabled) { @@ -916,6 +929,10 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) ALOGD("gps logging is not running\n"); } + if (cameraLogsEnabled) { + dumpCameraLogs(STDOUT_FILENO, modemLogAllDir); + } + dumpLogs(fd, extendedLogDir, modemLogAllDir, maxFileNum, EXTENDED_LOG_PREFIX); dumpRilLogs(fd, modemLogAllDir); dumpNetmgrLogs(modemLogAllDir); diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h index 2492b3be..10b95a17 100644 --- a/dumpstate/DumpstateDevice.h +++ b/dumpstate/DumpstateDevice.h @@ -30,13 +30,10 @@ namespace implementation { using ::android::hardware::dumpstate::V1_1::DumpstateMode; using ::android::hardware::dumpstate::V1_1::DumpstateStatus; using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; -using ::android::hardware::hidl_array; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; struct DumpstateDevice : public IDumpstateDevice { public: @@ -88,6 +85,7 @@ struct DumpstateDevice : public IDumpstateDevice { void dumpModem(int fd, int fdModem); void dumpRilLogs(int fd, std::string destDir); void dumpGpsLogs(int fd, std::string destDir); + void dumpCameraLogs(int fd, const std::string &destDir); }; } // namespace implementation