on go device when try to get timestamp, the value over-followed sometimes
as a result, GtsIncidentManagerTestCases would fail due to a negative timestamp
Bug: 142513252
Change-Id: I7d5e701bb8bf4e788a718e093681f97b95cb8551
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
Exempt-From-Owner-Approval: cherry-pick from internal
Merged-In: I2b87761401361f9cf96cdda070f26e70a5c6c935
(cherry picked from commit b8ba23418aa6868ec14e82c29311021e382a19bc)
Change-Id: I2b87761401361f9cf96cdda070f26e70a5c6c935
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
Merged-In: I19139c765b53ede63d3beb3ea3ac40ada1aba42d
timespec::tv_sec is time_t which is 32bit wide on
32bit platforms. Multipliyng 32bit integers (tv_sec and
1000) produces another 32bit integer which overflows
in this case and turns into a negative value which
confuses the logic downstream. This change makes the
multiplication to be 64bit which prevent the overflow.
Bug: 139320584
Bug: 139538727
Test: GtsIncidentManagerTestCases
Change-Id: Ie956074961c7c1f08e2519920f7ce69d5c9e12d3
Signed-off-by: Roman Kiryanov <rkir@google.com>
(cherry picked from commit e9db937f4008f097f4ee9dc341a3afc219a96fd9)
Protobuf 3.9.1 redefines google::protobuf::int64 from long long
to int64_t, which is sometimes long and sometimes long long. Use
PRIi64 to print it. Also temporarily cast to int64_t to decouple
this change from the change that updates protobuf.
Bug: 117607748
Test: m checkbuild
Change-Id: I482b957d2262e5001140ed1153c7de2b17facae2
This set of patches adds a way for the perfetto command line client to
save a trace to a hardcoded location,
/data/misc/perfetto-traces/incident-trace, and call into incidentd to
start a report, which will include said trace in a new section.
This is not a long-term solution, and is structured to minimize changes
to perfetto and incidentd. The latter is currently architected in a way
where it can only pull pre-defined information out of the system, so
we're resorting to persisting the intermediate results in a hardcoded
location.
This will introduce at most two more linked files at the same time.
Bug: 130543265
Tested: manually on crosshatch-userdebug
Merged-In: Iaaa312d2d9da73ca329807211227a8c7a049102c
Change-Id: Iaaa312d2d9da73ca329807211227a8c7a049102c
(cherry picked from commit 09a847902fa428f97841c3689b9f11243cc60460)
- 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
+ Sections which require encryption will be encryted on disk.
+ When the sections are requested by clients (e.g., permission controller, report assignee),
incidentd will decrypte the data.
+ For efficiency, encryption is done ONLY for sections that require encryption.
+ Use Keystore API for key management.
Bug: 131084614
Test: incidentd_test
Change-Id: I84d6b86807ba5bbde1051e847b2df6e79e6b5be5
+ Remove the spawned thread inside the ReportFile for filter_and_write_report
because it leads to accessing freed memory
Instead, let the caller of ReportFile::startFileteringData create the thread.
ReportFile class shouldn't care about whether it's writing to a pipe for IPC
or regular file.
+ Add uri building in incidentd
+ Add metadata and headers to incident reports
Test: existing passed tests in incidentd_test still pass.
Manually tested with statsd
Change-Id: I5fef900d31f5d181275814f1e1c8c98443f201a7
Previously, the decision to include or not include them was
done at runtime. This changes them to be behind a compile
time flag. It's just safer, because the code just isn't there
instead of being dependent on a system property.
Test: bit GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: If4e611914a7b0acd399ae27e55af8f718aee3ec8
+ IncidentReportArgs takes the bytes instead of IncidentHeaderProto object
This cl is the ag/6287053 + build fix.
Test: incidentd_test && statsd_test
Change-Id: I86bcb48f4ab212b36ca4611a1fa05faace9c3702
Added or changed some error messages and logging for easier debugging.
Log a few section errors to incident metadata in addition to logcat.
Also let incident reporting continue instead of failing when non-fatal
error occurs.
Bug: 119417232
Test: Take an incident report, and logcat.
Change-Id: Id18b7b690100923a8074d99b2312ee80c0bcd760
Implement dump() function in IncidentService so that it can be dumped by
default. Dumpstate calls it twice, one with and one without '--proto'.
dump() ignores the former.
Dumpsys allows 10s max for each service. Hence, section 1200, 1201, 1202
are skipped because they take too long. Section 3008 and 3015 are
skipped temporarily due to errors. All sections should be enabled once
we find a workaround.
A follow-up change in SELinux is needed to allow dumpstate to access
incidentd.
Bug: 119417232
Test: Run `adb shell dumpsys incident --proto`, inspect result and logs
Test: Run `adb bugreport`, make sure incident.proto is in the zip file
Check the proto for validity via aprotoc:
cat incident.proto | ./out/soong/host/linux-x86/bin/aprotoc --decode_raw
Exempt-From-Owner-Approval: The original owners no longer work on this
project.
Change-Id: I7d08f6b644cb6751b201fb7ba37ac5e1c42fd3c5
A few switches didn't have explicit breaks in them, which was causing
warnings. They were all benign, as the logic did not necessitate a
break. But this is will stop the warnings and perhaps prevent future
bugs.
Change-Id: Idb293a4896f4df8d3f11d748e0e716efc26bbd6a
Fixes: 119047812
Test: N/A
See build/soong/README.md for more information.
Test: m checkbuild
Merged-In: I8c80878cec46c9299234c6f4c1e0e19efc0a221e
Change-Id: I8c80878cec46c9299234c6f4c1e0e19efc0a221e
It will be a global error by default.
Cherry pick lost changes from AOSP, for Android.mk and main.cpp.
Test: make checkbuild
Bug: 112564944
Change-Id: I6f1024fa5e31302af27fa9d5bac195e511f4ba20
Exempt-From-Owner-Approval: do not block on new warnings
It will be a global error by default.
Test: make checkbuild
Bug: 112564944
Change-Id: Ib23d0cc8b95a3734d5bd28f8c9d967df669cfdf8
Exempt-From-Owner-Approval: do not block on new warnings
There are cases where dumping Java traces times out and then later tries
to write to a closed pipe, causing incidentd to crash. This introduces a
handler for the SIGPIPE signal so it doesn't crash due to a closed pipe.
Bug: 111729299
Test: lower section timeout to 5 seconds and make sure incident service
doesn't crash
Change-Id: I868aba1ae21a50ae76977e0e09e782cf94198473
(cherry picked from commit 5b763c13472effa7df25cc53a44d5bdae9392410)
Java trace dumps can take significantly longer than 30 seconds. Testing
suggests that 2 minutes should be ample time.
Bug: 111729299
Test: 'adb shell incident' and ensure the section doesn't time out.
Change-Id: I35e09fc1ca608122a1a352985ea3741f6ea0a344
(cherry picked from commit 0f7167947a6e3180da0964ec6187f9f01642fb6d)
Java trace dumps can take significantly longer than 30 seconds. Testing
suggests that 2 minutes should be ample time.
Bug: 111729299
Test: 'adb shell incident' and ensure the section doesn't time out.
Change-Id: I35e09fc1ca608122a1a352985ea3741f6ea0a344
There are cases where dumping Java traces times out and then later tries
to write to a closed pipe, causing incidentd to crash. This introduces a
handler for the SIGPIPE signal so it doesn't crash due to a closed pipe.
Bug: 111729299
Test: lower section timeout to 5 seconds and make sure incident service
doesn't crash
Change-Id: I868aba1ae21a50ae76977e0e09e782cf94198473
Arc++ devices don't have the /d/wakeup_sources file. There's a chance
other device won't have it either, and there may be other files that we
thought were standard but are actually not, so it's safer to just assume
that not every file will be available on every device and not treat a
missing file as an error.
Bug: 110109543
Test: atest incidentd_test
Change-Id: Ief09427f08d18aee611d057ddafdb9a3466744db
It will only print out a dump for userdebug or eng builds.
This is the same change as the pi-dev one (http://ag/3909863), but due
to changes in master, that change has a merge conflict, so I have to
create a separate CL for master.
Bug: 77727638
Test: it builds
Change-Id: Ib74d4c664f23a61e6fc33f700ba6a3c6fad32c74
It will only print out a dump for userdebug or eng builds.
Bug: 77727638
Test: flash device and check output of incident proto and
'dumpsys batterystats -c --history'
Merged-In: Ib74d4c664f23a61e6fc33f700ba6a3c6fad32c74
Change-Id: Ia0c993d1281cc350d93f9c13f5540b349a4bfb84