incidentd can now handle multiple callers asking it for incident reports
Test: bit incident_test:* GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
diff --git a/cmds/incidentd/src/Privacy.h b/cmds/incidentd/src/Privacy.h
index a0159d9..fc8caae 100644
--- a/cmds/incidentd/src/Privacy.h
+++ b/cmds/incidentd/src/Privacy.h
@@ -18,15 +18,15 @@
#ifndef PRIVACY_H
#define PRIVACY_H
+#include <android/os/IncidentReportArgs.h>
+
#include <stdint.h>
namespace android {
namespace os {
namespace incidentd {
-// This is the default value of DEST enum, sync with privacy.proto
-const uint8_t DEST_UNSET = 255; // DEST_UNSET is not exposed to libincident
-const uint8_t DEST_DEFAULT_VALUE = DEST_UNSET;
+using namespace android::os;
/*
* In order to NOT auto-generate large chuck of code by proto compiler in incidentd,
@@ -48,8 +48,8 @@
// This array is NULL-terminated.
Privacy** children;
- // DESTINATION Enum in frameworks/base/libs/incident/proto/android/privacy.proto.
- uint8_t dest;
+ // DESTINATION Enum in frameworks/base/core/proto/android/privacy.proto.
+ uint8_t policy;
// A list of regexp rules for stripping string fields in proto.
const char** patterns;
};
@@ -63,27 +63,28 @@
/**
* PrivacySpec defines the request has what level of privacy authorization.
* For example, a device without user consent should only be able to upload AUTOMATIC fields.
- * DEST_UNSET are treated as DEST_EXPLICIT.
+ * PRIVACY_POLICY_UNSET are treated as PRIVACY_POLICY_EXPLICIT.
*/
class PrivacySpec {
public:
- const uint8_t dest;
+ explicit PrivacySpec(uint8_t argPolicy);
- PrivacySpec() : dest(DEST_DEFAULT_VALUE) {}
bool operator<(const PrivacySpec& other) const;
// check permission of a policy, if returns true, don't strip the data.
bool CheckPremission(const Privacy* privacy,
- const uint8_t defaultDest = DEST_DEFAULT_VALUE) const;
+ const uint8_t defaultPrivacyPolicy = PRIVACY_POLICY_UNSET) const;
// if returns true, no data need to be stripped.
bool RequireAll() const;
- // Constructs spec using static methods below.
- static PrivacySpec new_spec(int dest);
+ uint8_t getPolicy() const;
private:
- explicit PrivacySpec(uint8_t dest) : dest(dest) {}
+ // unimplemented constructors
+ explicit PrivacySpec();
+
+ uint8_t mPolicy;
};
} // namespace incidentd