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 56 // for render process 57 constexpr int32_t START_UID_FOR_RENDER_PROCESS = 1000000; 58 constexpr int32_t END_UID_FOR_RENDER_PROCESS = 1099999; 59 60 // permissions 61 constexpr const char* PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE"; 62 constexpr const char* PERMISSION_UNINSTALL_CLONE_BUNDLE = "ohos.permission.UNINSTALL_CLONE_BUNDLE"; 63 constexpr const char* PERMISSION_GET_BUNDLE_INFO = "ohos.permission.GET_BUNDLE_INFO"; 64 constexpr const char* PERMISSION_GET_BUNDLE_INFO_PRIVILEGED = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"; 65 constexpr const char* PERMISSION_CHANGE_ABILITY_ENABLED_STATE = "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"; 66 constexpr const char* PERMISSION_REMOVECACHEFILE = "ohos.permission.REMOVE_CACHE_FILES"; 67 constexpr const char* PERMISSION_GET_DEFAULT_APPLICATION = "ohos.permission.GET_DEFAULT_APPLICATION"; 68 constexpr const char* PERMISSION_SET_DEFAULT_APPLICATION = "ohos.permission.SET_DEFAULT_APPLICATION"; 69 constexpr const char* PERMISSION_GET_INSTALLED_BUNDLE_LIST = "ohos.permission.GET_INSTALLED_BUNDLE_LIST"; 70 constexpr const char* PERMISSION_RUN_DYN_CODE = "ohos.permission.RUN_DYN_CODE"; 71 constexpr const char* PERMISSION_ACCESS_DYNAMIC_ICON = "ohos.permission.ACCESS_DYNAMIC_ICON"; 72 constexpr const char* PERMISSION_START_SHORTCUT = "ohos.permission.START_SHORTCUT"; 73 constexpr const char* PERMISSION_INSTALL_CLONE_BUNDLE = "ohos.permission.INSTALL_CLONE_BUNDLE"; 74 constexpr const char* PERMISSION_MANAGER_SHORTCUT = "ohos.permission.MANAGE_SHORTCUTS"; 75 constexpr const char* PERMISSION_ACCESS_APP_INSTALL_DIR = "ohos.permission.ACCESS_APP_INSTALL_DIR"; 76 77 enum class AppType { 78 SYSTEM_APP = 0, 79 THIRD_SYSTEM_APP, 80 THIRD_PARTY_APP, 81 }; 82 83 enum NoGetBundleStatsFlag : uint32_t { 84 GET_BUNDLE_WITH_ALL_SIZE = 0x00000000, 85 GET_BUNDLE_WITHOUT_INSTALL_SIZE = 0x00000001, 86 GET_BUNDLE_WITHOUT_DATA_SIZE = 0x00000002, 87 GET_BUNDLE_WITHOUT_CACHE_SIZE = 0x00000004, 88 }; 89 90 constexpr const char* ACTION_HOME = "action.system.home"; 91 constexpr const char* WANT_ACTION_HOME = "ohos.want.action.home"; 92 constexpr const char* ENTITY_HOME = "entity.system.home"; 93 94 constexpr uint8_t MAX_BUNDLE_NAME = 128; 95 constexpr uint8_t MIN_BUNDLE_NAME = 7; 96 constexpr uint8_t MAX_JSON_ELEMENT_LENGTH = 255; 97 constexpr uint16_t MAX_JSON_ARRAY_LENGTH = 512; 98 99 constexpr uint16_t MAX_JSON_STRING_LENGTH = 4096; 100 constexpr const char* UID = "uid"; 101 constexpr const char* USER_ID = "userId"; 102 constexpr const char* BUNDLE_NAME = "bundleName"; 103 constexpr const char* MODULE_NAME = "moduleName"; 104 constexpr const char* ABILITY_NAME = "abilityName"; 105 constexpr const char* HAP_PATH = "hapPath"; 106 constexpr const char* APP_INDEX = "appIndex"; 107 constexpr int8_t MAX_LIMIT_SIZE = 4; 108 109 constexpr const char* PARAM_URI_SEPARATOR = ":///"; 110 constexpr uint8_t PARAM_URI_SEPARATOR_LEN = 4; 111 constexpr const char* URI_SEPARATOR = "://"; 112 113 // ipc 114 constexpr int32_t CAPACITY_SIZE = 1 * 1024 * 1000; // 1M 115 constexpr int32_t MAX_PARCEL_CAPACITY = 100 * 1024 * 1024; // 100M 116 117 // permission 118 constexpr const char* LISTEN_BUNDLE_CHANGE = "ohos.permission.LISTEN_BUNDLE_CHANGE"; 119 120 // sandbox application 121 constexpr const char* SANDBOX_APP_INDEX = "sandbox_app_index"; 122 constexpr int16_t INITIAL_APP_INDEX = 0; 123 constexpr int16_t INITIAL_SANDBOX_APP_INDEX = 1000; 124 constexpr int16_t MAX_APP_INDEX = 100; 125 constexpr int16_t MAX_SANDBOX_APP_INDEX = INITIAL_SANDBOX_APP_INDEX + 100; 126 127 // app-distribution-type 128 constexpr const char* APP_DISTRIBUTION_TYPE_NONE = "none"; 129 constexpr const char* APP_DISTRIBUTION_TYPE_APP_GALLERY = "app_gallery"; 130 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE = "enterprise"; 131 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_NORMAL = "enterprise_normal"; 132 constexpr const char* APP_DISTRIBUTION_TYPE_ENTERPRISE_MDM = "enterprise_mdm"; 133 constexpr const char* APP_DISTRIBUTION_TYPE_INTERNALTESTING = "internaltesting"; 134 constexpr const char* APP_DISTRIBUTION_TYPE_OS_INTEGRATION = "os_integration"; 135 constexpr const char* APP_DISTRIBUTION_TYPE_CROWDTESTING = "crowdtesting"; 136 // app provision type 137 constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug"; 138 constexpr const char* APP_PROVISION_TYPE_RELEASE = "release"; 139 140 // crowdtesting 141 constexpr int8_t INVALID_CROWDTEST_DEADLINE = -1; 142 constexpr int8_t INHERIT_CROWDTEST_DEADLINE = -2; 143 144 // overlay installation 145 constexpr const char* OVERLAY_STATE = "overlayState"; 146 constexpr const char* PERMISSION_CHANGE_OVERLAY_ENABLED_STATE = "ohos.permission.CHANGE_OVERLAY_ENABLED_STATE"; 147 148 constexpr const char* SCENE_BOARD_BUNDLE_NAME = "com.ohos.sceneboard"; 149 150 // clone application 151 constexpr int32_t MAIN_APP_INDEX = 0; 152 } // namespace Constants 153 } // namespace AppExecFwk 154 } // namespace OHOS 155 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H