Loading cmds/incidentd/src/IncidentService.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "incidentd_util.h" #include "section_list.h" #include <android/os/IncidentReportArgs.h> #include <binder/IPCThreadState.h> #include <binder/IResultReceiver.h> #include <binder/IServiceManager.h> Loading @@ -41,6 +42,15 @@ enum { WHAT_RUN_REPORT = 1, WHAT_SEND_BACKLOG_TO_DROPBOX = 2 }; #define DEFAULT_BYTES_SIZE_LIMIT (20 * 1024 * 1024) // 20MB #define DEFAULT_REFACTORY_PERIOD_MS (24 * 60 * 60 * 1000) // 1 Day // Skip logs (1100 - 1108) because they are already in the bug report // Skip 1200, 1201, 1202, 3018 because they take too long // TODO(120079956): Skip 3008, 3015 because of error #define SKIPPED_SECTIONS { 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, /* Logs */ \ 1200, 1201, 1202, /* Native, hal, java traces */ \ 3008, /* "package --proto" */ \ 3015, /* "activity --proto processes" */ \ 3018 /* "meminfo -a --proto" */ } namespace android { namespace os { namespace incidentd { Loading Loading @@ -391,6 +401,38 @@ status_t IncidentService::cmd_privacy(FILE* in, FILE* out, FILE* err, Vector<Str return NO_ERROR; } status_t IncidentService::dump(int fd, const Vector<String16>& args) { if (std::find(args.begin(), args.end(), String16("--proto")) == args.end()) { ALOGD("Skip dumping incident. Only proto format is supported."); dprintf(fd, "Incident dump only supports proto version.\n"); return NO_ERROR; } ALOGD("Dump incident proto"); IncidentReportArgs incidentArgs; incidentArgs.setDest(DEST_EXPLICIT); int skipped[] = SKIPPED_SECTIONS; for (const Section** section = SECTION_LIST; *section; section++) { const int id = (*section)->id; if (std::find(std::begin(skipped), std::end(skipped), id) == std::end(skipped)) { incidentArgs.addSection(id); } } if (!checkIncidentPermissions(incidentArgs).isOk()) { return PERMISSION_DENIED; } int fd1 = dup(fd); if (fd1 < 0) { return -errno; } mHandler->scheduleRunReport(new ReportRequest(incidentArgs, NULL, fd1)); return NO_ERROR; } } // namespace incidentd } // namespace os } // namespace android cmds/incidentd/src/IncidentService.h +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public: virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override; virtual status_t command(FILE* in, FILE* out, FILE* err, Vector<String8>& args); virtual status_t dump(int fd, const Vector<String16>& args); private: sp<ReportRequestQueue> mQueue; Loading cmds/incidentd/src/main.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ int main(int /*argc*/, char** /*argv*/) { // Create the service sp<IncidentService> service = new IncidentService(looper); if (defaultServiceManager()->addService(String16("incident"), service) != 0) { if (defaultServiceManager()->addService(String16("incident"), service, false, IServiceManager::DUMP_FLAG_PRIORITY_NORMAL | IServiceManager::DUMP_FLAG_PROTO) != 0) { ALOGE("Failed to add service"); return -1; } Loading Loading
cmds/incidentd/src/IncidentService.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "incidentd_util.h" #include "section_list.h" #include <android/os/IncidentReportArgs.h> #include <binder/IPCThreadState.h> #include <binder/IResultReceiver.h> #include <binder/IServiceManager.h> Loading @@ -41,6 +42,15 @@ enum { WHAT_RUN_REPORT = 1, WHAT_SEND_BACKLOG_TO_DROPBOX = 2 }; #define DEFAULT_BYTES_SIZE_LIMIT (20 * 1024 * 1024) // 20MB #define DEFAULT_REFACTORY_PERIOD_MS (24 * 60 * 60 * 1000) // 1 Day // Skip logs (1100 - 1108) because they are already in the bug report // Skip 1200, 1201, 1202, 3018 because they take too long // TODO(120079956): Skip 3008, 3015 because of error #define SKIPPED_SECTIONS { 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, /* Logs */ \ 1200, 1201, 1202, /* Native, hal, java traces */ \ 3008, /* "package --proto" */ \ 3015, /* "activity --proto processes" */ \ 3018 /* "meminfo -a --proto" */ } namespace android { namespace os { namespace incidentd { Loading Loading @@ -391,6 +401,38 @@ status_t IncidentService::cmd_privacy(FILE* in, FILE* out, FILE* err, Vector<Str return NO_ERROR; } status_t IncidentService::dump(int fd, const Vector<String16>& args) { if (std::find(args.begin(), args.end(), String16("--proto")) == args.end()) { ALOGD("Skip dumping incident. Only proto format is supported."); dprintf(fd, "Incident dump only supports proto version.\n"); return NO_ERROR; } ALOGD("Dump incident proto"); IncidentReportArgs incidentArgs; incidentArgs.setDest(DEST_EXPLICIT); int skipped[] = SKIPPED_SECTIONS; for (const Section** section = SECTION_LIST; *section; section++) { const int id = (*section)->id; if (std::find(std::begin(skipped), std::end(skipped), id) == std::end(skipped)) { incidentArgs.addSection(id); } } if (!checkIncidentPermissions(incidentArgs).isOk()) { return PERMISSION_DENIED; } int fd1 = dup(fd); if (fd1 < 0) { return -errno; } mHandler->scheduleRunReport(new ReportRequest(incidentArgs, NULL, fd1)); return NO_ERROR; } } // namespace incidentd } // namespace os } // namespace android
cmds/incidentd/src/IncidentService.h +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ public: virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override; virtual status_t command(FILE* in, FILE* out, FILE* err, Vector<String8>& args); virtual status_t dump(int fd, const Vector<String16>& args); private: sp<ReportRequestQueue> mQueue; Loading
cmds/incidentd/src/main.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ int main(int /*argc*/, char** /*argv*/) { // Create the service sp<IncidentService> service = new IncidentService(looper); if (defaultServiceManager()->addService(String16("incident"), service) != 0) { if (defaultServiceManager()->addService(String16("incident"), service, false, IServiceManager::DUMP_FLAG_PRIORITY_NORMAL | IServiceManager::DUMP_FLAG_PROTO) != 0) { ALOGE("Failed to add service"); return -1; } Loading