blob: 5e8eac1833ceac8d57b3221edc91c44cd96687f9 [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 Chenec216482019-02-06 16:45:40 -080050 void addHeader(const vector<uint8_t>& headerProto);
Joe Onorato1754d742016-11-21 17:51:35 -080051
Yi Jin0f047162017-09-05 13:44:22 -070052 inline bool all() const { return mAll; }
Joe Onorato1754d742016-11-21 17:51:35 -080053 bool containsSection(int section) const;
Yi Jin0f047162017-09-05 13:44:22 -070054 inline int dest() const { return mDest; }
Joe Onorato1754d742016-11-21 17:51:35 -080055 inline const set<int>& sections() const { return mSections; }
Yi Jinbdf58942017-11-14 17:58:19 -080056 inline const vector<vector<uint8_t>>& headers() const { return mHeaders; }
Joe Onorato1754d742016-11-21 17:51:35 -080057
58 void merge(const IncidentReportArgs& that);
59
60private:
61 set<int> mSections;
Yi Jinbdf58942017-11-14 17:58:19 -080062 vector<vector<uint8_t>> mHeaders;
Joe Onorato1754d742016-11-21 17:51:35 -080063 bool mAll;
Yi Jin0f047162017-09-05 13:44:22 -070064 int mDest;
Joe Onorato1754d742016-11-21 17:51:35 -080065};
66
67}
68}
69
70#endif // ANDROID_OS_DUMPSTATE_ARGS_H_