1 /* 2 * Copyright (c) 2023-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_OPTIONS_H 17 #define FOUNDATION_ABILITY_RUNTIME_SIMULATOR_OPTIONS_H 18 19 #include <functional> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "ability_info.h" 25 #include "application_info.h" 26 #include "configuration.h" 27 #include "hap_module_info.h" 28 29 namespace OHOS { 30 namespace AbilityRuntime { 31 enum class DeviceType { 32 PHONE, 33 TV, 34 WATCH, 35 CAR, 36 TABLET, 37 TWO_IN_ONE, 38 WEARABLE, 39 UNKNOWN, 40 }; 41 42 enum class DeviceOrientation : int32_t { 43 PORTRAIT, 44 LANDSCAPE, 45 ORIENTATION_UNDEFINED, 46 }; 47 48 enum class ColorMode : int32_t { 49 LIGHT = 0, 50 DARK, 51 COLOR_MODE_UNDEFINED, 52 }; 53 54 struct DeviceConfig { 55 DeviceOrientation orientation { DeviceOrientation::PORTRAIT }; 56 double density { 1.0 }; 57 DeviceType deviceType { DeviceType::PHONE }; 58 double fontRatio { 1.0 }; 59 ColorMode colorMode { ColorMode::LIGHT }; 60 }; 61 62 struct DeviceResourceInfo { 63 DeviceConfig deviceConfig; 64 std::vector<int64_t> resourcehandlers; 65 std::string packagePath; 66 int32_t themeId { -1 }; 67 }; 68 69 struct DependencyHspInfo { 70 std::string moduleName; 71 std::string resourcePath; // resources.index path 72 std::vector<uint8_t> moduleJsonBuffer; // module.json buffer 73 }; 74 75 using SendCurrentRouterCallback = bool (*)(const std::string currentRouterPath); 76 using CallbackTypePostTask = std::function<void(const std::function<void()>&, int64_t)>; 77 78 struct Options { 79 bool isComponentMode = false; 80 std::string bundleName; 81 std::string moduleName; 82 std::string modulePath; 83 std::string resourcePath; 84 int debugPort = -1; 85 std::string assetPath; 86 std::string systemResourcePath; 87 std::string appResourcePath; 88 std::string containerSdkPath; 89 std::string url; 90 std::string language; 91 std::string region; 92 std::string script; 93 uint32_t themeId; 94 int32_t deviceWidth; 95 int32_t deviceHeight; 96 bool isRound; 97 SendCurrentRouterCallback onRouterChange; 98 DeviceConfig deviceConfig; 99 int32_t compatibleVersion; 100 bool installationFree; 101 int32_t labelId; 102 std::string compileMode; 103 std::string pageProfile; 104 int32_t targetVersion; 105 std::string releaseType; 106 bool enablePartialUpdate; 107 std::string previewPath; 108 bool enableFileOperation = false; 109 AppExecFwk::ApplicationInfo applicationInfo; 110 AppExecFwk::HapModuleInfo hapModuleInfo; 111 AppExecFwk::AbilityInfo abilityInfo; 112 std::shared_ptr<AppExecFwk::Configuration> configuration; 113 std::vector<uint8_t> moduleJsonBuffer; 114 CallbackTypePostTask postTask; 115 std::map<std::string, std::string> pkgContextInfoJsonStringMap; 116 std::map<std::string, std::string> packageNameList; 117 std::vector<DependencyHspInfo> dependencyHspInfos; 118 }; 119 } // namespace AbilityRuntime 120 } // namespace OHOS 121 #endif // FOUNDATION_ABILITY_RUNTIME_SIMULATOR_OPTIONS_H 122