1 /* 2 * Copyright (c) 2021-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_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 namespace Constants { 26 constexpr const char* TYPE_ONLY_MATCH_WILDCARD = "reserved/wildcard"; 27 constexpr const char* EMPTY_STRING = ""; 28 constexpr const char* FILE_UNDERLINE = "_"; 29 constexpr const char* BUNDLE_CODE_DIR = "/data/app/el1/bundle/public"; 30 constexpr const char* CACHE_DIR = "cache"; 31 constexpr int8_t START_USERID = 100; 32 constexpr int8_t DEFAULT_USERID = 0; 33 constexpr int8_t INVALID_USERID = -1; 34 constexpr int8_t UNSPECIFIED_USERID = -2; 35 constexpr int8_t ALL_USERID = -3; 36 constexpr int8_t ANY_USERID = -4; 37 constexpr int8_t PERMISSION_GRANTED = 0; 38 constexpr int8_t PERMISSION_NOT_GRANTED = -1; 39 constexpr int8_t DEFAULT_STREAM_FD = -1; 40 constexpr int8_t DUMP_INDENT = 4; 41 constexpr int8_t INVALID_API_VERSION = -1; 42 constexpr int8_t ALL_VERSIONCODE = -1; 43 constexpr int8_t INVALID_UDID = -1; 44 constexpr int8_t DEFAULT_INSTALLERID = -1; 45 constexpr int8_t DEFAULT_APP_INDEX = 0; 46 47 // uid and gid 48 constexpr int32_t INVALID_UID = -1; 49 constexpr int32_t ROOT_UID = 0; 50 constexpr int32_t FOUNDATION_UID = 5523; 51 constexpr int32_t CODE_PROTECT_UID = 7666; 52 constexpr int32_t BASE_APP_UID = 10000; 53 constexpr int32_t BASE_USER_RANGE = 200000; 54 constexpr int32_t MAX_APP_UID = 65535; 55 constexpr int32_t STORAGE_MANAGER_UID = 1090; 56 constexpr int32_t EDC_UID = 7200; 57 58 // for render process 59 constexpr int32_t START_UID_FOR_RENDER_PROCESS = 1000000; 60 constexpr int32_t END_UID_FOR_RENDER_PROCESS = 1099999; 61 62 /* 63 all of cache path for bundle: 64 modulename max is 128 65 /data/app/el1~el5/userid/base/bundlename/cache; 66 /data/app/el2/userid/sharefiles/bundlename/cache; 67 /data/app/el1~el5/userid/base/bundlename/haps/modulename/cache; 68 /data/app/el2/userid/sharefiles/bundlename/haps/modulename/cache; 69 */ 70 constexpr int16_t MAX_CACHE_DIR_SIZE = 774; 71 72 // permissions 73 constexpr const char* PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE"; 74 constexpr const char* PERMISSION_UNINSTALL_CLONE_BUNDLE = "ohos.permission.UNINSTALL_CLONE_BUNDLE"; 75 constexpr const char* PERMISSION_GET_BUNDLE_INFO = "ohos.permission.GET_BUNDLE_INFO"; 76 constexpr const char* PERMISSION_GET_BUNDLE_INFO_PRIVILEGED = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"; 77 constexpr const char* PERMISSION_CHANGE_ABILITY_ENABLED_STATE = "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"; 78 constexpr const char* PERMISSION_REMOVECACHEFILE = "ohos.permission.REMOVE_CACHE_FILES"; 79 constexpr const char* PERMISSION_GET_DEFAULT_APPLICATION = "ohos.permission.GET_DEFAULT_APPLICATION"; 80 constexpr const char* PERMISSION_SET_DEFAULT_APPLICATION = "ohos.permission.SET_DEFAULT_APPLICATION"; 81 constexpr const char* PERMISSION_GET_INSTALLED_BUNDLE_LIST = "ohos.permission.GET_INSTALLED_BUNDLE_LIST"; 82 constexpr const char* PERMISSION_RUN_DYN_CODE = "ohos.permission.RUN_DYN_CODE"; 83 constexpr const char* PERMISSION_ACCESS_DYNAMIC_ICON = "ohos.permission.ACCESS_DYNAMIC_ICON"; 84 constexpr const char* PERMISSION_START_SHORTCUT = "ohos.permission.START_SHORTCUT"; 85 constexpr const char* PERMISSION_INSTALL_CLONE_BUNDLE = "ohos.permission.INSTALL_CLONE_BUNDLE"; 86 constexpr const char* PERMISSION_MANAGER_SHORTCUT = "ohos.permission.MANAGE_SHORTCUTS"; 87 constexpr const char* PERMISSION_ACCESS_APP_INSTALL_DIR = "ohos.permission.ACCESS_APP_INSTALL_DIR"; 88 constexpr const char* PERMISSION_GET_SIGNATURE_INFO = "ohos.permission.GET_SIGNATURE_INFO"; 89 constexpr const char* PERMISSION_MIGRATE_DATA = "ohos.permission.MIGRATE_DATA"; 90 constexpr const char* PERMISSION_INSTALL_PLUGIN = "ohos.permission.INSTALL_PLUGIN_BUNDLE"; 91 constexpr const char* PERMISSION_UNINSTALL_PLUGIN = "ohos.permission.UNINSTALL_PLUGIN_BUNDLE"; 92 93 enum class AppType { 94 SYSTEM_APP = 0, 95 THIRD_SYSTEM_APP, 96 THIRD_PARTY_APP, 97 }; 98 99 enum NoGetBundleStatsFlag : uint32_t { 100 GET_BUNDLE_WITH_ALL_SIZE = 0x00000000, 101 GET_BUNDLE_WITHOUT_INSTALL_SIZE = 0x00000001, 102 GET_BUNDLE_WITHOUT_DATA_SIZE = 0x00000002, 103 GET_BUNDLE_WITHOUT_CACHE_SIZE = 0x00000004, 104 }; 105 106 constexpr const char* ACTION_HOME = "action.system.home"; 107 constexpr const char* WANT_ACTION_HOME = "ohos.want.action.home"; 108 constexpr const char* ENTITY_HOME = "entity.system.home"; 109 110 constexpr uint8_t MAX_BUNDLE_NAME = 128; 111 constexpr uint8_t MIN_BUNDLE_NAME = 7; 112 constexpr uint8_t MAX_JSON_ELEMENT_LENGTH = 255; 113 constexpr uint16_t MAX_JSON_ARRAY_LENGTH = 1024; 114 115 constexpr uint16_t MAX_JSON_STRING_LENGTH = 4096; 116 constexpr const char* UID = "uid"; 117 constexpr const char* USER_ID = "userId"; 118 constexpr const char* BUNDLE_NAME = "bundleName"; 119 constexpr const char* MODULE_NAME = "moduleName"; 120 constexpr const char* ABILITY_NAME = "abilityName"; 121 constexpr const char* HAP_PATH = "hapPath"; 122 constexpr const char* APP_INDEX = "appIndex"; 123 constexpr int8_t MAX_LIMIT_SIZE = 4; 124 125 constexpr const char* PARAM_URI_SEPARATOR = ":///"; 126 constexpr uint8_t PARAM_URI_SEPARATOR_LEN = 4; 127 constexpr const char* URI_SEPARATOR = "://"; 128 129 // ipc 130 constexpr int32_t CAPACITY_SIZE = 1 * 1024 * 1000; // 1M 131 constexpr int32_t MAX_PARCEL_CAPACITY = 100 * 1024 * 1024; // 100M 132 133 // permission 134 constexpr const char* LISTEN_BUNDLE_CHANGE = "ohos.permission.LISTEN_BUNDLE_CHANGE"; 135 136 // sandbox application 137 constexpr const char* SANDBOX_APP_INDEX = "sandbox_app_index"; 138 constexpr int16_t INITIAL_APP_INDEX = 0; 139 constexpr int16_t INITIAL_SANDBOX_APP_INDEX = 1000; 140 constexpr int16_t MAX_APP_INDEX = 100; 141 constexpr int16_t MAX_SANDBOX_APP_INDEX = INITIAL_SANDBOX_APP_INDEX + 100; 142 143 // app-distribution-type 144 constexpr const char* APP_DISTRIBUTION_TYPE_NONE = "none"; 145 constexpr const char* APP_DISTRIBUTION_TYPE_APP_GALLERY = "app_gallery"; 146 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE = "enterprise"; 147 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_NORMAL = "enterprise_normal"; 148 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_MDM = "enterprise_mdm"; 149 constexpr const char* APP_DISTRIBUTION_TYPE_INTERNALTESTING = "internaltesting"; 150 constexpr const char* APP_DISTRIBUTION_TYPE_OS_INTEGRATION = "os_integration"; 151 constexpr const char* APP_DISTRIBUTION_TYPE_CROWDTESTING = "crowdtesting"; 152 // app provision type 153 constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug"; 154 constexpr const char* APP_PROVISION_TYPE_RELEASE = "release"; 155 156 // crowdtesting 157 constexpr int8_t INVALID_CROWDTEST_DEADLINE = -1; 158 constexpr int8_t INHERIT_CROWDTEST_DEADLINE = -2; 159 160 // overlay installation 161 constexpr const char* OVERLAY_STATE = "overlayState"; 162 constexpr const char* PERMISSION_CHANGE_OVERLAY_ENABLED_STATE = "ohos.permission.CHANGE_OVERLAY_ENABLED_STATE"; 163 164 constexpr const char* SCENE_BOARD_BUNDLE_NAME = "com.ohos.sceneboard"; 165 166 // clone application 167 constexpr int32_t MAIN_APP_INDEX = 0; 168 constexpr int32_t CLONE_APP_INDEX_MAX = 5; 169 170 //param key-value 171 constexpr const char* VERIFY_UNINSTALL_FORCED_KEY = "ohos.bms.param.verifyUninstallForced"; 172 constexpr const char* VERIFY_UNINSTALL_FORCED_VALUE = "true"; 173 174 constexpr const char* VERIFY_UNINSTALL_RULE_KEY = "ohos.bms.param.verifyUninstallRule"; 175 constexpr const char* VERIFY_UNINSTALL_RULE_VALUE = "true"; 176 177 constexpr const char* SUPPORT_APP_TYPES_SEPARATOR = ","; 178 constexpr const char* APP_DISTRIBUTION_TYPE_WHITE_LIST = "appDistributionTypeWhiteList"; 179 } // namespace Constants 180 } // namespace AppExecFwk 181 } // namespace OHOS 182 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H