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 #ifndef OS_ACCOUNT_INTERFACES_INNERKITS_OS_ACCOUNT_CONSTANT_H 16 #define OS_ACCOUNT_INTERFACES_INNERKITS_OS_ACCOUNT_CONSTANT_H 17 18 #include <string> 19 #include "os_account_info.h" 20 21 namespace OHOS { 22 namespace AccountSA { 23 namespace Constants { 24 const std::string PATH_SEPARATOR = "/"; 25 const std::string USER_INFO_BASE = "/data/service/el1/public/account"; 26 const std::string SYSTEM_ETC_BASE = "/system/etc/account"; 27 const std::string OSACCOUNT_CONSTRAINTS_JSON_PATH = SYSTEM_ETC_BASE + PATH_SEPARATOR + "osaccount_constraints.json"; 28 const std::string CONSTRAINTS_LIST_JSON_PATH = SYSTEM_ETC_BASE + PATH_SEPARATOR + "constraints_list_collection.json"; 29 const std::string ACCOUNT_LIST_FILE_JSON_PATH = USER_INFO_BASE + PATH_SEPARATOR + "account_list.json"; 30 const std::string BASE_OSACCOUNT_CONSTRAINTS_JSON_PATH = 31 USER_INFO_BASE + PATH_SEPARATOR + "base_os_account_constraints.json"; 32 const std::string GLOBAL_OSACCOUNT_CONSTRAINTS_JSON_PATH = 33 USER_INFO_BASE + PATH_SEPARATOR + "global_os_account_constraints.json"; 34 const std::string SPECIFIC_OSACCOUNT_CONSTRAINTS_JSON_PATH = 35 USER_INFO_BASE + PATH_SEPARATOR + "specific_os_account_constraints.json"; 36 const std::string USER_PHOTO_FILE_PNG_NAME = "fase.png"; 37 const std::string USER_PHOTO_FILE_JPG_NAME = "fase.jpg"; 38 const std::string USER_PHOTO_BASE_JPG_HEAD = "data:image/jpeg;base64,"; 39 const std::string USER_PHOTO_BASE_PNG_HEAD = "data:image/png;base64,"; 40 const std::string USER_INFO_FILE_NAME = "account_info.json"; 41 const std::string OPERATION_ACTIVATE = "activate"; 42 const std::string OPERATION_CREATE = "create"; 43 const std::string OPERATION_DELETE = "delete"; 44 const std::string OPERATION_SWITCH = "switch"; 45 const std::string OPERATION_STOP = "stop"; 46 const std::string OPERATION_UPDATE = "update"; 47 const char OPERATION_UNLOCK[] = "unlock"; 48 49 // distributed database 50 const std::string APP_ID = "os_account_mgr_service"; 51 const bool SYNC_OS_ACCOUNT_DATABASE = true; 52 const std::uint32_t DEVICE_UUID_LENGTH = 65; 53 54 // uid judgment 55 const std::int32_t APP_UID_START = 2100; 56 const std::int32_t MAX_SYSTEM_UID_NUM = 2899; 57 58 // subscribe 59 const int SUBSCRIBER_MAX_SIZE = 100; 60 // account restrict 61 const unsigned int LOCAL_NAME_MAX_SIZE = 1024; 62 const unsigned int LOCAL_PHOTO_MAX_SIZE = 1024 * 4; 63 64 // domain info limits 65 const unsigned int DOMAIN_NAME_MAX_SIZE = 128; 66 const unsigned int DOMAIN_ACCOUNT_NAME_MAX_SIZE = 512; 67 68 // constraint limits 69 const unsigned int CONSTRAINT_MAX_SIZE = 128; 70 71 const std::int32_t ADMIN_LOCAL_ID = 0; 72 const int ADMIN_TYPE = -1; 73 const std::string ADMIN_LOCAL_NAME = "admin"; 74 const std::string STANDARD_LOCAL_NAME = "user"; 75 const std::int32_t START_USER_ID = 100; 76 const std::string START_USER_STRING_ID = "100"; 77 const std::int32_t MAX_USER_ID = 1099; 78 const std::int32_t INVALID_OS_ACCOUNT_ID = -1; 79 const size_t MAX_USER_ID_LENGTH = 4; 80 const int64_t SERIAL_NUMBER_NUM_START_FOR_ADMIN = 20210231; 81 const int64_t SERIAL_NUMBER_NUM_START = 1; 82 const int64_t CARRY_NUM = 100000000; 83 const bool IS_SERIAL_NUMBER_FULL_INIT_VALUE = false; 84 const int64_t TIME_WAIT_TIME_OUT = 5; 85 const std::int32_t WAIT_ONE_TIME = 1000; 86 87 // type template 88 const std::string DEVICE_OWNER_ID = "deviceOwnerId"; 89 const std::string ALL_GLOBAL_CONSTRAINTS = "allGlobalConstraints"; 90 const std::string ALL_SPECIFIC_CONSTRAINTS = "allSpecificConstraints"; 91 const std::string USER_CONSTRAINTS_TEMPLATE = "UserConstraintsTemplate"; 92 const std::string TYPE_LIST = "TypeList"; 93 const std::string ACCOUNT_LIST = "AccountList"; 94 const std::string COUNT_ACCOUNT_NUM = "CountAccountNum"; 95 const std::string MAX_ALLOW_CREATE_ACCOUNT_ID = "MaxAllowCreateAccountID"; 96 const std::string SERIAL_NUMBER_NUM = "SerialNumber"; 97 const std::string IS_MULTI_OS_ACCOUNT_ENABLE = "IsMultiOsAccountEnable"; 98 const std::string IS_SERIAL_NUMBER_FULL = "isSerialNumberFull"; 99 const std::string CONSTRAINTS_LIST = "constraints"; 100 const std::string IS_ALLOWED_CREATE_ADMIN = "IsAllowedCreateAdmin"; 101 102 // start type 103 const OS_ACCOUNT_SWITCH_MOD NOW_OS_ACCOUNT_SWITCH_MOD = OS_ACCOUNT_SWITCH_MOD::HOT_SWITCH; 104 }; // namespace Constants 105 } // namespace AccountSA 106 } // namespace OHOS 107 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_OS_ACCOUNT_CONSTANT_H 108