• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef PERMISSION_USED_RESPONSE_H
17 #define PERMISSION_USED_RESPONSE_H
18 
19 #include <string>
20 #include <vector>
21 #include "access_token.h"
22 
23 namespace OHOS {
24 namespace Security {
25 namespace AccessToken {
26 struct UsedRecordDetail {
27     int32_t status = 0;
28     int64_t timestamp = 0L;
29     int64_t accessDuration = 0L;
30 };
31 
32 struct PermissionUsedRecord {
33     std::string permissionName;
34     int32_t accessCount = 0;
35     int32_t rejectCount = 0;
36     int64_t lastAccessTime = 0L;
37     int64_t lastRejectTime = 0L;
38     int64_t lastAccessDuration = 0L;
39     std::vector<UsedRecordDetail> accessRecords;
40     std::vector<UsedRecordDetail> rejectRecords;
41 };
42 
43 struct BundleUsedRecord {
44     AccessTokenID tokenId;
45     bool isRemote;
46     std::string deviceId;
47     std::string bundleName;
48     std::vector<PermissionUsedRecord> permissionRecords;
49 };
50 
51 struct PermissionUsedResult {
52     int64_t beginTimeMillis = 0L;
53     int64_t endTimeMillis = 0L;
54     std::vector<BundleUsedRecord> bundleRecords;
55 };
56 } // namespace AccessToken
57 } // namespace Security
58 } // namespace OHOS
59 #endif // PERMISSION_USED_RESPONSE_H
60