1 /* 2 * Copyright (c) 2021-2024 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_INTERACT_ACROSS_LOCAL_ACCOUNTS = "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS"; 26 constexpr const char* PERMISSION_REQUIRE_FORM = "ohos.permission.REQUIRE_FORM"; 27 constexpr const char* PERMISSION_AGENT_REQUIRE_FORM = "ohos.permission.AGENT_REQUIRE_FORM"; 28 constexpr const char* PERMISSION_KEEP_BACKGROUND_RUNNING = "ohos.permission.KEEP_BACKGROUND_RUNNING"; 29 constexpr const char* PERMISSION_OBSERVE_FORM_RUNNING = "ohos.permission.OBSERVE_FORM_RUNNING"; 30 constexpr const char* PERMISSION_START_ABILITIES_FROM_BACKGROUND = 31 "ohos.permission.START_ABILITIES_FROM_BACKGROUND"; 32 constexpr const char* PARAM_FORM_IDENTITY_KEY = "ohos.extra.param.key.form_identity"; 33 constexpr const char* PARAM_FORM_CALLING_IDENTITY_KEY = "ohos.extra.param.key.form_calling_identity"; 34 constexpr const char* PARAM_MODULE_NAME_KEY = "ohos.extra.param.key.module_name"; 35 constexpr const char* PARAM_BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name"; 36 constexpr const char* PARAM_ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name"; 37 constexpr const char* PARAM_FORM_NAME_KEY = "ohos.extra.param.key.form_name"; 38 constexpr const char* PARAM_FORM_DIMENSION_KEY = "ohos.extra.param.key.form_dimension"; 39 constexpr const char* PARAM_FORM_RENDERINGMODE_KEY = "ohos.extra.param.key.form_rendering_mode"; 40 constexpr const char* PARAM_FORM_OBSCURED_KEY = "ohos.extra.param.key.form_obscured_mode"; 41 constexpr const char* PARAM_MESSAGE_KEY = "ohos.extra.param.key.message"; 42 constexpr const char* PARAM_FORM_TEMPORARY_KEY = "ohos.extra.param.key.form_temporary"; 43 constexpr const char* PARAM_CALLER_BUNDLE_NAME_KEY = "ohos.extra.param.key.caller_bundle_name"; 44 constexpr const char* PARAM_FORM_TRANSPARENCY_KEY = "ohos.extra.param.key.form_background_transparency"; 45 constexpr const char* PARAM_FORM_WIDTH_KEY = "ohos.extra.param.key.form_width"; 46 constexpr const char* PARAM_FORM_HEIGHT_KEY = "ohos.extra.param.key.form_height"; 47 constexpr int32_t ONE_HOST_MAX_FORM_SIZE = 256; 48 constexpr const char* RECREATE_FORM_KEY = "ohos.extra.param.key.recreate"; 49 constexpr const char* PARAM_FORM_CUSTOMIZE_KEY = "ohos.extra.param.key.form_customize"; 50 constexpr const char* PARAM_FORM_ORIENTATION_KEY = "ohos.extra.param.key.form_orientation"; 51 constexpr int32_t ORIENTATION_PORTRAIT = 1; 52 constexpr int32_t ORIENTATION_LANDSCAPE = 2; 53 constexpr const char* PARAM_FORM_ABILITY_NAME_KEY = "abilityName"; 54 constexpr const char* PARAM_FORM_USER_ID = "ohos.extra.param.key.form_user_id"; 55 constexpr const char* KEY_IS_TIMER = "isCountTimerRefresh"; 56 constexpr const char* KEY_TIMER_REFRESH = "isTimerRefresh"; 57 constexpr const char* KEY_CONNECT_REFRESH = "isConnectRefresh"; 58 constexpr const char* PARAM_FORM_REFRESH_TYPE = "ohos.extra.param.key.refresh_type"; 59 constexpr const char* SYSTEM_PARAM_FORM_UPDATE_TIME = "persist.sys.fms.form.update.time"; 60 constexpr const char* SYSTEM_PARAM_FORM_REFRESH_MIN_TIME = "persist.sys.fms.form.refresh.min.time"; 61 constexpr const char* ACTION_UPDATEATTIMER = "form_update_at_timer"; 62 constexpr const char* KEY_WAKEUP_TIME = "wakeUpTime"; 63 constexpr const char* KEY_WAKEUP_TIME_LEFT = "wakeUpTimeLeft"; 64 constexpr const char* KEY_WAKEUP_TIME_RIGHT = "wakeUpTimeRight"; 65 constexpr const char* KEY_ACTION_TYPE = "form_update_action_type"; 66 constexpr const char* ABS_CODE_PATH = "/data/app/el1/bundle/public"; 67 constexpr const char* LOCAL_CODE_PATH = "/data/storage/el1/bundle"; 68 constexpr const char* LOCAL_BUNDLES = "/data/bundles"; 69 constexpr const char* FORM_PUBLISH_ACTION = "action.form.publish"; 70 constexpr const char* FORM_PAGE_ACTION = "action.form.page"; 71 constexpr const char* OPEN_FORM_MANAGE_VIEW = "openFormManageView"; 72 constexpr int32_t PAGE_ROUTER_SERVICE_CODE_FORM_MANAGE = 1; 73 constexpr int32_t PAGE_ROUTER_SERVICE_CODE_CONTROL_CENTER = 2; 74 constexpr int32_t PAGE_ROUTER_SERVICE_CODE_FORM_EDIT = 3; 75 constexpr const char* PARMA_REQUEST_METHOD = "requestMethod"; 76 constexpr const char* PARMA_OPEN_FORM_EDIT_VIEW = "openFormEditView"; 77 constexpr const char* PARMA_OPEN_FORM_EDIT_SEC_PAGE_VIEW = "openFormEditSecPageView"; 78 constexpr const char* PARAM_PAGE_ROUTER_SERVICE_CODE = "pageRouterServiceCode"; 79 constexpr const char* PARAM_SEC_PAGE_ABILITY_NAME = "secPageAbilityName"; 80 constexpr const char* PARAM_DEVICE_ID_KEY = "ohos.extra.param.key.device_id"; 81 constexpr const char* PARAM_FORM_HOST_TOKEN = "ohos.extra.param.form.host.token"; 82 constexpr const char* PARAM_PUBLISH_FORM_HOST_BUNDLE_KEY = "ohos.extra.param.key.form_host_bundle_name"; 83 constexpr const char* PARAM_PUBLISH_FORM_HOST_MODULE_KEY = "ohos.extra.param.key.form_host_module_name"; 84 constexpr const char* PARAM_PUBLISH_FORM_HOST_ABILITY_KEY = "ohos.extra.param.key.form_host_ability_name"; 85 constexpr const char* FRS_BUNDLE_NAME = "com.ohos.formrenderservice"; 86 constexpr const char* FRS_APP_INDEX = "ohos.extra.param.key.frs_index"; 87 constexpr const char* PARAM_FORM_ID = "formID"; 88 constexpr const char* IS_FORM_AGENT = "isFormAgent"; 89 constexpr const char* PARAM_FORM_BORDER_WIDTH_KEY = "ohos.extra.param.key.form_border_width"; 90 constexpr const char* FORM_LOCATION_KEY = "ohos.extra.param.key.form_location"; 91 constexpr const char* FORM_DISABLE_GESTURE_KEY = "ohos.extra.param.key.form_disable_gesture"; 92 constexpr const char* FORM_DISABLE_BLUR_BACKGROUND = "ohos.extra.param.key.form_disable_blur_background"; 93 constexpr int32_t TYPE_RESET_LIMIT = 1; 94 constexpr int32_t TYPE_STATIC_UPDATE = 2; 95 constexpr int32_t TYPE_DYNAMIC_UPDATE = 3; 96 const long ABS_REFRESH_MS = 2500; 97 constexpr const char* PARAM_HOST_BG_INVERSE_COLOR_KEY = "ohos.extra.param.key.host_bg_inverse_color"; 98 constexpr const char* PARAM_FONT_FOLLOW_SYSTEM_KEY = "ohos.inner.key.font_follow_system"; 99 constexpr const char* PARAM_FORM_ENABLE_BLUR_BACKGROUND_KEY = "ohos.inner.key.enable_blur_background"; 100 constexpr const char* PARAM_THEME_KEY = "ohos.extra.param.key.form_is_theme"; 101 constexpr const char* PARAM_THEME_THEME_FORM_ID = "themeFormId"; 102 constexpr const char* PARAM_THEME_THEME_ID = "themeId"; 103 constexpr const char* PARAM_PUBLISH_FORM_HOST_SNAPSHOT_KEY = "ohos.extra.param.key.add_form_to_host_snapshot"; 104 constexpr const char* PARAM_PUBLISH_FORM_HOST_WIDTH_KEY = "ohos.extra.param.key.add_form_to_host_width"; 105 constexpr const char* PARAM_PUBLISH_FORM_HOST_HEIGHT_KEY = "ohos.extra.param.key.add_form_to_host_height"; 106 constexpr const char* PARAM_PUBLISH_FORM_HOST_SCREENX_KEY = "ohos.extra.param.key.add_form_to_host_screenx"; 107 constexpr const char* PARAM_PUBLISH_FORM_HOST_SCREENY_KEY = "ohos.extra.param.key.add_form_to_host_screeny"; 108 constexpr const char* CPU_SCENE_ID_CONFIG_UPDATE = "1"; 109 constexpr const char* PARAM_DYNAMIC_NAME_KEY = "isDynamic"; 110 constexpr const char* RECYCLE_FORMS_USER_ID = "ohos.extra.param.key.recycle_forms_user_id"; 111 constexpr const char* PARAM_APP_CLONE_INDEX_KEY = "ohos.extra.param.key.appCloneIndex"; 112 113 constexpr int32_t UNKNOWN = 0; 114 // The form events type which means that the form becomes visible. 115 constexpr int32_t FORM_VISIBLE = 1; 116 // The form events type which means that the form becomes invisible. 117 constexpr int32_t FORM_INVISIBLE = 2; 118 119 // The default user id 120 constexpr int32_t DEFAULT_USER_ID = 0; 121 122 constexpr int32_t DEFAULT_SANDBOX_FRS_APP_INDEX = 1001; 123 124 // The invalid user id 125 constexpr int32_t INVALID_USER_ID = -1; 126 127 // The default provider user id 128 constexpr int32_t DEFAULT_PROVIDER_USER_ID = -1; 129 130 // The max uid of system app. 131 constexpr int32_t MAX_SYSTEM_APP_UID = 10000; 132 133 constexpr int32_t CALLING_UID_TRANSFORM_DIVISOR = 200000; 134 135 constexpr int32_t MIN_TIME_SPEED = 1; 136 constexpr int32_t MAX_TIME_SPEED = 1000; 137 constexpr int32_t MAX_HOUR = 23; 138 constexpr int32_t MAX_MINUTE = 59; 139 constexpr int32_t MAX_SECOND = 60; 140 constexpr int32_t MIN_TIME = 0; 141 constexpr int32_t HOUR_PER_DAY = 24; 142 constexpr int32_t MIN_PER_HOUR = 60; 143 constexpr int32_t SEC_PER_MIN = 60; 144 constexpr int32_t MS_PER_DAY = 24 * 60 * 60 * 1000; 145 const long TIME_1000 = 1000; 146 const long TIME_1000000 = 1000000; 147 const long TIME_CONVERSION = 30 * 60 * TIME_1000; 148 constexpr int32_t MIN_CONFIG_DURATION = 1; // 1 means 30 min 149 constexpr int32_t MAX_CONFIG_DURATION = 2 * 24 * 7; // one week 150 const long MIN_PERIOD = MIN_CONFIG_DURATION * TIME_CONVERSION; // 30 min in ms unit 151 const long MAX_PERIOD = MAX_CONFIG_DURATION * TIME_CONVERSION; // 1 week in ms unit 152 const long ABS_TIME = 30 * TIME_1000; // 30s abs time 153 constexpr const char* TIME_DELIMETER = ":"; 154 constexpr const char* TIMES_DELIMETER = ","; 155 constexpr int32_t UPDATE_AT_CONFIG_COUNT = 2; 156 constexpr int32_t UPDATE_AT_CONFIG_MAX_COUNT = 24; 157 158 constexpr int32_t LIMIT_COUNT = 50; 159 constexpr int32_t MIN_NEXT_TIME = 300; // seconds 160 161 // The max retry times of reconnection. 162 constexpr int32_t MAX_RETRY_TIME = 30; 163 // The time interval between reconnections(milliseconds). 164 constexpr int32_t SLEEP_TIME = 1000; 165 166 constexpr int64_t MS_PER_SECOND = 1000; 167 168 // form host bundlename 169 constexpr const char* PARAM_FORM_HOST_BUNDLENAME_KEY = "form_host_bundlename"; 170 171 // form manager service bundlename 172 constexpr const char* PARAM_FORM_MANAGER_SERVICE_BUNDLENAME_KEY = "form_manager_service_bundlename"; 173 174 // PROVIDER_FLAG false:ProviderFormInfo is null;true: ProviderFormInfo not null 175 constexpr const char* PROVIDER_FLAG = "provider_flag"; 176 constexpr const char* FORM_CONNECT_ID = "form_connect_id"; 177 constexpr const char* FORM_SUPPLY_INFO = "form_supply_info"; 178 constexpr const char* FORM_SHARE_REQUEST_CODE = "form_share_request_code"; 179 constexpr const char* FORM_ACQUIRE_DATA_REQUEST_CODE = "form_acquire_data_request_code"; 180 // the delimiter between bundleName and abilityName 181 constexpr const char* NAME_DELIMITER = "::"; 182 183 constexpr const char* PARAM_FORM_ADD_COUNT = "form.add.count"; 184 185 constexpr const char* FORM_SUPPLY_UID = "form_supply_uid"; 186 constexpr const char* FORM_RENDER_COMP_ID = "form_render_comp_id"; 187 constexpr const char* FORM_DELAY_TIME_OF_RECYCLE = "form_delay_time_of_recycle"; 188 constexpr const char* FORM_STATUS_DATA = "form_status_data"; 189 constexpr const char* FORM_IS_DYNAMIC = "form_is_dynamic"; 190 constexpr const char* FORM_IS_RECOVER_FORM = "form_is_recover_form"; 191 constexpr const char* FORM_IS_RECOVER_FORM_TO_HANDLE_CLICK_EVENT = "form_is_recover_form_to_handle_click_event"; 192 193 const size_t MAX_LAYOUT = 8; 194 constexpr int32_t MAX_FORMS = 512; 195 constexpr int32_t MAX_RECORD_PER_APP = 256; 196 constexpr int32_t MAX_TEMP_FORMS = 256; 197 constexpr int32_t MAX_FORM_DATA_SIZE = 1024; 198 constexpr int32_t DEFAULT_VISIBLE_NOTIFY_DELAY = 1000; 199 200 constexpr char MAX_NORMAL_FORM_SIZE [] = "maxNormalFormSize"; 201 constexpr char MAX_TEMP_FORM_SIZE [] = "maxTempFormSize"; 202 constexpr char HOST_MAX_FORM_SIZE [] = "hostMaxFormSize"; 203 constexpr char VISIBLE_NOTIFY_DELAY [] = "visibleNotifyDelayTime"; 204 205 constexpr int32_t NOT_IN_RECOVERY = 0; 206 constexpr int32_t RECOVER_FAIL = 1; 207 constexpr int32_t IN_RECOVERING = 2; 208 209 constexpr int32_t FLAG_HAS_OBJECT = 1; 210 constexpr int32_t FLAG_NO_OBJECT = 0; 211 212 constexpr int32_t DEATH_RECIPIENT_FLAG = 0; 213 constexpr int32_t MAX_VISIBLE_NOTIFY_LIST = 32; 214 215 constexpr const char* ACQUIRE_TYPE = "form_acquire_form"; 216 constexpr int32_t ACQUIRE_TYPE_CREATE_FORM = 1; 217 constexpr int32_t ACQUIRE_TYPE_RECREATE_FORM = 2; 218 219 constexpr int32_t DELETE_FORM = 3; 220 constexpr int32_t RELEASE_FORM = 8; 221 constexpr int32_t RELEASE_CACHED_FORM = 9; 222 223 constexpr int64_t INVALID_UDID_HASH = 0L; 224 225 constexpr int32_t REFRESH_ALL_FORM = 0; 226 constexpr int32_t REFRESH_APP_FORM = 1; 227 constexpr int32_t REFRESH_ATOMIC_FORM = 2; 228 constexpr int32_t REFRESH_SYSTEMAPP_FORM = 3; 229 230 enum class Dimension : int8_t { 231 DIMENSION_MIN = 1, 232 DIMENSION_1_2 = DIMENSION_MIN, 233 DIMENSION_2_2, 234 DIMENSION_2_4, 235 DIMENSION_4_4, 236 DIMENSION_2_1, 237 DIMENSION_1_1, 238 DIMENSION_6_4, 239 DIMENSION_2_3, 240 DIMENSION_3_3, 241 DIMENSION_MAX = DIMENSION_3_3 242 }; 243 244 enum class Shape : int8_t { 245 RECT = 1, 246 CIRCLE 247 }; 248 249 const std::map<Dimension, std::string> DIMENSION_MAP = { 250 {Dimension::DIMENSION_1_2, "1*2"}, 251 {Dimension::DIMENSION_2_2, "2*2"}, 252 {Dimension::DIMENSION_2_4, "2*4"}, 253 {Dimension::DIMENSION_4_4, "4*4"}, 254 {Dimension::DIMENSION_2_1, "2*1"}, 255 {Dimension::DIMENSION_1_1, "1*1"}, 256 {Dimension::DIMENSION_6_4, "6*4"}, 257 {Dimension::DIMENSION_2_3, "2*3"}, 258 {Dimension::DIMENSION_3_3, "3*3"} 259 }; 260 261 enum class RenderingMode : int8_t { 262 FULL_COLOR = 0, 263 SINGLE_COLOR 264 }; 265 266 enum class FormLocation : int8_t { 267 OTHER = -1, 268 DESKTOP = 0, 269 FORM_CENTER = 1, 270 FORM_MANAGER = 2, 271 NEGATIVE_SCREEN = 3, 272 FORM_CENTER_NEGATIVE_SCREEN = 4, 273 FORM_MANAGER_NEGATIVE_SCREEN = 5, 274 SCREEN_LOCK = 6, 275 AI_SUGGESTION = 7, 276 }; 277 278 enum class PublishFormErrorCode : int8_t { 279 SUCCESS, 280 NO_SPACE, 281 PARAM_ERROR, 282 INTERNAL_ERROR, 283 }; 284 285 struct PublishFormResult { 286 PublishFormErrorCode code; 287 std::string message; 288 }; 289 // refresh type 290 constexpr int32_t REFRESHTYPE_DEFAULT = -1; 291 constexpr int32_t REFRESHTYPE_HOST = 0; 292 constexpr int32_t REFRESHTYPE_INTERVAL = 1; 293 constexpr int32_t REFRESHTYPE_UPDATETIMES = 2; 294 constexpr int32_t REFRESHTYPE_UPDATENEXTTIME = 3; 295 constexpr int32_t REFRESHTYPE_NETWORKCHANGED = 4; 296 constexpr int32_t REFRESHTYPE_VISIABLE = 99; 297 constexpr int32_t FULL_UPDATE = 0; 298 constexpr int32_t ADD_UPDATE = 1; 299 300 // rdb 301 const std::string FORM_MANAGER_SERVICE_PATH = "/data/service/el1/public/database/form_storage"; 302 const std::string FORM_RDB_NAME = "/formdb.db"; 303 constexpr const char* FORM_RDB_TABLE_NAME = "form_table"; 304 constexpr const char* FORM_JOURNAL_MODE = "WAL"; 305 constexpr const char* FORM_SYNC_MODE = "FULL"; 306 constexpr int32_t FORM_RDB_VERSION = 1; 307 constexpr const char* FORM_RDB_FILE_TYPE = ""; 308 constexpr const char* FORM_RENDER_TYPE_KEY = "form_render_type"; 309 constexpr int32_t RENDER_FORM = 0; // default value 310 constexpr int32_t UPDATE_RENDERING_FORM = 1; 311 constexpr const char* FORM_UPDATE_TYPE_KEY = "form_update_type"; 312 constexpr int32_t ADD_FORM_UPDATE_FORM = 0; // default value 313 constexpr int32_t ADAPTER_UPDATE_FORM = 1; 314 constexpr const char* FORM_COMPILE_MODE_KEY = "form_compile_mode"; 315 constexpr const char* FORM_COMPATIBLE_VERSION_KEY = "form_compatible_version"; 316 constexpr const char* FORM_TARGET_VERSION_KEY = "form_target_version"; 317 318 //ArkTs card 319 constexpr const char* FORM_COMP_ID = "ohos.extra.param.key.form_comp_id"; 320 constexpr const char* FORM_DENSITY = "ohos.extra.param.key.form_density"; 321 constexpr const char* FORM_PROCESS_ON_ADD_SURFACE = "ohos.extra.param.key.process_on_add_surface"; 322 constexpr const char* FORM_ALLOW_UPDATE = "allowUpdate"; 323 324 // The state of whether the ArkTs card can be rendered 325 constexpr const char FORM_RENDER_STATE[] = "ohos.extra.param.key.form_render_state"; 326 327 //CallEvent 328 constexpr const char* FORM_CALL_EVENT_PARAMS = "params"; 329 constexpr const char* PARAM_FORM_CALL_EVENT_METHOD_KEY = "method"; 330 constexpr int32_t EVENT_CALL_NOTIFY = 1; 331 //arquireFormData 332 constexpr const char* LAUNCH_REASON_KEY = "ohos.extra.param.key.form_launch_reason"; 333 // The form launch reason which means that the form is default. 334 constexpr int32_t FORM_DEFAULT = 1; 335 // The form launch reason which means that the form is share. 336 constexpr int32_t FORM_SHARE = 2; 337 // Specify the form Id 338 constexpr const char* PARAM_FORM_MIGRATE_FORM_KEY = "ohos.extra.param.key.migrate_form"; 339 // For click message event 340 constexpr const char* KEY_DIRECT_CALL_INAPP = "directCallInApp"; 341 // Is the user granted 342 constexpr const char* FORM_PERMISSION_GRANTED_KEY = "ohos.extra.param.key.permission_granted"; 343 // User permission name 344 constexpr const char* FORM_PERMISSION_NAME_KEY = "ohos.extra.param.key.permission_name"; 345 346 constexpr const char* MODULE_PKG_NAME_KEY = "pkg_name"; 347 constexpr const char* MODULE_HAP_PATH_KEY = "hap_path"; 348 // Form enable skeleton key 349 constexpr const char* FORM_ENABLE_SKELETON_KEY = "ohos.extra.param.key.enable_skeleton"; 350 // Allow form update and refresh 351 constexpr const char* FORM_ENABLE_UPDATE_REFRESH_KEY = "enableFormUpdateRefresh"; 352 // Is form contains multiple app 353 const std::string IS_MULTI_APP_FORM = "isMultiAppForm"; 354 // form contains multi app is true 355 const std::string IS_MULTI_APP_FORM_TRUE = "true"; 356 // Form data update type 357 constexpr const char* FORM_DATA_UPDATE_TYPE = "formDataUpdateType"; 358 } // namespace Constants 359 } // namespace AppExecFwk 360 } // namespace OHOS 361 #endif // OHOS_FORM_FWK_FORM_CONSTANTS_H 362