1 /* 2 * Copyright (c) 2021-2022 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_INFO_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_INFO_H 18 19 #include "nocopyable.h" 20 21 #include "ability_info.h" 22 #include "bundle_constants.h" 23 #include "bundle_info.h" 24 #include "common_event_info.h" 25 #include "common_profile.h" 26 #include "distributed_bundle_info.h" 27 #include "extension_ability_info.h" 28 #include "form_info.h" 29 #include "hap_module_info.h" 30 #include "inner_app_quick_fix.h" 31 #include "inner_bundle_user_info.h" 32 #include "json_util.h" 33 #include "quick_fix/app_quick_fix.h" 34 #include "quick_fix/hqf_info.h" 35 #include "shortcut_info.h" 36 #include "want.h" 37 38 namespace OHOS { 39 namespace AppExecFwk { 40 struct Distro { 41 bool deliveryWithInstall = false; 42 std::string moduleName; 43 std::string moduleType; 44 bool installationFree = false; 45 }; 46 47 struct DefinePermission { 48 std::string name; 49 std::string grantMode = Profile::DEFINEPERMISSION_GRANT_MODE_SYSTEM_GRANT; 50 std::string availableLevel = Profile::DEFINEPERMISSION_AVAILABLE_LEVEL_DEFAULT_VALUE; 51 bool provisionEnable = true; 52 bool distributedSceneEnable = false; 53 std::string label; 54 int32_t labelId = 0; 55 std::string description; 56 int32_t descriptionId = 0; 57 }; 58 59 struct Dependency { 60 std::string moduleName; 61 std::string bundleName; 62 }; 63 64 struct InnerModuleInfo { 65 std::string name; 66 std::string modulePackage; 67 std::string moduleName; 68 std::string modulePath; 69 std::string moduleDataDir; 70 std::string moduleResPath; 71 std::string label; 72 std::string hapPath; 73 int32_t labelId = 0; 74 std::string description; 75 int32_t descriptionId = 0; 76 std::string icon; 77 int32_t iconId = 0; 78 std::string mainAbility; // config.json : mainAbility; module.json : mainElement 79 std::string entryAbilityKey; // skills contains "action.system.home" and "entity.system.home" 80 std::string srcPath; 81 std::string hashValue; 82 bool isEntry = false; 83 bool installationFree = false; 84 // all user's value of isRemovable 85 // key:userId 86 // value:isRemovable true or flase 87 std::map<std::string, bool> isRemovable; 88 MetaData metaData; 89 ModuleColorMode colorMode = ModuleColorMode::AUTO; 90 Distro distro; 91 std::vector<std::string> reqCapabilities; 92 std::vector<std::string> abilityKeys; 93 std::vector<std::string> skillKeys; 94 // new version fields 95 std::string pages; 96 std::string process; 97 std::string srcEntrance; 98 std::string uiSyntax; 99 std::string virtualMachine; 100 bool isModuleJson = false; 101 bool isStageBasedModel = false; 102 std::vector<DefinePermission> definePermissions; 103 std::vector<RequestPermission> requestPermissions; 104 std::vector<std::string> deviceTypes; 105 std::vector<std::string> extensionKeys; 106 std::vector<std::string> extensionSkillKeys; 107 std::vector<Metadata> metadata; 108 int32_t upgradeFlag = 0; 109 std::vector<Dependency> dependencies; 110 std::string compileMode; 111 bool isLibIsolated = false; 112 std::string nativeLibraryPath; 113 std::string cpuAbi; 114 AtomicServiceModuleType atomicServiceModuleType; 115 std::vector<std::string> preloads; 116 }; 117 118 struct SkillUri { 119 std::string scheme; 120 std::string host; 121 std::string port; 122 std::string path; 123 std::string pathStartWith; 124 std::string pathRegex; 125 std::string type; 126 }; 127 128 struct Skill { 129 public: 130 std::vector<std::string> actions; 131 std::vector<std::string> entities; 132 std::vector<SkillUri> uris; 133 bool Match(const OHOS::AAFwk::Want &want) const; 134 bool MatchLauncher(const OHOS::AAFwk::Want &want) const; 135 bool MatchType(const std::string &type, const std::string &skillUriType) const; 136 private: 137 bool MatchAction(const std::string &action) const; 138 bool MatchEntities(const std::vector<std::string> ¶mEntities) const; 139 bool MatchUriAndType(const std::string &uriString, const std::string &type) const; 140 bool MatchUri(const std::string &uriString, const SkillUri &skillUri) const; 141 bool StartsWith(const std::string &sourceString, const std::string &targetPrefix) const; 142 std::string GetOptParamUri(const std::string &uriString) const; 143 }; 144 145 enum InstallExceptionStatus : int32_t { 146 INSTALL_START = 1, 147 INSTALL_FINISH, 148 UPDATING_EXISTED_START, 149 UPDATING_NEW_START, 150 UPDATING_FINISH, 151 UNINSTALL_BUNDLE_START, 152 UNINSTALL_PACKAGE_START, 153 UNKNOWN_STATUS, 154 }; 155 156 struct InstallMark { 157 std::string bundleName; 158 std::string packageName; 159 int32_t status = InstallExceptionStatus::UNKNOWN_STATUS; 160 }; 161 162 struct SandboxAppPersistentInfo { 163 uint32_t accessTokenId = 0; 164 int32_t appIndex = 0; 165 int32_t userId = Constants::INVALID_USERID; 166 }; 167 168 class InnerBundleInfo { 169 public: 170 enum class BundleStatus { 171 ENABLED = 1, 172 DISABLED, 173 }; 174 175 InnerBundleInfo(); 176 InnerBundleInfo &operator=(const InnerBundleInfo &info); 177 ~InnerBundleInfo(); 178 /** 179 * @brief Transform the InnerBundleInfo object to json. 180 * @param jsonObject Indicates the obtained json object. 181 * @return 182 */ 183 void ToJson(nlohmann::json &jsonObject) const; 184 /** 185 * @brief Transform the json object to InnerBundleInfo object. 186 * @param jsonObject Indicates the obtained json object. 187 * @return Returns 0 if the json object parsed successfully; returns error code otherwise. 188 */ 189 int32_t FromJson(const nlohmann::json &jsonObject); 190 /** 191 * @brief Add module info to old InnerBundleInfo object. 192 * @param newInfo Indicates the new InnerBundleInfo object. 193 * @return Returns true if the module successfully added; returns false otherwise. 194 */ 195 bool AddModuleInfo(const InnerBundleInfo &newInfo); 196 /** 197 * @brief Update module info to old InnerBundleInfo object. 198 * @param newInfo Indicates the new InnerBundleInfo object. 199 * @return 200 */ 201 void UpdateModuleInfo(const InnerBundleInfo &newInfo); 202 /** 203 * @brief Remove module info from InnerBundleInfo object. 204 * @param modulePackage Indicates the module package to be remove. 205 * @return 206 */ 207 void RemoveModuleInfo(const std::string &modulePackage); 208 /** 209 * @brief Find hap module info by module package. 210 * @param modulePackage Indicates the module package. 211 * @param userId Indicates the user ID. 212 * @return Returns the HapModuleInfo object if find it; returns null otherwise. 213 */ 214 std::optional<HapModuleInfo> FindHapModuleInfo( 215 const std::string &modulePackage, int32_t userId = Constants::UNSPECIFIED_USERID) const; 216 /** 217 * @brief Get module hashValue. 218 * @param modulePackage Indicates the module package. 219 * @param hapModuleInfo Indicates the hapModuleInfo. 220 * @return 221 */ 222 void GetModuleWithHashValue( 223 int32_t flags, const std::string &modulePackage, HapModuleInfo &hapModuleInfo) const; 224 /** 225 * @brief Find abilityInfo by bundle name and ability name. 226 * @param bundleName Indicates the bundle name. 227 * @param moduleName Indicates the module name 228 * @param abilityName Indicates the ability name. 229 * @param userId Indicates the user ID. 230 * @return Returns the AbilityInfo object if find it; returns null otherwise. 231 */ 232 std::optional<AbilityInfo> FindAbilityInfo(const std::string &bundleName, 233 const std::string &moduleName, const std::string &abilityName, 234 int32_t userId = Constants::UNSPECIFIED_USERID) const; 235 /** 236 * @brief Find abilityInfo by bundle name and ability name. 237 * @param bundleName Indicates the bundle name. 238 * @param moduleName Indicates the module name 239 * @param abilityName Indicates the ability name. 240 * @return Returns the AbilityInfo object if find it; returns null otherwise. 241 */ 242 std::optional<AbilityInfo> FindAbilityInfoV9(const std::string &bundleName, 243 const std::string &moduleName, const std::string &abilityName) const; 244 /** 245 * @brief Find abilityInfo by bundle name module name and ability name. 246 * @param bundleName Indicates the bundle name. 247 * @param moduleName Indicates the module name 248 * @param abilityName Indicates the ability name. 249 * @return Returns ERR_OK if abilityInfo find successfully obtained; returns other ErrCode otherwise. 250 */ 251 ErrCode FindAbilityInfo(const std::string &bundleName, const std::string &moduleName, 252 const std::string &abilityName, AbilityInfo &info) const; 253 /** 254 * @brief Find abilityInfo of list by bundle name. 255 * @param bundleName Indicates the bundle name. 256 * @param userId Indicates the user ID. 257 * @return Returns the AbilityInfo of list if find it; returns null otherwise. 258 */ 259 std::optional<std::vector<AbilityInfo>> FindAbilityInfos( 260 const std::string &bundleName, int32_t userId = Constants::UNSPECIFIED_USERID) const; 261 /** 262 * @brief Find extensionInfo by bundle name and extension name. 263 * @param bundleName Indicates the bundle name. 264 * @param moduleName Indicates the module name. 265 * @param extensionName Indicates the extension name 266 * @return Returns the ExtensionAbilityInfo object if find it; returns null otherwise. 267 */ 268 std::optional<ExtensionAbilityInfo> FindExtensionInfo( 269 const std::string &bundleName, const std::string &moduleName, const std::string &extensionName) const; 270 /** 271 * @brief Find extensionInfos by bundle name. 272 * @param bundleName Indicates the bundle name. 273 * @return Returns the ExtensionAbilityInfo array if find it; returns null otherwise. 274 */ 275 std::optional<std::vector<ExtensionAbilityInfo>> FindExtensionInfos(const std::string &bundleName) const; 276 /** 277 * @brief Transform the InnerBundleInfo object to string. 278 * @return Returns the string object 279 */ 280 std::string ToString() const; 281 /** 282 * @brief Add ability infos to old InnerBundleInfo object. 283 * @param abilityInfos Indicates the AbilityInfo object to be add. 284 * @return 285 */ AddModuleAbilityInfo(const std::map<std::string,AbilityInfo> & abilityInfos)286 void AddModuleAbilityInfo(const std::map<std::string, AbilityInfo> &abilityInfos) 287 { 288 for (const auto &ability : abilityInfos) { 289 baseAbilityInfos_.try_emplace(ability.first, ability.second); 290 } 291 } 292 AddModuleExtensionInfos(const std::map<std::string,ExtensionAbilityInfo> & extensionInfos)293 void AddModuleExtensionInfos(const std::map<std::string, ExtensionAbilityInfo> &extensionInfos) 294 { 295 for (const auto &extensionInfo : extensionInfos) { 296 baseExtensionInfos_.try_emplace(extensionInfo.first, extensionInfo.second); 297 } 298 } 299 /** 300 * @brief Add skill infos to old InnerBundleInfo object. 301 * @param skillInfos Indicates the Skill object to be add. 302 * @return 303 */ AddModuleSkillInfo(const std::map<std::string,std::vector<Skill>> & skillInfos)304 void AddModuleSkillInfo(const std::map<std::string, std::vector<Skill>> &skillInfos) 305 { 306 for (const auto &skills : skillInfos) { 307 skillInfos_.try_emplace(skills.first, skills.second); 308 } 309 } AddModuleExtensionSkillInfos(const std::map<std::string,std::vector<Skill>> & extensionSkillInfos)310 void AddModuleExtensionSkillInfos(const std::map<std::string, std::vector<Skill>> &extensionSkillInfos) 311 { 312 for (const auto &skills : extensionSkillInfos) { 313 extensionSkillInfos_.try_emplace(skills.first, skills.second); 314 } 315 } 316 /** 317 * @brief Add form infos to old InnerBundleInfo object. 318 * @param formInfos Indicates the Forms object to be add. 319 * @return 320 */ AddModuleFormInfo(const std::map<std::string,std::vector<FormInfo>> & formInfos)321 void AddModuleFormInfo(const std::map<std::string, std::vector<FormInfo>> &formInfos) 322 { 323 for (const auto &forms : formInfos) { 324 formInfos_.try_emplace(forms.first, forms.second); 325 } 326 } 327 /** 328 * @brief Add common events to old InnerBundleInfo object. 329 * @param commonEvents Indicates the Common Event object to be add. 330 * @return 331 */ AddModuleCommonEvent(const std::map<std::string,CommonEventInfo> & commonEvents)332 void AddModuleCommonEvent(const std::map<std::string, CommonEventInfo> &commonEvents) 333 { 334 for (const auto &commonEvent : commonEvents) { 335 commonEvents_.try_emplace(commonEvent.first, commonEvent.second); 336 } 337 } 338 /** 339 * @brief Add shortcut infos to old InnerBundleInfo object. 340 * @param shortcutInfos Indicates the Shortcut object to be add. 341 * @return 342 */ AddModuleShortcutInfo(const std::map<std::string,ShortcutInfo> & shortcutInfos)343 void AddModuleShortcutInfo(const std::map<std::string, ShortcutInfo> &shortcutInfos) 344 { 345 for (const auto &shortcut : shortcutInfos) { 346 shortcutInfos_.try_emplace(shortcut.first, shortcut.second); 347 } 348 } 349 /** 350 * @brief Add innerModuleInfos to old InnerBundleInfo object. 351 * @param innerModuleInfos Indicates the InnerModuleInfo object to be add. 352 * @return 353 */ AddInnerModuleInfo(const std::map<std::string,InnerModuleInfo> & innerModuleInfos)354 void AddInnerModuleInfo(const std::map<std::string, InnerModuleInfo> &innerModuleInfos) 355 { 356 for (const auto &info : innerModuleInfos) { 357 innerModuleInfos_.try_emplace(info.first, info.second); 358 } 359 } 360 /** 361 * @brief Get application name. 362 * @return Return application name 363 */ GetApplicationName()364 std::string GetApplicationName() const 365 { 366 return baseApplicationInfo_->name; 367 } 368 /** 369 * @brief Set bundle status. 370 * @param status Indicates the BundleStatus object to set. 371 * @return 372 */ SetBundleStatus(const BundleStatus & status)373 void SetBundleStatus(const BundleStatus &status) 374 { 375 bundleStatus_ = status; 376 } 377 /** 378 * @brief Get bundle status. 379 * @return Return the BundleStatus object 380 */ GetBundleStatus()381 BundleStatus GetBundleStatus() const 382 { 383 return bundleStatus_; 384 } 385 /** 386 * @brief Set bundle install time. 387 * @param time Indicates the install time to set. 388 * @param userId Indicates the user ID. 389 * @return 390 */ 391 void SetBundleInstallTime( 392 const int64_t time, int32_t userId = Constants::UNSPECIFIED_USERID); 393 /** 394 * @brief Get bundle install time. 395 * @param userId Indicates the user ID. 396 * @return Return the bundle install time. 397 */ 398 int64_t GetBundleInstallTime(int32_t userId = Constants::UNSPECIFIED_USERID) const 399 { 400 InnerBundleUserInfo innerBundleUserInfo; 401 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 402 APP_LOGE("can not find userId %{public}d when GetBundleInstallTime", userId); 403 return -1; 404 } 405 return innerBundleUserInfo.installTime; 406 } 407 /** 408 * @brief Set bundle update time. 409 * @param time Indicates the update time to set. 410 * @param userId Indicates the user ID. 411 * @return 412 */ 413 void SetBundleUpdateTime(const int64_t time, int32_t userId = Constants::UNSPECIFIED_USERID); 414 /** 415 * @brief Get bundle update time. 416 * @param userId Indicates the user ID. 417 * @return Return the bundle update time. 418 */ 419 int64_t GetBundleUpdateTime(int32_t userId = Constants::UNSPECIFIED_USERID) const 420 { 421 InnerBundleUserInfo innerBundleUserInfo; 422 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 423 APP_LOGE("can not find userId %{public}d when GetBundleUpdateTime", userId); 424 return -1; 425 } 426 return innerBundleUserInfo.updateTime; 427 } 428 /** 429 * @brief Get bundle name. 430 * @return Return bundle name 431 */ GetBundleName()432 const std::string GetBundleName() const 433 { 434 return baseApplicationInfo_->bundleName; 435 } 436 /** 437 * @brief Get baseBundleInfo. 438 * @return Return the BundleInfo object. 439 */ GetBaseBundleInfo()440 BundleInfo GetBaseBundleInfo() const 441 { 442 return *baseBundleInfo_; 443 } 444 /** 445 * @brief Set baseBundleInfo. 446 * @param bundleInfo Indicates the BundleInfo object. 447 */ SetBaseBundleInfo(const BundleInfo & bundleInfo)448 void SetBaseBundleInfo(const BundleInfo &bundleInfo) 449 { 450 *baseBundleInfo_ = bundleInfo; 451 } 452 /** 453 * @brief Update baseBundleInfo. 454 * @param bundleInfo Indicates the new BundleInfo object. 455 * @return 456 */ 457 void UpdateBaseBundleInfo(const BundleInfo &bundleInfo, bool isEntry); 458 /** 459 * @brief Get baseApplicationInfo. 460 * @return Return the ApplicationInfo object. 461 */ GetBaseApplicationInfo()462 ApplicationInfo GetBaseApplicationInfo() const 463 { 464 return *baseApplicationInfo_; 465 } 466 /** 467 * @brief Set baseApplicationInfo. 468 * @param applicationInfo Indicates the ApplicationInfo object. 469 */ SetBaseApplicationInfo(const ApplicationInfo & applicationInfo)470 void SetBaseApplicationInfo(const ApplicationInfo &applicationInfo) 471 { 472 *baseApplicationInfo_ = applicationInfo; 473 } 474 /** 475 * @brief Update baseApplicationInfo. 476 * @param applicationInfo Indicates the ApplicationInfo object. 477 */ 478 void UpdateBaseApplicationInfo(const ApplicationInfo &applicationInfo); 479 /** 480 * @brief Get application enabled. 481 * @param userId Indicates the user ID. 482 * @return Return whether the application is enabled. 483 */ 484 bool GetApplicationEnabled(int32_t userId = Constants::UNSPECIFIED_USERID) const 485 { 486 InnerBundleUserInfo innerBundleUserInfo; 487 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 488 APP_LOGE("can not find userId %{public}d when GetApplicationEnabled", userId); 489 return false; 490 } 491 492 return innerBundleUserInfo.bundleUserInfo.enabled; 493 } GetApplicationEnabledV9(int32_t userId,bool & isEnabled)494 ErrCode GetApplicationEnabledV9(int32_t userId, bool &isEnabled) const 495 { 496 InnerBundleUserInfo innerBundleUserInfo; 497 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 498 APP_LOGE("can not find bundleUserInfo in userId: %{public}d when GetApplicationEnabled", userId); 499 return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; 500 } 501 isEnabled = innerBundleUserInfo.bundleUserInfo.enabled; 502 return ERR_OK; 503 } 504 /** 505 * @brief Set application enabled. 506 * @param userId Indicates the user ID. 507 * @return Returns ERR_OK if the SetApplicationEnabled is successfully; returns error code otherwise. 508 */ 509 ErrCode SetApplicationEnabled(bool enabled, int32_t userId = Constants::UNSPECIFIED_USERID); 510 /** 511 * @brief Get application code path. 512 * @return Return the string object. 513 */ GetAppCodePath()514 const std::string GetAppCodePath() const 515 { 516 return baseApplicationInfo_->codePath; 517 } 518 /** 519 * @brief Set application code path. 520 * @param codePath Indicates the code path to be set. 521 */ SetAppCodePath(const std::string codePath)522 void SetAppCodePath(const std::string codePath) 523 { 524 baseApplicationInfo_->codePath = codePath; 525 } 526 /** 527 * @brief Insert innerModuleInfos. 528 * @param modulePackage Indicates the modulePackage object as key. 529 * @param innerModuleInfo Indicates the InnerModuleInfo object as value. 530 */ InsertInnerModuleInfo(const std::string & modulePackage,const InnerModuleInfo & innerModuleInfo)531 void InsertInnerModuleInfo(const std::string &modulePackage, const InnerModuleInfo &innerModuleInfo) 532 { 533 innerModuleInfos_.try_emplace(modulePackage, innerModuleInfo); 534 } 535 /** 536 * @brief Insert AbilityInfo. 537 * @param key bundleName.moduleName.abilityName 538 * @param abilityInfo value. 539 */ InsertAbilitiesInfo(const std::string & key,const AbilityInfo & abilityInfo)540 void InsertAbilitiesInfo(const std::string &key, const AbilityInfo &abilityInfo) 541 { 542 baseAbilityInfos_.emplace(key, abilityInfo); 543 } 544 /** 545 * @brief Insert ExtensionAbilityInfo. 546 * @param key bundleName.moduleName.extensionName 547 * @param extensionInfo value. 548 */ InsertExtensionInfo(const std::string & key,const ExtensionAbilityInfo & extensionInfo)549 void InsertExtensionInfo(const std::string &key, const ExtensionAbilityInfo &extensionInfo) 550 { 551 baseExtensionInfos_.emplace(key, extensionInfo); 552 } 553 /** 554 * @brief Insert ability skillInfos. 555 * @param key bundleName.moduleName.abilityName 556 * @param skills ability skills. 557 */ InsertSkillInfo(const std::string & key,const std::vector<Skill> & skills)558 void InsertSkillInfo(const std::string &key, const std::vector<Skill> &skills) 559 { 560 skillInfos_.emplace(key, skills); 561 } 562 /** 563 * @brief Insert extension skillInfos. 564 * @param key bundleName.moduleName.extensionName 565 * @param skills extension skills. 566 */ InsertExtensionSkillInfo(const std::string & key,const std::vector<Skill> & skills)567 void InsertExtensionSkillInfo(const std::string &key, const std::vector<Skill> &skills) 568 { 569 extensionSkillInfos_.emplace(key, skills); 570 } 571 /** 572 * @brief Find AbilityInfo object by Uri. 573 * @param abilityUri Indicates the ability uri. 574 * @param userId Indicates the user ID. 575 * @return Returns the AbilityInfo object if find it; returns null otherwise. 576 */ FindAbilityInfoByUri(const std::string & abilityUri)577 std::optional<AbilityInfo> FindAbilityInfoByUri(const std::string &abilityUri) const 578 { 579 APP_LOGI("Uri is %{public}s", abilityUri.c_str()); 580 for (const auto &ability : baseAbilityInfos_) { 581 auto abilityInfo = ability.second; 582 if (abilityInfo.uri.size() < strlen(Constants::DATA_ABILITY_URI_PREFIX)) { 583 continue; 584 } 585 586 auto configUri = abilityInfo.uri.substr(strlen(Constants::DATA_ABILITY_URI_PREFIX)); 587 APP_LOGI("configUri is %{public}s", configUri.c_str()); 588 if (configUri == abilityUri) { 589 return abilityInfo; 590 } 591 } 592 return std::nullopt; 593 } 594 FindExtensionAbilityInfoByUri(const std::string & uri,ExtensionAbilityInfo & extensionAbilityInfo)595 bool FindExtensionAbilityInfoByUri(const std::string &uri, ExtensionAbilityInfo &extensionAbilityInfo) const 596 { 597 for (const auto &item : baseExtensionInfos_) { 598 if (uri == item.second.uri) { 599 extensionAbilityInfo = item.second; 600 APP_LOGD("find target extension, bundleName : %{public}s, moduleName : %{public}s, name : %{public}s", 601 extensionAbilityInfo.bundleName.c_str(), extensionAbilityInfo.moduleName.c_str(), 602 extensionAbilityInfo.name.c_str()); 603 return true; 604 } 605 } 606 return false; 607 } 608 609 /** 610 * @brief Find AbilityInfo object by Uri. 611 * @param abilityUri Indicates the ability uri. 612 * @param userId Indicates the user ID. 613 * @return Returns the AbilityInfo object if find it; returns null otherwise. 614 */ 615 void FindAbilityInfosByUri(const std::string &abilityUri, 616 std::vector<AbilityInfo> &abilityInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 617 { 618 APP_LOGI("Uri is %{public}s", abilityUri.c_str()); 619 for (auto &ability : baseAbilityInfos_) { 620 auto abilityInfo = ability.second; 621 if (abilityInfo.uri.size() < strlen(Constants::DATA_ABILITY_URI_PREFIX)) { 622 continue; 623 } 624 625 auto configUri = abilityInfo.uri.substr(strlen(Constants::DATA_ABILITY_URI_PREFIX)); 626 APP_LOGI("configUri is %{public}s", configUri.c_str()); 627 if (configUri == abilityUri) { 628 GetApplicationInfo( 629 ApplicationFlag::GET_APPLICATION_INFO_WITH_PERMISSION, userId, abilityInfo.applicationInfo); 630 abilityInfos.emplace_back(abilityInfo); 631 } 632 } 633 return; 634 } 635 /** 636 * @brief Get all ability names in application. 637 * @return Returns ability names. 638 */ GetAbilityNames()639 auto GetAbilityNames() const 640 { 641 std::vector<std::string> abilityNames; 642 for (auto &ability : baseAbilityInfos_) { 643 abilityNames.emplace_back(ability.second.name); 644 } 645 return abilityNames; 646 } 647 /** 648 * @brief Get version code in application. 649 * @return Returns version code. 650 */ GetVersionCode()651 uint32_t GetVersionCode() const 652 { 653 return baseBundleInfo_->versionCode; 654 } 655 /** 656 * @brief Get version name in application. 657 * @return Returns version name. 658 */ GetVersionName()659 std::string GetVersionName() const 660 { 661 return baseBundleInfo_->versionName; 662 } 663 /** 664 * @brief Get vendor in application. 665 * @return Returns vendor. 666 */ GetVendor()667 std::string GetVendor() const 668 { 669 return baseBundleInfo_->vendor; 670 } 671 /** 672 * @brief Get comparible version in application. 673 * @return Returns comparible version. 674 */ GetCompatibleVersion()675 uint32_t GetCompatibleVersion() const 676 { 677 return baseBundleInfo_->compatibleVersion; 678 } 679 /** 680 * @brief Get target version in application. 681 * @return Returns target version. 682 */ GetTargetVersion()683 uint32_t GetTargetVersion() const 684 { 685 return baseBundleInfo_->targetVersion; 686 } 687 /** 688 * @brief Get release type in application. 689 * @return Returns release type. 690 */ GetReleaseType()691 std::string GetReleaseType() const 692 { 693 return baseBundleInfo_->releaseType; 694 } 695 /** 696 * @brief Get minCompatibleVersionCode in base bundleInfo. 697 * @return Returns release type. 698 */ GetMinCompatibleVersionCode()699 uint32_t GetMinCompatibleVersionCode() const 700 { 701 return baseBundleInfo_->minCompatibleVersionCode; 702 } 703 /** 704 * @brief Get install mark in application. 705 * @return Returns install mark. 706 */ SetInstallMark(const std::string & bundleName,const std::string & packageName,const InstallExceptionStatus & status)707 void SetInstallMark(const std::string &bundleName, const std::string &packageName, 708 const InstallExceptionStatus &status) 709 { 710 mark_.bundleName = bundleName; 711 mark_.packageName = packageName; 712 mark_.status = status; 713 } 714 /** 715 * @brief Get install mark in application. 716 * @return Returns install mark. 717 */ GetInstallMark()718 InstallMark GetInstallMark() const 719 { 720 return mark_; 721 } 722 /** 723 * @brief Set application base data dir. 724 * @param baseDataDir Indicates the dir to be set. 725 */ SetBaseDataDir(const std::string & baseDataDir)726 void SetBaseDataDir(const std::string &baseDataDir) 727 { 728 baseDataDir_ = baseDataDir; 729 } 730 /** 731 * @brief Get application base data dir. 732 * @return Return the string object. 733 */ GetBaseDataDir()734 std::string GetBaseDataDir() const 735 { 736 return baseDataDir_; 737 } 738 /** 739 * @brief Get application data dir. 740 * @return Return the string object. 741 */ GetAppDataDir()742 std::string GetAppDataDir() const 743 { 744 return baseApplicationInfo_->dataDir; 745 } 746 /** 747 * @brief Set application data dir. 748 * @param dataDir Indicates the data Dir to be set. 749 */ SetAppDataDir(std::string dataDir)750 void SetAppDataDir(std::string dataDir) 751 { 752 baseApplicationInfo_->dataDir = dataDir; 753 } 754 /** 755 * @brief Set application data base dir. 756 * @param dataBaseDir Indicates the data base Dir to be set. 757 */ SetAppDataBaseDir(std::string dataBaseDir)758 void SetAppDataBaseDir(std::string dataBaseDir) 759 { 760 baseApplicationInfo_->dataBaseDir = dataBaseDir; 761 } 762 /** 763 * @brief Set application cache dir. 764 * @param cacheDir Indicates the cache Dir to be set. 765 */ SetAppCacheDir(std::string cacheDir)766 void SetAppCacheDir(std::string cacheDir) 767 { 768 baseApplicationInfo_->cacheDir = cacheDir; 769 } 770 /** 771 * @brief Set application uid. 772 * @param uid Indicates the uid to be set. 773 */ SetUid(int uid)774 void SetUid(int uid) {} 775 /** 776 * @brief Get application uid. 777 * @param userId Indicates the user ID. 778 * @return Returns the uid. 779 */ 780 int GetUid(int32_t userId = Constants::UNSPECIFIED_USERID) const 781 { 782 InnerBundleUserInfo innerBundleUserInfo; 783 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 784 return Constants::INVALID_UID; 785 } 786 787 return innerBundleUserInfo.uid; 788 } 789 /** 790 * @brief Get application gid. 791 * @param userId Indicates the user ID. 792 * @return Returns the gid. 793 */ 794 int GetGid(int32_t userId = Constants::UNSPECIFIED_USERID) const 795 { 796 InnerBundleUserInfo innerBundleUserInfo; 797 if (!GetInnerBundleUserInfo(userId, innerBundleUserInfo)) { 798 return Constants::INVALID_GID; 799 } 800 801 if (innerBundleUserInfo.gids.empty()) { 802 return Constants::INVALID_GID; 803 } 804 805 return innerBundleUserInfo.gids[0]; 806 } 807 /** 808 * @brief Set application gid. 809 * @param gid Indicates the gid to be set. 810 */ SetGid(int gid)811 void SetGid(int gid) {} 812 /** 813 * @brief Get application AppType. 814 * @return Returns the AppType. 815 */ GetAppType()816 Constants::AppType GetAppType() const 817 { 818 return appType_; 819 } 820 /** 821 * @brief Set application AppType. 822 * @param gid Indicates the AppType to be set. 823 */ SetAppType(Constants::AppType appType)824 void SetAppType(Constants::AppType appType) 825 { 826 appType_ = appType; 827 if (appType_ == Constants::AppType::SYSTEM_APP) { 828 baseApplicationInfo_->isSystemApp = true; 829 } else { 830 baseApplicationInfo_->isSystemApp = false; 831 } 832 } 833 /** 834 * @brief Get application user id. 835 * @return Returns the user id. 836 */ GetUserId()837 int GetUserId() const 838 { 839 return userId_; 840 } 841 /** 842 * @brief Set application user id. 843 * @param gid Indicates the user id to be set. 844 */ SetUserId(int userId)845 void SetUserId(int userId) 846 { 847 userId_ = userId; 848 } 849 850 // only used in install progress with newInfo GetCurrentModulePackage()851 std::string GetCurrentModulePackage() const 852 { 853 return currentPackage_; 854 } SetCurrentModulePackage(const std::string & modulePackage)855 void SetCurrentModulePackage(const std::string &modulePackage) 856 { 857 currentPackage_ = modulePackage; 858 } AddModuleSrcDir(const std::string & moduleSrcDir)859 void AddModuleSrcDir(const std::string &moduleSrcDir) 860 { 861 if (innerModuleInfos_.count(currentPackage_) == 1) { 862 innerModuleInfos_.at(currentPackage_).modulePath = moduleSrcDir; 863 } 864 } AddModuleDataDir(const std::string & moduleDataDir)865 void AddModuleDataDir(const std::string &moduleDataDir) 866 { 867 if (innerModuleInfos_.count(currentPackage_) == 1) { 868 innerModuleInfos_.at(currentPackage_).moduleDataDir = moduleDataDir; 869 } 870 } 871 AddModuleResPath(const std::string & moduleSrcDir)872 void AddModuleResPath(const std::string &moduleSrcDir) 873 { 874 if (innerModuleInfos_.count(currentPackage_) == 1) { 875 std::string moduleResPath; 876 if (isNewVersion_) { 877 moduleResPath = moduleSrcDir + Constants::PATH_SEPARATOR + Constants::RESOURCES_INDEX; 878 } else { 879 moduleResPath = moduleSrcDir + Constants::PATH_SEPARATOR + Constants::ASSETS_DIR + 880 Constants::PATH_SEPARATOR +innerModuleInfos_.at(currentPackage_).distro.moduleName + 881 Constants::PATH_SEPARATOR + Constants::RESOURCES_INDEX; 882 } 883 884 innerModuleInfos_.at(currentPackage_).moduleResPath = moduleResPath; 885 for (auto &abilityInfo : baseAbilityInfos_) { 886 abilityInfo.second.resourcePath = moduleResPath; 887 } 888 for (auto &extensionInfo : baseExtensionInfos_) { 889 extensionInfo.second.resourcePath = moduleResPath; 890 } 891 } 892 } 893 SetModuleHapPath(const std::string & hapPath)894 void SetModuleHapPath(const std::string &hapPath) 895 { 896 if (innerModuleInfos_.count(currentPackage_) == 1) { 897 innerModuleInfos_.at(currentPackage_).hapPath = hapPath; 898 for (auto &abilityInfo : baseAbilityInfos_) { 899 abilityInfo.second.hapPath = hapPath; 900 } 901 for (auto &extensionInfo : baseExtensionInfos_) { 902 extensionInfo.second.hapPath = hapPath; 903 } 904 } 905 } 906 GetModuleHapPath(const std::string & modulePackage)907 const std::string &GetModuleHapPath(const std::string &modulePackage) const 908 { 909 if (innerModuleInfos_.find(modulePackage) != innerModuleInfos_.end()) { 910 return innerModuleInfos_.at(modulePackage).hapPath; 911 } 912 913 return Constants::EMPTY_STRING; 914 } 915 GetModuleName(const std::string & modulePackage)916 const std::string &GetModuleName(const std::string &modulePackage) const 917 { 918 if (innerModuleInfos_.find(modulePackage) != innerModuleInfos_.end()) { 919 return innerModuleInfos_.at(modulePackage).moduleName; 920 } 921 922 return Constants::EMPTY_STRING; 923 } 924 925 const std::string &GetCurModuleName() const; 926 GetDefinePermissions()927 std::vector<DefinePermission> GetDefinePermissions() const 928 { 929 std::vector<DefinePermission> definePermissions; 930 if (innerModuleInfos_.count(currentPackage_) == 1) { 931 definePermissions = innerModuleInfos_.at(currentPackage_).definePermissions; 932 } 933 return definePermissions; 934 } 935 GetRequestPermissions()936 std::vector<RequestPermission> GetRequestPermissions() const 937 { 938 std::vector<RequestPermission> requestPermissions; 939 if (innerModuleInfos_.count(currentPackage_) == 1) { 940 requestPermissions = innerModuleInfos_.at(currentPackage_).requestPermissions; 941 } 942 return requestPermissions; 943 } 944 945 std::vector<DefinePermission> GetAllDefinePermissions() const; 946 947 std::vector<RequestPermission> GetAllRequestPermissions() const; 948 FindModule(std::string modulePackage)949 bool FindModule(std::string modulePackage) const 950 { 951 return (innerModuleInfos_.find(modulePackage) != innerModuleInfos_.end()); 952 } 953 IsEntryModule(std::string modulePackage)954 bool IsEntryModule(std::string modulePackage) const 955 { 956 if (FindModule(modulePackage)) { 957 return innerModuleInfos_.at(modulePackage).isEntry; 958 } 959 return false; 960 } 961 GetIsKeepAlive()962 bool GetIsKeepAlive() const 963 { 964 return baseBundleInfo_->isKeepAlive; 965 } 966 SetIsFreeInstallApp(bool isFreeInstall)967 void SetIsFreeInstallApp(bool isFreeInstall) 968 { 969 baseApplicationInfo_->isFreeInstallApp = isFreeInstall; 970 } 971 GetIsFreeInstallApp()972 bool GetIsFreeInstallApp() const 973 { 974 return baseApplicationInfo_->isFreeInstallApp; 975 } 976 977 std::string GetMainAbility() const; 978 979 void GetMainAbilityInfo(AbilityInfo &abilityInfo) const; 980 GetModuleDir(std::string modulePackage)981 std::string GetModuleDir(std::string modulePackage) const 982 { 983 if (innerModuleInfos_.find(modulePackage) != innerModuleInfos_.end()) { 984 return innerModuleInfos_.at(modulePackage).modulePath; 985 } 986 return Constants::EMPTY_STRING; 987 } 988 GetModuleDataDir(std::string modulePackage)989 std::string GetModuleDataDir(std::string modulePackage) const 990 { 991 if (innerModuleInfos_.find(modulePackage) != innerModuleInfos_.end()) { 992 return innerModuleInfos_.at(modulePackage).moduleDataDir; 993 } 994 return Constants::EMPTY_STRING; 995 } 996 IsDisabled()997 bool IsDisabled() const 998 { 999 return (bundleStatus_ == BundleStatus::DISABLED); 1000 } 1001 IsEnabled()1002 bool IsEnabled() const 1003 { 1004 return (bundleStatus_ == BundleStatus::ENABLED); 1005 } 1006 IsOnlyModule(const std::string & modulePackage)1007 bool IsOnlyModule(const std::string &modulePackage) 1008 { 1009 if ((innerModuleInfos_.size() == 1) && (innerModuleInfos_.count(modulePackage) == 1)) { 1010 return true; 1011 } 1012 return false; 1013 } 1014 SetProvisionId(const std::string & provisionId)1015 void SetProvisionId(const std::string &provisionId) 1016 { 1017 baseBundleInfo_->appId = baseBundleInfo_->name + Constants::FILE_UNDERLINE + provisionId; 1018 } 1019 GetProvisionId()1020 std::string GetProvisionId() const 1021 { 1022 if (!baseBundleInfo_->appId.empty()) { 1023 return baseBundleInfo_->appId.substr(baseBundleInfo_->name.size() + 1); 1024 } 1025 return ""; 1026 } 1027 GetAppId()1028 std::string GetAppId() const 1029 { 1030 return baseBundleInfo_->appId; 1031 } 1032 SetAppFeature(const std::string & appFeature)1033 void SetAppFeature(const std::string &appFeature) 1034 { 1035 appFeature_ = appFeature; 1036 } 1037 GetAppFeature()1038 std::string GetAppFeature() const 1039 { 1040 return appFeature_; 1041 } 1042 SetAppPrivilegeLevel(const std::string & appPrivilegeLevel)1043 void SetAppPrivilegeLevel(const std::string &appPrivilegeLevel) 1044 { 1045 if (appPrivilegeLevel.empty()) { 1046 return; 1047 } 1048 baseApplicationInfo_->appPrivilegeLevel = appPrivilegeLevel; 1049 } 1050 GetAppPrivilegeLevel()1051 std::string GetAppPrivilegeLevel() const 1052 { 1053 return baseApplicationInfo_->appPrivilegeLevel; 1054 } 1055 1056 bool HasEntry() const; 1057 1058 /** 1059 * @brief Insert formInfo. 1060 * @param keyName Indicates object as key. 1061 * @param formInfos Indicates the formInfo object as value. 1062 */ InsertFormInfos(const std::string & keyName,const std::vector<FormInfo> & formInfos)1063 void InsertFormInfos(const std::string &keyName, const std::vector<FormInfo> &formInfos) 1064 { 1065 formInfos_.emplace(keyName, formInfos); 1066 } 1067 /** 1068 * @brief Insert commonEvent. 1069 * @param keyName Indicates object as key. 1070 * @param commonEvents Indicates the common event object as value. 1071 */ InsertCommonEvents(const std::string & keyName,const CommonEventInfo & commonEvents)1072 void InsertCommonEvents(const std::string &keyName, const CommonEventInfo &commonEvents) 1073 { 1074 commonEvents_.emplace(keyName, commonEvents); 1075 } 1076 /** 1077 * @brief Insert shortcutInfos. 1078 * @param keyName Indicates object as key. 1079 * @param shortcutInfos Indicates the shortcutInfos object as value. 1080 */ InsertShortcutInfos(const std::string & keyName,const ShortcutInfo & shortcutInfos)1081 void InsertShortcutInfos(const std::string &keyName, const ShortcutInfo &shortcutInfos) 1082 { 1083 shortcutInfos_.emplace(keyName, shortcutInfos); 1084 } 1085 // use for new Info in updating progress RestoreFromOldInfo(const InnerBundleInfo & oldInfo)1086 void RestoreFromOldInfo(const InnerBundleInfo &oldInfo) 1087 { 1088 SetAppCodePath(oldInfo.GetAppCodePath()); 1089 SetBaseDataDir(oldInfo.GetBaseDataDir()); 1090 SetUid(oldInfo.GetUid()); 1091 SetGid(oldInfo.GetGid()); 1092 } RestoreModuleInfo(const InnerBundleInfo & oldInfo)1093 void RestoreModuleInfo(const InnerBundleInfo &oldInfo) 1094 { 1095 if (oldInfo.FindModule(currentPackage_)) { 1096 innerModuleInfos_.at(currentPackage_).moduleDataDir = oldInfo.GetModuleDataDir(currentPackage_); 1097 } 1098 } 1099 SetModuleHashValue(const std::string & hashValue)1100 void SetModuleHashValue(const std::string &hashValue) 1101 { 1102 if (innerModuleInfos_.count(currentPackage_) == 1) { 1103 innerModuleInfos_.at(currentPackage_).hashValue = hashValue; 1104 } 1105 } 1106 SetModuleCpuAbi(const std::string & cpuAbi)1107 void SetModuleCpuAbi(const std::string &cpuAbi) 1108 { 1109 if (innerModuleInfos_.count(currentPackage_) == 1) { 1110 innerModuleInfos_.at(currentPackage_).cpuAbi = cpuAbi; 1111 } 1112 } 1113 SetModuleNativeLibraryPath(const std::string & nativeLibraryPath)1114 void SetModuleNativeLibraryPath(const std::string &nativeLibraryPath) 1115 { 1116 if (innerModuleInfos_.count(currentPackage_) == 1) { 1117 innerModuleInfos_.at(currentPackage_).nativeLibraryPath = nativeLibraryPath; 1118 } 1119 } 1120 /** 1121 * @brief Set ability enabled. 1122 * @param bundleName Indicates the bundleName. 1123 * @param moduleName Indicates the moduleName. 1124 * @param abilityName Indicates the abilityName. 1125 * @param isEnabled Indicates the ability enabled. 1126 * @param userId Indicates the user id. 1127 * @return Returns ERR_OK if the setAbilityEnabled is successfully; returns error code otherwise. 1128 */ 1129 ErrCode SetAbilityEnabled(const std::string &bundleName, const std::string &moduleName, 1130 const std::string &abilityName, bool isEnabled, int32_t userId); 1131 /** 1132 * @brief Set the Application Need Recover object 1133 * @param moduleName Indicates the module name of the application. 1134 * @param upgradeFlag Indicates the module is need update or not. 1135 * @return Return ERR_OK if set data successfully. 1136 */ 1137 ErrCode SetModuleUpgradeFlag(std::string moduleName, int32_t upgradeFlag); 1138 1139 /** 1140 * @brief Get the Application Need Recover object 1141 * @param moduleName Indicates the module name of the application. 1142 * @return upgradeFlag type,NOT_UPGRADE means not need to be upgraded,SINGLE_UPGRADE means 1143 * single module need to be upgraded,RELATION_UPGRADE means relation module need to be upgraded. 1144 */ 1145 int32_t GetModuleUpgradeFlag(std::string moduleName) const; 1146 1147 /** 1148 * @brief Obtains configuration information about an application. 1149 * @param flags Indicates the flag used to specify information contained 1150 * in the ApplicationInfo object that will be returned. 1151 * @param userId Indicates the user ID. 1152 * @param appInfo Indicates the obtained ApplicationInfo object. 1153 */ 1154 void GetApplicationInfo(int32_t flags, int32_t userId, ApplicationInfo &appInfo) const; 1155 /** 1156 * @brief Obtains configuration information about an application. 1157 * @param flags Indicates the flag used to specify information contained 1158 * in the ApplicationInfo object that will be returned. 1159 * @param userId Indicates the user ID. 1160 * @param appInfo Indicates the obtained ApplicationInfo object. 1161 * @return return ERR_OK if getApplicationInfo successfully, return error code otherwise. 1162 */ 1163 ErrCode GetApplicationInfoV9(int32_t flags, int32_t userId, ApplicationInfo &appInfo) const; 1164 /** 1165 * @brief Obtains configuration information about an bundle. 1166 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 1167 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 1168 * @param userId Indicates the user ID. 1169 */ 1170 bool GetBundleInfo(int32_t flags, BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const; 1171 /** 1172 * @brief Obtains configuration information about an bundle. 1173 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 1174 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 1175 * @param userId Indicates the user ID. 1176 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 1177 */ 1178 ErrCode GetBundleInfoV9(int32_t flags, 1179 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const; 1180 /** 1181 * @brief Check if special metadata is in the application. 1182 * @param metaData Indicates the special metaData. 1183 * @param bundleInfos Returns true if the metadata in application; returns false otherwise. 1184 */ 1185 bool CheckSpecialMetaData(const std::string &metaData) const; 1186 /** 1187 * @brief Obtains the FormInfo objects provided by all applications on the device. 1188 * @param moduleName Indicates the module name of the application. 1189 * @param formInfos List of FormInfo objects if obtained; 1190 */ 1191 void GetFormsInfoByModule(const std::string &moduleName, std::vector<FormInfo> &formInfos) const; 1192 /** 1193 * @brief Obtains the FormInfo objects provided by a specified application on the device. 1194 * @param formInfos List of FormInfo objects if obtained; 1195 */ 1196 void GetFormsInfoByApp(std::vector<FormInfo> &formInfos) const; 1197 /** 1198 * @brief Obtains the ShortcutInfo objects provided by a specified application on the device. 1199 * @param shortcutInfos List of ShortcutInfo objects if obtained. 1200 */ 1201 void GetShortcutInfos(std::vector<ShortcutInfo> &shortcutInfos) const; 1202 /** 1203 * @brief Obtains the common event objects provided by a specified application on the device. 1204 * @param commonEvents List of common event objects if obtained. 1205 */ 1206 void GetCommonEvents(const std::string &eventKey, std::vector<CommonEventInfo> &commonEvents) const; 1207 1208 1209 std::optional<InnerModuleInfo> GetInnerModuleInfoByModuleName(const std::string &moduleName) const; 1210 1211 void GetModuleNames(std::vector<std::string> &moduleNames) const; 1212 1213 bool CheckAppInstallControl(const std::string &appId, int32_t userId) const; 1214 GetInnerModuleInfos()1215 const std::map<std::string, InnerModuleInfo> &GetInnerModuleInfos() const 1216 { 1217 return innerModuleInfos_; 1218 } 1219 /** 1220 * @brief Fetch all innerModuleInfos, can be modify. 1221 */ FetchInnerModuleInfos()1222 std::map<std::string, InnerModuleInfo> &FetchInnerModuleInfos() 1223 { 1224 return innerModuleInfos_; 1225 } 1226 /** 1227 * @brief Fetch all abilityInfos, can be modify. 1228 */ FetchAbilityInfos()1229 std::map<std::string, AbilityInfo> &FetchAbilityInfos() 1230 { 1231 return baseAbilityInfos_; 1232 } 1233 /** 1234 * @brief Obtains all abilityInfos. 1235 */ GetInnerAbilityInfos()1236 const std::map<std::string, AbilityInfo> &GetInnerAbilityInfos() const 1237 { 1238 return baseAbilityInfos_; 1239 } 1240 /** 1241 * @brief Obtains all skillInfos. 1242 */ GetInnerSkillInfos()1243 const std::map<std::string, std::vector<Skill>> &GetInnerSkillInfos() const 1244 { 1245 return skillInfos_; 1246 } 1247 /** 1248 * @brief Fetch all extensionAbilityInfos, can be modify. 1249 */ FetchInnerExtensionInfos()1250 std::map<std::string, ExtensionAbilityInfo> &FetchInnerExtensionInfos() 1251 { 1252 return baseExtensionInfos_; 1253 } 1254 /** 1255 * @brief Obtains all extensionAbilityInfos. 1256 */ GetInnerExtensionInfos()1257 const std::map<std::string, ExtensionAbilityInfo> &GetInnerExtensionInfos() const 1258 { 1259 return baseExtensionInfos_; 1260 } 1261 /** 1262 * @brief Obtains all extensionSkillInfos. 1263 */ GetExtensionSkillInfos()1264 const std::map<std::string, std::vector<Skill>> &GetExtensionSkillInfos() const 1265 { 1266 return extensionSkillInfos_; 1267 } 1268 /** 1269 * @brief Get the bundle is whether removable. 1270 * @return Return whether the bundle is removable. 1271 */ IsRemovable()1272 bool IsRemovable() const 1273 { 1274 return baseApplicationInfo_->removable; 1275 } SetIsPreInstallApp(bool isPreInstallApp)1276 void SetIsPreInstallApp(bool isPreInstallApp) 1277 { 1278 baseBundleInfo_->isPreInstallApp = isPreInstallApp; 1279 } IsPreInstallApp()1280 bool IsPreInstallApp() const 1281 { 1282 return baseBundleInfo_->isPreInstallApp; 1283 } 1284 /** 1285 * @brief Get whether the bundle is a system app. 1286 * @return Return whether the bundle is a system app. 1287 */ IsSystemApp()1288 bool IsSystemApp() const 1289 { 1290 return baseApplicationInfo_->isSystemApp; 1291 } 1292 /** 1293 * @brief Get all InnerBundleUserInfo. 1294 * @return Return about all userinfo under the app. 1295 */ GetInnerBundleUserInfos()1296 const std::map<std::string, InnerBundleUserInfo>& GetInnerBundleUserInfos() const 1297 { 1298 return innerBundleUserInfos_; 1299 } 1300 /** 1301 * @brief Reset bundle state. 1302 * @param userId Indicates the userId to set. 1303 */ 1304 void ResetBundleState(int32_t userId); 1305 /** 1306 * @brief Set userId to remove userinfo. 1307 * @param userId Indicates the userId to set. 1308 */ 1309 void RemoveInnerBundleUserInfo(int32_t userId); 1310 /** 1311 * @brief Set userId to add userinfo. 1312 * @param userId Indicates the userInfo to set. 1313 */ 1314 void AddInnerBundleUserInfo(const InnerBundleUserInfo& userInfo); 1315 /** 1316 * @brief Set userId to add userinfo. 1317 * @param userId Indicates the userInfo to set. 1318 * @param userInfo Indicates the userInfo to get. 1319 * @return Return whether the user information is obtained successfully. 1320 */ 1321 bool GetInnerBundleUserInfo(int32_t userId, InnerBundleUserInfo& userInfo) const; 1322 /** 1323 * @brief Check whether the user exists. 1324 * @param userId Indicates the userInfo to set. 1325 * @return Return whether the user exists.. 1326 */ 1327 bool HasInnerBundleUserInfo(int32_t userId) const; 1328 /** 1329 * @brief Check whether onlyCreateBundleUser. 1330 * @return Return onlyCreateBundleUser. 1331 */ IsOnlyCreateBundleUser()1332 bool IsOnlyCreateBundleUser() const 1333 { 1334 return onlyCreateBundleUser_; 1335 } 1336 /** 1337 * @brief Set onlyCreateBundleUser. 1338 * @param onlyCreateBundleUser Indicates the onlyCreateBundleUser. 1339 */ SetOnlyCreateBundleUser(bool onlyCreateBundleUser)1340 void SetOnlyCreateBundleUser(bool onlyCreateBundleUser) 1341 { 1342 onlyCreateBundleUser_ = onlyCreateBundleUser; 1343 } 1344 /** 1345 * @brief Check whether isSingleton. 1346 * @return Return isSingleton. 1347 */ IsSingleton()1348 bool IsSingleton() const 1349 { 1350 return baseApplicationInfo_->singleton; 1351 } 1352 /** 1353 * @brief Get response userId. 1354 * @param userId Indicates the request userId.. 1355 * @return Return response userId. 1356 */ 1357 int32_t GetResponseUserId(int32_t requestUserId) const; 1358 GetModuleNameVec()1359 std::vector<std::string> GetModuleNameVec() const 1360 { 1361 std::vector<std::string> moduleVec; 1362 for (const auto &it : innerModuleInfos_) { 1363 moduleVec.emplace_back(it.first); 1364 } 1365 return moduleVec; 1366 } 1367 GetAccessTokenId(const int32_t userId)1368 uint32_t GetAccessTokenId(const int32_t userId) const 1369 { 1370 InnerBundleUserInfo userInfo; 1371 if (GetInnerBundleUserInfo(userId, userInfo)) { 1372 return userInfo.accessTokenId; 1373 } 1374 return 0; 1375 } 1376 1377 void SetAccessTokenId(uint32_t accessToken, const int32_t userId); 1378 SetIsNewVersion(bool flag)1379 void SetIsNewVersion(bool flag) 1380 { 1381 isNewVersion_ = flag; 1382 } 1383 GetIsNewVersion()1384 bool GetIsNewVersion() const 1385 { 1386 return isNewVersion_; 1387 } 1388 GetAsanEnabled()1389 bool GetAsanEnabled() const 1390 { 1391 return baseApplicationInfo_->asanEnabled; 1392 } 1393 SetAsanEnabled(bool asanEnabled)1394 void SetAsanEnabled(bool asanEnabled) 1395 { 1396 baseApplicationInfo_->asanEnabled = asanEnabled; 1397 } 1398 SetAsanLogPath(const std::string & asanLogPath)1399 void SetAsanLogPath(const std::string& asanLogPath) 1400 { 1401 baseApplicationInfo_->asanLogPath = asanLogPath; 1402 } 1403 GetAsanLogPath()1404 std::string GetAsanLogPath() const 1405 { 1406 return baseApplicationInfo_->asanLogPath; 1407 } 1408 SetAllowedAcls(const std::vector<std::string> & allowedAcls)1409 void SetAllowedAcls(const std::vector<std::string> &allowedAcls) 1410 { 1411 allowedAcls_.clear(); 1412 for (const auto &acl : allowedAcls) { 1413 allowedAcls_.emplace_back(acl); 1414 } 1415 } 1416 GetAllowedAcls()1417 std::vector<std::string> GetAllowedAcls() const 1418 { 1419 return allowedAcls_; 1420 } 1421 /** 1422 * @brief ability is enabled. 1423 * @param abilityInfo Indicates the abilityInfo. 1424 * @param userId Indicates the user Id. 1425 * @return Return set ability enabled result. 1426 */ 1427 bool IsAbilityEnabled(const AbilityInfo &abilityInfo, int32_t userId) const; 1428 1429 ErrCode IsAbilityEnabledV9(const AbilityInfo &abilityInfo, int32_t userId, bool &isEnable) const; 1430 IsAccessible()1431 bool IsAccessible() const 1432 { 1433 return baseApplicationInfo_->accessible; 1434 } 1435 1436 bool GetDependentModuleNames(const std::string &moduleName, std::vector<std::string> &dependentModuleNames) const; 1437 1438 bool GetAllDependentModuleNames(const std::string &moduleName, 1439 std::vector<std::string> &dependentModuleNames) const; 1440 1441 void GetUriPrefixList(std::vector<std::string> &uriPrefixList, const std::string &excludeModule = "") const; 1442 void GetUriPrefixList(std::vector<std::string> &uriPrefixList, int32_t userId, 1443 const std::string &excludeModule = "") const; 1444 /** 1445 * @brief Whether bundle of userId should be removed. 1446 * @param userId Indicates the userId. 1447 * @return Return get bundle isRemoved result 1448 */ 1449 bool IsBundleRemovable(int32_t userId) const; 1450 /** 1451 * @brief Whether module of userId is exist. 1452 * @param moduleName Indicates the moduleName. 1453 * @param userId Indicates the userId. 1454 * @return Return get module exist result. 1455 */ 1456 bool IsUserExistModule(const std::string &moduleName, int32_t userId) const; 1457 /** 1458 * @brief whether userId's module should be removed. 1459 * @param moduleName Indicates the moduleName. 1460 * @param userId Indicates the userId. 1461 * @param isRemovable Indicates the module whether is removable. 1462 * @return Return get module isRemoved result. 1463 */ 1464 ErrCode IsModuleRemovable(const std::string &moduleName, int32_t userId, bool &isRemovable) const; 1465 /** 1466 * @brief Add module removable info 1467 * @param info Indicates the innerModuleInfo of module. 1468 * @param stringUserId Indicates the string userId add to isRmovable map. 1469 * @param isEnable Indicates the value of enable module is removed. 1470 * @return Return add module isRemovable info result. 1471 */ 1472 bool AddModuleRemovableInfo(InnerModuleInfo &info, const std::string &stringUserId, bool isEnable) const; 1473 /** 1474 * @brief Set userId's module value of isRemoved. 1475 * @param moduleName Indicates the moduleName. 1476 * @param isEnable Indicates the module isRemovable is enable. 1477 * @param userId Indicates the userId. 1478 * @return Return set module isRemoved result. 1479 */ 1480 bool SetModuleRemovable(const std::string &moduleName, bool isEnable, int32_t userId); 1481 /** 1482 * @brief Delete userId isRemoved info from module. 1483 * @param moduleName Indicates the moduleName. 1484 * @param userId Indicates the userId. 1485 * @return 1486 */ 1487 void DeleteModuleRemovable(const std::string &moduleName, int32_t userId); 1488 /** 1489 * @brief Delete removable info. 1490 * @param info Indicates the innerModuleInfo of module. 1491 * @param stringUserId Indicates the string userId of isRmovable map. 1492 * @return 1493 */ 1494 void DeleteModuleRemovableInfo(InnerModuleInfo &info, const std::string &stringUserId); 1495 SetEntryInstallationFree(bool installationFree)1496 void SetEntryInstallationFree(bool installationFree) 1497 { 1498 baseBundleInfo_->entryInstallationFree = installationFree; 1499 if (installationFree) { 1500 baseApplicationInfo_->needAppDetail = false; 1501 baseApplicationInfo_->appDetailAbilityLibraryPath = Constants::EMPTY_STRING; 1502 } 1503 } 1504 GetEntryInstallationFree()1505 bool GetEntryInstallationFree() const 1506 { 1507 return baseBundleInfo_->entryInstallationFree; 1508 } 1509 SetBundlePackInfo(const BundlePackInfo & bundlePackInfo)1510 void SetBundlePackInfo(const BundlePackInfo &bundlePackInfo) 1511 { 1512 bundlePackInfo_ = bundlePackInfo; 1513 } 1514 GetBundlePackInfo()1515 BundlePackInfo GetBundlePackInfo() const 1516 { 1517 return bundlePackInfo_; 1518 } 1519 SetAppIndex(int32_t appIndex)1520 void SetAppIndex(int32_t appIndex) 1521 { 1522 appIndex_ = appIndex; 1523 } 1524 GetAppIndex()1525 int32_t GetAppIndex() const 1526 { 1527 return appIndex_; 1528 } 1529 SetIsSandbox(bool isSandbox)1530 void SetIsSandbox(bool isSandbox) 1531 { 1532 isSandboxApp_ = isSandbox; 1533 } 1534 GetIsSandbox()1535 bool GetIsSandbox() const 1536 { 1537 return isSandboxApp_; 1538 } 1539 CleanInnerBundleUserInfos()1540 void CleanInnerBundleUserInfos() 1541 { 1542 innerBundleUserInfos_.clear(); 1543 } 1544 GetSandboxPersistentInfo()1545 std::vector<SandboxAppPersistentInfo> GetSandboxPersistentInfo() const 1546 { 1547 return sandboxPersistentInfo_; 1548 } 1549 AddSandboxPersistentInfo(const SandboxAppPersistentInfo & info)1550 void AddSandboxPersistentInfo(const SandboxAppPersistentInfo& info) 1551 { 1552 auto it = std::find_if(sandboxPersistentInfo_.begin(), sandboxPersistentInfo_.end(), [&info]( 1553 const auto &sandboxInfo) { 1554 return sandboxInfo.appIndex == info.appIndex; 1555 }); 1556 1557 if (it != sandboxPersistentInfo_.end()) { 1558 sandboxPersistentInfo_.erase(it); 1559 } 1560 sandboxPersistentInfo_.emplace_back(info); 1561 } 1562 RemoveSandboxPersistentInfo(const SandboxAppPersistentInfo & info)1563 void RemoveSandboxPersistentInfo(const SandboxAppPersistentInfo& info) 1564 { 1565 auto it = std::find_if(sandboxPersistentInfo_.begin(), sandboxPersistentInfo_.end(), [&info]( 1566 const auto &sandboxInfo) { 1567 return sandboxInfo.appIndex == info.appIndex; 1568 }); 1569 1570 if (it == sandboxPersistentInfo_.end()) { 1571 return; 1572 } 1573 sandboxPersistentInfo_.erase(it); 1574 } 1575 ClearSandboxPersistentInfo()1576 void ClearSandboxPersistentInfo() 1577 { 1578 sandboxPersistentInfo_.clear(); 1579 } 1580 GetCertificateFingerprint()1581 std::string GetCertificateFingerprint() const 1582 { 1583 return baseApplicationInfo_->fingerprint; 1584 } 1585 SetCertificateFingerprint(const std::string & fingerprint)1586 void SetCertificateFingerprint(const std::string &fingerprint) 1587 { 1588 baseApplicationInfo_->fingerprint = fingerprint; 1589 } 1590 GetNativeLibraryPath()1591 const std::string &GetNativeLibraryPath() const 1592 { 1593 return baseApplicationInfo_->nativeLibraryPath; 1594 } 1595 SetNativeLibraryPath(const std::string & nativeLibraryPath)1596 void SetNativeLibraryPath(const std::string &nativeLibraryPath) 1597 { 1598 baseApplicationInfo_->nativeLibraryPath = nativeLibraryPath; 1599 } 1600 GetArkNativeFileAbi()1601 const std::string &GetArkNativeFileAbi() const 1602 { 1603 return baseApplicationInfo_->arkNativeFileAbi; 1604 } 1605 SetArkNativeFileAbi(const std::string & arkNativeFileAbi)1606 void SetArkNativeFileAbi(const std::string &arkNativeFileAbi) 1607 { 1608 baseApplicationInfo_->arkNativeFileAbi = arkNativeFileAbi; 1609 } 1610 GetArkNativeFilePath()1611 const std::string &GetArkNativeFilePath() const 1612 { 1613 return baseApplicationInfo_->arkNativeFilePath; 1614 } 1615 SetArkNativeFilePath(const std::string & arkNativeFilePath)1616 void SetArkNativeFilePath(const std::string &arkNativeFilePath) 1617 { 1618 baseApplicationInfo_->arkNativeFilePath = arkNativeFilePath; 1619 } 1620 GetCpuAbi()1621 const std::string &GetCpuAbi() const 1622 { 1623 return baseApplicationInfo_->cpuAbi; 1624 } 1625 SetCpuAbi(const std::string & cpuAbi)1626 void SetCpuAbi(const std::string &cpuAbi) 1627 { 1628 baseApplicationInfo_->cpuAbi = cpuAbi; 1629 } 1630 SetRemovable(bool removable)1631 void SetRemovable(bool removable) 1632 { 1633 baseApplicationInfo_->removable = removable; 1634 } 1635 SetKeepAlive(bool keepAlive)1636 void SetKeepAlive(bool keepAlive) 1637 { 1638 baseApplicationInfo_->keepAlive = keepAlive; 1639 baseBundleInfo_->isKeepAlive = keepAlive; 1640 } 1641 SetSingleton(bool singleton)1642 void SetSingleton(bool singleton) 1643 { 1644 baseApplicationInfo_->singleton = singleton; 1645 baseBundleInfo_->singleton = singleton; 1646 } 1647 SetRunningResourcesApply(bool runningResourcesApply)1648 void SetRunningResourcesApply(bool runningResourcesApply) 1649 { 1650 baseApplicationInfo_->runningResourcesApply = runningResourcesApply; 1651 } 1652 SetAssociatedWakeUp(bool associatedWakeUp)1653 void SetAssociatedWakeUp(bool associatedWakeUp) 1654 { 1655 baseApplicationInfo_->associatedWakeUp = associatedWakeUp; 1656 } 1657 SetUserDataClearable(bool userDataClearable)1658 void SetUserDataClearable(bool userDataClearable) 1659 { 1660 baseApplicationInfo_->userDataClearable = userDataClearable; 1661 } 1662 SetHideDesktopIcon(bool hideDesktopIcon)1663 void SetHideDesktopIcon(bool hideDesktopIcon) 1664 { 1665 baseApplicationInfo_->hideDesktopIcon = hideDesktopIcon; 1666 if (hideDesktopIcon) { 1667 baseApplicationInfo_->needAppDetail = false; 1668 baseApplicationInfo_->appDetailAbilityLibraryPath = Constants::EMPTY_STRING; 1669 } 1670 } 1671 SetFormVisibleNotify(bool formVisibleNotify)1672 void SetFormVisibleNotify(bool formVisibleNotify) 1673 { 1674 baseApplicationInfo_->formVisibleNotify = formVisibleNotify; 1675 } 1676 SetAllowCommonEvent(const std::vector<std::string> & allowCommonEvent)1677 void SetAllowCommonEvent(const std::vector<std::string> &allowCommonEvent) 1678 { 1679 baseApplicationInfo_->allowCommonEvent.clear(); 1680 for (const auto &event : allowCommonEvent) { 1681 baseApplicationInfo_->allowCommonEvent.emplace_back(event); 1682 } 1683 } 1684 SetApplicationBundleType(BundleType type)1685 void SetApplicationBundleType(BundleType type) 1686 { 1687 baseApplicationInfo_->bundleType = type; 1688 } 1689 GetApplicationBundleType()1690 BundleType GetApplicationBundleType() const 1691 { 1692 return baseApplicationInfo_->bundleType; 1693 } 1694 SetInnerModuleAtomicPreload(const std::string & moduleName,const std::vector<std::string> & preloads)1695 bool SetInnerModuleAtomicPreload(const std::string &moduleName, const std::vector<std::string> &preloads) 1696 { 1697 if (innerModuleInfos_.find(moduleName) == innerModuleInfos_.end()) { 1698 APP_LOGE("innerBundleInfo does not contain the module."); 1699 return false; 1700 } 1701 innerModuleInfos_.at(moduleName).preloads = preloads; 1702 return true; 1703 } 1704 SetInnerModuleAtomicType(const std::string & moduleName,AtomicServiceModuleType type)1705 bool SetInnerModuleAtomicType(const std::string &moduleName, AtomicServiceModuleType type) 1706 { 1707 if (innerModuleInfos_.find(moduleName) == innerModuleInfos_.end()) { 1708 APP_LOGE("innerBundleInfo does not contain the module."); 1709 return false; 1710 } 1711 innerModuleInfos_.at(moduleName).atomicServiceModuleType = type; 1712 return true; 1713 } 1714 GetHasAtomicServiceConfig()1715 bool GetHasAtomicServiceConfig() const 1716 { 1717 return hasAtomicServiceConfig_; 1718 } 1719 SetHasAtomicServiceConfig(bool hasConfig)1720 void SetHasAtomicServiceConfig(bool hasConfig) 1721 { 1722 hasAtomicServiceConfig_ = hasConfig; 1723 } 1724 GetAtomicMainModuleName()1725 std::string GetAtomicMainModuleName() const 1726 { 1727 return mainAtomicModuleName_; 1728 } 1729 SetAtomicMainModuleName(std::string main)1730 void SetAtomicMainModuleName(std::string main) 1731 { 1732 mainAtomicModuleName_ = main; 1733 } 1734 SetAppProvisionMetadata(const std::vector<Metadata> & metadatas)1735 void SetAppProvisionMetadata(const std::vector<Metadata> &metadatas) 1736 { 1737 provisionMetadatas_ = metadatas; 1738 } 1739 GetAppProvisionMetadata()1740 std::vector<Metadata> GetAppProvisionMetadata() const 1741 { 1742 return provisionMetadatas_; 1743 } 1744 1745 void SetDisposedStatus(int32_t status); 1746 1747 int32_t GetDisposedStatus() const; 1748 1749 void SetAppDistributionType(const std::string &appDistributionType); 1750 1751 std::string GetAppDistributionType() const; 1752 1753 void SetAppProvisionType(const std::string &appProvisionType); 1754 1755 std::string GetAppProvisionType() const; 1756 1757 void SetAppCrowdtestDeadline(int64_t crowdtestDeadline); 1758 1759 int64_t GetAppCrowdtestDeadline() const; 1760 1761 std::vector<std::string> GetDistroModuleName() const; 1762 1763 std::string GetModuleNameByPackage(const std::string &packageName) const; 1764 1765 std::string GetModuleTypeByPackage(const std::string &packageName) const; 1766 1767 AppQuickFix GetAppQuickFix() const; 1768 1769 void SetAppQuickFix(const AppQuickFix &appQuickFix); 1770 1771 std::vector<HqfInfo> GetQuickFixHqfInfos() const; 1772 1773 void SetQuickFixHqfInfos(const std::vector<HqfInfo> &hqfInfos); 1774 1775 void UpdatePrivilegeCapability(const ApplicationInfo &applicationInfo); 1776 void UpdateRemovable(bool isPreInstall, bool removable); 1777 bool FetchNativeSoAttrs( 1778 const std::string &requestPackage, std::string &cpuAbi, std::string &nativeLibraryPath) const; 1779 void UpdateNativeLibAttrs(const ApplicationInfo &applicationInfo); 1780 void UpdateArkNativeAttrs(const ApplicationInfo &applicationInfo); 1781 bool IsLibIsolated(const std::string &moduleName) const; 1782 std::vector<std::string> GetDeviceType(const std::string &packageName) const; 1783 void UpdateAppDetailAbilityAttrs(); 1784 1785 private: 1786 void GetBundleWithAbilities( 1787 int32_t flags, BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const; 1788 void GetBundleWithExtension( 1789 int32_t flags, BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) const; 1790 void BuildDefaultUserInfo(); 1791 void RemoveDuplicateName(std::vector<std::string> &name) const; 1792 void GetBundleWithReqPermissionsV9(int32_t flags, uint32_t userId, BundleInfo &bundleInfo) const; 1793 void ProcessBundleFlags(int32_t flags, int32_t userId, BundleInfo &bundleInfo) const; 1794 void ProcessBundleWithHapModuleInfoFlag(int32_t flags, BundleInfo &bundleInfo, int32_t userId) const; 1795 void GetBundleWithAbilitiesV9(int32_t flags, HapModuleInfo &hapModuleInfo, int32_t userId) const; 1796 void GetBundleWithExtensionAbilitiesV9(int32_t flags, HapModuleInfo &hapModuleInfo) const; 1797 1798 // using for get 1799 Constants::AppType appType_ = Constants::AppType::THIRD_PARTY_APP; 1800 int uid_ = Constants::INVALID_UID; 1801 int gid_ = Constants::INVALID_GID; 1802 int userId_ = Constants::DEFAULT_USERID; 1803 std::string baseDataDir_; 1804 BundleStatus bundleStatus_ = BundleStatus::ENABLED; 1805 std::shared_ptr<ApplicationInfo> baseApplicationInfo_; 1806 std::shared_ptr<BundleInfo> baseBundleInfo_; // applicationInfo and abilityInfo empty 1807 std::string appFeature_; 1808 std::vector<std::string> allowedAcls_; 1809 InstallMark mark_; 1810 int32_t appIndex_ = Constants::INITIAL_APP_INDEX; 1811 int32_t disposedStatus_ = Constants::DEFAULT_DISPOSED_STATUS; 1812 bool isSandboxApp_ = false; 1813 1814 // only using for install or update progress, doesn't need to save to database 1815 std::string currentPackage_; 1816 // Auxiliary property, which is used when the application 1817 // has been installed when the user is created. 1818 bool onlyCreateBundleUser_ = false; 1819 1820 std::map<std::string, InnerModuleInfo> innerModuleInfos_; 1821 1822 std::map<std::string, std::vector<FormInfo>> formInfos_; 1823 std::map<std::string, CommonEventInfo> commonEvents_; 1824 std::map<std::string, ShortcutInfo> shortcutInfos_; 1825 1826 std::map<std::string, AbilityInfo> baseAbilityInfos_; 1827 std::map<std::string, std::vector<Skill>> skillInfos_; 1828 1829 std::map<std::string, InnerBundleUserInfo> innerBundleUserInfos_; 1830 1831 BundlePackInfo bundlePackInfo_; 1832 // new version fields 1833 bool isNewVersion_ = false; 1834 std::map<std::string, ExtensionAbilityInfo> baseExtensionInfos_; 1835 std::map<std::string, std::vector<Skill>> extensionSkillInfos_; 1836 1837 // SandBox App Persistent Info 1838 std::vector<SandboxAppPersistentInfo> sandboxPersistentInfo_; 1839 // quick fix hqf info 1840 std::vector<HqfInfo> hqfInfos_; 1841 1842 // atomicService 1843 bool hasAtomicServiceConfig_ = false; 1844 std::string mainAtomicModuleName_; 1845 1846 // provision metadata 1847 std::vector<Metadata> provisionMetadatas_; 1848 }; 1849 1850 void from_json(const nlohmann::json &jsonObject, InnerModuleInfo &info); 1851 void from_json(const nlohmann::json &jsonObject, SkillUri &uri); 1852 void from_json(const nlohmann::json &jsonObject, Skill &skill); 1853 void from_json(const nlohmann::json &jsonObject, Distro &distro); 1854 void from_json(const nlohmann::json &jsonObject, InstallMark &installMark); 1855 void from_json(const nlohmann::json &jsonObject, DefinePermission &definePermission); 1856 void from_json(const nlohmann::json &jsonObject, SandboxAppPersistentInfo &sandboxPersistentInfo); 1857 void from_json(const nlohmann::json &jsonObject, Dependency &dependency); 1858 } // namespace AppExecFwk 1859 } // namespace OHOS 1860 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_INFO_H