Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 1 | /** |
| 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 | |
| 27 | namespace android { |
| 28 | namespace os { |
| 29 | |
| 30 | using namespace std; |
| 31 | |
Yi Jin | bdf5894 | 2017-11-14 17:58:19 -0800 | [diff] [blame] | 32 | // DESTINATION enum value, sync with proto/android/privacy.proto |
| 33 | const uint8_t DEST_LOCAL = 0; |
| 34 | const uint8_t DEST_EXPLICIT = 100; |
| 35 | const uint8_t DEST_AUTOMATIC = 200; |
| 36 | |
| 37 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 38 | class IncidentReportArgs : public Parcelable { |
| 39 | public: |
| 40 | IncidentReportArgs(); |
Chih-Hung Hsieh | 7a88a93 | 2018-12-20 13:45:04 -0800 | [diff] [blame] | 41 | IncidentReportArgs(const IncidentReportArgs& that); |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 42 | 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 Jin | 0f04716 | 2017-09-05 13:44:22 -0700 | [diff] [blame] | 48 | void setDest(int dest); |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 49 | void addSection(int section); |
Yao Chen | a8e78b9 | 2019-03-04 17:23:38 -0800 | [diff] [blame] | 50 | void setReceiverPkg(const string& pkg); |
| 51 | void setReceiverCls(const string& cls); |
Yao Chen | ec21648 | 2019-02-06 16:45:40 -0800 | [diff] [blame] | 52 | void addHeader(const vector<uint8_t>& headerProto); |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 53 | |
Yi Jin | 0f04716 | 2017-09-05 13:44:22 -0700 | [diff] [blame] | 54 | inline bool all() const { return mAll; } |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 55 | bool containsSection(int section) const; |
Yi Jin | 0f04716 | 2017-09-05 13:44:22 -0700 | [diff] [blame] | 56 | inline int dest() const { return mDest; } |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 57 | inline const set<int>& sections() const { return mSections; } |
Yao Chen | a8e78b9 | 2019-03-04 17:23:38 -0800 | [diff] [blame] | 58 | inline const String16& receiverPkg() const { return mReceiverPkg; } |
| 59 | inline const String16& receiverCls() const { return mReceiverCls; } |
Yi Jin | bdf5894 | 2017-11-14 17:58:19 -0800 | [diff] [blame] | 60 | inline const vector<vector<uint8_t>>& headers() const { return mHeaders; } |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 61 | |
| 62 | void merge(const IncidentReportArgs& that); |
| 63 | |
| 64 | private: |
| 65 | set<int> mSections; |
Yi Jin | bdf5894 | 2017-11-14 17:58:19 -0800 | [diff] [blame] | 66 | vector<vector<uint8_t>> mHeaders; |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 67 | bool mAll; |
Yi Jin | 0f04716 | 2017-09-05 13:44:22 -0700 | [diff] [blame] | 68 | int mDest; |
Yao Chen | a8e78b9 | 2019-03-04 17:23:38 -0800 | [diff] [blame] | 69 | String16 mReceiverPkg; |
| 70 | String16 mReceiverCls; |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | #endif // ANDROID_OS_DUMPSTATE_ARGS_H_ |