1 /* 2 * Copyright (c) 2024 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 BUNDLE_MANAGER_UTILS_H 17 #define BUNDLE_MANAGER_UTILS_H 18 19 #include <cstdint> 20 21 namespace OHOS { 22 namespace CJSystemapi { 23 namespace BundleManager { 24 25 struct RetMetadata { 26 char* name; 27 char* value; 28 char* resource; 29 }; 30 31 struct CArrMetadata { 32 RetMetadata* head; 33 int64_t size; 34 }; 35 36 struct ModuleMetadata { 37 char* moduleName; 38 CArrMetadata metadata; 39 }; 40 41 struct CArrMoMeta { 42 ModuleMetadata* head; 43 int64_t size; 44 }; 45 46 struct CResource { 47 char* bundleName; 48 char* moduleName; 49 uint32_t id; 50 }; 51 52 struct CArrString { 53 char** head; 54 int64_t size; 55 }; 56 57 58 struct RetApplicationInfo { 59 char* name; 60 char* description; 61 uint32_t descriptionId; 62 bool enabled; 63 char* label; 64 uint32_t labelId; 65 char* icon; 66 uint32_t iconId; 67 char* process; 68 CArrString permissions; 69 char* codePath; 70 CArrMoMeta metadataArray; 71 bool removable; 72 uint32_t accessTokenId; 73 int32_t uid; 74 CResource iconResource; 75 CResource labelResource; 76 CResource descriptionResource; 77 char* appDistributionType; 78 char* appProvisionType; 79 bool systemApp; 80 int32_t bundleType; 81 bool debug; 82 bool dataUnclearable; 83 bool cloudFileSyncEnabled; 84 }; 85 86 struct CArrInt32 { 87 int32_t* head; 88 int64_t size; 89 }; 90 91 struct RetWindowSize { 92 double maxWindowRatio; 93 double minWindowRatio; 94 uint32_t maxWindowWidth; 95 uint32_t minWindowWidth; 96 uint32_t maxWindowHeight; 97 uint32_t minWindowHeight; 98 }; 99 100 101 struct RetAbilityInfo { 102 char* bundleName; 103 char* moduleName; 104 char* name; 105 char* label; 106 uint32_t labelId; 107 char* description; 108 uint32_t descriptionId; 109 char* icon; 110 uint32_t iconId; 111 char* process; 112 bool exported; 113 int32_t orientation; 114 int32_t launchType; 115 CArrString permissions; 116 CArrString deviceTypes; 117 RetApplicationInfo applicationInfo; 118 CArrMetadata metadata; 119 bool enabled; 120 CArrInt32 supportWindowModes; 121 RetWindowSize windowSize; 122 }; 123 124 struct CArrRetAbilityInfo { 125 RetAbilityInfo* head; 126 int64_t size; 127 }; 128 129 struct RetExtensionAbilityInfo { 130 char* bundleName; 131 char* moduleName; 132 char* name; 133 uint32_t labelId; 134 uint32_t descriptionId; 135 uint32_t iconId; 136 bool exported; 137 int32_t extensionAbilityType; 138 CArrString permissions; 139 RetApplicationInfo applicationInfo; 140 CArrMetadata metadata; 141 bool enabled; 142 char* readPermission; 143 char* writePermission; 144 char* extensionAbilityTypeName; 145 }; 146 147 struct CArrRetExtensionAbilityInfo { 148 RetExtensionAbilityInfo* head; 149 int64_t size; 150 }; 151 152 struct RetPreloadItem { 153 char* moduleName; 154 }; 155 156 struct CArrRetPreloadItem { 157 RetPreloadItem* head; 158 int64_t size; 159 }; 160 161 struct RetDependency { 162 char* bundleName; 163 char* moduleName; 164 uint32_t versionCode; 165 }; 166 167 struct CArrRetDependency { 168 RetDependency* head; 169 int64_t size; 170 }; 171 172 struct RetHapModuleInfo { 173 char* name; 174 char* icon; 175 uint32_t iconId; 176 char* label; 177 uint32_t labelId; 178 char* description; 179 uint32_t descriptionId; 180 char* mainElementName; 181 CArrRetAbilityInfo abilitiesInfo; 182 CArrRetExtensionAbilityInfo extensionAbilitiesInfo; 183 CArrMetadata metadata; 184 CArrString deviceTypes; 185 bool installationFree; 186 char* hashValue; 187 int32_t moduleType; 188 CArrRetPreloadItem preloads; 189 CArrRetDependency dependencies; 190 char* fileContextMenuConfig; 191 }; 192 193 struct CArrHapInfo { 194 RetHapModuleInfo* head; 195 int64_t size; 196 }; 197 198 struct RetUsedScene { 199 CArrString abilities; 200 char* when; 201 }; 202 203 struct RetReqPermissionDetail { 204 char* name; 205 char* moduleName; 206 char* reason; 207 uint32_t reasonId; 208 RetUsedScene usedScence; 209 }; 210 211 struct CArrReqPerDetail { 212 RetReqPermissionDetail* head; 213 int64_t size; 214 }; 215 216 struct RetSignatureInfo { 217 char* appId; 218 char* fingerprint; 219 char* appIdentifier; 220 }; 221 222 struct RetCArrString { 223 int32_t code; 224 CArrString value; 225 }; 226 227 struct CRecoverableApplicationInfo { 228 char* bundleName; 229 char* moduleName; 230 uint32_t labelId; 231 uint32_t iconId; 232 }; 233 234 struct CArrRecoverableApplicationInfo { 235 CRecoverableApplicationInfo* head; 236 int64_t size; 237 }; 238 239 struct RetRecoverableApplicationInfo { 240 int32_t code; 241 CArrRecoverableApplicationInfo data; 242 }; 243 244 struct RetBundleInfo { 245 char* name; 246 char* vendor; 247 uint32_t versionCode; 248 char* versionName; 249 uint32_t minCompatibleVersionCode; 250 uint32_t targetVersion; 251 RetApplicationInfo appInfo; 252 CArrHapInfo hapInfo; 253 CArrReqPerDetail perDetail; 254 CArrInt32 state; 255 RetSignatureInfo signInfo; 256 int64_t installTime; 257 int64_t updateTime; 258 int32_t uid; 259 }; 260 261 enum BundleFlag { 262 // get bundle info except abilityInfos 263 GET_BUNDLE_DEFAULT = 0x00000000, 264 // get bundle info include abilityInfos 265 GET_BUNDLE_WITH_ABILITIES = 0x00000001, 266 // get bundle info include request permissions 267 GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010, 268 // get bundle info include extension info 269 GET_BUNDLE_WITH_EXTENSION_INFO = 0x00000020, 270 // get bundle info include hash value 271 GET_BUNDLE_WITH_HASH_VALUE = 0x00000030, 272 // get bundle info inlcude menu, only for dump usage 273 GET_BUNDLE_WITH_MENU = 0x00000040, 274 }; 275 276 enum class GetBundleInfoFlag { 277 GET_BUNDLE_INFO_DEFAULT = 0x00000000, 278 GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, 279 GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, 280 GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, 281 GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, 282 GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, 283 GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, 284 GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, 285 GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, 286 GET_BUNDLE_INFO_WITH_MENU = 0x00000100, 287 }; 288 } // BundleManager 289 } // CJSystemapi 290 } // OHOS 291 292 #endif