• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "frameworks/base/libs/incident/proto/android/os/header.pb.h"
28 
29 namespace android {
30 namespace os {
31 
32 using namespace std;
33 
34 // DESTINATION enum value, sync with proto/android/privacy.proto
35 const uint8_t DEST_LOCAL = 0;
36 const uint8_t DEST_EXPLICIT = 100;
37 const uint8_t DEST_AUTOMATIC = 200;
38 
39 
40 class IncidentReportArgs : public Parcelable {
41 public:
42     IncidentReportArgs();
43     explicit IncidentReportArgs(const IncidentReportArgs& that);
44     virtual ~IncidentReportArgs();
45 
46     virtual status_t writeToParcel(Parcel* out) const;
47     virtual status_t readFromParcel(const Parcel* in);
48 
49     void setAll(bool all);
50     void setDest(int dest);
51     void addSection(int section);
52     void addHeader(const IncidentHeaderProto& headerProto);
53 
all()54     inline bool all() const { return mAll; }
55     bool containsSection(int section) const;
dest()56     inline int dest() const { return mDest; }
sections()57     inline const set<int>& sections() const { return mSections; }
headers()58     inline const vector<vector<uint8_t>>& headers() const { return mHeaders; }
59 
60     void merge(const IncidentReportArgs& that);
61 
62 private:
63     set<int> mSections;
64     vector<vector<uint8_t>> mHeaders;
65     bool mAll;
66     int mDest;
67 };
68 
69 }
70 }
71 
72 #endif // ANDROID_OS_DUMPSTATE_ARGS_H_
73