summaryrefslogtreecommitdiff
path: root/libs/incident
diff options
context:
space:
mode:
authorYao Chen <yaochen@google.com>2019-03-04 17:23:38 -0800
committerYao Chen <yaochen@google.com>2019-03-04 23:47:27 -0800
commita8e78b9b88cd5c36313fe0439ffca41bcf93bc9d (patch)
tree27d6308ff21be154ee81aea618499a3a9b0000e8 /libs/incident
parent65c6cd861860a719f1225730d0e3d57a531e6f1c (diff)
Add receiver info to IncidentdDetails in statsd_config
This can be used for sending a broadcast to an app which incidentd would share the incident report with. Test: added unit test in statsd_test Change-Id: Ieaf5b3b4d67168e2a99ff54e6392c77d8372ed4e
Diffstat (limited to 'libs/incident')
-rw-r--r--libs/incident/include/android/os/IncidentReportArgs.h6
-rw-r--r--libs/incident/src/IncidentReportArgs.cpp25
2 files changed, 31 insertions, 0 deletions
diff --git a/libs/incident/include/android/os/IncidentReportArgs.h b/libs/incident/include/android/os/IncidentReportArgs.h
index 5e8eac1833ce..f056d3b6c9e8 100644
--- a/libs/incident/include/android/os/IncidentReportArgs.h
+++ b/libs/incident/include/android/os/IncidentReportArgs.h
@@ -47,12 +47,16 @@ public:
void setAll(bool all);
void setDest(int dest);
void addSection(int section);
+ void setReceiverPkg(const string& pkg);
+ void setReceiverCls(const string& cls);
void addHeader(const vector<uint8_t>& headerProto);
inline bool all() const { return mAll; }
bool containsSection(int section) const;
inline int dest() const { return mDest; }
inline const set<int>& sections() const { return mSections; }
+ inline const String16& receiverPkg() const { return mReceiverPkg; }
+ inline const String16& receiverCls() const { return mReceiverCls; }
inline const vector<vector<uint8_t>>& headers() const { return mHeaders; }
void merge(const IncidentReportArgs& that);
@@ -62,6 +66,8 @@ private:
vector<vector<uint8_t>> mHeaders;
bool mAll;
int mDest;
+ String16 mReceiverPkg;
+ String16 mReceiverCls;
};
}
diff --git a/libs/incident/src/IncidentReportArgs.cpp b/libs/incident/src/IncidentReportArgs.cpp
index 06b7a5b682b1..46c8dcf967d7 100644
--- a/libs/incident/src/IncidentReportArgs.cpp
+++ b/libs/incident/src/IncidentReportArgs.cpp
@@ -81,6 +81,16 @@ IncidentReportArgs::writeToParcel(Parcel* out) const
return err;
}
+ err = out->writeString16(mReceiverPkg);
+ if (err != NO_ERROR) {
+ return err;
+ }
+
+ err = out->writeString16(mReceiverCls);
+ if (err != NO_ERROR) {
+ return err;
+ }
+
return NO_ERROR;
}
@@ -134,6 +144,9 @@ IncidentReportArgs::readFromParcel(const Parcel* in)
}
mDest = dest;
+ mReceiverPkg = in->readString16();
+ mReceiverCls = in->readString16();
+
return OK;
}
@@ -161,6 +174,18 @@ IncidentReportArgs::addSection(int section)
}
void
+IncidentReportArgs::setReceiverPkg(const string& pkg)
+{
+ mReceiverPkg = String16(pkg.c_str());
+}
+
+void
+IncidentReportArgs::setReceiverCls(const string& cls)
+{
+ mReceiverCls = String16(cls.c_str());
+}
+
+void
IncidentReportArgs::addHeader(const vector<uint8_t>& headerProto)
{
mHeaders.push_back(headerProto);