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 32 // DESTINATION enum value, sync with frameworks/base/core/proto/android/privacy.proto 33 const uint8_t PRIVACY_POLICY_LOCAL = 0; 34 const uint8_t PRIVACY_POLICY_EXPLICIT = 100; 35 const uint8_t PRIVACY_POLICY_AUTOMATIC = 200; 36 const uint8_t PRIVACY_POLICY_UNSET = 255; 37 38 39 class IncidentReportArgs : public Parcelable { 40 public: 41 IncidentReportArgs(); 42 IncidentReportArgs(const IncidentReportArgs& that); 43 virtual ~IncidentReportArgs(); 44 45 virtual status_t writeToParcel(Parcel* out) const; 46 virtual status_t readFromParcel(const Parcel* in); 47 48 void setAll(bool all); 49 void setPrivacyPolicy(int privacyPolicy); 50 void addSection(int section); 51 void setReceiverPkg(const string& pkg); 52 void setReceiverCls(const string& cls); 53 void addHeader(const vector<uint8_t>& headerProto); 54 all()55 inline bool all() const { return mAll; } 56 bool containsSection(int section, bool specific) const; getPrivacyPolicy()57 inline int getPrivacyPolicy() const { return mPrivacyPolicy; } sections()58 inline const set<int>& sections() const { return mSections; } receiverPkg()59 inline const string& receiverPkg() const { return mReceiverPkg; } receiverCls()60 inline const string& receiverCls() const { return mReceiverCls; } headers()61 inline const vector<vector<uint8_t>>& headers() const { return mHeaders; } 62 63 void merge(const IncidentReportArgs& that); 64 65 private: 66 set<int> mSections; 67 vector<vector<uint8_t>> mHeaders; 68 bool mAll; 69 int mPrivacyPolicy; 70 string mReceiverPkg; 71 string mReceiverCls; 72 }; 73 74 } 75 } 76 77 #endif // ANDROID_OS_DUMPSTATE_ARGS_H_ 78