summaryrefslogtreecommitdiff
path: root/cmds/incident/main.cpp
AgeCommit message (Collapse)Author
2023-08-28Use String8/16 c_str Tomasz Wasilczyk
Bug: 295394788 Test: make checkbuild Change-Id: I538720d4de2dcc038b417048209782ff605b7e30
2020-03-05Merge "Add an option to zip incident report" into rvc-dev TreeHugger Robot
2020-03-05Add an option to zip incident report Mike Ma
Incident reports are getting bigger as we add more sections. Add an option (-z, default off) to zip incident report. Bug: 150160547 Test: atest incidentd_test Test: adb shell incident -z -p EXPLICIT | gunzip | ./out/soong/host/linux-x86/bin/aprotoc --decode=android.os.IncidentProto --proto_path=./ --proto_path=external/protobuf/src frameworks/base/core/proto/android/os/incident.proto Change-Id: I7c8ff1d91df842c200462ee29f15feae68e62739
2020-03-04Fix a race conditon in `incident`. Boleyn Su
`incident` may exit too early, which leads to data lost. This commit fixes it. Bug: 144821874 Test: atest com.android.server.cts.IncidentdTest Change-Id: Ib73118cb690a8247049b5685ed0b227dad63f752
2019-11-30unique_fd is passed by value in AIDL interfaces Jiyong Park
FileDescriptor type in AIDL was translated into const unique_fd& in C++. Now, it is unique_fd, i.e. passed by value, to make it easier to keep it beyond the scope of the call. Bug: 144943748 Test: m Change-Id: I2b87761401361f9cf96cdda070f26e70a5c6c935
2019-08-22Add an API to dump incident report for dumpstate Mike Ma
Instead of just relying on the regular iteration through the system services inside dumpstate, add another API to IIncidentManager dedicated for dumpstate. - It is only callable by dumpstate() (check the calling uid) - It has the same behavior as the current call inside dump() Advantages: - More explicit function name, right next to takeIncidentReport will make it easier to keep them in sync. - Nobody else can call it, make security easier. - If dumpstate calls it explicitly, it can skip the 10 second timeout - The regular dump() call should provide debugging data about incidentd itself, for example timestamps for the most recent N incident reports taken and the current state of the work directory, allowing us to debug incidentd itself. Bug: 137493082 Test: Manually trigger a bug report, and verify /proto/incident_log.proto in the zip file. Change-Id: I19139c765b53ede63d3beb3ea3ac40ada1aba42d
2019-05-21Fix lookup of incident section by name to not crash. Joe Onorato
Bug: 132890298 Test: adb shell incident asdfadfasdfadf doesn't crash Change-Id: I74226960e8e2643df3491cd9dff8e9acc639e24f
2019-05-21Add command line utilites to set the reason field in incident report header Joe Onorato
Bug: 132890298 Test: incident_report -t -r "\"Hello Joe\"" 3000 Change-Id: Ic7a2523d7e87ba88019c5ac9b23ff35387fbc498
2019-04-26Get incidentd cts working again. Joe Onorato
- The buffer size increased, and the CTS test that checked that was triggering. - Privacy filtering wasn't working for the stack trace sections - The incident command was not handling the default arguments correctly - The throttler was throttling streaming reports, which made the test flaky. Bug: 126253679 Test: atest CtsIncidentHostTestCases Change-Id: I342cd7d0421ea8c22b7796fc99e779f21855af73
2019-03-26incidentd can now handle multiple callers asking it for incident reports Joe Onorato
Test: bit incident_test:* GtsIncidentManagerTestCases:* Bug: 123543706 Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
2018-01-24Fix command line tool to set the right privacy enum. Yi Jin
Test: manual Change-Id: I3f0845ea32b46f1a028f8b6d3d4180a90a47beb5
2017-09-07Implement Pii Stripper Part 3 Yi Jin
The incident request args sets privacy spec. Strip action is optimized to run once for each type of spec and ready for flush multiple times. Incident command is updated to take -p option to specify privacy spec. Bug: 64687253 Test: unit tests written, manually run incident command to test as well Change-Id: I6753df117f76dc1a5f4d2152baa3fbbf56b490e4
2017-08-07The proto field is set based on which header the data belongs to. Yi Jin
Bug: 64371071 Test: tested manually using native test Change-Id: Ic7671041981d9a722ef00ce6c50cdb12b3e5414d
2017-07-24This cl does the following things: Yi Jin
0) Implements a skeleton of incident_helper 1) Implements FileSection class which calls incident_helper to parse file content to protobuf 2) Adds Kernel Wake Sources to incident.proto and makes it parsed by FileSection 3) Adds basic gtests to test FdBuffer, io_utils, FileSection implementation Bug: 62923266 Bug: 62926061 Test: manual - push incidentd, incident_helper and incident to my device and verify kernel wakeup sources file is able to be parsed. Change-Id: I2aa6b6158d962ce70e6fa6c8a9c42213a45ff41c
2016-12-15First checkin of incident reporting. Joe Onorato
There are a few major pieces here: incidentd --------- This daemon (started by init) runs and accepts incoming requests to take incident reports. When prompted, it calls into various system services and fills in an IncidentProto data structure, and then writes the report into dropbox. The next steps for incidentd: - Security review of SELinux policies. These will be a subset of the dumpstate permissions. Until this is done, incidentd is not started at boot time. incident -------- This shell command calls into incidentd, and can initiate an incident report and either capture the output or leave for dropbox. incident_report --------------- This host side tool can call adb shell with the correct parameters and also format the incident report as text. This formatting code was left of the device on purpose. Right now it's pretty small, but as the number of fields increases, the metadata and code to do the formatting will start to grow. The incident_report command also contains a workaround to let it work before incidentd is turned on by default. Right now, it is implemented to call adb shell dumpsys <service> --proto directly, whereas in the future it will go through the full incidentd flow. incident_section_gen -------------------- A build-time tool that generates a stripped down set of information about the fields that are available. libincident ----------- This library contains the code to connect to incidentd, and the meta proto definitions that are used by the framework protos. The basics are here now, but they are not fully fleshed out yet. The privacy.proto file contains annotations that can go in the proto file that we will later use to filter which fields are uploaded, and which are used by local sources. For example, a device in a test lab is safe to upload much much more information than a real user. These will share the same mechanism, but the user's output will be filtered according to these annotations. frameworks/core/proto --------------------- These .proto files contain the definitions of the system's output. There is one master android.os.IncidentProto file that is the top level of an incident report, but some other services (notification, fingerprint, batterystats, etc) will have others that are used directly by the logging mechanism. Other files which are shared by several of the services also go here, such as ComponentName, Locale, Configuration, etc. There will be many more. There is also a first iplementation of a dump method handling --proto in the fingerprint service. IncidentManager --------------- The java API to trigger an incident report. Test: Not written yet Change-Id: I59568b115ac7fcf73af70c946c95752bf33ae67f