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_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H 18 19 #include <map> 20 #include <set> 21 #include <string> 22 #include <vector> 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 namespace ServiceConstants { 27 constexpr const char* ASSETS_DIR = "assets"; 28 constexpr const char* RESOURCES_INDEX = "resources.index"; 29 constexpr int32_t INVALID_GID = -1; 30 const int32_t BUNDLE_RDB_VERSION = 1; 31 const std::string PATH_SEPARATOR = "/"; 32 const std::string LIBS = "libs/"; 33 const std::string AN = "an/"; 34 const std::string RES_FILE_PATH = "resources/resfile/"; 35 const std::string HNPS_FILE_PATH = "hnp_tmp_extract_dir/"; 36 const std::string HNPS = "hnp/"; 37 constexpr const char* DIR_EL1 = "el1"; 38 constexpr const char* DIR_EL2 = "el2"; 39 constexpr const char* DIR_EL3 = "el3"; 40 constexpr const char* DIR_EL4 = "el4"; 41 constexpr const char* DIR_EL5 = "el5"; 42 const std::vector<std::string> BUNDLE_EL = {DIR_EL1, DIR_EL2, DIR_EL3, DIR_EL4}; 43 constexpr const char* ARM_EABI = "armeabi"; 44 constexpr const char* ARM_EABI_V7A = "armeabi-v7a"; 45 constexpr const char* ARM64_V8A = "arm64-v8a"; 46 constexpr const char* ARM64 = "arm64"; 47 constexpr const char* X86 = "x86"; 48 constexpr const char* X86_64 = "x86_64"; 49 const std::map<std::string, std::string> ABI_MAP = { 50 {ARM_EABI, "arm"}, 51 {ARM_EABI_V7A, "arm"}, 52 {ARM64_V8A, "arm64"}, 53 {X86, "x86"}, 54 {X86_64, "x86_64"}, 55 }; 56 const std::string CLONE_BUNDLE_PREFIX = "clone_"; 57 constexpr const char* UNINSTALL_TMP_PREFIX = "=uninstall_tmp_"; 58 constexpr const char* INSTALL_FILE_SUFFIX = ".hap"; 59 constexpr const char* HSP_FILE_SUFFIX = ".hsp"; 60 constexpr const char* QUICK_FIX_FILE_SUFFIX = ".hqf"; 61 const char FILE_SEPARATOR_CHAR = '/'; 62 constexpr const char* CURRENT_DEVICE_ID = "PHONE-001"; 63 constexpr const char* HAP_COPY_PATH = "/data/service/el1/public/bms/bundle_manager_service"; 64 constexpr const char* TMP_SUFFIX = "_tmp"; 65 constexpr const char* BUNDLE_APP_DATA_BASE_DIR = "/data/app/"; 66 constexpr const char* BASE = "/base/"; 67 constexpr const char* CLONE = "clone"; 68 constexpr const char* PLUS_SIGN = "+"; 69 constexpr const char* MINUS_SIGN = "-"; 70 constexpr const char* DATABASE = "/database/"; 71 constexpr const char* LOG = "/log/"; 72 constexpr const char* HAPS = "/haps/"; 73 constexpr const char* EXTENSION_DIR = "+extension-"; 74 constexpr const char* FILE_SEPARATOR_LINE = "-"; 75 constexpr const char* FILE_SEPARATOR_PLUS = "+"; 76 constexpr const char* BUNDLE_MANAGER_SERVICE_PATH = "/data/service/el1/public/bms/bundle_manager_service"; 77 constexpr const char* SANDBOX_DATA_PATH = "/data/storage/el2/base"; 78 constexpr const char* APP_INSTALL_SANDBOX_PATH = "/data/bms_app_install"; 79 constexpr const char* REAL_DATA_PATH = "/data/app/el2"; 80 constexpr const char* DATA_GROUP_PATH = "/group/"; 81 constexpr const char* STREAM_INSTALL_PATH = "stream_install"; 82 constexpr const char* SECURITY_STREAM_INSTALL_PATH = "security_stream_install"; 83 constexpr const char* QUICK_FIX_PATH = "quick_fix"; 84 constexpr const char* SECURITY_QUICK_FIX_PATH = "security_quick_fix"; 85 constexpr const char* BUNDLE_ASAN_LOG_DIR = "/data/local/app-logs"; 86 constexpr const char* SCREEN_LOCK_FILE_DATA_PATH = "/data/app/el5"; 87 constexpr const char* GALLERY_DOWNLOAD_PATH = "/app_install/"; 88 constexpr int NOT_EXIST_USERID = -5; 89 constexpr int PATH_MAX_SIZE = 256; 90 constexpr int32_t API_VERSION_NINE = 9; 91 constexpr int32_t API_VERSION_TWELVE = 12; 92 constexpr int32_t BACKUP_DEFAULT_APP_KEY = -2; 93 // native so 94 constexpr const char* ABI_DEFAULT = "default"; 95 constexpr const char* ABI_SEPARATOR = ","; 96 constexpr const char* MODULE_NAME_SEPARATOR = ","; 97 constexpr const char* AN_SUFFIX = ".an"; 98 constexpr const char* AP_SUFFIX = ".ap"; 99 constexpr const char* SYSTEM_LIB64 = "/system/lib64"; 100 constexpr const char* PATCH_PATH = "patch_"; 101 constexpr const char* HOT_RELOAD_PATH = "hotreload_"; 102 // uid and gid 103 constexpr int32_t BMS_UID = 1000; 104 constexpr int32_t SHELL_UID = 2000; 105 constexpr int32_t BACKU_HOME_GID = 1089; 106 constexpr int32_t ACCOUNT_UID = 3058; 107 constexpr int32_t BMS_GID = 1000; 108 constexpr int32_t DATABASE_DIR_GID = 3012; 109 constexpr int32_t DFS_GID = 1009; 110 constexpr int32_t LOG_DIR_GID = 1007; 111 constexpr int32_t APP_INSTALL_GID = 2002; 112 // permissions 113 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_BUNDLE"; 114 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_NORMAL_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE"; 115 constexpr const char* PERMISSION_INSTALL_ENTERPRISE_MDM_BUNDLE = "ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE"; 116 constexpr const char* PERMISSION_INSTALL_INTERNALTESTING_BUNDLE = "ohos.permission.INSTALL_INTERNALTESTING_BUNDLE"; 117 constexpr const char* PERMISSION_MANAGE_DISPOSED_APP_STATUS = "ohos.permission.MANAGE_DISPOSED_APP_STATUS"; 118 constexpr const char* PERMISSION_INSTALL_SELF_BUNDLE = "ohos.permission.INSTALL_SELF_BUNDLE"; 119 constexpr const char* PERMISSION_UNINSTALL_BUNDLE = "ohos.permission.UNINSTALL_BUNDLE"; 120 constexpr const char* PERMISSION_RECOVER_BUNDLE = "ohos.permission.RECOVER_BUNDLE"; 121 constexpr const char* PERMISSION_GET_BUNDLE_RESOURCES = "ohos.permission.GET_BUNDLE_RESOURCES"; 122 constexpr const char* PERMISSION_INSTALL_SANDBOX_BUNDLE = "ohos.permission.INSTALL_SANDBOX_BUNDLE"; 123 constexpr const char* PERMISSION_UNINSTALL_SANDBOX_BUNDLE = "ohos.permission.UNINSTALL_SANDBOX_BUNDLE"; 124 constexpr const char* PERMISSION_INSTALL_QUICK_FIX_BUNDLE = "ohos.permission.INSTALL_QUICK_FIX_BUNDLE"; 125 constexpr const char* PERMISSION_UNINSTALL_QUICK_FIX_BUNDLE = "ohos.permission.UNINSTALL_QUICK_FIX_BUNDLE"; 126 constexpr const char* PERMISSION_CHANGE_BUNDLE_UNINSTALL_STATE = "ohos.permission.CHANGE_BUNDLE_UNINSTALL_STATE"; 127 constexpr const char* PERMISSION_PROTECT_SCREEN_LOCK_DATA = "ohos.permission.PROTECT_SCREEN_LOCK_DATA"; 128 129 constexpr const char* FLAG_HOME_INTENT_FROM_SYSTEM = "flag.home.intent.from.system"; 130 // max number of haps under one direction 131 constexpr uint8_t MAX_HAP_NUMBER = 128; 132 constexpr const char* DATA_ABILITY_URI_PREFIX = "dataability://"; 133 // appFeature 134 constexpr const char* HOS_SYSTEM_APP = "hos_system_app"; 135 // rdb 136 constexpr const char* BUNDLE_RDB_NAME = "/bmsdb.db"; 137 // thread pool 138 constexpr const char* RELATIVE_PATH = "../"; 139 // app detail ability 140 constexpr const char* APP_DETAIL_ABILITY = "AppDetailAbility"; 141 // overlay installation 142 constexpr int32_t DEFAULT_OVERLAY_ENABLE_STATUS = 1; 143 constexpr int32_t DEFAULT_OVERLAY_DISABLE_STATUS = 0; 144 constexpr int32_t OVERLAY_MINIMUM_PRIORITY = 1; 145 // ark compile mode 146 constexpr const char* COMPILE_PARTIAL = "partial"; 147 constexpr const char* ARK_CACHE_PATH = "/data/local/ark-cache/"; 148 constexpr const char* ARK_PROFILE_PATH = "/data/local/ark-profile/"; 149 // code signature 150 constexpr const char* CODE_SIGNATURE_FILE_SUFFIX = ".sig"; 151 constexpr const char* CODE_SIGNATURE_HAP = "Hap"; 152 constexpr const char* SIGNATURE_FILE_PATH = "signature_files"; 153 constexpr const char* SECURITY_SIGNATURE_FILE_PATH = "security_signature_files"; 154 //pgo file 155 constexpr const char* PGO_FILE_SUFFIX = ".ap"; 156 // system param 157 constexpr const char* ALLOW_ENTERPRISE_BUNDLE = "const.bms.allowenterprisebundle"; 158 constexpr const char* IS_ENTERPRISE_DEVICE = "const.edm.is_enterprise_device"; 159 constexpr const char* DEVELOPERMODE_STATE = "const.security.developermode.state"; 160 //extResource 161 constexpr const char* EXT_RESOURCE_FILE_PATH = "ext_resource"; 162 // hmdfs and sharefs config 163 constexpr const char* HMDFS_CONFIG_PATH = "/config/hmdfs/"; 164 constexpr const char* SHAREFS_CONFIG_PATH = "/config/sharefs/"; 165 constexpr const char* SYSTEM_SERVICE_DIR = "/data/service/el1/public"; 166 constexpr const char* SYSTEM_UI_BUNDLE_NAME = "com.ohos.systemui"; 167 constexpr const char* LAUNCHER_BUNDLE_NAME = "com.ohos.launcher"; 168 // clone application 169 constexpr int32_t CLONE_APP_INDEX_MIN = 1; 170 constexpr int32_t CLONE_APP_INDEX_MAX = 5; 171 // shader 172 constexpr const char* SHADER_CACHE_PATH = "/data/local/shader_cache/local/"; 173 constexpr const char* CLOUD_SHADER_PATH = "/data/local/shader_cache/cloud/"; 174 constexpr const char* CLOUD_SHADER_OWNER = "const.appgallery.shaderowner.bundlename"; 175 // apiReleaseType 176 const std::string API_RELEASE_TYPE_RELEASE = "Release"; 177 const std::string API_RELEASE_TYPE_BETA = "Beta"; 178 const std::string API_RELEASE_TYPE_CANARY = "Canary"; 179 // allow multi icon bundle 180 const std::set<std::string> ALLOW_MULTI_ICON_BUNDLE = { 181 "com.ohos.contacts" 182 }; 183 constexpr const char* CALLER_NAME_BMS = "bms"; 184 // group 185 constexpr int16_t DATA_GROUP_DIR_MODE = 02770; 186 } // namespace ServiceConstants 187 } // namespace AppExecFwk 188 } // namespace OHOS 189 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_SERVICE_CONSTANTS_H