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_INFO_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_INFO_H 18 19 #include <string> 20 #include <vector> 21 22 #include "parcel.h" 23 24 #include "ability_info.h" 25 #include "application_info.h" 26 #include "extension_ability_info.h" 27 #include "hap_module_info.h" 28 #include "message_parcel.h" 29 #include "overlay/overlay_bundle_info.h" 30 31 namespace OHOS { 32 namespace AppExecFwk { 33 enum BundleFlag { 34 // get bundle info except abilityInfos 35 GET_BUNDLE_DEFAULT = 0x00000000, 36 // get bundle info include abilityInfos 37 GET_BUNDLE_WITH_ABILITIES = 0x00000001, 38 // get bundle info include request permissions 39 GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010, 40 // get bundle info include extension info 41 GET_BUNDLE_WITH_EXTENSION_INFO = 0x00000020, 42 // get bundle info include hash value 43 GET_BUNDLE_WITH_HASH_VALUE = 0x00000030, 44 // get bundle info inlcude menu, only for dump usage 45 GET_BUNDLE_WITH_MENU = 0x00000040, 46 }; 47 48 enum class GetBundleInfoFlag { 49 GET_BUNDLE_INFO_DEFAULT = 0x00000000, 50 GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, 51 GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, 52 GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, 53 GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, 54 GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, 55 GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, 56 GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, 57 GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, 58 GET_BUNDLE_INFO_WITH_MENU = 0x00000100, 59 }; 60 61 struct RequestPermissionUsedScene : public Parcelable { 62 std::vector<std::string> abilities; 63 std::string when; 64 65 bool ReadFromParcel(Parcel &parcel); 66 virtual bool Marshalling(Parcel &parcel) const override; 67 static RequestPermissionUsedScene *Unmarshalling(Parcel &parcel); 68 }; 69 70 struct RequestPermission : public Parcelable { 71 std::string name; 72 std::string moduleName; 73 std::string reason; 74 int32_t reasonId = 0; 75 RequestPermissionUsedScene usedScene; 76 77 bool ReadFromParcel(Parcel &parcel); 78 virtual bool Marshalling(Parcel &parcel) const override; 79 static RequestPermission *Unmarshalling(Parcel &parcel); 80 }; 81 82 struct SignatureInfo : public Parcelable { 83 std::string appId; 84 std::string fingerprint; 85 std::string appIdentifier; 86 87 bool ReadFromParcel(Parcel &parcel); 88 virtual bool Marshalling(Parcel &parcel) const override; 89 static SignatureInfo *Unmarshalling(Parcel &parcel); 90 }; 91 92 // configuration information about a bundle 93 struct BundleInfo : public Parcelable { 94 std::string name; 95 96 uint32_t versionCode = 0; 97 std::string versionName; 98 uint32_t minCompatibleVersionCode = 0; 99 100 uint32_t compatibleVersion = 0; 101 uint32_t targetVersion = 0; 102 103 bool isKeepAlive = false; 104 bool singleton = false; 105 bool isPreInstallApp = false; 106 107 std::string vendor; 108 std::string releaseType; 109 bool isNativeApp = false; 110 111 std::string mainEntry; // modulePackage 112 std::string entryModuleName; // moduleName 113 bool entryInstallationFree = false; // application : false; atomic service : true 114 std::string appId; 115 std::vector<std::string> oldAppIds; // used for appId changed 116 117 // user related fields, assign when calling the get interface 118 int uid = -1; 119 int gid = -1; 120 int64_t installTime = 0; 121 int64_t updateTime = 0; 122 int32_t appIndex = 0; // index for sandbox app 123 124 ApplicationInfo applicationInfo; 125 std::vector<AbilityInfo> abilityInfos; 126 std::vector<ExtensionAbilityInfo> extensionInfos; 127 std::vector<HapModuleInfo> hapModuleInfos; 128 std::vector<std::string> hapModuleNames; // the "module.package" in each config.json 129 std::vector<std::string> moduleNames; // the "module.name" in each config.json 130 std::vector<std::string> modulePublicDirs; // the public paths of all modules of the application. 131 std::vector<std::string> moduleDirs; // the paths of all modules of the application. 132 std::vector<std::string> moduleResPaths; // the paths of all resources paths. 133 134 std::vector<std::string> reqPermissions; 135 std::vector<std::string> defPermissions; 136 std::vector<int32_t> reqPermissionStates; 137 std::vector<RequestPermission> reqPermissionDetails; 138 std::vector<OverlayBundleInfo> overlayBundleInfos; 139 140 // unused 141 std::string cpuAbi; 142 std::string seInfo; 143 std::string label; 144 std::string description; 145 std::string jointUserId; 146 int32_t minSdkVersion = -1; 147 int32_t maxSdkVersion = -1; 148 bool isDifferentName = false; 149 int32_t overlayType = NON_OVERLAY_TYPE; 150 151 SignatureInfo signatureInfo; 152 153 bool ReadFromParcel(Parcel &parcel); 154 virtual bool Marshalling(Parcel &parcel) const override; 155 static BundleInfo *Unmarshalling(Parcel &parcel); 156 }; 157 } // namespace AppExecFwk 158 } // namespace OHOS 159 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_INFO_H 160