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_BUNDLE_CONSTANTS_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace AppExecFwk { 23 namespace Constants { 24 25 const std::string EMPTY_STRING = ""; 26 const std::string BUNDLE_PROFILE_NAME = "config.json"; 27 const std::string INSTALL_FILE_SUFFIX = ".hap"; 28 const std::string PATH_SEPARATOR = "/"; 29 const std::string FILE_UNDERLINE = "_"; 30 const std::string ILLEGAL_PATH_FIELD = "../"; 31 const char DOT_SUFFIX = '.'; 32 const std::string CURRENT_DEVICE_ID = "PHONE-001"; 33 const std::string BUNDLE_DATA_BASE_DIR = "/data/bundlemgr"; 34 const std::string BUNDLE_DATA_BASE_FILE = BUNDLE_DATA_BASE_DIR + "/bmsdb.json"; 35 const std::string SYSTEM_APP_SCAN_PATH = "/system/app"; 36 const std::string SYSTEM_APP_INSTALL_PATH = "/data/accounts"; 37 const std::string THIRD_SYSTEM_APP_SCAN_PATH = "/system/vendor"; 38 const std::string THIRD_SYSTEM_APP_INSTALL_PATH = "/data/accounts"; 39 const std::string THIRD_PARTY_APP_INSTALL_PATH = "/data/accounts"; 40 const std::string EXTRACT_TMP_PATH = "/data/sadata/install_tmp/bundle_haps"; 41 const std::string HAP_COPY_PATH = "/data/sadata/install_tmp/Tmp_"; 42 const std::string USER_ACCOUNT_DIR = "account"; 43 const std::string APP_CODE_DIR = "applications"; 44 const std::string APP_DATA_DIR = "appdata"; 45 const std::string DATA_BASE_DIR = "database"; 46 const std::string DATA_DIR = "files"; 47 const std::string CACHE_DIR = "cache"; 48 const std::string SHARED_DIR = "shared"; 49 const std::string SHARED_PREFERENCE_DIR = "sharedPreference"; 50 const std::string TMP_SUFFIX = "_tmp"; 51 const std::string ASSETS_DIR = "assets"; 52 const std::string RESOURCES_INDEX = "resources.index"; 53 54 const std::string BMS_SERVICE_NAME = "BundleMgrService"; 55 const std::string INSTALLD_SERVICE_NAME = "installd"; 56 const std::string SYSTEM_APP = "system"; 57 const std::string THIRD_PARTY_APP = "third-party"; 58 constexpr int DEFAULT_USERID = 0; 59 constexpr int INVALID_USERID = -1; 60 constexpr int PATH_MAX_SIZE = 256; 61 constexpr int SIGNATURE_MATCHED = 0; 62 constexpr int SIGNATURE_NOT_MATCHED = 1; 63 constexpr int SIGNATURE_UNKNOWN_BUNDLE = 2; 64 constexpr int PERMISSION_GRANTED = 0; 65 constexpr int PERMISSION_NOT_GRANTED = -1; 66 constexpr int DUMP_INDENT = 4; 67 constexpr unsigned int INSTALLD_UMASK = 0000; 68 69 // uid and gid 70 constexpr int32_t INVALID_UID = -1; 71 constexpr int32_t INVALID_GID = -1; 72 constexpr int32_t ROOT_UID = 0; 73 constexpr int32_t BMS_UID = 1000; 74 constexpr int32_t BMS_GID = 1000; 75 constexpr int32_t BASE_SYS_UID = 2100; 76 constexpr int32_t MAX_SYS_UID = 2899; 77 constexpr int32_t BASE_SYS_VEN_UID = 5000; 78 constexpr int32_t MAX_SYS_VEN_UID = 5999; 79 constexpr int32_t BASE_APP_UID = 10000; 80 constexpr int32_t MAX_APP_UID = 65535; 81 const std::string PROFILE_KEY_UID_SIZE = "size"; 82 const std::string PROFILE_KEY_UID_AND_GID = "uid_and_gid"; 83 84 // permissions 85 const std::string PERMISSION_INSTALL_BUNDLE = "ohos.permission.INSTALL_BUNDLE"; 86 87 enum class AppType { 88 SYSTEM_APP = 0, 89 THIRD_SYSTEM_APP, 90 THIRD_PARTY_APP, 91 }; 92 93 const std::string INTENT_ACTION_HOME = "action.system.home"; 94 const std::string INTENT_ENTITY_HOME = "entity.system.home"; 95 const std::string FLAG_HOME_INTENT_FROM_SYSTEM = "flag.home.intent.from.system"; 96 97 // the ability file folder name. 98 const std::string LIB_FOLDER_NAME = "libs"; 99 const std::string RES_FOLDER_NAME = "resources"; 100 101 constexpr uint8_t MAX_LABLE_LEN = 30; 102 constexpr uint8_t MAX_BUNDLE_NAME = 255; 103 constexpr uint8_t MIN_BUNDLE_NAME = 7; 104 constexpr uint8_t MAX_VENDOR = 255; 105 constexpr uint8_t EQUAL_ZERO = 0; 106 constexpr uint8_t MAX_MODULE_PACKAGE = 127; 107 constexpr uint8_t MAX_MODULE_NAME = 255; 108 constexpr uint8_t MAX_MODULE_ABILITIES_READPERMISSION = 255; 109 constexpr uint8_t MAX_MODULE_ABILITIES_WRITEPERMISSION = 255; 110 constexpr uint8_t MAX_MODULE_SHORTCUTID = 63; 111 constexpr uint8_t MAX_MODULE_LABEL = 63; 112 // distributed database 113 const std::string APP_ID = "bundle_manager_service"; 114 const std::string STORE_ID = "installed_bundle_datas"; 115 const std::string ABILITY_USAGE_STORE_ID = "ability_usage_datas"; 116 117 // single max hap size 118 constexpr int32_t MAX_HAP_SIZE = 50 * 1024 * 1024; 119 120 const std::string UID = "uid"; 121 const int32_t MAX_LIMIT_SIZE = 4; 122 123 const std::string DATA_ABILITY_URI_PREFIX = "dataability://"; 124 const char DATA_ABILITY_URI_SEPARATOR = '/'; 125 126 const int MAX_DIMENSION_SIZE = 10; 127 const int MAX_DEVICETYPE_SIZE = 50; 128 129 } // namespace Constants 130 } // namespace AppExecFwk 131 } // namespace OHOS 132 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_BUNDLE_CONSTANTS_H