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_BUNDLE_PACK_INFO_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_PACK_INFO_H 18 19 #include <string> 20 #include <vector> 21 22 #include "parcel.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 27 enum BundlePackFlag { 28 GET_PACK_INFO_ALL = 0x00000000, 29 GET_PACKAGES = 0x00000001, 30 GET_BUNDLE_SUMMARY = 0x00000002, 31 GET_MODULE_SUMMARY = 0x00000004, 32 }; 33 34 struct Version { 35 uint32_t code = 0; 36 std::string name; 37 uint32_t minCompatibleVersionCode = 0; 38 }; 39 40 struct PackageApp { 41 std::string bundleName; 42 Version version; 43 }; 44 45 struct AbilityFormInfo { 46 std::string name; 47 std::string type; 48 bool updateEnabled = false; 49 std::string scheduledUpdateTime; 50 uint32_t updateDuration = 0; 51 std::vector<std::string> supportDimensions; 52 std::string defaultDimension; 53 }; 54 55 struct ModuleAbilityInfo { 56 std::string name; 57 std::string label; 58 bool visible = false; 59 std::vector<AbilityFormInfo> forms; 60 }; 61 62 struct ModuleDistro { 63 std::string moduleType; 64 std::string moduleName; 65 bool installationFree = false; 66 bool deliveryWithInstall = false; 67 }; 68 69 struct ApiVersion { 70 uint32_t compatible = 0; 71 std::string releaseType; 72 uint32_t target = 0; 73 }; 74 75 struct ExtensionAbilities { 76 std::string name; 77 std::vector<AbilityFormInfo> forms; 78 }; 79 80 struct PackageModule { 81 std::string mainAbility; 82 std::vector<std::string> deviceType; 83 std::vector<ModuleAbilityInfo> abilities; 84 std::vector<ExtensionAbilities> extensionAbilities; 85 ModuleDistro distro; 86 ApiVersion apiVersion; 87 }; 88 89 struct Summary { 90 PackageApp app; 91 std::vector<PackageModule> modules; 92 }; 93 94 struct Packages { 95 std::vector<std::string> deviceType; 96 std::string moduleType; 97 bool deliveryWithInstall = false; 98 std::string name; 99 }; 100 101 struct BundlePackInfo : public Parcelable { 102 Summary summary; 103 std::vector<Packages> packages; 104 GetValidBundlePackInfo105 bool GetValid() const 106 { 107 return isValid_; 108 } SetValidBundlePackInfo109 void SetValid(bool isValid) 110 { 111 isValid_ = isValid; 112 } 113 bool ReadFromParcel(Parcel &parcel); 114 virtual bool Marshalling(Parcel &parcel) const override; 115 static BundlePackInfo *Unmarshalling(Parcel &parcel); 116 private: 117 bool isValid_ = false; 118 }; 119 } // AppExecFwk 120 } // OHOS 121 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_PACK_INFO_H 122