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_request.h 28 * 29 * @brief Declares enum PermissionUsageFlagEnum and struct PermissionUsedRequest. 30 * 31 * @since 8.0 32 * @version 8.0 33 */ 34 35 #ifndef PERMISSION_USED_REQUEST_H 36 #define PERMISSION_USED_REQUEST_H 37 38 #include <string> 39 #include <vector> 40 41 #include "access_token.h" 42 43 namespace OHOS { 44 namespace Security { 45 namespace AccessToken { 46 /** 47 * @brief permission usage flag values 48 */ 49 typedef enum PermissionUsageFlagEnum { 50 /** permission usage for summary */ 51 FLAG_PERMISSION_USAGE_SUMMARY = 0, 52 /** permission usage for detail */ 53 FLAG_PERMISSION_USAGE_DETAIL = 1, 54 /** permission usage for screen locked summary */ 55 FLAG_PERMISSION_USAGE_SUMMARY_IN_SCREEN_LOCKED = 2, 56 /** permission usage for screen unlocked summary */ 57 FLAG_PERMISSION_USAGE_SUMMARY_IN_SCREEN_UNLOCKED = 3, 58 /** permission usage for app in background summary */ 59 FLAG_PERMISSION_USAGE_SUMMARY_IN_APP_BACKGROUND = 4, 60 /** permission usage for app in foreground summary */ 61 FLAG_PERMISSION_USAGE_SUMMARY_IN_APP_FOREGROUND = 5, 62 } PermissionUsageFlag; 63 64 /** 65 * @brief permission usage flag values 66 */ 67 struct PermissionUsedRequest { 68 AccessTokenID tokenId = 0; 69 /** indicats whether the tokenID is remote tokenID */ 70 bool isRemote = false; 71 std::string deviceId = ""; 72 std::string bundleName = ""; 73 /** permission name list */ 74 std::vector<std::string> permissionList; 75 int64_t beginTimeMillis = 0L; 76 int64_t endTimeMillis = 0L; 77 PermissionUsageFlag flag = FLAG_PERMISSION_USAGE_SUMMARY; 78 }; 79 } // namespace AccessToken 80 } // namespace Security 81 } // namespace OHOS 82 #endif // PERMISSION_USED_REQUEST_H 83