1 /* 2 * Copyright (c) 2020-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 BundleManager 18 * @{ 19 * 20 * @brief Provides structures and functions for managing application bundles and obtaining application information. 21 * 22 * You can use functions provided by this module to install, update, or uninstall an application, obtain 23 * {@link AbilityInfo} and {@link BundleInfo} about an application, and obtain the bundle name of an application based 24 * on the application's user ID (UID). 25 * 26 * @since 1.0 27 * @version 1.0 28 */ 29 30 /** 31 * @file ability_info.h 32 * 33 * @brief Declares structures and functions for managing ability information. 34 * 35 * You can use the function provided in this file to clear ability information. 36 * 37 * @since 1.0 38 * @version 1.0 39 */ 40 41 #ifndef OHOS_ABILITY_INFO_H 42 #define OHOS_ABILITY_INFO_H 43 44 #include <stdbool.h> 45 #include "stdint.h" 46 #include "module_info.h" 47 48 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 49 /** 50 * @brief Defines the maximun length of the system capabiliy name. 51 */ 52 #define MAX_SYSCAP_NAME_LEN 64 53 54 /** 55 * @brief Defines the maximun num of system capabilities. 56 */ 57 #define MAX_SYSCAP_NUM 512 58 59 /** 60 * @brief Enumerates types of templates used by an ability. 61 */ 62 typedef enum { 63 /** Unknown */ 64 UNKNOWN = 0, 65 66 /** Page */ 67 PAGE, 68 69 /** Service */ 70 SERVICE 71 } AbilityType; 72 73 /** 74 * @brief Enumerates startup modes of an ability. 75 */ 76 typedef enum { 77 /** Singleton mode, allowing only one instance */ 78 SINGLETON = 0, 79 80 /** Standard mode, allowing multiple instances */ 81 STANDARD 82 } LaunchMode; 83 84 /** 85 * @brief Defines the system capability name. 86 */ 87 typedef struct { 88 char name[MAX_SYSCAP_NAME_LEN]; 89 } SystemCapName; 90 91 /** 92 * @brief Defines the system capability information. 93 */ 94 typedef struct { 95 int32_t systemCapNum; 96 SystemCapName *systemCapName; 97 } SystemCapability; 98 99 #endif 100 101 #define MAX_SKILL_ITEM 4 102 /** 103 * @brief Defines the skill information. 104 */ 105 typedef struct { 106 char *entities[MAX_SKILL_ITEM]; 107 char *actions[MAX_SKILL_ITEM]; 108 } Skill; 109 #define SKILL_SIZE 16 110 111 /** 112 * @brief Defines the ability information. 113 */ 114 typedef struct { 115 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 116 /** Whether the ability is visible */ 117 bool isVisible; 118 119 /** Template used by the ability */ 120 AbilityType abilityType; 121 122 /** Startup mode of the ability */ 123 LaunchMode launchMode; 124 125 /** 126 * Pointer to the name of the HAP package to which the ability belongs. The HAP information is encapsulated in a 127 * {@link ModuleInfo} object. 128 */ 129 char *moduleName; 130 131 /** Pointer to the class name of the ability */ 132 char *name; 133 134 /** Pointer to the description of the ability */ 135 char *description; 136 137 /** Pointer to the icon path of the ability */ 138 char *iconPath; 139 140 /** Pointer to the device ID */ 141 char *deviceId; 142 143 /** Pointer to the ability name visible to users */ 144 char *label; 145 146 /** Pointer to the deviceCapability */ 147 SystemCapability deviceCap; 148 #else 149 /** Pointer to the source code path. This field is available only to basic watches. */ 150 char *srcPath; 151 #endif 152 /** Pointer to the application bundle name */ 153 char *bundleName; 154 /** metadata/skills for ablity info. */ 155 MetaData *metaData[METADATA_SIZE]; 156 Skill *skills[SKILL_SIZE]; 157 } AbilityInfo; 158 159 #ifdef __cplusplus 160 #if __cplusplus 161 extern "C" { 162 #endif 163 #endif // __cplusplus 164 /** 165 * @brief Clears an {@link AbilityInfo} object. 166 * 167 * This function clears and releases the memory occupied by the fields of the pointer type included in the specified 168 * {@link AbilityInfo} object. 169 * @param abilityInfo Indicates the pointer to the {@link AbilityInfo} object to clear. 170 * 171 * @since 1.0 172 * @version 1.0 173 */ 174 void ClearAbilityInfo(AbilityInfo *abilityInfo); 175 #ifdef __cplusplus 176 #if __cplusplus 177 } 178 #endif 179 #endif // __cplusplus 180 181 #endif // OHOS_ABILITY_INFO_H 182 /** @} */