1 /* 2 * Copyright (c) 2021 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_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_FORM_CONSTANTS_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_FORM_CONSTANTS_H 18 19 #include <map> 20 #include <string> 21 22 namespace OHOS { 23 namespace AppExecFwk { 24 namespace Constants { 25 const std::string PERMISSION_REQUIRE_FORM = "ohos.permission.REQUIRE_FORM"; 26 const std::string PARAM_FORM_IDENTITY_KEY = "ohos.extra.param.key.form_identity"; 27 const std::string PARAM_FORM_CALLING_IDENTITY_KEY = "ohos.extra.param.key.form_calling_identity"; 28 const std::string PARAM_MODULE_NAME_KEY = "ohos.extra.param.key.module_name"; 29 const std::string PARAM_FORM_NAME_KEY = "ohos.extra.param.key.form_name"; 30 const std::string PARAM_FORM_DIMENSION_KEY = "ohos.extra.param.key.form_dimension"; 31 const std::string PARAM_MESSAGE_KEY = "ohos.extra.param.key.message"; 32 const std::string PARAM_FORM_TEMPORARY_KEY = "ohos.extra.param.key.form_temporary"; 33 const int32_t ONE_HOST_MAX_FORM_SIZE = 256; 34 const std::string RECREATE_FORM_KEY = "ohos.extra.param.key.recreate"; 35 const std::string PARAM_FORM_CUSTOMIZE_KEY = "ohos.extra.param.key.form_customize"; 36 const std::string PARAM_FORM_ORIENTATION_KEY = "ohos.extra.param.key.form_orientation"; 37 const int32_t ORIENTATION_PORTRAIT = 1; 38 const int32_t ORIENTATION_LANDSCAPE = 2; 39 const std::string PARAM_FORM_ABILITY_NAME_KEY = "abilityName"; 40 41 const std::string KEY_IS_TIMER = "isTimerRefresh"; 42 const std::string SYSTEM_PARAM_FORM_UPDATE_TIME = "persist.sys.fms.form.update.time"; 43 const std::string SYSTEM_PARAM_FORM_REFRESH_MIN_TIME = "persist.sys.fms.form.refresh.min.time"; 44 const std::string ACTION_UPDATEATTIMER = "form_update_at_timer"; 45 const std::string KEY_WAKEUP_TIME = "wakeUpTime"; 46 const std::string KEY_ACTION_TYPE = "form_update_action_type"; 47 const int TYPE_RESET_LIMIT = 1; 48 const int TYPE_STATIC_UPDATE = 2; 49 const int TYPE_DYNAMIC_UPDATE = 3; 50 const long ABS_REFRESH_MS = 2500; 51 52 // The form events type which means that the form becomes visible. 53 const int32_t FORM_VISIBLE = 1; 54 // The form events type which means that the form becomes invisible. 55 const int32_t FORM_INVISIBLE = 2; 56 57 // The default user id 58 const int32_t DEFAULT_USER_ID = 0; 59 60 // The max uid of system app. 61 const int32_t MAX_SYSTEM_APP_UID = 10000; 62 63 const int MAX_HOUR = 23; 64 const int MAX_MININUTE = 59; 65 const int MIN_TIME = 0; 66 const int HOUR_PER_DAY = 24; 67 const int MIN_PER_HOUR = 60; 68 const long TIME_1000 = 1000; 69 const long TIME_1000000 = 1000000; 70 const long TIME_CONVERSION = 30 * 60 * TIME_1000; 71 const int MIN_CONFIG_DURATION = 1; // 1 means 30 min 72 const int MAX_CONFIG_DURATION = 2 * 24 * 7; // one week 73 const long MIN_PERIOD = MIN_CONFIG_DURATION * TIME_CONVERSION; // 30 min in ms unit 74 const long MAX_PERIOD = MAX_CONFIG_DURATION * TIME_CONVERSION; // 1 week in ms unit 75 const long ABS_TIME = 5 * TIME_1000; // 5s abs time 76 const int WORK_POOL_SIZE = 4; 77 const std::string TIME_DELIMETER = ":"; 78 const int UPDATE_AT_CONFIG_COUNT = 2; 79 80 const int LIMIT_COUNT = 50; 81 const int MIN_NEXT_TIME = 300; // seconds 82 83 // The max retry times of reconnection. 84 const int32_t MAX_RETRY_TIME = 30; 85 // The time interval between reconnections(milliseconds). 86 const int32_t SLEEP_TIME = 1000; 87 88 const int64_t MS_PER_SECOND = 1000; 89 90 // form host bundlename 91 const std::string PARAM_FORM_HOST_BUNDLENAME_KEY = "form_host_bundlename"; 92 93 // form manager service bundlename 94 const std::string PARAM_FORM_MANAGER_SERVICE_BUNDLENAME_KEY = "form_manager_service_bundlename"; 95 96 // PROVIDER_FLAG false:ProviderFormInfo is null;true: ProviderFormInfo not null 97 const std::string PROVIDER_FLAG = "provider_flag"; 98 const std::string FORM_CONNECT_ID = "form_connect_id"; 99 const std::string FORM_SUPPLY_INFO = "form_supply_info"; 100 101 // the delimiter between bundleName and abilityName 102 const std::string NAME_DELIMITER = "::"; 103 104 const size_t MAX_LAYOUT = 8; 105 const std::map<int32_t, std::string> DIMENSION_MAP = { 106 {1, "1*2"}, 107 {2, "2*2"}, 108 {3, "2*4"}, 109 {4, "4*4"}, 110 }; 111 const int MAX_FORMS = 512; 112 const int MAX_RECORD_PER_APP = 256; 113 const int MAX_TEMP_FORMS = 256; 114 const int MAX_FORM_DATA_SIZE = 1024; 115 116 const int NOT_IN_RECOVERY = 0; 117 const int RECOVER_FAIL = 1; 118 const int IN_RECOVERING = 2; 119 120 const int FLAG_HAS_OBJECT = 1; 121 const int FLAG_NO_OBJECT = 0; 122 123 const int DEATH_RECIPIENT_FLAG = 0; 124 const int MAX_VISIBLE_NOTIFY_LIST = 32; 125 126 const std::string ACQUIRE_TYPE = "form_acquire_form"; 127 const int ACQUIRE_TYPE_CREATE_FORM = 1; 128 const int ACQUIRE_TYPE_RECREATE_FORM = 2; 129 130 const int DELETE_FORM = 3; 131 const int RELEASE_FORM = 8; 132 const int RELEASE_CACHED_FORM = 9; 133 134 const int64_t INVALID_UDID_HASH = 0L; 135 136 enum class FormMgrMessage { 137 // ipc id 1-1000 for kit 138 // ipc id 1001-2000 for DMS 139 // ipc id 2001-3000 for tools 140 // ipc id for add form (3001) 141 FORM_MGR_ADD_FORM = 3001, 142 143 // ipc id for delete form (3002) 144 FORM_MGR_DELETE_FORM, 145 146 // ipc id for form done release form (3003) 147 FORM_MGR_RELEASE_FORM, 148 149 // ipc id for connecting update form (3004) 150 FORM_MGR_UPDATE_FORM, 151 152 // ipc id for form visible notify (3005) 153 FORM_MGR_NOTIFY_FORM_VISIBLE, 154 155 // ipc id for form invisible notify (3006) 156 FORM_MGR_NOTIFY_FORM_INVISIBLE, 157 158 // ipc id for refreshing data cache (3007) 159 FORM_MGR_CAST_TEMP_FORM, 160 161 // ipc id 2001-3000 for tools 162 // ipc id for dumping state (2001) 163 FORM_MGR_DUMP_STATE = 2001, 164 }; 165 } // namespace Constants 166 } // namespace AppExecFwk 167 } // namespace OHOS 168 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_FORM_CONSTANTS_H 169