• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 OHOS_FORM_FWK_FORM_CONSTANTS_H
17 #define OHOS_FORM_FWK_FORM_CONSTANTS_H
18 
19 #include <map>
20 #include <string>
21 
22 namespace OHOS {
23 namespace AppExecFwk {
24 namespace Constants {
25     constexpr const char* PERMISSION_REQUIRE_FORM = "ohos.permission.REQUIRE_FORM";
26     constexpr const char* PERMISSION_KEEP_BACKGROUND_RUNNING = "ohos.permission.KEEP_BACKGROUND_RUNNING";
27     constexpr const char* PARAM_FORM_IDENTITY_KEY = "ohos.extra.param.key.form_identity";
28     constexpr const char* PARAM_FORM_CALLING_IDENTITY_KEY = "ohos.extra.param.key.form_calling_identity";
29     constexpr const char* PARAM_MODULE_NAME_KEY = "ohos.extra.param.key.module_name";
30     constexpr const char* PARAM_BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name";
31     constexpr const char* PARAM_ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name";
32     constexpr const char* PARAM_FORM_NAME_KEY = "ohos.extra.param.key.form_name";
33     constexpr const char* PARAM_FORM_DIMENSION_KEY = "ohos.extra.param.key.form_dimension";
34     constexpr const char* PARAM_MESSAGE_KEY = "ohos.extra.param.key.message";
35     constexpr const char* PARAM_FORM_TEMPORARY_KEY = "ohos.extra.param.key.form_temporary";
36     constexpr const char* PARAM_FORM_WIDTH_KEY = "ohos.extra.param.key.form_width";
37     constexpr const char* PARAM_FORM_HEIGHT_KEY = "ohos.extra.param.key.form_height";
38     constexpr int32_t ONE_HOST_MAX_FORM_SIZE = 256;
39     constexpr const char* RECREATE_FORM_KEY = "ohos.extra.param.key.recreate";
40     constexpr const char* PARAM_FORM_CUSTOMIZE_KEY = "ohos.extra.param.key.form_customize";
41     constexpr const char* PARAM_FORM_ORIENTATION_KEY = "ohos.extra.param.key.form_orientation";
42     constexpr int32_t ORIENTATION_PORTRAIT = 1;
43     constexpr int32_t ORIENTATION_LANDSCAPE = 2;
44     constexpr const char* PARAM_FORM_ABILITY_NAME_KEY = "abilityName";
45     constexpr const char* PARAM_FORM_USER_ID = "ohos.extra.param.key.form_user_id";
46     constexpr const char* KEY_IS_TIMER = "isCountTimerRefresh";
47     constexpr const char* KEY_TIMER_REFRESH = "isTimerRefresh";
48     constexpr const char* SYSTEM_PARAM_FORM_UPDATE_TIME = "persist.sys.fms.form.update.time";
49     constexpr const char* SYSTEM_PARAM_FORM_REFRESH_MIN_TIME = "persist.sys.fms.form.refresh.min.time";
50     constexpr const char* ACTION_UPDATEATTIMER = "form_update_at_timer";
51     constexpr const char* KEY_WAKEUP_TIME = "wakeUpTime";
52     constexpr const char* KEY_WAKEUP_TIME_LEFT = "wakeUpTimeLeft";
53     constexpr const char* KEY_WAKEUP_TIME_RIGHT = "wakeUpTimeRight";
54     constexpr const char* KEY_ACTION_TYPE = "form_update_action_type";
55     constexpr const char* ABS_CODE_PATH = "/data/app/el1/bundle/public";
56     constexpr const char* LOCAL_CODE_PATH = "/data/storage/el1/bundle";
57     constexpr const char* LOCAL_BUNDLES = "/data/bundles";
58     constexpr const char* FORM_PUBLISH_ACTION = "action.form.publish";
59     constexpr const char* PARAM_DEVICE_ID_KEY = "ohos.extra.param.key.device_id";
60     constexpr const char* PARAM_FORM_HOST_TOKEN = "ohos.extra.param.form.host.token";
61     constexpr const char* PARAM_FORM_ID = "formID";
62     constexpr int32_t TYPE_RESET_LIMIT = 1;
63     constexpr int32_t TYPE_STATIC_UPDATE = 2;
64     constexpr int32_t TYPE_DYNAMIC_UPDATE = 3;
65     const long ABS_REFRESH_MS = 2500;
66 
67     // The form events type which means that the form becomes visible.
68     constexpr int32_t FORM_VISIBLE = 1;
69     // The form events type which means that the form becomes invisible.
70     constexpr int32_t FORM_INVISIBLE = 2;
71 
72     // The default user id
73     constexpr int32_t DEFAULT_USER_ID = 0;
74 
75     // The max uid of system app.
76     constexpr int32_t MAX_SYSTEM_APP_UID = 10000;
77 
78     constexpr int32_t MIN_TIME_SPEED = 1;
79     constexpr int32_t MAX_TIME_SPEED = 1000;
80     constexpr int32_t MAX_HOUR = 23;
81     constexpr int32_t MAX_MINUTE = 59;
82     constexpr int32_t MAX_SECOND = 60;
83     constexpr int32_t MIN_TIME = 0;
84     constexpr int32_t HOUR_PER_DAY = 24;
85     constexpr int32_t MIN_PER_HOUR = 60;
86     constexpr int32_t SEC_PER_MIN = 60;
87     constexpr int32_t MS_PER_DAY = 24 * 60 * 60 * 1000;
88     const long TIME_1000 = 1000;
89     const long TIME_1000000 = 1000000;
90     const long TIME_CONVERSION = 30 * 60 * TIME_1000;
91     constexpr int32_t MIN_CONFIG_DURATION = 1; // 1 means 30 min
92     constexpr int32_t MAX_CONFIG_DURATION = 2 * 24 * 7; // one week
93     const long MIN_PERIOD = MIN_CONFIG_DURATION * TIME_CONVERSION; // 30 min in ms unit
94     const long MAX_PERIOD = MAX_CONFIG_DURATION * TIME_CONVERSION; // 1 week in ms unit
95     const long ABS_TIME = 5 * TIME_1000; // 5s abs time
96     constexpr int32_t WORK_POOL_SIZE = 4;
97     constexpr const char* TIME_DELIMETER = ":";
98     constexpr int32_t UPDATE_AT_CONFIG_COUNT = 2;
99 
100     constexpr int32_t LIMIT_COUNT = 50;
101     constexpr int32_t MIN_NEXT_TIME = 300; // seconds
102 
103     // The max retry times of reconnection.
104     constexpr int32_t MAX_RETRY_TIME = 30;
105     // The time interval between reconnections(milliseconds).
106     constexpr int32_t SLEEP_TIME = 1000;
107 
108     constexpr int64_t MS_PER_SECOND = 1000;
109 
110     // form host bundlename
111     constexpr const char* PARAM_FORM_HOST_BUNDLENAME_KEY = "form_host_bundlename";
112 
113     // form manager service bundlename
114     constexpr const char* PARAM_FORM_MANAGER_SERVICE_BUNDLENAME_KEY = "form_manager_service_bundlename";
115 
116     // PROVIDER_FLAG false:ProviderFormInfo is null;true: ProviderFormInfo not null
117     constexpr const char* PROVIDER_FLAG = "provider_flag";
118     constexpr const char* FORM_CONNECT_ID = "form_connect_id";
119     constexpr const char* FORM_SUPPLY_INFO = "form_supply_info";
120     constexpr const char* FORM_SHARE_REQUEST_CODE = "form_share_request_code";
121     // the delimiter between bundleName and abilityName
122     constexpr const char* NAME_DELIMITER = "::";
123 
124     constexpr const char* PARAM_FORM_ADD_COUNT = "form.add.count";
125 
126     constexpr const char* FORM_SUPPLY_UID = "form_supply_uid";
127     constexpr const char* FORM_RENDER_COMP_ID = "form_render_comp_id";
128 
129     const size_t MAX_LAYOUT = 8;
130     constexpr int32_t MAX_FORMS = 512;
131     constexpr int32_t MAX_RECORD_PER_APP = 256;
132     constexpr int32_t MAX_TEMP_FORMS = 256;
133     constexpr int32_t MAX_FORM_DATA_SIZE = 1024;
134 
135     constexpr int32_t NOT_IN_RECOVERY = 0;
136     constexpr int32_t RECOVER_FAIL = 1;
137     constexpr int32_t IN_RECOVERING = 2;
138 
139     constexpr int32_t FLAG_HAS_OBJECT = 1;
140     constexpr int32_t FLAG_NO_OBJECT = 0;
141 
142     constexpr int32_t DEATH_RECIPIENT_FLAG = 0;
143     constexpr int32_t MAX_VISIBLE_NOTIFY_LIST = 32;
144 
145     constexpr const char* ACQUIRE_TYPE = "form_acquire_form";
146     constexpr int32_t ACQUIRE_TYPE_CREATE_FORM = 1;
147     constexpr int32_t ACQUIRE_TYPE_RECREATE_FORM = 2;
148 
149     constexpr int32_t DELETE_FORM = 3;
150     constexpr int32_t RELEASE_FORM = 8;
151     constexpr int32_t RELEASE_CACHED_FORM = 9;
152 
153     constexpr int64_t INVALID_UDID_HASH = 0L;
154 
155     enum class Dimension : int8_t {
156         DIMENSION_MIN = 1,
157         DIMENSION_1_2 = DIMENSION_MIN,
158         DIMENSION_2_2,
159         DIMENSION_2_4,
160         DIMENSION_4_4,
161         DIMENSION_2_1,
162         DIMENSION_MAX = DIMENSION_2_1
163     };
164 
165     const std::map<Dimension, std::string> DIMENSION_MAP = {
166         {Dimension::DIMENSION_1_2, "1*2"},
167         {Dimension::DIMENSION_2_2, "2*2"},
168         {Dimension::DIMENSION_2_4, "2*4"},
169         {Dimension::DIMENSION_4_4, "4*4"},
170         {Dimension::DIMENSION_2_1, "2*1"}
171     };
172 
173     // rdb
174     constexpr const char* FORM_RDB_NAME = "/formdb.db";
175     constexpr const char* FORM_RDB_TABLE_NAME = "form_table";
176     constexpr const char* FORM_MANAGER_SERVICE_PATH = "/data/service/el1/public/database/form_storage";
177     constexpr const char* FORM_JOURNAL_MODE = "WAL";
178     constexpr const char* FORM_SYNC_MODE = "FULL";
179     constexpr int32_t FORM_RDB_VERSION = 1;
180     constexpr const char* FORM_RDB_FILE_TYPE = "";
181     constexpr const char* FORM_RENDER_TYPE_KEY = "form_render_type";
182     constexpr int32_t RENDER_FORM = 0; // default value
183     constexpr int32_t UPDATE_RENDERING_FORM = 1;
184     constexpr const char* FORM_COMPILE_MODE_KEY = "form_compile_mode";
185     constexpr const char* FORM_COMPATIBLE_VERSION_CODE_KEY = "form_compatible_version_code";
186 
187     //ets card
188     constexpr const char* FORM_COMP_ID = "ohos.extra.param.key.form_comp_id";
189     constexpr const char* FORM_DENSITY = "ohos.extra.param.key.form_density";
190     constexpr const char* FORM_PROCESS_ON_ADD_SURFACE = "ohos.extra.param.key.process_on_add_surface";
191     constexpr const char* FORM_ALLOW_UPDATE = "allowUpdate";
192 
193     //CallEvent
194     constexpr const char* FORM_CALL_EVENT_PARAMS = "params";
195     constexpr const char* PARAM_FORM_CALL_EVENT_METHOD_KEY = "method";
196     constexpr int32_t EVENT_CALL_NOTIFY = 1;
197 }  // namespace Constants
198 }  // namespace AppExecFwk
199 }  // namespace OHOS
200 #endif  // OHOS_FORM_FWK_FORM_CONSTANTS_H
201