1 /* 2 * Copyright (c) 2020 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 bundle_info.h 32 * 33 * @brief Declares structures and functions for managing application bundle information. 34 * 35 * You can use the function provided in this file to clear bundle information. 36 * 37 * @since 1.0 38 * @version 1.0 39 */ 40 #ifndef OHOS_BUNDLE_INFO_H 41 #define OHOS_BUNDLE_INFO_H 42 43 #include "ability_info.h" 44 #include "module_info.h" 45 #include "stdint.h" 46 47 /** 48 * @brief Defines the bundle information. 49 */ 50 typedef struct { 51 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 52 /** Whether the application is kept alive */ 53 bool isKeepAlive; 54 55 /** 56 * Whether the application is a local application. A local application refers to an application developed using 57 * C++ in the system. The value <b>true</b> indicates a local application, and <b>false</b> indicates a non-local 58 * application. 59 */ 60 bool isNativeApp; 61 62 /** UID allocated during application installation */ 63 int32_t uid; 64 65 /** Application group ID allocated during application installation */ 66 int32_t gid; 67 #endif 68 /** 69 * Whether the application is a system application. System applications cannot be uninstalled. The value 70 * <b>true</b> indicates a system application, and <b>false</b> indicates a non-system application. 71 */ 72 bool isSystemApp; 73 74 /** Minimum API version required */ 75 int32_t compatibleApi; 76 77 /** Target API version */ 78 int32_t targetApi; 79 80 /** Version code of the application, which is the internal version number */ 81 int32_t versionCode; 82 83 /** Pointer to the version name visible to users */ 84 char *versionName; 85 86 /** Pointer to the bundle name of the application */ 87 char *bundleName; 88 89 /** Pointer to the application name visible to users */ 90 char *label; 91 92 /** Pointer to the big icon of the application */ 93 char *bigIconPath; 94 95 /** 96 * Pointer to the installation path of the application, which is in the <b>/app/run/<i>bundle name</i></b> 97 * format 98 */ 99 char *codePath; 100 101 /** Pointer to the path for storing data files of the application. The data path is <b>/app/data</b>. */ 102 char *dataPath; 103 104 /** Pointer to the vendor name of the application */ 105 char *vendor; 106 107 /** 108 * Pointer to the HAP package information about the application. The HAP information is encapsulated in 109 * {@link ModuleInfo} objects. 110 */ 111 ModuleInfo *moduleInfos; 112 113 /** Number of {@link ModuleInfo} objects included in the application */ 114 int32_t numOfModule; 115 116 /** 117 * Application ID, which uniquely identifies an application. It is a combination of the bundle name and 118 * signature of the application. 119 */ 120 char *appId; 121 122 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 123 /** 124 * Pointer to the ability information about the application. The ability information is encapsulated in 125 * {@link AbilityInfo} objects. 126 */ 127 AbilityInfo *abilityInfos; 128 129 /** Number of {@link AbilityInfo} objects in the application */ 130 int32_t numOfAbility; 131 #else 132 /** 133 * Pointer to the path for storing the small icon of the application. This field is available only to basic 134 * watches. 135 */ 136 char *smallIconPath; 137 138 /** Pointer to the ability information about the application. This field is available only to basic watches. */ 139 AbilityInfo *abilityInfo; 140 #endif 141 } BundleInfo; 142 143 #ifdef __cplusplus 144 #if __cplusplus 145 extern "C" { 146 #endif 147 #endif // __cplusplus 148 /** 149 * @brief Clears a {@link BundleInfo} object. 150 * 151 * This function clears and releases the memory occupied by the fields of the pointer type included in the specified 152 * {@link BundleInfo} object. 153 * @param bundleInfo Indicates the pointer to the {@link BundleInfo} object to clear. 154 * 155 * @since 1.0 156 * @version 1.0 157 */ 158 void ClearBundleInfo(BundleInfo *bundleInfo); 159 #ifdef __cplusplus 160 #if __cplusplus 161 } 162 #endif 163 #endif // __cplusplus 164 165 #endif // OHOS_BUNDLE_INFO_H 166 /** @} */