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/Privacy.cpp b/cmds/incidentd/src/Privacy.cpp
index 4fe74c4..0cc358f 100644
--- a/cmds/incidentd/src/Privacy.cpp
+++ b/cmds/incidentd/src/Privacy.cpp
@@ -18,17 +18,30 @@
#include <android/os/IncidentReportArgs.h>
#include <stdlib.h>
+#include <strstream>
+
namespace android {
namespace os {
namespace incidentd {
using namespace android::os;
+using std::strstream;
static const bool kEncryptionEnabled = false;
uint64_t encode_field_id(const Privacy* p) { return (uint64_t)p->type << 32 | p->field_id; }
+string Privacy::toString() const {
+ if (this == NULL) {
+ return "Privacy{null}";
+ }
+ strstream os;
+ os << "Privacy{field_id=" << field_id << " type=" << ((int)type)
+ << " children=" << ((void*)children) << " policy=" << ((int)policy) << "}";
+ return os.str();
+}
+
const Privacy* lookup(const Privacy* p, uint32_t fieldId) {
if (p->children == NULL) return NULL;
for (int i = 0; p->children[i] != NULL; i++) { // NULL-terminated.
@@ -87,6 +100,16 @@
return mPolicy == android::os::PRIVACY_POLICY_LOCAL;
}
+uint8_t cleanup_privacy_policy(uint8_t policy) {
+ if (policy >= PRIVACY_POLICY_AUTOMATIC) {
+ return PRIVACY_POLICY_AUTOMATIC;
+ }
+ if (policy >= PRIVACY_POLICY_EXPLICIT) {
+ return PRIVACY_POLICY_EXPLICIT;
+ }
+ return PRIVACY_POLICY_LOCAL;
+}
+
} // namespace incidentd
} // namespace os
} // namespace android