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_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_HAP_MODULE_INFO_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_HAP_MODULE_INFO_H 18 19 #include <string> 20 21 #include "ability_info.h" 22 #include "extension_ability_info.h" 23 #include "parcel.h" 24 #include "quick_fix/hqf_info.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 enum class ModuleColorMode { 29 AUTO = -1, 30 DARK, 31 LIGHT, 32 }; 33 34 enum class ModuleType { 35 UNKNOWN = 0, 36 ENTRY = 1, 37 FEATURE = 2, 38 SHARED = 3 39 }; 40 41 enum class AtomicServiceModuleType { 42 NORMAL = 0, 43 MAIN = 1, 44 }; 45 46 struct PreloadItem : public Parcelable { 47 std::string moduleName; 48 49 PreloadItem() = default; PreloadItemPreloadItem50 explicit PreloadItem(std::string name) : moduleName(name) {} 51 bool ReadFromParcel(Parcel &parcel); 52 virtual bool Marshalling(Parcel &parcel) const override; 53 static PreloadItem *Unmarshalling(Parcel &parcel); 54 }; 55 56 // configuration information about an module 57 struct HapModuleInfo : public Parcelable { 58 std::string name; // module.name in config.json 59 std::string package; 60 std::string moduleName; // module.distro.moduleName in config.json 61 std::string description; 62 int32_t descriptionId = 0; 63 std::string iconPath; 64 int32_t iconId = 0; 65 std::string label; 66 int32_t labelId = 0; 67 std::string backgroundImg; 68 std::string mainAbility; 69 std::string srcPath; 70 std::string hashValue; 71 std::string hapPath; 72 int supportedModes = 0; 73 bool isLibIsolated = false; 74 std::string nativeLibraryPath; 75 std::string cpuAbi; 76 77 // quick fix hqf info 78 HqfInfo hqfInfo; 79 80 std::vector<std::string> reqCapabilities; 81 std::vector<std::string> deviceTypes; 82 std::vector<std::string> dependencies; 83 std::vector<AbilityInfo> abilityInfos; 84 ModuleColorMode colorMode = ModuleColorMode::AUTO; 85 // new version fields 86 std::string bundleName; 87 std::string mainElementName; 88 std::string pages; 89 std::string process; 90 std::string resourcePath; 91 std::string srcEntrance; 92 std::string uiSyntax; 93 std::string virtualMachine; 94 bool deliveryWithInstall = false; 95 bool installationFree = false; 96 bool isModuleJson = false; 97 bool isStageBasedModel = false; 98 std::map<std::string, bool> isRemovable; 99 ModuleType moduleType = ModuleType::UNKNOWN; 100 std::vector<ExtensionAbilityInfo> extensionInfos; 101 std::vector<Metadata> metadata; 102 int32_t upgradeFlag = 0; 103 CompileMode compileMode = CompileMode::JS_BUNDLE; 104 std::string moduleSourceDir; 105 AtomicServiceModuleType atomicServiceModuleType = AtomicServiceModuleType::NORMAL; 106 std::vector<PreloadItem> preloads; 107 bool ReadFromParcel(Parcel &parcel); 108 virtual bool Marshalling(Parcel &parcel) const override; 109 static HapModuleInfo *Unmarshalling(Parcel &parcel); 110 }; 111 } // namespace AppExecFwk 112 } // namespace OHOS 113 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_HAP_MODULE_INFO_H 114