1 /* 2 * Copyright (c) 2023 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_APPLICATION_INFO_H 17 #define FOUNDATION_ABILITY_RUNTIME_SIMULATOR_COMMON_APPLICATION_INFO_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 #include "module_info.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 namespace { 27 static const std::string AVAILABLELEVEL_NORMAL = "normal"; 28 static const std::string DEFAULT_ENTITY_TYPE = "unspecified"; 29 static const std::string DEFAULT_COMPILE_SDK_TYPE = "OpenHarmony"; 30 } 31 enum ApplicationFlag { 32 GET_BASIC_APPLICATION_INFO = 0x00000000, 33 GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, 34 GET_APPLICATION_INFO_WITH_METADATA = 0x00000040, 35 GET_APPLICATION_INFO_WITH_DISABLE = 0x00000200, 36 GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT = 0x00000400, 37 GET_ALL_APPLICATION_INFO = 0xFFFF0000, 38 }; 39 40 enum class GetApplicationFlag { 41 GET_APPLICATION_INFO_DEFAULT = 0x00000000, 42 GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000001, 43 GET_APPLICATION_INFO_WITH_METADATA = 0x00000002, 44 GET_APPLICATION_INFO_WITH_DISABLE = 0x00000004, 45 }; 46 47 enum class BundleType { 48 APP = 0, 49 ATOMIC_SERVICE = 1, 50 SHARED = 2, 51 }; 52 53 enum class CompatiblePolicy { 54 NORMAL = 0, 55 BACKWARD_COMPATIBILITY = 1, 56 }; 57 58 struct Metadata { 59 std::string name; 60 std::string value; 61 std::string resource; 62 }; 63 64 struct CustomizeData { 65 std::string name; 66 std::string value; 67 std::string extra; 68 }; 69 70 struct MetaData { 71 std::vector<CustomizeData> customizeData; 72 }; 73 74 struct Resource { 75 /** the hap bundle name */ 76 std::string bundleName; 77 78 /** the hap module name */ 79 std::string moduleName; 80 81 /** the resource id in hap */ 82 int32_t id = 0; 83 }; 84 85 // configuration information about an application 86 struct ApplicationInfo { 87 std::string name; // application name is same to bundleName 88 std::string bundleName; 89 90 uint32_t versionCode = 0; 91 std::string versionName; 92 int32_t minCompatibleVersionCode = 0; 93 94 uint32_t apiCompatibleVersion = 0; 95 int32_t apiTargetVersion = 0; 96 int64_t crowdtestDeadline = -1; 97 98 std::string iconPath; 99 int32_t iconId = 0; 100 Resource iconResource; 101 102 std::string label; 103 int32_t labelId = 0; 104 Resource labelResource; 105 106 std::string description; 107 int32_t descriptionId = 0; 108 Resource descriptionResource; 109 110 bool keepAlive = false; 111 bool removable = true; 112 bool singleton = false; 113 bool userDataClearable = true; 114 bool accessible = false; 115 bool runningResourcesApply = false; 116 bool associatedWakeUp = false; 117 bool hideDesktopIcon = false; 118 bool formVisibleNotify = false; 119 std::vector<std::string> allowCommonEvent; 120 std::vector<int32_t> resourcesApply; 121 122 bool isSystemApp = false; 123 bool isLauncherApp = false; 124 bool isFreeInstallApp = false; 125 bool asanEnabled = false; 126 std::string asanLogPath; 127 128 std::string codePath; 129 std::string dataDir; 130 std::string dataBaseDir; 131 std::string cacheDir; 132 std::string entryDir; 133 134 std::string apiReleaseType; 135 bool debug = false; 136 std::string deviceId; 137 bool distributedNotificationEnabled = true; 138 std::string entityType = DEFAULT_ENTITY_TYPE; 139 std::string process; 140 int32_t supportedModes = 0; // returns 0 if the application does not support the driving mode 141 std::string vendor; 142 143 // apl 144 std::string appPrivilegeLevel = AVAILABLELEVEL_NORMAL; 145 std::string appDistributionType = "none"; 146 std::string appProvisionType = "release"; 147 148 // user related fields, assign when calling the get interface 149 uint32_t accessTokenId = 0; 150 uint64_t accessTokenIdEx = 0; 151 bool enabled = false; 152 int32_t uid = -1; 153 154 // native so 155 std::string nativeLibraryPath; 156 std::string cpuAbi; 157 std::string arkNativeFilePath; 158 std::string arkNativeFileAbi; 159 160 // assign when calling the get interface 161 std::vector<std::string> permissions; 162 std::vector<std::string> moduleSourceDirs; 163 std::vector<ModuleInfo> moduleInfos; 164 std::map<std::string, std::vector<CustomizeData>> metaData; 165 std::map<std::string, std::vector<Metadata>> metadata; 166 // Installation-free 167 std::vector<std::string> targetBundleList; 168 169 std::string fingerprint; 170 171 // unused 172 std::string icon; 173 int32_t flags = 0; 174 std::string entryModuleName; 175 bool isCompressNativeLibs = true; 176 std::string signatureKey; 177 178 // switch 179 bool multiProjects = false; 180 181 // app detail ability 182 bool needAppDetail = false; 183 std::string appDetailAbilityLibraryPath; 184 185 // overlay installation 186 std::string targetBundleName; 187 int32_t targetPriority; 188 int32_t overlayState; 189 190 bool split = true; 191 BundleType bundleType = BundleType::APP; 192 193 std::string compileSdkVersion; 194 std::string compileSdkType = DEFAULT_COMPILE_SDK_TYPE; 195 }; 196 } // namespace AppExecFwk 197 } // namespace OHOS 198 #endif // FOUNDATION_ABILITY_RUNTIME_SIMULATOR_COMMON_APPLICATION_INFO_H 199