blob: f056d3b6c9e8ac2eeacda453fb115055c798b1d0 [file] [log] [blame]
Joe Onorato1754d742016-11-21 17:51:35 -08001/**
2 * Copyright (c) 2016, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_OS_DUMPSTATE_ARGS_H_
18#define ANDROID_OS_DUMPSTATE_ARGS_H_
19
20#include <binder/Parcel.h>
21#include <binder/Parcelable.h>
22#include <utils/String16.h>
23
24#include <set>
25#include <vector>
26
27namespace android {
28namespace os {
29
30using namespace std;
31
Yi Jinbdf58942017-11-14 17:58:19 -080032// DESTINATION enum value, sync with proto/android/privacy.proto
33const uint8_t DEST_LOCAL = 0;
34const uint8_t DEST_EXPLICIT = 100;
35const uint8_t DEST_AUTOMATIC = 200;
36
37
Joe Onorato1754d742016-11-21 17:51:35 -080038class IncidentReportArgs : public Parcelable {
39public:
40 IncidentReportArgs();
Chih-Hung Hsieh7a88a932018-12-20 13:45:04 -080041 IncidentReportArgs(const IncidentReportArgs& that);
Joe Onorato1754d742016-11-21 17:51:35 -080042 virtual ~IncidentReportArgs();
43
44 virtual status_t writeToParcel(Parcel* out) const;
45 virtual status_t readFromParcel(const Parcel* in);
46
47 void setAll(bool all);
Yi Jin0f047162017-09-05 13:44:22 -070048 void setDest(int dest);
Joe Onorato1754d742016-11-21 17:51:35 -080049 void addSection(int section);
Yao Chena8e78b92019-03-04 17:23:38 -080050 void setReceiverPkg(const string& pkg);
51 void setReceiverCls(const string& cls);
Yao Chenec216482019-02-06 16:45:40 -080052 void addHeader(const vector<uint8_t>& headerProto);
Joe Onorato1754d742016-11-21 17:51:35 -080053
Yi Jin0f047162017-09-05 13:44:22 -070054 inline bool all() const { return mAll; }
Joe Onorato1754d742016-11-21 17:51:35 -080055 bool containsSection(int section) const;
Yi Jin0f047162017-09-05 13:44:22 -070056 inline int dest() const { return mDest; }
Joe Onorato1754d742016-11-21 17:51:35 -080057 inline const set<int>& sections() const { return mSections; }
Yao Chena8e78b92019-03-04 17:23:38 -080058 inline const String16& receiverPkg() const { return mReceiverPkg; }
59 inline const String16& receiverCls() const { return mReceiverCls; }
Yi Jinbdf58942017-11-14 17:58:19 -080060 inline const vector<vector<uint8_t>>& headers() const { return mHeaders; }
Joe Onorato1754d742016-11-21 17:51:35 -080061
62 void merge(const IncidentReportArgs& that);
63
64private:
65 set<int> mSections;
Yi Jinbdf58942017-11-14 17:58:19 -080066 vector<vector<uint8_t>> mHeaders;
Joe Onorato1754d742016-11-21 17:51:35 -080067 bool mAll;
Yi Jin0f047162017-09-05 13:44:22 -070068 int mDest;
Yao Chena8e78b92019-03-04 17:23:38 -080069 String16 mReceiverPkg;
70 String16 mReceiverCls;
Joe Onorato1754d742016-11-21 17:51:35 -080071};
72
73}
74}
75
76#endif // ANDROID_OS_DUMPSTATE_ARGS_H_