Get incidentd cts working again.
- 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
diff --git a/cmds/incidentd/src/Throttler.cpp b/cmds/incidentd/src/Throttler.cpp
index 11136ec..5f90ab3 100644
--- a/cmds/incidentd/src/Throttler.cpp
+++ b/cmds/incidentd/src/Throttler.cpp
@@ -33,6 +33,21 @@
Throttler::~Throttler() {}
+sp<ReportBatch> Throttler::filterBatch(const sp<ReportBatch>& queued) {
+ sp<ReportBatch> result = new ReportBatch();
+
+ // We will never throttle the streaming ones.
+ queued->transferStreamingRequests(result);
+
+ // If the persisted ones aren't to be throttled, then add them to the
+ // batch we're going to do.
+ if (!shouldThrottle()) {
+ queued->transferPersistedRequests(result);
+ }
+
+ return result;
+}
+
bool Throttler::shouldThrottle() {
int64_t now = android::elapsedRealtime();
if (now > mRefractoryPeriodMs + mLastRefractoryMs) {
@@ -56,4 +71,4 @@
} // namespace incidentd
} // namespace os
-} // namespace android
\ No newline at end of file
+} // namespace android