Fixes regarding to comments in ag/2839267
1. use struct {} to instantiate privacy fields for efficiency reason
2. use vector<uint8_t>* instead of vector<uint8_t>& to indicate the
caller knows the value gets changed.
3. binary search privay policy for sections
Bug: 65595927
Test: unit test covers
Change-Id: Ic58c2f607465d1a7f10352b9a38c3d8b1a5cf352
diff --git a/cmds/incidentd/src/Privacy.h b/cmds/incidentd/src/Privacy.h
index c56ba9b8..7f1977e 100644
--- a/cmds/incidentd/src/Privacy.h
+++ b/cmds/incidentd/src/Privacy.h
@@ -30,17 +30,13 @@
uint32_t field_id;
uint8_t type;
// ignore parent's privacy flags if children are set, NULL-terminated
- const Privacy** children;
+ Privacy** children;
// the following fields are identitical to
// frameworks/base/libs/incident/proto/android/privacy.proto
uint8_t dest;
const char** patterns; // only set when type is string
- Privacy(uint32_t field_id, uint8_t type, uint8_t dest); // generic constructor
- Privacy(uint32_t field_id, const Privacy** children); // used for message type
- Privacy(uint32_t field_id, uint8_t dest, const char** patterns); // used for string type
-
bool IsMessageType() const;
bool IsStringType() const;
bool HasChildren() const;