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