1 /* 2 * Copyright (c) 2022-2023 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 /** 17 * @addtogroup Privacy 18 * @{ 19 * 20 * @brief Provides sensitive data access management. 21 * 22 * @since 8.0 23 * @version 8.0 24 */ 25 26 /** 27 * @file permission_used_result.h 28 * 29 * @brief Declares structs. 30 * 31 * @since 8.0 32 * @version 8.0 33 */ 34 35 #ifndef PERMISSION_USED_RESPONSE_H 36 #define PERMISSION_USED_RESPONSE_H 37 38 #include <string> 39 #include <vector> 40 #include "access_token.h" 41 42 namespace OHOS { 43 namespace Security { 44 namespace AccessToken { 45 /** 46 * @brief Record used detail struct 47 */ 48 struct UsedRecordDetail { 49 /** 50 * permission active state, for details about the valid values, 51 * see the definition of ActiveChangeType in 52 * the active_change_response_info.h file. 53 */ 54 int32_t status = 0; 55 /** permission active state change timestamp */ 56 int64_t timestamp = 0L; 57 /** permission active state remain times */ 58 int64_t accessDuration = 0L; 59 }; 60 61 /** 62 * @brief Permission used record struct 63 */ 64 struct PermissionUsedRecord { 65 /** permission name */ 66 std::string permissionName; 67 /** permission access count */ 68 int32_t accessCount = 0; 69 /** permission reject count */ 70 int32_t rejectCount = 0; 71 /** permission last access timestamp */ 72 int64_t lastAccessTime = 0L; 73 /** permission last reject timestamp */ 74 int64_t lastRejectTime = 0L; 75 /** permission last access remain time */ 76 int64_t lastAccessDuration = 0L; 77 /** UsedRecordDetail list */ 78 std::vector<UsedRecordDetail> accessRecords; 79 /** UsedRecordDetail list */ 80 std::vector<UsedRecordDetail> rejectRecords; 81 }; 82 83 /** 84 * @brief Bundle used record struct 85 */ 86 struct BundleUsedRecord { 87 /** token id */ 88 AccessTokenID tokenId; 89 /** is remote token */ 90 bool isRemote; 91 /** device id */ 92 std::string deviceId; 93 /** bundle name */ 94 std::string bundleName; 95 /** PermissionUsedRecord list */ 96 std::vector<PermissionUsedRecord> permissionRecords; 97 }; 98 99 /** 100 * @brief Permission used result struct 101 */ 102 struct PermissionUsedResult { 103 /** begin timestamp */ 104 int64_t beginTimeMillis = 0L; 105 /** end timestamp */ 106 int64_t endTimeMillis = 0L; 107 /** BundleUsedRecord list */ 108 std::vector<BundleUsedRecord> bundleRecords; 109 }; 110 } // namespace AccessToken 111 } // namespace Security 112 } // namespace OHOS 113 #endif // PERMISSION_USED_RESPONSE_H 114