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_ABILITY_INFO_H 17 #define FOUNDATION_ABILITY_RUNTIME_SIMULATOR_COMMON_ABILITY_INFO_H 18 19 #include <string> 20 #include <vector> 21 22 #include "application_info.h" 23 #include "extension_ability_info.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 enum class AbilityType { 28 UNKNOWN = 0, 29 PAGE, 30 SERVICE, 31 DATA, 32 FORM, 33 EXTENSION, 34 }; 35 36 enum class BackgroundMode { 37 DEFAULT = 0, 38 DATA_TRANSFER = 1 << 0, 39 AUDIO_PLAYBACK = 1 << 1, 40 AUDIO_RECORDING = 1 << 2, 41 LOCATION = 1 << 3, 42 BLUETOOTH_INTERACTION = 1 << 4, 43 MULTI_DEVICE_CONNECTION = 1 << 5, 44 WIFI_INTERACTION = 1 << 6, 45 VOIP = 1 << 7, 46 TASK_KEEPING = 1 << 8, 47 }; 48 49 enum class AbilitySubType { 50 UNSPECIFIED = 0, 51 CA, 52 }; 53 54 enum class DisplayOrientation { 55 UNSPECIFIED = 0, 56 LANDSCAPE, 57 PORTRAIT, 58 FOLLOWRECENT, 59 LANDSCAPE_INVERTED, 60 PORTRAIT_INVERTED, 61 AUTO_ROTATION, 62 AUTO_ROTATION_LANDSCAPE, 63 AUTO_ROTATION_PORTRAIT, 64 AUTO_ROTATION_RESTRICTED, 65 AUTO_ROTATION_LANDSCAPE_RESTRICTED, 66 AUTO_ROTATION_PORTRAIT_RESTRICTED, 67 LOCKED, 68 }; 69 70 enum class LaunchMode { 71 SINGLETON = 0, 72 STANDARD, // support more than one instance 73 SPECIFIED, 74 }; 75 76 enum class SupportWindowMode { 77 FULLSCREEN = 0, 78 SPLIT, 79 FLOATING, 80 }; 81 82 // configuration information about an ability 83 struct AbilityInfo { 84 std::string name; // ability name, only the main class name 85 std::string label; 86 std::string description; 87 std::string iconPath; 88 int32_t labelId; 89 int32_t descriptionId; 90 int32_t iconId; 91 std::string theme; 92 bool visible = false; 93 std::string kind; // ability category 94 AbilityType type = AbilityType::UNKNOWN; 95 ExtensionAbilityType extensionAbilityType = ExtensionAbilityType::UNSPECIFIED; 96 DisplayOrientation orientation = DisplayOrientation::UNSPECIFIED; 97 LaunchMode launchMode = LaunchMode::SINGLETON; 98 std::string srcPath; 99 std::string srcLanguage = "js"; 100 std::vector<std::string> permissions; 101 102 std::string process; 103 std::vector<std::string> deviceTypes; 104 std::vector<std::string> deviceCapabilities; 105 std::string uri; 106 std::string targetAbility; 107 ApplicationInfo applicationInfo; 108 bool isLauncherAbility = false; 109 bool isNativeAbility = false; 110 bool enabled = false; 111 bool supportPipMode = false; 112 bool formEnabled = false; 113 bool removeMissionAfterTerminate = false; 114 std::string readPermission; 115 std::string writePermission; 116 std::vector<std::string> configChanges; 117 uint32_t formEntity = 0; 118 int32_t minFormHeight = 0; 119 int32_t defaultFormHeight = 0; 120 int32_t minFormWidth = 0; 121 int32_t defaultFormWidth = 0; 122 MetaData metaData; 123 uint32_t backgroundModes = 0; 124 125 std::vector<SkillUriForAbilityAndExtension> skillUri; 126 127 // set when install 128 std::string package; // the "module.package" in config.json 129 std::string bundleName; 130 std::string moduleName; // the "module.name" in config.json 131 std::string applicationName; // the "bundlename" in config.json 132 133 std::string codePath; // ability main code path with name 134 std::string resourcePath; // resource path for resource init 135 std::string hapPath; 136 137 std::string srcEntrance; 138 std::vector<Metadata> metadata; 139 bool isModuleJson = false; 140 bool isStageBasedModel = false; 141 bool continuable = false; 142 int32_t priority = 0; 143 144 // configuration fields on startup page 145 std::string startWindowIcon; 146 int32_t startWindowIconId; 147 std::string startWindowBackground; 148 int32_t startWindowBackgroundId; 149 // whether to display in the missions list 150 bool excludeFromMissions = false; 151 bool unclearableMission = false; 152 // whether to support recover UI interface 153 bool recoverable = false; 154 155 // support windows mode 156 std::vector<SupportWindowMode> windowModes; 157 double maxWindowRatio = 0; 158 double minWindowRatio = 0; 159 uint32_t maxWindowWidth = 0; 160 uint32_t minWindowWidth = 0; 161 uint32_t maxWindowHeight = 0; 162 uint32_t minWindowHeight = 0; 163 // for NAPI, save self query cache 164 int32_t uid = -1; 165 CompileMode compileMode = CompileMode::JS_BUNDLE; 166 167 // unused 168 std::string originalBundleName; 169 std::string appName; 170 std::string privacyUrl; 171 std::string privacyName; 172 std::string downloadUrl; 173 std::string versionName; 174 std::string className; 175 std::string originalClassName; 176 std::string uriPermissionMode; 177 std::string uriPermissionPath; 178 uint32_t packageSize = 0; 179 bool multiUserShared = false; 180 bool grantPermission = false; 181 bool directLaunch = true; 182 AbilitySubType subType = AbilitySubType::UNSPECIFIED; 183 std::string libPath; 184 std::string deviceId; 185 int64_t installTime; 186 std::vector<std::string> supportExtNames; 187 std::vector<std::string> supportMimeTypes; 188 }; 189 } // namespace AppExecFwk 190 } // namespace OHOS 191 #endif // FOUNDATION_ABILITY_RUNTIME_SIMULATOR_COMMON_ABILITY_INFO_H 192