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_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     UNKNOWN,
38 };
39 
40 enum class DeviceOrientation : int32_t {
41     PORTRAIT,
42     LANDSCAPE,
43     ORIENTATION_UNDEFINED,
44 };
45 
46 enum class ColorMode : int32_t {
47     LIGHT = 0,
48     DARK,
49     COLOR_MODE_UNDEFINED,
50 };
51 
52 struct DeviceConfig {
53     DeviceOrientation orientation { DeviceOrientation::PORTRAIT };
54     double density { 1.0 };
55     DeviceType deviceType { DeviceType::PHONE };
56     double fontRatio { 1.0 };
57     ColorMode colorMode { ColorMode::LIGHT };
58 };
59 
60 struct DeviceResourceInfo {
61     DeviceConfig deviceConfig;
62     std::vector<int64_t> resourcehandlers;
63     std::string packagePath;
64     int32_t themeId { -1 };
65 };
66 
67 using SendCurrentRouterCallback = bool (*)(const std::string currentRouterPath);
68 using CallbackTypePostTask = std::function<void(const std::function<void()>&, int64_t)>;
69 
70 struct Options {
71     std::string bundleName;
72     std::string moduleName;
73     std::string modulePath;
74     std::string resourcePath;
75     int debugPort = -1;
76     std::string assetPath;
77     std::string systemResourcePath;
78     std::string appResourcePath;
79     std::string containerSdkPath;
80     std::string url;
81     std::string language;
82     std::string region;
83     std::string script;
84     uint32_t themeId;
85     int32_t deviceWidth;
86     int32_t deviceHeight;
87     bool isRound;
88     SendCurrentRouterCallback onRouterChange;
89     DeviceConfig deviceConfig;
90     int32_t compatibleVersion;
91     bool installationFree;
92     int32_t labelId;
93     std::string compileMode;
94     std::string pageProfile;
95     int32_t targetVersion;
96     std::string releaseType;
97     bool enablePartialUpdate;
98     std::string previewPath;
99     AppExecFwk::ApplicationInfo applicationInfo;
100     AppExecFwk::HapModuleInfo hapModuleInfo;
101     AppExecFwk::AbilityInfo abilityInfo;
102     std::shared_ptr<AppExecFwk::Configuration> configuration;
103     std::vector<uint8_t> moduleJsonBuffer;
104     CallbackTypePostTask postTask;
105     std::map<std::string, std::string> pkgContextInfoJsonStringMap;
106     std::map<std::string, std::string> packageNameList;
107 };
108 } // namespace AbilityRuntime
109 } // namespace OHOS
110 #endif // FOUNDATION_ABILITY_RUNTIME_SIMULATOR_OPTIONS_H
111