已合并
modify ohos dfx #3727
cicely0504创建于 7月28日
modify ohos dfx #3727
已合并
共 90 个文件变更+1515-5015
| @@ -25,6 +25,9 @@ | |||
| 25 | namespace OHOS { | 25 | namespace OHOS { |
| 26 | namespace AccountSA { | 26 | namespace AccountSA { |
| 27 | namespace Constants { | 27 | namespace Constants { |
| 28 | +// publish | ||
| 29 | +const char OPERATION_EVENT_PUBLISH[] = "eventPublish"; | ||
| 30 | +const char OPERATION_GET_INFO[] = "getInfo"; | ||
| 28 | //DOMAIN_DFX | 31 | //DOMAIN_DFX |
| 29 | const char DOMAIN_OPT_REGISTER[] = "registerPlugin"; | 32 | const char DOMAIN_OPT_REGISTER[] = "registerPlugin"; |
| 30 | const char DOMAIN_OPT_UNREGISTER[] = "unregisterPlugin"; | 33 | const char DOMAIN_OPT_UNREGISTER[] = "unregisterPlugin"; |
| @@ -29,18 +29,6 @@ constexpr const char TIMER_NAME[] = "AccountMgrTimer"; | |||
| 29 | namespace Constants { | 29 | namespace Constants { |
| 30 | constexpr int32_t DELAY_FOR_EXCEPTION = 100; | 30 | constexpr int32_t DELAY_FOR_EXCEPTION = 100; |
| 31 | constexpr int32_t MAX_RETRY_TIMES = 10; | 31 | constexpr int32_t MAX_RETRY_TIMES = 10; |
| 32 | -const char OPERATION_EVENT_PUBLISH[] = "eventPublish"; | ||
| 33 | -const char OPERATION_GET_INFO[] = "getInfo"; | ||
| 34 | -const char OPERATION_SET_INFO[] = "setInfo"; | ||
| 35 | -const char OPERATION_TOKEN_INVALID[] = "tokenInvalid"; | ||
| 36 | -const char OPERATION_LOGOUT[] = "logout"; | ||
| 37 | -const char OPERATION_LOGOFF[] = "logoff"; | ||
| 38 | -const char OPERATION_LOGIN[] = "login"; | ||
| 39 | -const char OPERATION_SUBSCRIBE[] = "subscribe"; | ||
| 40 | -const char OPERATION_UNSUBSCRIBE[] = "unsubscribe"; | ||
| 41 | -const char OPERATION_SUBSCRIBE_SPACE_EVENT[] = "subscribeSpaceEvent"; | ||
| 42 | -const char OPERATION_UNSUBSCRIBE_SPACE_EVENT[] = "unsubscribeSpaceEvent"; | ||
| 43 | -const char OPERATION_GET_SERVICE[] = "getService"; | ||
| 44 | const int32_t E_IPC_ERROR = 29189; | 32 | const int32_t E_IPC_ERROR = 29189; |
| 45 | const int32_t E_IPC_SA_DIED = 32; | 33 | const int32_t E_IPC_SA_DIED = 32; |
| 46 | constexpr int32_t UID_TRANSFORM_DIVISOR = 200000; // local account id = uid / UID_TRANSFORM_DIVISOR | 34 | constexpr int32_t UID_TRANSFORM_DIVISOR = 200000; // local account id = uid / UID_TRANSFORM_DIVISOR |
| @@ -54,11 +54,6 @@ const char OHOS_ACCOUNT_EVENT_LOGOFF[] = "Ohos.account.event.LOGOFF"; | |||
| 54 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_CREATE[] = "Ohos.account.event.DISTRIBUTED_SPACE_CREATE"; | 54 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_CREATE[] = "Ohos.account.event.DISTRIBUTED_SPACE_CREATE"; |
| 55 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_DELETED[] = "Ohos.account.event.DISTRIBUTED_SPACE_DELETE"; | 55 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_DELETED[] = "Ohos.account.event.DISTRIBUTED_SPACE_DELETE"; |
| 56 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_SWITCHED[] = "Ohos.account.event.DISTRIBUTED_SPACE_SWITCH"; | 56 | const char OHOS_ACCOUNT_EVENT_DISTRIBUTED_SPACE_SWITCHED[] = "Ohos.account.event.DISTRIBUTED_SPACE_SWITCH"; |
| 57 | -const char OPERATION_INIT_OPEN_FILE_TO_READ[] = "InitOpenFileToRead"; | ||
| 58 | -const char OPERATION_REMOVE_FILE[] = "RemoveFile"; | ||
| 59 | -const char OPERATION_OPEN_FILE_TO_READ[] = "OpenFileToRead"; | ||
| 60 | -const char OPERATION_OPEN_FILE_TO_WRITE[] = "OpenFileToWrite"; | ||
| 61 | -const char OPERATION_CHANGE_MODE_FILE[] = "ChangeModeFile"; | ||
| 62 | const char OPERATION_FORCE_CREATE_DIRECTORY[] = "ForceCreateDirectory"; | 57 | const char OPERATION_FORCE_CREATE_DIRECTORY[] = "ForceCreateDirectory"; |
| 63 | const char OPERATION_CHANGE_MODE_DIRECTORY[] = "ChangeModeDirectory"; | 58 | const char OPERATION_CHANGE_MODE_DIRECTORY[] = "ChangeModeDirectory"; |
| 64 | /** | 59 | /** |
| @@ -0,0 +1,54 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2026 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +namespace OHOS { | ||
| 22 | +namespace AccountSA { | ||
| 23 | +namespace Constants { | ||
| 24 | +//OHOS_DFX | ||
| 25 | +const char OPERATION_SET_INFO[] = "setInfo"; | ||
| 26 | +const char OPERATION_INIT[] = "init"; | ||
| 27 | +const char OPERATION_STATE_CHANGE[] = "stateChange"; | ||
| 28 | +const char OPERATION_TOKEN_INVALID[] = "tokenInvalid"; | ||
| 29 | +const char OPERATION_LOGOUT[] = "logout"; | ||
| 30 | +const char OPERATION_LOGOFF[] = "logoff"; | ||
| 31 | +const char OPERATION_LOGIN[] = "login"; | ||
| 32 | +const char OPERATION_SUBSCRIBE[] = "subscribe"; | ||
| 33 | +const char OPERATION_UNSUBSCRIBE[] = "unsubscribe"; | ||
| 34 | +const char OPERATION_SUBSCRIBE_SPACE_EVENT[] = "subscribeSpaceEvent"; | ||
| 35 | +const char OPERATION_UNSUBSCRIBE_SPACE_EVENT[] = "unsubscribeSpaceEvent"; | ||
| 36 | +const char OPERATION_GET_SERVICE[] = "getService"; | ||
| 37 | +const char OPERATION_CLEAR[] = "clear"; | ||
| 38 | +const char OPERATION_FILE_WATCHER[] = "fileWatcher"; | ||
| 39 | +//FILE_DFX | ||
| 40 | +const char OPERATION_INIT_OPEN_FILE_TO_READ[] = "InitOpenFileToRead"; | ||
| 41 | +const char OPERATION_STAT_FILE[] = "StatFile"; | ||
| 42 | +const char OPERATION_CREATE_FILE[] = "CreateFile"; | ||
| 43 | +const char OPERATION_REMOVE_FILE[] = "RemoveFile"; | ||
| 44 | +const char OPERATION_OPEN_FILE_TO_READ[] = "OpenFileToRead"; | ||
| 45 | +const char OPERATION_OPEN_FILE_TO_WRITE[] = "OpenFileToWrite"; | ||
| 46 | +const char OPERATION_CHANGE_MODE_FILE[] = "ChangeModeFile"; | ||
| 47 | +const char OPERATION_FORCE_CREATE_DIRECTORY[] = "ForceCreateDirectory"; | ||
| 48 | +const char OPERATION_CHANGE_MODE_DIRECTORY[] = "ChangeModeDirectory"; | ||
| 49 | + | ||
| 50 | +} // namespace Constants | ||
| 51 | +} // namespace AccountSA | ||
| 52 | +} // namespace OHOS | ||
| 53 | + | ||
| 54 | + | ||
| @@ -255,29 +255,30 @@ private: | |||
| 255 | * Config current account config. | 255 | * Config current account config. |
| 256 | * | 256 | * |
| 257 | * @param ohosAccountInfo target ohos account information. | 257 | * @param ohosAccountInfo target ohos account information. |
| 258 | - * @return true if success. | 258 | + * @return ERR_OK if success, specific error code if failed. |
| 259 | */ | 259 | */ |
| 260 | - bool SaveOhosAccountInfo(AccountInfo &ohosAccountInfo) const; | 260 | + ErrCode SaveOhosAccountInfo(AccountInfo &ohosAccountInfo) const; |
| 261 | 261 | ||
| 262 | /** | 262 | /** |
| 263 | * Clear current account config. | 263 | * Clear current account config. |
| 264 | * @param curOhosAccountInfo current ohos account info. | 264 | * @param curOhosAccountInfo current ohos account info. |
| 265 | * @param clrStatus account status. | 265 | * @param clrStatus account status. |
| 266 | + * @return ERR_OK if success, specific error code if failed. | ||
| 266 | */ | 267 | */ |
| 267 | - bool ClearOhosAccount(AccountInfo &curOhosAccountInfo, std::int32_t clrStatus = ACCOUNT_STATE_UNBOUND) const; | 268 | + ErrCode ClearOhosAccount(AccountInfo &curOhosAccountInfo, std::int32_t clrStatus = ACCOUNT_STATE_UNBOUND) const; |
| 268 | 269 | ||
| 269 | /** | 270 | /** |
| 270 | * Check whether the ohos account can be bound to the current user or not | 271 | * Check whether the ohos account can be bound to the current user or not |
| 271 | - * @return true if can. | 272 | + * @return ERR_OK if can bind, specific error code if cannot. |
| 272 | */ | 273 | */ |
| 273 | - bool CheckOhosAccountCanBind(const AccountInfo &currAccountInfo, | 274 | + ErrCode CheckOhosAccountCanBind(const AccountInfo &currAccountInfo, |
| 274 | const OhosAccountInfo &newOhosAccountInfo, const std::string &newOhosUid) const; | 275 | const OhosAccountInfo &newOhosAccountInfo, const std::string &newOhosUid) const; |
| 275 | 276 | ||
| 276 | /** | 277 | /** |
| 277 | * Get current ohos account info and check whether input information match or not | 278 | * Get current ohos account info and check whether input information match or not |
| 278 | - * @return true if matches. | 279 | + * @return ERR_OK if matches, specific error code if not match or read failed. |
| 279 | */ | 280 | */ |
| 280 | - bool GetCurOhosAccountAndCheckMatch(AccountInfo &curOhosAccountInfo, | 281 | + ErrCode GetCurOhosAccountAndCheckMatch(AccountInfo &curOhosAccountInfo, |
| 281 | const std::string &inputName, | 282 | const std::string &inputName, |
| 282 | const std::string &inputUid, | 283 | const std::string &inputUid, |
| 283 | const std::int32_t callingUserId) const; | 284 | const std::int32_t callingUserId) const; |
| @@ -19,7 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | - | ||
| 23 | 22 | ||
| 24 | 23 | ||
| 25 | 24 | ||
| @@ -48,6 +47,7 @@ | |||
| 48 | 47 | ||
| 49 | 48 | ||
| 50 | 49 | ||
| 50 | + | ||
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | 53 | ||
| @@ -18,11 +18,11 @@ | |||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | - | ||
| 22 | 21 | ||
| 23 | 22 | ||
| 24 | 23 | ||
| 25 | 24 | ||
| 25 | + | ||
| 26 | 26 | ||
| 27 | namespace OHOS { | 27 | namespace OHOS { |
| 28 | namespace AccountSA { | 28 | namespace AccountSA { |
| @@ -23,10 +23,10 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | - | ||
| 27 | 26 | ||
| 28 | 27 | ||
| 29 | 28 | ||
| 29 | + | ||
| 30 | 30 | ||
| 31 | namespace OHOS { | 31 | namespace OHOS { |
| 32 | namespace AccountSA { | 32 | namespace AccountSA { |
| @@ -165,7 +165,7 @@ ErrCode OhosAccountDataDeal::Init(int32_t userId) | |||
| 165 | if (!fin) { | 165 | if (!fin) { |
| 166 | int32_t err = errno; | 166 | int32_t err = errno; |
| 167 | ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", configFile.c_str(), err); | 167 | ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", configFile.c_str(), err); |
| 168 | - ReportOhosAccountOperationFail(userId, OPERATION_INIT_OPEN_FILE_TO_READ, err, configFile); | 168 | + ReportOhosAccountOperationFail(userId, Constants::OPERATION_INIT_OPEN_FILE_TO_READ, err, configFile); |
| 169 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; | 169 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; |
| 170 | } | 170 | } |
| 171 | 171 | ||
| @@ -179,7 +179,7 @@ ErrCode OhosAccountDataDeal::Init(int32_t userId) | |||
| 179 | if (RemoveFile(configFile)) { | 179 | if (RemoveFile(configFile)) { |
| 180 | int32_t err = errno; | 180 | int32_t err = errno; |
| 181 | ACCOUNT_LOGE("Remove invalid json file %{public}s failed, errno %{public}d.", configFile.c_str(), err); | 181 | ACCOUNT_LOGE("Remove invalid json file %{public}s failed, errno %{public}d.", configFile.c_str(), err); |
| 182 | - ReportOhosAccountOperationFail(userId, OPERATION_REMOVE_FILE, err, configFile); | 182 | + ReportOhosAccountOperationFail(userId, Constants::OPERATION_REMOVE_FILE, err, configFile); |
| 183 | } | 183 | } |
| 184 | return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION; | 184 | return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION; |
| 185 | } | 185 | } |
| @@ -236,6 +236,8 @@ ErrCode OhosAccountDataDeal::SaveAccountInfo(const AccountInfo &accountInfo) | |||
| 236 | avatarFile, accountInfo.ohosAccountInfo_.avatar_); | 236 | avatarFile, accountInfo.ohosAccountInfo_.avatar_); |
| 237 | if (ret != ERR_OK) { | 237 | if (ret != ERR_OK) { |
| 238 | ACCOUNT_LOGE("Failed to save avatar! ret = %{public}d", ret); | 238 | ACCOUNT_LOGE("Failed to save avatar! ret = %{public}d", ret); |
| 239 | + ReportOhosAccountOperationFail(accountInfo.userId_, Constants::OPERATION_OPEN_FILE_TO_WRITE, ret, | ||
| 240 | + "Failed to save avatar"); | ||
| 239 | return ret; | 241 | return ret; |
| 240 | } | 242 | } |
| 241 | std::string accountInfoValue = PackJsonToString(jsonData); | 243 | std::string accountInfoValue = PackJsonToString(jsonData); |
| @@ -243,10 +245,10 @@ ErrCode OhosAccountDataDeal::SaveAccountInfo(const AccountInfo &accountInfo) | |||
| 243 | 245 | ||
| 244 | ret = accountFileOperator_->InputFileByPathAndContent(configFile, accountInfoValue); | 246 | ret = accountFileOperator_->InputFileByPathAndContent(configFile, accountInfoValue); |
| 245 | if (ret == ERR_OHOSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR) { | 247 | if (ret == ERR_OHOSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR) { |
| 246 | - ReportOhosAccountOperationFail(accountInfo.userId_, OPERATION_CHANGE_MODE_FILE, ret, configFile); | 248 | + ReportOhosAccountOperationFail(accountInfo.userId_, Constants::OPERATION_CHANGE_MODE_FILE, ret, configFile); |
| 247 | } | 249 | } |
| 248 | if (ret != ERR_OK && ret != ERR_OHOSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR) { | 250 | if (ret != ERR_OK && ret != ERR_OHOSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR) { |
| 249 | - ReportOhosAccountOperationFail(accountInfo.userId_, OPERATION_OPEN_FILE_TO_WRITE, ret, configFile); | 251 | + ReportOhosAccountOperationFail(accountInfo.userId_, Constants::OPERATION_OPEN_FILE_TO_WRITE, ret, configFile); |
| 250 | } | 252 | } |
| 251 | 253 | ||
| 252 | // report data_size when distributed account profile photo updated | 254 | // report data_size when distributed account profile photo updated |
| @@ -264,7 +266,7 @@ ErrCode OhosAccountDataDeal::ParseJsonFromFile(const std::string &filePath, CJso | |||
| 264 | if (!fin) { | 266 | if (!fin) { |
| 265 | int32_t err = errno; | 267 | int32_t err = errno; |
| 266 | ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", filePath.c_str(), err); | 268 | ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", filePath.c_str(), err); |
| 267 | - ReportOhosAccountOperationFail(userId, OPERATION_OPEN_FILE_TO_READ, err, filePath); | 269 | + ReportOhosAccountOperationFail(userId, Constants::OPERATION_OPEN_FILE_TO_READ, err, filePath); |
| 268 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; | 270 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; |
| 269 | } | 271 | } |
| 270 | std::string fileContent((std::istreambuf_iterator<char>(fin)), std::istreambuf_iterator<char>()); | 272 | std::string fileContent((std::istreambuf_iterator<char>(fin)), std::istreambuf_iterator<char>()); |
| @@ -272,6 +274,7 @@ ErrCode OhosAccountDataDeal::ParseJsonFromFile(const std::string &filePath, CJso | |||
| 272 | jsonData = CreateJsonFromString(fileContent); | 274 | jsonData = CreateJsonFromString(fileContent); |
| 273 | if (jsonData == nullptr || !IsObject(jsonData)) { | 275 | if (jsonData == nullptr || !IsObject(jsonData)) { |
| 274 | ACCOUNT_LOGE("Invalid json file, %{public}s, remove", filePath.c_str()); | 276 | ACCOUNT_LOGE("Invalid json file, %{public}s, remove", filePath.c_str()); |
| 277 | + ReportOhosAccountOperationFail(userId, Constants::OPERATION_OPEN_FILE_TO_READ, -1, "Invalid json file"); | ||
| 275 | return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION; | 278 | return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION; |
| 276 | } | 279 | } |
| 277 | std::string avatarData; | 280 | std::string avatarData; |
| @@ -373,7 +376,7 @@ ErrCode OhosAccountDataDeal::GetAccountInfo(AccountInfo &accountInfo, const int3 | |||
| 373 | if (ret != ERR_OK) { | 376 | if (ret != ERR_OK) { |
| 374 | if (ret != ERR_ACCOUNT_COMMON_FILE_NOT_EXIST) { | 377 | if (ret != ERR_ACCOUNT_COMMON_FILE_NOT_EXIST) { |
| 375 | std::string errorMsg = "Stat " + configFile + " failed"; | 378 | std::string errorMsg = "Stat " + configFile + " failed"; |
| 376 | - ReportOhosAccountOperationFail(userId, OPERATION_OPEN_FILE_TO_READ, ret, errorMsg); | 379 | + ReportOhosAccountOperationFail(userId, Constants::OPERATION_OPEN_FILE_TO_READ, ret, errorMsg); |
| 377 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; | 380 | return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR; |
| 378 | } else { | 381 | } else { |
| 379 | ACCOUNT_LOGI("File %{public}s not exist, create!", configFile.c_str()); | 382 | ACCOUNT_LOGI("File %{public}s not exist, create!", configFile.c_str()); |
| @@ -47,6 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | + | ||
| 50 | 51 | ||
| 51 | 52 | ||
| 52 | 53 | ||
| @@ -307,8 +308,6 @@ static ErrCode ProcDistributedAccountStateChange( | |||
| 307 | auto itFunc = eventFuncMap.find(eventStr); | 308 | auto itFunc = eventFuncMap.find(eventStr); |
| 308 | if (itFunc == eventFuncMap.end()) { | 309 | if (itFunc == eventFuncMap.end()) { |
| 309 | ACCOUNT_LOGE("invalid event: %{public}s", eventStr.c_str()); | 310 | ACCOUNT_LOGE("invalid event: %{public}s", eventStr.c_str()); |
| 310 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_SET_INFO, ERR_ACCOUNT_COMMON_INVALID_PARAMETER, | ||
| 311 | - eventStr.c_str()); | ||
| 312 | return ERR_ACCOUNT_COMMON_INVALID_PARAMETER; | 311 | return ERR_ACCOUNT_COMMON_INVALID_PARAMETER; |
| 313 | } | 312 | } |
| 314 | return (itFunc->second)(userId, info, eventStr); | 313 | return (itFunc->second)(userId, info, eventStr); |
| @@ -358,8 +357,6 @@ static ErrCode ProcDistributedAccountSpaceStateChange( | |||
| 358 | auto itFunc = eventFuncMap.find(eventStr); | 357 | auto itFunc = eventFuncMap.find(eventStr); |
| 359 | if (itFunc == eventFuncMap.end()) { | 358 | if (itFunc == eventFuncMap.end()) { |
| 360 | ACCOUNT_LOGE("invalid event for space: %{public}s", eventStr.c_str()); | 359 | ACCOUNT_LOGE("invalid event for space: %{public}s", eventStr.c_str()); |
| 361 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_SET_INFO, ERR_ACCOUNT_COMMON_INVALID_PARAMETER, | ||
| 362 | - eventStr.c_str()); | ||
| 363 | return ERR_ACCOUNT_COMMON_INVALID_PARAMETER; | 360 | return ERR_ACCOUNT_COMMON_INVALID_PARAMETER; |
| 364 | } | 361 | } |
| 365 | return (itFunc->second)(userId, subspaceId, info, eventStr); | 362 | return (itFunc->second)(userId, subspaceId, info, eventStr); |
| @@ -401,31 +398,30 @@ ErrCode OhosAccountManager::OhosAccountStateChange( | |||
| 401 | /** | 398 | /** |
| 402 | * Clear current account information | 399 | * Clear current account information |
| 403 | */ | 400 | */ |
| 404 | -bool OhosAccountManager::ClearOhosAccount(AccountInfo &curOhosAccountInfo, std::int32_t clrStatus) const | 401 | +ErrCode OhosAccountManager::ClearOhosAccount(AccountInfo &curOhosAccountInfo, std::int32_t clrStatus) const |
| 405 | { | 402 | { |
| 406 | curOhosAccountInfo.clear(clrStatus); | 403 | curOhosAccountInfo.clear(clrStatus); |
| 407 | ErrCode errCode = dataDealer_->AccountInfoToJson(curOhosAccountInfo); | 404 | ErrCode errCode = dataDealer_->AccountInfoToJson(curOhosAccountInfo); |
| 408 | if (errCode != ERR_OK) { | 405 | if (errCode != ERR_OK) { |
| 409 | - ACCOUNT_LOGE("AccountInfoToJson error"); | 406 | + ACCOUNT_LOGE("AccountInfoToJson error, err %{public}d.", errCode); |
| 410 | - return false; | ||
| 411 | } | 407 | } |
| 412 | - return true; | 408 | + return errCode; |
| 413 | } | 409 | } |
| 414 | 410 | ||
| 415 | /** | 411 | /** |
| 416 | * Config current account config. | 412 | * Config current account config. |
| 417 | * | 413 | * |
| 418 | * @param ohosAccountInfo distribute account information. | 414 | * @param ohosAccountInfo distribute account information. |
| 419 | - * @return true if success. | 415 | + * @return ERR_OK if success, specific error code if failed. |
| 420 | */ | 416 | */ |
| 421 | -bool OhosAccountManager::SaveOhosAccountInfo(AccountInfo &ohosAccountInfo) const | 417 | +ErrCode OhosAccountManager::SaveOhosAccountInfo(AccountInfo &ohosAccountInfo) const |
| 422 | { | 418 | { |
| 423 | ErrCode errCode = dataDealer_->AccountInfoToJson(ohosAccountInfo); | 419 | ErrCode errCode = dataDealer_->AccountInfoToJson(ohosAccountInfo); |
| 424 | if (errCode != ERR_OK) { | 420 | if (errCode != ERR_OK) { |
| 425 | - ACCOUNT_LOGE("AccountInfoToJson error."); | 421 | + ACCOUNT_LOGE("AccountInfoToJson error, err %{public}d.", errCode); |
| 426 | - return false; | 422 | + return errCode; |
| 427 | } | 423 | } |
| 428 | - return true; | 424 | + return ERR_OK; |
| 429 | } | 425 | } |
| 430 | 426 | ||
| 431 | /** | 427 | /** |
| @@ -555,7 +551,6 @@ ErrCode OhosAccountManager::GetOhosAccountDistributedInfo(const int32_t userId, | |||
| 555 | if (isSystemApp || bundleName.empty()) { | 551 | if (isSystemApp || bundleName.empty()) { |
| 556 | return ERR_OK; | 552 | return ERR_OK; |
| 557 | } | 553 | } |
| 558 | - ReportOsAccountLifeCycle(userId, "GetDistributedInfo_" + bundleName); | ||
| 559 | AnonymizeOhosAccountInfo(ohosAccountInfo, bundleName); | 554 | AnonymizeOhosAccountInfo(ohosAccountInfo, bundleName); |
| 560 | return ERR_OK; | 555 | return ERR_OK; |
| 561 | } | 556 | } |
| @@ -933,6 +928,8 @@ bool OhosAccountManager::HandleEvent(AccountInfo &curOhosAccount, const std::str | |||
| 933 | bool ret = accountState_->StateChangeProcess(event); | 928 | bool ret = accountState_->StateChangeProcess(event); |
| 934 | if (!ret) { | 929 | if (!ret) { |
| 935 | ACCOUNT_LOGE("Handle event %{public}d failed", event); | 930 | ACCOUNT_LOGE("Handle event %{public}d failed", event); |
| 931 | + REPORT_OHOS_ACCOUNT_FAIL(-1, Constants::OPERATION_STATE_CHANGE, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR, | ||
| 932 | + eventStr); | ||
| 936 | return false; | 933 | return false; |
| 937 | } | 934 | } |
| 938 | std::int32_t newState = accountState_->GetAccountState(); | 935 | std::int32_t newState = accountState_->GetAccountState(); |
| @@ -976,10 +973,11 @@ ErrCode OhosAccountManager::LoginOhosAccount(const int32_t userId, const OhosAcc | |||
| 976 | } | 973 | } |
| 977 | std::string ohosAccountUid = GenerateOhosUdidWithSha256(ohosAccountInfo.name_, ohosAccountInfo.uid_); | 974 | std::string ohosAccountUid = GenerateOhosUdidWithSha256(ohosAccountInfo.name_, ohosAccountInfo.uid_); |
| 978 | // current local user cannot be bound again when it has already been bound to an ohos account | 975 | // current local user cannot be bound again when it has already been bound to an ohos account |
| 979 | - if (!CheckOhosAccountCanBind(currAccountInfo, ohosAccountInfo, ohosAccountUid)) { | 976 | + ErrCode bindErr = CheckOhosAccountCanBind(currAccountInfo, ohosAccountInfo, ohosAccountUid); |
| 980 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGIN, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR, | 977 | + if (bindErr != ERR_OK) { |
| 978 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGIN, bindErr, | ||
| 981 | "Call checkOhosAccountCanBind failed."); | 979 | "Call checkOhosAccountCanBind failed."); |
| 982 | - ACCOUNT_LOGE("check can be bound failed, userId %{public}d.", userId); | 980 | + ACCOUNT_LOGE("check can be bound failed, userId %{public}d, err %{public}d.", userId, bindErr); |
| 983 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; | 981 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; |
| 984 | } | 982 | } |
| 985 | int32_t originalStatus = currAccountInfo.ohosAccountInfo_.status_; | 983 | int32_t originalStatus = currAccountInfo.ohosAccountInfo_.status_; |
| @@ -991,8 +989,10 @@ ErrCode OhosAccountManager::LoginOhosAccount(const int32_t userId, const OhosAcc | |||
| 991 | } | 989 | } |
| 992 | // update account info | 990 | // update account info |
| 993 | UpdateOhosAccountInfo(ohosAccountInfo, ohosAccountUid, currAccountInfo); | 991 | UpdateOhosAccountInfo(ohosAccountInfo, ohosAccountUid, currAccountInfo); |
| 994 | - if (!SaveOhosAccountInfo(currAccountInfo)) { | 992 | + ErrCode saveErr = SaveOhosAccountInfo(currAccountInfo); |
| 995 | - ACCOUNT_LOGE("SaveOhosAccountInfo failed! userId %{public}d.", userId); | 993 | + if (saveErr != ERR_OK) { |
| 994 | + ACCOUNT_LOGE("SaveOhosAccountInfo failed! userId %{public}d, err %{public}d.", userId, saveErr); | ||
| 995 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGIN, saveErr, "Save account failed"); | ||
| 996 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 996 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 997 | } | 997 | } |
| 998 | if (ohosAccountInfo.avatar_.empty()) { | 998 | if (ohosAccountInfo.avatar_.empty()) { |
| @@ -1036,11 +1036,12 @@ ErrCode OhosAccountManager::LogoutOhosAccount( | |||
| 1036 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); | 1036 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); |
| 1037 | 1037 | ||
| 1038 | AccountInfo currentAccount; | 1038 | AccountInfo currentAccount; |
| 1039 | - if (!GetCurOhosAccountAndCheckMatch(currentAccount, ohosAccountInfo.name_, | 1039 | + ErrCode matchErr = GetCurOhosAccountAndCheckMatch(currentAccount, ohosAccountInfo.name_, |
| 1040 | - ohosAccountInfo.uid_, userId)) { | 1040 | + ohosAccountInfo.uid_, userId); |
| 1041 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOUT, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR, | 1041 | + if (matchErr != ERR_OK) { |
| 1042 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOUT, matchErr, | ||
| 1042 | "Call getCurOhosAccountAndCheckMatch failed."); | 1043 | "Call getCurOhosAccountAndCheckMatch failed."); |
| 1043 | - ACCOUNT_LOGE("check match failed, userId %{public}d.", userId); | 1044 | + ACCOUNT_LOGE("check match failed, userId %{public}d, err %{public}d.", userId, matchErr); |
| 1044 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; | 1045 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; |
| 1045 | } | 1046 | } |
| 1046 | 1047 | ||
| @@ -1052,9 +1053,10 @@ ErrCode OhosAccountManager::LogoutOhosAccount( | |||
| 1052 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1053 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1053 | } | 1054 | } |
| 1054 | 1055 | ||
| 1055 | - ret = ClearOhosAccount(currentAccount); // clear account info with ACCOUNT_STATE_UNBOUND | 1056 | + ErrCode clearErr = ClearOhosAccount(currentAccount); // clear account info with ACCOUNT_STATE_UNBOUND |
| 1056 | - if (!ret) { | 1057 | + if (clearErr != ERR_OK) { |
| 1057 | - ACCOUNT_LOGE("ClearOhosAccount failed! userId %{public}d.", userId); | 1058 | + ACCOUNT_LOGE("ClearOhosAccount failed! userId %{public}d, err %{public}d.", userId, clearErr); |
| 1059 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOUT, clearErr, "Clear account failed"); | ||
| 1058 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1060 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1059 | } | 1061 | } |
| 1060 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::LOGOUT); | 1062 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::LOGOUT); |
| @@ -1080,10 +1082,12 @@ ErrCode OhosAccountManager::LogoffOhosAccount( | |||
| 1080 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); | 1082 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); |
| 1081 | 1083 | ||
| 1082 | AccountInfo currentAccount; | 1084 | AccountInfo currentAccount; |
| 1083 | - if (!GetCurOhosAccountAndCheckMatch(currentAccount, ohosAccountInfo.name_, ohosAccountInfo.uid_, userId)) { | 1085 | + ErrCode matchErr = GetCurOhosAccountAndCheckMatch(currentAccount, ohosAccountInfo.name_, |
| 1084 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOFF, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR, | 1086 | + ohosAccountInfo.uid_, userId); |
| 1087 | + if (matchErr != ERR_OK) { | ||
| 1088 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOFF, matchErr, | ||
| 1085 | "Call getCurOhosAccountAndCheckMatch failed."); | 1089 | "Call getCurOhosAccountAndCheckMatch failed."); |
| 1086 | - ACCOUNT_LOGE("check match failed, userId %{public}d.", userId); | 1090 | + ACCOUNT_LOGE("check match failed, userId %{public}d, err %{public}d.", userId, matchErr); |
| 1087 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; | 1091 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; |
| 1088 | } | 1092 | } |
| 1089 | 1093 | ||
| @@ -1095,9 +1099,10 @@ ErrCode OhosAccountManager::LogoffOhosAccount( | |||
| 1095 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1099 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1096 | } | 1100 | } |
| 1097 | 1101 | ||
| 1098 | - ret = ClearOhosAccount(currentAccount); // clear account info with ACCOUNT_STATE_UNBOUND | 1102 | + ErrCode clearErr = ClearOhosAccount(currentAccount); // clear account info with ACCOUNT_STATE_UNBOUND |
| 1099 | - if (!ret) { | 1103 | + if (clearErr != ERR_OK) { |
| 1100 | - ACCOUNT_LOGE("ClearOhosAccount failed, userId %{public}d.", userId); | 1104 | + ACCOUNT_LOGE("ClearOhosAccount failed, userId %{public}d, err %{public}d.", userId, clearErr); |
| 1105 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_LOGOFF, clearErr, "Clear account failed"); | ||
| 1101 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1106 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1102 | } | 1107 | } |
| 1103 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::LOGOFF); | 1108 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::LOGOFF); |
| @@ -1123,11 +1128,12 @@ ErrCode OhosAccountManager::HandleOhosAccountTokenInvalidEvent( | |||
| 1123 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); | 1128 | std::lock_guard<std::mutex> mutexLock(mgrMutex_); |
| 1124 | 1129 | ||
| 1125 | AccountInfo currentOhosAccount; | 1130 | AccountInfo currentOhosAccount; |
| 1126 | - if (!GetCurOhosAccountAndCheckMatch(currentOhosAccount, ohosAccountInfo.name_, | 1131 | + ErrCode matchErr = GetCurOhosAccountAndCheckMatch(currentOhosAccount, ohosAccountInfo.name_, |
| 1127 | - ohosAccountInfo.uid_, userId)) { | 1132 | + ohosAccountInfo.uid_, userId); |
| 1128 | - REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_TOKEN_INVALID, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR, | 1133 | + if (matchErr != ERR_OK) { |
| 1134 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_TOKEN_INVALID, matchErr, | ||
| 1129 | "Call getCurOhosAccountAndCheckMatch failed."); | 1135 | "Call getCurOhosAccountAndCheckMatch failed."); |
| 1130 | - ACCOUNT_LOGE("check match failed, userId %{public}d.", userId); | 1136 | + ACCOUNT_LOGE("check match failed, userId %{public}d, err %{public}d.", userId, matchErr); |
| 1131 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; | 1137 | return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; |
| 1132 | } | 1138 | } |
| 1133 | 1139 | ||
| @@ -1139,10 +1145,11 @@ ErrCode OhosAccountManager::HandleOhosAccountTokenInvalidEvent( | |||
| 1139 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1145 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1140 | } | 1146 | } |
| 1141 | 1147 | ||
| 1142 | - ret = SaveOhosAccountInfo(currentOhosAccount); | 1148 | + ErrCode saveErr = SaveOhosAccountInfo(currentOhosAccount); |
| 1143 | - if (!ret) { | 1149 | + if (saveErr != ERR_OK) { |
| 1144 | // moving on even if failed to update account info | 1150 | // moving on even if failed to update account info |
| 1145 | - ACCOUNT_LOGW("SaveOhosAccountInfo failed, userId %{public}d.", userId); | 1151 | + ACCOUNT_LOGW("SaveOhosAccountInfo failed, userId %{public}d, err %{public}d.", userId, saveErr); |
| 1152 | + REPORT_OHOS_ACCOUNT_FAIL(userId, Constants::OPERATION_TOKEN_INVALID, saveErr, "Save account failed"); | ||
| 1146 | } | 1153 | } |
| 1147 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::TOKEN_INVALID); | 1154 | subscribeManager_.Publish(userId, DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE::TOKEN_INVALID); |
| 1148 | AccountEventProvider::EventPublishAsUser(COMMON_EVENT_HWID_TOKEN_INVALID, userId); | 1155 | AccountEventProvider::EventPublishAsUser(COMMON_EVENT_HWID_TOKEN_INVALID, userId); |
| @@ -1186,6 +1193,8 @@ bool OhosAccountManager::OnInitialize() | |||
| 1186 | // when json file corrupted, have it another try | 1193 | // when json file corrupted, have it another try |
| 1187 | if ((tryTimes == MAX_RETRY_TIMES) || (errCode != ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION)) { | 1194 | if ((tryTimes == MAX_RETRY_TIMES) || (errCode != ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION)) { |
| 1188 | ACCOUNT_LOGE("parse json file failed: %{public}d, tryTime: %{public}d", errCode, tryTimes); | 1195 | ACCOUNT_LOGE("parse json file failed: %{public}d, tryTime: %{public}d", errCode, tryTimes); |
| 1196 | + REPORT_OHOS_ACCOUNT_FAIL(-1, Constants::OPERATION_INIT, errCode, | ||
| 1197 | + "OhosAccountManager initialization failed"); | ||
| 1189 | return false; | 1198 | return false; |
| 1190 | } | 1199 | } |
| 1191 | } | 1200 | } |
| @@ -1295,6 +1304,8 @@ ErrCode OhosAccountManager::HandleSpaceStateChange(OsAccountSubspaceInfo &spaceI | |||
| 1295 | bool ret = accountState_->StateChangeProcess(event); | 1304 | bool ret = accountState_->StateChangeProcess(event); |
| 1296 | if (!ret) { | 1305 | if (!ret) { |
| 1297 | ACCOUNT_LOGE("Handle space event %{public}d failed", event); | 1306 | ACCOUNT_LOGE("Handle space event %{public}d failed", event); |
| 1307 | + REPORT_OHOS_ACCOUNT_FAIL(-1, Constants::OPERATION_STATE_CHANGE, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR, | ||
| 1308 | + eventStr); | ||
| 1298 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; | 1309 | return ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR; |
| 1299 | } | 1310 | } |
| 1300 | std::int32_t newState = accountState_->GetAccountState(); | 1311 | std::int32_t newState = accountState_->GetAccountState(); |
| @@ -1535,12 +1546,12 @@ ErrCode OhosAccountManager::LogoffOhosAccountSpace(int32_t userId, int32_t subsp | |||
| 1535 | 1546 | ||
| 1536 | 1547 | ||
| 1537 | 1548 | ||
| 1538 | -bool OhosAccountManager::CheckOhosAccountCanBind(const AccountInfo &currAccountInfo, | 1549 | +ErrCode OhosAccountManager::CheckOhosAccountCanBind(const AccountInfo &currAccountInfo, |
| 1539 | const OhosAccountInfo &newOhosAccountInfo, const std::string &newOhosUid) const | 1550 | const OhosAccountInfo &newOhosAccountInfo, const std::string &newOhosUid) const |
| 1540 | { | 1551 | { |
| 1541 | if (newOhosUid.length() != OHOS_ACCOUNT_UDID_LENGTH) { | 1552 | if (newOhosUid.length() != OHOS_ACCOUNT_UDID_LENGTH) { |
| 1542 | ACCOUNT_LOGE("newOhosUid invalid length, %{public}zu.", newOhosUid.length()); | 1553 | ACCOUNT_LOGE("newOhosUid invalid length, %{public}zu.", newOhosUid.length()); |
| 1543 | - return false; | 1554 | + return ERR_ACCOUNT_COMMON_INVALID_PARAMETER; |
| 1544 | } | 1555 | } |
| 1545 | 1556 | ||
| 1546 | // check if current account has been bound or not | 1557 | // check if current account has been bound or not |
| @@ -1549,9 +1560,9 @@ bool OhosAccountManager::CheckOhosAccountCanBind(const AccountInfo &currAccountI | |||
| 1549 | (currAccountInfo.ohosAccountInfo_.name_ != newOhosAccountInfo.name_))) { | 1560 | (currAccountInfo.ohosAccountInfo_.name_ != newOhosAccountInfo.name_))) { |
| 1550 | ACCOUNT_LOGE("current account has already been bounded. callingUserId %{public}d.", | 1561 | ACCOUNT_LOGE("current account has already been bounded. callingUserId %{public}d.", |
| 1551 | AccountMgrService::GetInstance().GetCallingUserID()); | 1562 | AccountMgrService::GetInstance().GetCallingUserID()); |
| 1552 | - return false; | 1563 | + return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; |
| 1553 | } | 1564 | } |
| 1554 | - return true; | 1565 | + return ERR_OK; |
| 1555 | } | 1566 | } |
| 1556 | 1567 | ||
| 1557 | 1568 | ||
| @@ -1568,20 +1579,22 @@ bool OhosAccountManager::CheckSameDistributedAccount(const OhosAccountInfo &curr | |||
| 1568 | return true; | 1579 | return true; |
| 1569 | } | 1580 | } |
| 1570 | 1581 | ||
| 1571 | -bool OhosAccountManager::GetCurOhosAccountAndCheckMatch(AccountInfo &curAccountInfo, | 1582 | +ErrCode OhosAccountManager::GetCurOhosAccountAndCheckMatch(AccountInfo &curAccountInfo, const std::string &inputName, |
| 1572 | - const std::string &inputName, | 1583 | + const std::string &inputUid, const std::int32_t callingUserId) const |
| 1573 | - const std::string &inputUid, | ||
| 1574 | - const std::int32_t callingUserId) const | ||
| 1575 | { | 1584 | { |
| 1576 | - if (dataDealer_->AccountInfoFromJson(curAccountInfo, callingUserId) != ERR_OK) { | 1585 | + ErrCode errCode = dataDealer_->AccountInfoFromJson(curAccountInfo, callingUserId); |
| 1586 | + if (errCode != ERR_OK) { | ||
| 1577 | ACCOUNT_LOGE("cannot read from config, inputName %{public}s.", AnonymizeNameStr(inputName).c_str()); | 1587 | ACCOUNT_LOGE("cannot read from config, inputName %{public}s.", AnonymizeNameStr(inputName).c_str()); |
| 1578 | - return false; | 1588 | + return errCode; |
| 1579 | } | 1589 | } |
| 1580 | 1590 | ||
| 1581 | OhosAccountInfo newInfo; | 1591 | OhosAccountInfo newInfo; |
| 1582 | newInfo.name_ = inputName; | 1592 | newInfo.name_ = inputName; |
| 1583 | newInfo.uid_ = inputUid; | 1593 | newInfo.uid_ = inputUid; |
| 1584 | - return CheckSameDistributedAccount(curAccountInfo.ohosAccountInfo_, newInfo, callingUserId); | 1594 | + if (!CheckSameDistributedAccount(curAccountInfo.ohosAccountInfo_, newInfo, callingUserId)) { |
| 1595 | + return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR; | ||
| 1596 | + } | ||
| 1597 | + return ERR_OK; | ||
| 1585 | } | 1598 | } |
| 1586 | 1599 | ||
| 1587 | 1600 | ||
| @@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | + | ||
| 26 | 27 | ||
| 27 | 28 | ||
| 28 | namespace OHOS { | 29 | namespace OHOS { |
| @@ -253,6 +253,7 @@ ohos_moduletest("os_account_manager_service_module_test") { | |||
| 253 | "${os_account_dfx_path}/data_dfx", | 253 | "${os_account_dfx_path}/data_dfx", |
| 254 | "${services_path}/accountmgr/include/common/database/kvstore", | 254 | "${services_path}/accountmgr/include/common/database/kvstore", |
| 255 | "${services_path}/accountmgr/include/common/database", | 255 | "${services_path}/accountmgr/include/common/database", |
| 256 | + "${services_path}/accountmgr/include/distributed_account" | ||
| 256 | ] | 257 | ] |
| 257 | sources = [ | 258 | sources = [ |
| 258 | "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", | 259 | "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", |
| @@ -139,6 +139,7 @@ ohos_unittest("OhosDataDealTest") { | |||
| 139 | "${account_iam_interfaces_native_path}/include", | 139 | "${account_iam_interfaces_native_path}/include", |
| 140 | "${os_account_interfaces_native_path}/include", | 140 | "${os_account_interfaces_native_path}/include", |
| 141 | "${os_account_core_path}/include", | 141 | "${os_account_core_path}/include", |
| 142 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 142 | ] | 143 | ] |
| 143 | 144 | ||
| 144 | sources = [ | 145 | sources = [ |
| @@ -194,6 +195,7 @@ ohos_unittest("OhosEventManagerMultipleThreadTest") { | |||
| 194 | include_dirs = [ | 195 | include_dirs = [ |
| 195 | "${services_path}/accountmgr/include", | 196 | "${services_path}/accountmgr/include", |
| 196 | "${os_account_dfx_path}/hidumper_adapter", | 197 | "${os_account_dfx_path}/hidumper_adapter", |
| 198 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 197 | ] | 199 | ] |
| 198 | 200 | ||
| 199 | sources = [ | 201 | sources = [ |
| @@ -231,6 +233,7 @@ group("unittest") { | |||
| 231 | ":OhosServiceTest", | 233 | ":OhosServiceTest", |
| 232 | ] | 234 | ] |
| 233 | deps += [ | 235 | deps += [ |
| 236 | + ":OhosAccountDfxCoverageTest", | ||
| 234 | ":OhosAccountSpaceLoginLogoutTest", | 237 | ":OhosAccountSpaceLoginLogoutTest", |
| 235 | ":OsAccountSubProfileManagerTest", | 238 | ":OsAccountSubProfileManagerTest", |
| 236 | ":OsAccountSubProfileSubscribeManagerTest", | 239 | ":OsAccountSubProfileSubscribeManagerTest", |
| @@ -329,6 +332,7 @@ ohos_unittest("OhosAccountSpaceLoginLogoutTest") { | |||
| 329 | "${os_account_core_path}/include", | 332 | "${os_account_core_path}/include", |
| 330 | "${services_path}/accountmgr/test/unittest/ohos_account/mock", | 333 | "${services_path}/accountmgr/test/unittest/ohos_account/mock", |
| 331 | "${services_path}/accountmgr/include", | 334 | "${services_path}/accountmgr/include", |
| 335 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 332 | "${services_path}/accountmgr/test/mock/include/ams", | 336 | "${services_path}/accountmgr/test/mock/include/ams", |
| 333 | "${common_path}/account_error", | 337 | "${common_path}/account_error", |
| 334 | "${common_path}/log/include", | 338 | "${common_path}/log/include", |
| @@ -769,6 +773,7 @@ ohos_unittest("OsAccountSubProfileSubscribeManagerTest") { | |||
| 769 | "${os_account_subspace_interfaces_native_path}/include", | 773 | "${os_account_subspace_interfaces_native_path}/include", |
| 770 | "${os_account_subspace_framework_path}/src", | 774 | "${os_account_subspace_framework_path}/src", |
| 771 | "${services_path}/accountmgr/include", | 775 | "${services_path}/accountmgr/include", |
| 776 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 772 | "${services_path}/accountmgr/include/os_account_subprofile", | 777 | "${services_path}/accountmgr/include/os_account_subprofile", |
| 773 | "${common_path}/account_error", | 778 | "${common_path}/account_error", |
| 774 | "${common_path}/log/include", | 779 | "${common_path}/log/include", |
| @@ -1093,3 +1098,142 @@ ohos_unittest("OsAccountSubspaceCoverageTest") { | |||
| 1093 | ] | 1098 | ] |
| 1094 | part_name = "os_account" | 1099 | part_name = "os_account" |
| 1095 | } | 1100 | } |
| 1101 | + | ||
| 1102 | +ohos_unittest("OhosAccountDfxCoverageTest") { | ||
| 1103 | + branch_protector_ret = "pac_ret" | ||
| 1104 | + | ||
| 1105 | + sanitize = { | ||
| 1106 | + cfi = true | ||
| 1107 | + cfi_cross_dso = true | ||
| 1108 | + debug = false | ||
| 1109 | + } | ||
| 1110 | + | ||
| 1111 | + module_out_path = module_output_path | ||
| 1112 | + cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 1113 | + | ||
| 1114 | + sources = [ | ||
| 1115 | + "${common_path}/log/src/account_log_wrapper.cpp", | ||
| 1116 | + "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", | ||
| 1117 | + "${common_path}/file_operator/src/account_file_operator.cpp", | ||
| 1118 | + "${services_path}/accountmgr/src/appaccount/app_account_control_manager.cpp", | ||
| 1119 | + "${services_path}/accountmgr/src/ability_manager_adapter/ability_manager_adapter.cpp", | ||
| 1120 | + "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp", | ||
| 1121 | + "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", | ||
| 1122 | + "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", | ||
| 1123 | + "ohos_account_dfx_coverage_test.cpp", | ||
| 1124 | + ] | ||
| 1125 | + sources += account_service_sources | ||
| 1126 | + sources -= [ | ||
| 1127 | + "${services_path}/accountmgr/src/ohos_account_data_deal.cpp", | ||
| 1128 | + ] | ||
| 1129 | + include_dirs = [ | ||
| 1130 | + "${account_iam_interfaces_native_path}/include", | ||
| 1131 | + "${os_account_interfaces_native_path}/include", | ||
| 1132 | + "${os_account_core_path}/include", | ||
| 1133 | + "${services_path}/accountmgr/include", | ||
| 1134 | + "${services_path}/accountmgr/include/account_iam", | ||
| 1135 | + "${services_path}/accountmgr/include/domain_account", | ||
| 1136 | + "${services_path}/accountmgr/include/osaccount", | ||
| 1137 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 1138 | + "${common_path}/log/include", | ||
| 1139 | + "${innerkits_common}/include", | ||
| 1140 | + "${innerkits_path}/include", | ||
| 1141 | + "${os_account_dfx_path}/hisysevent_adapter", | ||
| 1142 | + "${services_path}/accountmgr/include/bundle_manager_adapter", | ||
| 1143 | + ] | ||
| 1144 | + | ||
| 1145 | + configs = [ | ||
| 1146 | + ":accountmgr_data_deal_test_config", | ||
| 1147 | + "${services_path}/accountmgr:accountmgr_config", | ||
| 1148 | + "${services_path}/accountmgr/test:accountmgr_test_config", | ||
| 1149 | + ] | ||
| 1150 | + | ||
| 1151 | + deps = [ | ||
| 1152 | + "${common_path}:libaccount_common", | ||
| 1153 | + "${innerkits_native_path}:libaccountkits", | ||
| 1154 | + "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 1155 | + "${app_account_innerkits_native_path}:app_account_authenticator_callback_proxy", | ||
| 1156 | + "${app_account_innerkits_native_path}:app_account_authenticator_callback_proxy", | ||
| 1157 | + "${app_account_innerkits_native_path}:app_account_authenticator_callback_stub", | ||
| 1158 | + "${account_iam_framework_path}:account_iam_innerkits", | ||
| 1159 | + "${account_iam_framework_path}:account_iam_stub", | ||
| 1160 | + "${os_account_subspace_framework_path}:os_account_subspace_stub", | ||
| 1161 | + "${innerkits_native_path}:account_stub", | ||
| 1162 | + "${os_account_innerkits_native_path}:os_account_event_proxy", | ||
| 1163 | + "${os_account_innerkits_native_path}:os_account_state_reply_callback_proxy", | ||
| 1164 | + "${os_account_innerkits_native_path}:os_account_state_reply_callback_stub", | ||
| 1165 | + "${os_account_innerkits_native_path}:os_account_proxy", | ||
| 1166 | + "${os_account_innerkits_native_path}:os_account_stub", | ||
| 1167 | + ] | ||
| 1168 | + | ||
| 1169 | + external_deps = [ | ||
| 1170 | + "ability_base:base", | ||
| 1171 | + "ability_base:configuration", | ||
| 1172 | + "ability_base:want", | ||
| 1173 | + "ability_runtime:ability_connect_callback_stub", | ||
| 1174 | + "ability_runtime:app_manager", | ||
| 1175 | + "ability_runtime:wantagent_innerkits", | ||
| 1176 | + "access_token:libaccesstoken_sdk", | ||
| 1177 | + "access_token:libtokenid_sdk", | ||
| 1178 | + "access_token:libtokensetproc_shared", | ||
| 1179 | + "bundle_framework:appexecfwk_base", | ||
| 1180 | + "cJSON:cjson", | ||
| 1181 | + "c_utils:utils", | ||
| 1182 | + "googletest:gmock_main", | ||
| 1183 | + "googletest:gtest_main", | ||
| 1184 | + "hilog:libhilog", | ||
| 1185 | + "init:libbegetutil", | ||
| 1186 | + "ipc:ipc_single", | ||
| 1187 | + "kv_store:distributeddata_inner", | ||
| 1188 | + "openssl:libcrypto_shared", | ||
| 1189 | + "safwk:system_ability_fwk", | ||
| 1190 | + "samgr:samgr_proxy", | ||
| 1191 | + ] | ||
| 1192 | + | ||
| 1193 | + if (has_hiviewdfx_hisysevent_part) { | ||
| 1194 | + cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] | ||
| 1195 | + external_deps += [ "hisysevent:libhisysevent" ] | ||
| 1196 | + } | ||
| 1197 | + | ||
| 1198 | + if (has_ces_part) { | ||
| 1199 | + cflags_cc += [ "-DHAS_CES_PART" ] | ||
| 1200 | + external_deps += [ "common_event_service:cesfwk_innerkits" ] | ||
| 1201 | + } | ||
| 1202 | + | ||
| 1203 | + if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 1204 | + cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 1205 | + sources += | ||
| 1206 | + [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] | ||
| 1207 | + } | ||
| 1208 | + if (has_user_auth_part) { | ||
| 1209 | + cflags_cc += [ | ||
| 1210 | + "-DHAS_USER_AUTH_PART" | ||
| 1211 | + ] | ||
| 1212 | + sources += [ | ||
| 1213 | + "${services_path}/accountmgr/src/account_iam/account_iam_callback.cpp", | ||
| 1214 | + "${services_path}/accountmgr/src/account_iam/account_iam_service.cpp", | ||
| 1215 | + "${services_path}/accountmgr/src/account_iam/inner_account_iam_manager.cpp", | ||
| 1216 | + "${services_path}/accountmgr/src/account_iam/account_iam_hisysevent_utils.cpp", | ||
| 1217 | + ] | ||
| 1218 | + external_deps += [ "user_auth_framework:userauth_client" ] | ||
| 1219 | + } | ||
| 1220 | + if (os_account_support_domain_accounts) { | ||
| 1221 | + cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 1222 | + sources += [ | ||
| 1223 | + "${domain_account_framework_path}/src/domain_account_callback_service.cpp", | ||
| 1224 | + "${domain_account_framework_path}/src/domain_account_parcel.cpp", | ||
| 1225 | + "${domain_account_framework_path}/src/domain_account_common.cpp", | ||
| 1226 | + ] | ||
| 1227 | + deps += [ | ||
| 1228 | + "${domain_account_framework_path}:domain_account_stub", | ||
| 1229 | + "${domain_account_framework_path}:domain_account_callback_proxy", | ||
| 1230 | + "${domain_account_framework_path}:domain_account_callback_stub", | ||
| 1231 | + "${domain_account_framework_path}:domain_account_plugin_proxy", | ||
| 1232 | + ] | ||
| 1233 | + } | ||
| 1234 | + if (has_storage_service_part) { | ||
| 1235 | + cflags_cc += [ "-DHAS_STORAGE_PART" ] | ||
| 1236 | + external_deps += [ "storage_service:storage_manager_sa_proxy" ] | ||
| 1237 | + } | ||
| 1238 | + part_name = "os_account" | ||
| 1239 | +} | ||
| @@ -0,0 +1,321 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2026 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + | ||
| 26 | +namespace OHOS { | ||
| 27 | +namespace AccountSA { | ||
| 28 | +using namespace testing::ext; | ||
| 29 | + | ||
| 30 | +namespace { | ||
| 31 | +const std::int32_t TEST_USER_ID = 100; | ||
| 32 | +const std::string TEST_NAME = "TestName"; | ||
| 33 | +const std::string TEST_UID = "TestUid"; | ||
| 34 | +const std::string TEST_SHA_UID = "6C28D0B5A98C3F1AE9FFF3FFE9D2A46B93792EFAA07A53C18E2B36A3C81B48CB"; | ||
| 35 | +std::string g_eventLogin = OHOS_ACCOUNT_EVENT_LOGIN; | ||
| 36 | +std::string g_eventLogout = OHOS_ACCOUNT_EVENT_LOGOUT; | ||
| 37 | +std::string g_eventLogoff = OHOS_ACCOUNT_EVENT_LOGOFF; | ||
| 38 | +std::string g_eventTokenInvalid = OHOS_ACCOUNT_EVENT_TOKEN_INVALID; | ||
| 39 | + | ||
| 40 | +static bool g_hasLogin = false; | ||
| 41 | +static bool g_accountInfoFromJsonFail = true; | ||
| 42 | +static bool g_accountInfoToJsonFail = true; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +class OhosAccountDfxCoverageTest : public testing::Test { | ||
| 46 | +public: | ||
| 47 | + void SetUp(); | ||
| 48 | + void TearDown(); | ||
| 49 | +}; | ||
| 50 | + | ||
| 51 | +void OhosAccountDfxCoverageTest::SetUp() | ||
| 52 | +{ | ||
| 53 | + g_hasLogin = false; | ||
| 54 | + g_accountInfoFromJsonFail = true; | ||
| 55 | + g_accountInfoToJsonFail = true; | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +void OhosAccountDfxCoverageTest::TearDown() | ||
| 59 | +{ | ||
| 60 | + g_hasLogin = false; | ||
| 61 | + g_accountInfoFromJsonFail = true; | ||
| 62 | + g_accountInfoToJsonFail = true; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +OhosAccountDataDeal::OhosAccountDataDeal(const std::string &configFileDir) | ||
| 69 | + : configFileDir_(configFileDir), | ||
| 70 | + accountFileWatcherMgr_(AccountFileWatcherMgr::GetInstance()) | ||
| 71 | +{ | ||
| 72 | + accountFileOperator_ = nullptr; | ||
| 73 | + initOk_ = false; | ||
| 74 | + checkCallbackFunc_ = nullptr; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +OhosAccountDataDeal::OhosAccountDataDeal(const std::string &configFileDir) | ||
| 78 | + : configFileDir_(configFileDir) | ||
| 79 | +{ | ||
| 80 | + accountFileOperator_ = nullptr; | ||
| 81 | + initOk_ = false; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | + | ||
| 85 | +ErrCode OhosAccountDataDeal::Init(int32_t userId) | ||
| 86 | +{ | ||
| 87 | + return ERR_OK; | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +ErrCode OhosAccountDataDeal::AccountInfoFromJson(AccountInfo &accountInfo, int32_t userId) | ||
| 91 | +{ | ||
| 92 | + if (g_accountInfoFromJsonFail) { | ||
| 93 | + return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION; | ||
| 94 | + } | ||
| 95 | + if (!g_hasLogin) { | ||
| 96 | + accountInfo.ohosAccountInfo_.name_ = DEFAULT_OHOS_ACCOUNT_NAME; | ||
| 97 | + accountInfo.ohosAccountInfo_.uid_ = DEFAULT_OHOS_ACCOUNT_UID; | ||
| 98 | + accountInfo.ohosAccountInfo_.status_ = ACCOUNT_STATE_UNBOUND; | ||
| 99 | + } else { | ||
| 100 | + accountInfo.ohosAccountInfo_.name_ = TEST_NAME; | ||
| 101 | + accountInfo.ohosAccountInfo_.uid_ = TEST_SHA_UID; | ||
| 102 | + accountInfo.ohosAccountInfo_.status_ = ACCOUNT_STATE_LOGIN; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + accountInfo.userId_ = TEST_USER_ID; | ||
| 106 | + return ERR_OK; | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +ErrCode OhosAccountDataDeal::AccountInfoToJson(const AccountInfo &accountInfo) | ||
| 110 | +{ | ||
| 111 | + if (g_accountInfoToJsonFail) { | ||
| 112 | + return ERR_ACCOUNT_COMMON_FILE_OPEN_FAILED; | ||
| 113 | + } | ||
| 114 | + return ERR_OK; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +/** | ||
| 118 | + * @tc.name: OhosAccountDfxCoverageTest001 | ||
| 119 | + * @tc.desc: Test LoginOhosAccount with AccountInfoToJson failed. | ||
| 120 | + * @tc.type: FUNC | ||
| 121 | + * @tc.require: | ||
| 122 | + */ | ||
| 123 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest001, TestSize.Level3) | ||
| 124 | +{ | ||
| 125 | + g_accountInfoFromJsonFail = false; | ||
| 126 | + g_accountInfoToJsonFail = true; | ||
| 127 | + | ||
| 128 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 129 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 130 | + | ||
| 131 | + OhosAccountInfo ohosAccountInfo; | ||
| 132 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 133 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 134 | + | ||
| 135 | + ErrCode result = manager.LoginOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogin); | ||
| 136 | + EXPECT_EQ(result, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR); | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +/** | ||
| 140 | + * @tc.name: OhosAccountDfxCoverageTest002 | ||
| 141 | + * @tc.desc: Test LogoutOhosAccount with AccountInfoFromJson failed. | ||
| 142 | + * @tc.type: FUNC | ||
| 143 | + * @tc.require: | ||
| 144 | + */ | ||
| 145 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest002, TestSize.Level3) | ||
| 146 | +{ | ||
| 147 | + g_accountInfoFromJsonFail = true; | ||
| 148 | + | ||
| 149 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 150 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 151 | + | ||
| 152 | + OhosAccountInfo ohosAccountInfo; | ||
| 153 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 154 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 155 | + | ||
| 156 | + ErrCode result = manager.LogoutOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogout); | ||
| 157 | + EXPECT_EQ(result, ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR); | ||
| 158 | +} | ||
| 159 | + | ||
| 160 | +/** | ||
| 161 | + * @tc.name: OhosAccountDfxCoverageTest003 | ||
| 162 | + * @tc.desc: Test LogoutOhosAccount with logged in account and AccountInfoToJson failed. | ||
| 163 | + * @tc.type: FUNC | ||
| 164 | + * @tc.require: | ||
| 165 | + */ | ||
| 166 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest003, TestSize.Level3) | ||
| 167 | +{ | ||
| 168 | + g_accountInfoFromJsonFail = false; | ||
| 169 | + g_accountInfoToJsonFail = true; | ||
| 170 | + g_hasLogin = true; | ||
| 171 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 172 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 173 | + | ||
| 174 | + OhosAccountInfo ohosAccountInfo; | ||
| 175 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 176 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 177 | + | ||
| 178 | + ErrCode result = manager.LogoutOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogout); | ||
| 179 | + EXPECT_EQ(result, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR); | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +/** | ||
| 183 | + * @tc.name: OhosAccountDfxCoverageTest004 | ||
| 184 | + * @tc.desc: Test LogoffOhosAccount with logged in account and AccountInfoToJson failed. | ||
| 185 | + * @tc.type: FUNC | ||
| 186 | + * @tc.require: | ||
| 187 | + */ | ||
| 188 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest004, TestSize.Level3) | ||
| 189 | +{ | ||
| 190 | + g_accountInfoFromJsonFail = false; | ||
| 191 | + g_accountInfoToJsonFail = true; | ||
| 192 | + g_hasLogin = true; | ||
| 193 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 194 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 195 | + | ||
| 196 | + OhosAccountInfo ohosAccountInfo; | ||
| 197 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 198 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 199 | + | ||
| 200 | + ErrCode result = manager.LogoffOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogoff); | ||
| 201 | + EXPECT_EQ(result, ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR); | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +/** | ||
| 205 | + * @tc.name: OhosAccountDfxCoverageTest005 | ||
| 206 | + * @tc.desc: Test HandleOhosAccountTokenInvalidEvent with logged in account and AccountInfoToJson failed. | ||
| 207 | + * @tc.type: FUNC | ||
| 208 | + * @tc.require: | ||
| 209 | + */ | ||
| 210 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest005, TestSize.Level3) | ||
| 211 | +{ | ||
| 212 | + g_accountInfoFromJsonFail = false; | ||
| 213 | + g_accountInfoToJsonFail = true; | ||
| 214 | + g_hasLogin = true; | ||
| 215 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 216 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 217 | + | ||
| 218 | + OhosAccountInfo ohosAccountInfo; | ||
| 219 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 220 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 221 | + | ||
| 222 | + ErrCode result = manager.HandleOhosAccountTokenInvalidEvent(TEST_USER_ID, ohosAccountInfo, g_eventTokenInvalid); | ||
| 223 | + EXPECT_EQ(result, ERR_OK); | ||
| 224 | +} | ||
| 225 | + | ||
| 226 | +/** | ||
| 227 | + * @tc.name: OhosAccountDfxCoverageTest006 | ||
| 228 | + * @tc.desc: Test LoginOhosAccount with AccountInfoToJson success. | ||
| 229 | + * @tc.type: FUNC | ||
| 230 | + * @tc.require: | ||
| 231 | + */ | ||
| 232 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest006, TestSize.Level3) | ||
| 233 | +{ | ||
| 234 | + g_accountInfoFromJsonFail = false; | ||
| 235 | + g_accountInfoToJsonFail = false; | ||
| 236 | + g_hasLogin = false; | ||
| 237 | + | ||
| 238 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 239 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 240 | + | ||
| 241 | + OhosAccountInfo ohosAccountInfo; | ||
| 242 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 243 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 244 | + | ||
| 245 | + ErrCode result = manager.LoginOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogin); | ||
| 246 | + EXPECT_EQ(result, ERR_OK); | ||
| 247 | +} | ||
| 248 | + | ||
| 249 | +/** | ||
| 250 | + * @tc.name: OhosAccountDfxCoverageTest007 | ||
| 251 | + * @tc.desc: Test LogoutOhosAccount with AccountInfoToJson success. | ||
| 252 | + * @tc.type: FUNC | ||
| 253 | + * @tc.require: | ||
| 254 | + */ | ||
| 255 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest007, TestSize.Level3) | ||
| 256 | +{ | ||
| 257 | + g_accountInfoFromJsonFail = false; | ||
| 258 | + g_accountInfoToJsonFail = false; | ||
| 259 | + g_hasLogin = true; | ||
| 260 | + | ||
| 261 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 262 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 263 | + | ||
| 264 | + OhosAccountInfo ohosAccountInfo; | ||
| 265 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 266 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 267 | + | ||
| 268 | + ErrCode result = manager.LogoutOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogout); | ||
| 269 | + EXPECT_EQ(result, ERR_OK); | ||
| 270 | +} | ||
| 271 | + | ||
| 272 | +/** | ||
| 273 | + * @tc.name: OhosAccountDfxCoverageTest008 | ||
| 274 | + * @tc.desc: Test LogoffOhosAccount with AccountInfoToJson success. | ||
| 275 | + * @tc.type: FUNC | ||
| 276 | + * @tc.require: | ||
| 277 | + */ | ||
| 278 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest008, TestSize.Level3) | ||
| 279 | +{ | ||
| 280 | + g_accountInfoFromJsonFail = false; | ||
| 281 | + g_accountInfoToJsonFail = false; | ||
| 282 | + g_hasLogin = true; | ||
| 283 | + | ||
| 284 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 285 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 286 | + | ||
| 287 | + OhosAccountInfo ohosAccountInfo; | ||
| 288 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 289 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 290 | + | ||
| 291 | + ErrCode result = manager.LogoffOhosAccount(TEST_USER_ID, ohosAccountInfo, g_eventLogoff); | ||
| 292 | + EXPECT_EQ(result, ERR_OK); | ||
| 293 | +} | ||
| 294 | + | ||
| 295 | +/** | ||
| 296 | + * @tc.name: OhosAccountDfxCoverageTest009 | ||
| 297 | + * @tc.desc: Test HandleOhosAccountTokenInvalidEvent with AccountInfoToJson success. | ||
| 298 | + * @tc.type: FUNC | ||
| 299 | + * @tc.require: | ||
| 300 | + */ | ||
| 301 | +HWTEST_F(OhosAccountDfxCoverageTest, OhosAccountDfxCoverageTest009, TestSize.Level3) | ||
| 302 | +{ | ||
| 303 | + g_accountInfoFromJsonFail = false; | ||
| 304 | + g_accountInfoToJsonFail = false; | ||
| 305 | + g_hasLogin = true; | ||
| 306 | + | ||
| 307 | + OhosAccountManager& manager = OhosAccountManager::GetInstance(); | ||
| 308 | + manager.dataDealer_ = std::make_unique<OhosAccountDataDeal>(""); | ||
| 309 | + | ||
| 310 | + OhosAccountInfo ohosAccountInfo; | ||
| 311 | + ohosAccountInfo.name_ = TEST_NAME; | ||
| 312 | + ohosAccountInfo.uid_ = TEST_UID; | ||
| 313 | + | ||
| 314 | + ErrCode result = manager.HandleOhosAccountTokenInvalidEvent(TEST_USER_ID, ohosAccountInfo, g_eventTokenInvalid); | ||
| 315 | + EXPECT_EQ(result, ERR_OK); | ||
| 316 | +} | ||
| 317 | + | ||
| 318 | + | ||
| 319 | + | ||
| 320 | +} // namespace AccountSA | ||
| 321 | +} // namespace OHOS | ||
| @@ -345,7 +345,7 @@ HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest012, TestSize.Level3) | |||
| 345 | AccountInfo curOhosAccountInfo; | 345 | AccountInfo curOhosAccountInfo; |
| 346 | OhosAccountInfo newOhosAccountInfo; | 346 | OhosAccountInfo newOhosAccountInfo; |
| 347 | EXPECT_EQ(OhosAccountManager::GetInstance().CheckOhosAccountCanBind(curOhosAccountInfo, newOhosAccountInfo, "test"), | 347 | EXPECT_EQ(OhosAccountManager::GetInstance().CheckOhosAccountCanBind(curOhosAccountInfo, newOhosAccountInfo, "test"), |
| 348 | - false); | 348 | + ERR_ACCOUNT_COMMON_INVALID_PARAMETER); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | /** | 351 | /** |
| @@ -472,27 +472,32 @@ HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest016, TestSize.Level3) | |||
| 472 | std::string input = ""; | 472 | std::string input = ""; |
| 473 | AccountInfo info; | 473 | AccountInfo info; |
| 474 | std::string inputUid; | 474 | std::string inputUid; |
| 475 | - bool result = OhosAccountManager::GetInstance().GetCurOhosAccountAndCheckMatch(info, input, input, 100); | 475 | + ErrCode result = OhosAccountManager::GetInstance().GetCurOhosAccountAndCheckMatch(info, input, input, 100); |
| 476 | - EXPECT_EQ(result, false); | 476 | + EXPECT_NE(result, ERR_OK); |
| 477 | result = OhosAccountManager::GetInstance().GetCurOhosAccountAndCheckMatch(info, TEST_NAME, TEST_NAME, 100); | 477 | result = OhosAccountManager::GetInstance().GetCurOhosAccountAndCheckMatch(info, TEST_NAME, TEST_NAME, 100); |
| 478 | - EXPECT_EQ(result, false); | 478 | + EXPECT_NE(result, ERR_OK); |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | /** | 481 | /** |
| 482 | * @tc.name: OhosAccountManagerTest017 | 482 | * @tc.name: OhosAccountManagerTest017 |
| 483 | - * @tc.desc: Test GetOsAccountLocalIdForSubProfile in non-macro mode accepts base+1 subProfileId. | 483 | + * @tc.desc: test CheckOhosAccountCanBind account already bound with different uid. |
| 484 | * @tc.type: FUNC | 484 | * @tc.type: FUNC |
| 485 | * @tc.require: | 485 | * @tc.require: |
| 486 | */ | 486 | */ |
| 487 | -HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest017, TestSize.Level1) | 487 | +HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest017, TestSize.Level3) |
| 488 | { | 488 | { |
| 489 | - constexpr int32_t osAccountId = 100; | 489 | + AccountInfo curOhosAccountInfo; |
| 490 | - constexpr int32_t subProfileId = osAccountId * Constants::OS_ACCOUNT_SUBSPACE_ID_MULTIPLIER + 1; | 490 | + curOhosAccountInfo.ohosAccountInfo_.status_ = ACCOUNT_STATE_LOGIN; |
| 491 | - int32_t resultOsAccountId = -1; | 491 | + curOhosAccountInfo.ohosAccountInfo_.uid_ = std::string(64, 'A'); |
| 492 | - ErrCode ret = OhosAccountManager::GetInstance().GetOsAccountLocalIdForSubProfile( | 492 | + curOhosAccountInfo.ohosAccountInfo_.name_ = "existingAccount"; |
| 493 | - subProfileId, resultOsAccountId); | 493 | + |
| 494 | - EXPECT_EQ(ret, ERR_OK); | 494 | + OhosAccountInfo newOhosAccountInfo; |
| 495 | - EXPECT_EQ(resultOsAccountId, osAccountId); | 495 | + newOhosAccountInfo.name_ = "differentAccount"; |
| 496 | + | ||
| 497 | + std::string newOhosUid(64, 'B'); | ||
| 498 | + EXPECT_EQ(OhosAccountManager::GetInstance().CheckOhosAccountCanBind( | ||
| 499 | + curOhosAccountInfo, newOhosAccountInfo, newOhosUid), | ||
| 500 | + ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR); | ||
| 496 | } | 501 | } |
| 497 | 502 | ||
| 498 | /** | 503 | /** |
| @@ -543,3 +548,20 @@ HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest020, TestSize.Level1) | |||
| 543 | EXPECT_EQ(ret, ERR_OK); | 548 | EXPECT_EQ(ret, ERR_OK); |
| 544 | EXPECT_EQ(index, 0); | 549 | EXPECT_EQ(index, 0); |
| 545 | } | 550 | } |
| 551 | + | ||
| 552 | +/** | ||
| 553 | + * @tc.name: OhosAccountManagerTest021 | ||
| 554 | + * @tc.desc: Test GetOsAccountLocalIdForSubProfile in non-macro mode accepts base+1 subProfileId. | ||
| 555 | + * @tc.type: FUNC | ||
| 556 | + * @tc.require: | ||
| 557 | + */ | ||
| 558 | +HWTEST_F(OhosAccountManagerTest, OhosAccountManagerTest021, TestSize.Level1) | ||
| 559 | +{ | ||
| 560 | + constexpr int32_t osAccountId = 100; | ||
| 561 | + constexpr int32_t subProfileId = osAccountId * Constants::OS_ACCOUNT_SUBSPACE_ID_MULTIPLIER + 1; | ||
| 562 | + int32_t resultOsAccountId = -1; | ||
| 563 | + ErrCode ret = OhosAccountManager::GetInstance().GetOsAccountLocalIdForSubProfile( | ||
| 564 | + subProfileId, resultOsAccountId); | ||
| 565 | + EXPECT_EQ(ret, ERR_OK); | ||
| 566 | + EXPECT_EQ(resultOsAccountId, osAccountId); | ||
| 567 | +} | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -10,11 +10,39 @@ | |||
| 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | + | ||
| 14 | +import("../../../os_account.gni") | ||
| 15 | + | ||
| 16 | +config("account_stub_fuzztest_config") { | ||
| 17 | + include_dirs = [ | ||
| 18 | + "${innerkits_path}/include", | ||
| 19 | + "${os_account_core_path}/include", | ||
| 20 | + "${os_account_interfaces_native_path}/include", | ||
| 21 | + "${os_account_path}/dfx/hidumper_adapter", | ||
| 22 | + "${os_account_path}/dfx/hitrace_adapter", | ||
| 23 | + "${services_path}/accountmgr/include", | ||
| 24 | + "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 25 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 26 | + "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 27 | + ] | ||
| 28 | + cflags = [ | ||
| 29 | + "-g", | ||
| 30 | + "-O0", | ||
| 31 | + "-Wno-unused-variable", | ||
| 32 | + "-fno-omit-frame-pointer", | ||
| 33 | + ] | ||
| 34 | + if (target_cpu == "arm") { | ||
| 35 | + cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 36 | + } | ||
| 37 | + defines = [ | ||
| 38 | + "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 39 | + "LOG_DOMAIN = 0xD001B00", | ||
| 40 | + ] | ||
| 41 | +} | ||
| 42 | + | ||
| 13 | group("fuzztest") { | 43 | group("fuzztest") { |
| 14 | testonly = true | 44 | testonly = true |
| 15 | - | ||
| 16 | deps = [ | 45 | deps = [ |
| 17 | - # deps file | ||
| 18 | "cmdgetohosaccountinfobyuseridstub_fuzzer:CmdGetOhosAccountInfoByUserIdStubFuzzTest", | 46 | "cmdgetohosaccountinfobyuseridstub_fuzzer:CmdGetOhosAccountInfoByUserIdStubFuzzTest", |
| 19 | "cmdgetosaccountservicestub_fuzzer:CmdGetOsAccountServiceStubFuzzTest", | 47 | "cmdgetosaccountservicestub_fuzzer:CmdGetOsAccountServiceStubFuzzTest", |
| 20 | "cmdqueryohosaccountinfobyuseridstub_fuzzer:CmdQueryOhosAccountInfoByUserIdStubFuzzTest", | 48 | "cmdqueryohosaccountinfobyuseridstub_fuzzer:CmdQueryOhosAccountInfoByUserIdStubFuzzTest", |
| @@ -11,72 +11,21 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdGetOhosAccountInfoByUserIdStubFuzzTest") { | 16 | ohos_fuzztest("CmdGetOhosAccountInfoByUserIdStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | 19 | + configs = [ |
| 27 | - "${innerkits_path}/include", | 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", |
| 28 | - "${os_account_core_path}/include", | 21 | + "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 31 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 32 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 33 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 34 | - "${services_path}/accountmgr/include", | ||
| 35 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 36 | ] | 22 | ] |
| 37 | - cflags = [ | ||
| 38 | - "-g", | ||
| 39 | - "-O0", | ||
| 40 | - "-Wno-unused-variable", | ||
| 41 | - "-fno-omit-frame-pointer", | ||
| 42 | - ] | ||
| 43 | - if (target_cpu == "arm") { | ||
| 44 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 45 | - } | ||
| 46 | - configs = [ "${domain_account_framework_path}:frameworks_domain_account_interface_public_config" ] | ||
| 47 | sources = [ | 23 | sources = [ |
| 48 | "${app_account_services_path}/src/account_mgr_service.cpp", | 24 | "${app_account_services_path}/src/account_mgr_service.cpp", |
| 49 | "cmdgetohosaccountinfobyuseridstub_fuzzer.cpp", | 25 | "cmdgetohosaccountinfobyuseridstub_fuzzer.cpp", |
| 50 | ] | 26 | ] |
| 51 | - | 27 | + deps = account_stub_deps + [ |
| 52 | - deps = [ | ||
| 53 | - "${innerkits_native_path}:account_stub", | ||
| 54 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 55 | "${os_account_innerkits_native_path}:os_account_state_reply_callback_proxy", | 28 | "${os_account_innerkits_native_path}:os_account_state_reply_callback_proxy", |
| 56 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 57 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 58 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 59 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 60 | - ] | ||
| 61 | - | ||
| 62 | - external_deps = [ | ||
| 63 | - "ability_base:want", | ||
| 64 | - "ability_runtime:app_manager", | ||
| 65 | - "ability_runtime:wantagent_innerkits", | ||
| 66 | - "access_token:libaccesstoken_sdk", | ||
| 67 | - "access_token:libtokenid_sdk", | ||
| 68 | - "bundle_framework:appexecfwk_base", | ||
| 69 | - "cJSON:cjson", | ||
| 70 | - "c_utils:utils", | ||
| 71 | - "hilog:libhilog", | ||
| 72 | - "ipc:ipc_single", | ||
| 73 | - "kv_store:distributeddata_inner", | ||
| 74 | - "safwk:system_ability_fwk", | ||
| 75 | - "samgr:samgr_proxy", | ||
| 76 | - ] | ||
| 77 | - | ||
| 78 | - defines = [ | ||
| 79 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 80 | - "LOG_DOMAIN = 0xD001B00", | ||
| 81 | ] | 29 | ] |
| 30 | + external_deps = account_stub_ext_deps | ||
| 82 | } | 31 | } |
| @@ -11,70 +11,19 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdGetOsAccountServiceStubFuzzTest") { | 16 | ohos_fuzztest("CmdGetOsAccountServiceStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | 19 | + configs = [ |
| 27 | - "${innerkits_path}/include", | 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", |
| 28 | - "${os_account_core_path}/include", | 21 | + "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 31 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 32 | - "${services_path}/accountmgr/include", | ||
| 33 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 34 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 35 | ] | 22 | ] |
| 36 | - cflags = [ | ||
| 37 | - "-g", | ||
| 38 | - "-O0", | ||
| 39 | - "-Wno-unused-variable", | ||
| 40 | - "-fno-omit-frame-pointer", | ||
| 41 | - ] | ||
| 42 | - if (target_cpu == "arm") { | ||
| 43 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 44 | - } | ||
| 45 | - configs = [ "${domain_account_framework_path}:frameworks_domain_account_interface_public_config" ] | ||
| 46 | sources = [ | 23 | sources = [ |
| 47 | - "${os_account_path}/services/accountmgr/src/account_mgr_service.cpp", | 24 | + "${app_account_services_path}/src/account_mgr_service.cpp", |
| 48 | "cmdgetosaccountservicestub_fuzzer.cpp", | 25 | "cmdgetosaccountservicestub_fuzzer.cpp", |
| 49 | ] | 26 | ] |
| 50 | - | 27 | + deps = account_stub_deps |
| 51 | - deps = [ | 28 | + external_deps = account_stub_ext_deps |
| 52 | - "${innerkits_native_path}:account_stub", | ||
| 53 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 54 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 55 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 56 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 57 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 58 | - ] | ||
| 59 | - | ||
| 60 | - external_deps = [ | ||
| 61 | - "ability_base:want", | ||
| 62 | - "ability_runtime:app_manager", | ||
| 63 | - "ability_runtime:wantagent_innerkits", | ||
| 64 | - "access_token:libaccesstoken_sdk", | ||
| 65 | - "access_token:libtokenid_sdk", | ||
| 66 | - "bundle_framework:appexecfwk_base", | ||
| 67 | - "cJSON:cjson", | ||
| 68 | - "c_utils:utils", | ||
| 69 | - "hilog:libhilog", | ||
| 70 | - "ipc:ipc_single", | ||
| 71 | - "kv_store:distributeddata_inner", | ||
| 72 | - "safwk:system_ability_fwk", | ||
| 73 | - "samgr:samgr_proxy", | ||
| 74 | - ] | ||
| 75 | - | ||
| 76 | - defines = [ | ||
| 77 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 78 | - "LOG_DOMAIN = 0xD001B00", | ||
| 79 | - ] | ||
| 80 | } | 29 | } |
| @@ -11,75 +11,20 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdQueryOhosAccountInfoByUserIdStubFuzzTest") { | 16 | ohos_fuzztest("CmdQueryOhosAccountInfoByUserIdStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | ||
| 27 | - "${innerkits_path}/include", | ||
| 28 | - "${os_account_core_path}/include", | ||
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 31 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 32 | - "${services_path}/accountmgr/include", | ||
| 33 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 34 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 35 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 36 | - ] | ||
| 37 | - cflags = [ | ||
| 38 | - "-g", | ||
| 39 | - "-O0", | ||
| 40 | - "-Wno-unused-variable", | ||
| 41 | - "-fno-omit-frame-pointer", | ||
| 42 | - ] | ||
| 43 | - if (target_cpu == "arm") { | ||
| 44 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 45 | - } | ||
| 46 | configs = [ | 19 | configs = [ |
| 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", | ||
| 47 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", | 21 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 48 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", | 22 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", |
| 49 | ] | 23 | ] |
| 50 | - | ||
| 51 | sources = [ | 24 | sources = [ |
| 52 | "${app_account_services_path}/src/account_mgr_service.cpp", | 25 | "${app_account_services_path}/src/account_mgr_service.cpp", |
| 53 | "cmdqueryohosaccountinfobyuseridstub_fuzzer.cpp", | 26 | "cmdqueryohosaccountinfobyuseridstub_fuzzer.cpp", |
| 54 | ] | 27 | ] |
| 55 | - | 28 | + deps = account_stub_deps |
| 56 | - deps = [ | 29 | + external_deps = account_stub_ext_deps |
| 57 | - "${innerkits_native_path}:account_stub", | ||
| 58 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 59 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 60 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 61 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 62 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 63 | - ] | ||
| 64 | - | ||
| 65 | - external_deps = [ | ||
| 66 | - "ability_base:want", | ||
| 67 | - "ability_runtime:app_manager", | ||
| 68 | - "ability_runtime:wantagent_innerkits", | ||
| 69 | - "access_token:libaccesstoken_sdk", | ||
| 70 | - "access_token:libtokenid_sdk", | ||
| 71 | - "bundle_framework:appexecfwk_base", | ||
| 72 | - "cJSON:cjson", | ||
| 73 | - "c_utils:utils", | ||
| 74 | - "hilog:libhilog", | ||
| 75 | - "ipc:ipc_single", | ||
| 76 | - "kv_store:distributeddata_inner", | ||
| 77 | - "safwk:system_ability_fwk", | ||
| 78 | - "samgr:samgr_proxy", | ||
| 79 | - ] | ||
| 80 | - | ||
| 81 | - defines = [ | ||
| 82 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 83 | - "LOG_DOMAIN = 0xD001B00", | ||
| 84 | - ] | ||
| 85 | } | 30 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2024-2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,74 +11,20 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdSetOhosAccountInfoByUserIdStubFuzzTest") { | 16 | ohos_fuzztest("CmdSetOhosAccountInfoByUserIdStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | ||
| 27 | - "${innerkits_path}/include", | ||
| 28 | - "${os_account_core_path}/include", | ||
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 31 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 32 | - "${services_path}/accountmgr/include", | ||
| 33 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 34 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 35 | - ] | ||
| 36 | - cflags = [ | ||
| 37 | - "-g", | ||
| 38 | - "-O0", | ||
| 39 | - "-Wno-unused-variable", | ||
| 40 | - "-fno-omit-frame-pointer", | ||
| 41 | - ] | ||
| 42 | - if (target_cpu == "arm") { | ||
| 43 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 44 | - } | ||
| 45 | configs = [ | 19 | configs = [ |
| 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", | ||
| 46 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", | 21 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 47 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", | 22 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", |
| 48 | ] | 23 | ] |
| 49 | - | ||
| 50 | sources = [ | 24 | sources = [ |
| 51 | "${app_account_services_path}/src/account_mgr_service.cpp", | 25 | "${app_account_services_path}/src/account_mgr_service.cpp", |
| 52 | "cmdsetohosaccountinfobyuseridstub_fuzzer.cpp", | 26 | "cmdsetohosaccountinfobyuseridstub_fuzzer.cpp", |
| 53 | ] | 27 | ] |
| 54 | - | 28 | + deps = account_stub_deps |
| 55 | - deps = [ | 29 | + external_deps = account_stub_ext_deps |
| 56 | - "${innerkits_native_path}:account_stub", | ||
| 57 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 58 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 59 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 60 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 61 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 62 | - ] | ||
| 63 | - | ||
| 64 | - external_deps = [ | ||
| 65 | - "ability_base:want", | ||
| 66 | - "ability_runtime:app_manager", | ||
| 67 | - "ability_runtime:wantagent_innerkits", | ||
| 68 | - "access_token:libaccesstoken_sdk", | ||
| 69 | - "access_token:libtokenid_sdk", | ||
| 70 | - "bundle_framework:appexecfwk_base", | ||
| 71 | - "cJSON:cjson", | ||
| 72 | - "c_utils:utils", | ||
| 73 | - "hilog:libhilog", | ||
| 74 | - "ipc:ipc_single", | ||
| 75 | - "kv_store:distributeddata_inner", | ||
| 76 | - "safwk:system_ability_fwk", | ||
| 77 | - "samgr:samgr_proxy", | ||
| 78 | - ] | ||
| 79 | - | ||
| 80 | - defines = [ | ||
| 81 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 82 | - "LOG_DOMAIN = 0xD001B00", | ||
| 83 | - ] | ||
| 84 | } | 30 | } |
| @@ -11,76 +11,20 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdSetOhosAccountInfoStubFuzzTest") { | 16 | ohos_fuzztest("CmdSetOhosAccountInfoStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | ||
| 27 | - "${innerkits_path}/include", | ||
| 28 | - "${os_account_core_path}/include", | ||
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 31 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 32 | - "${services_path}/accountmgr/include", | ||
| 33 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 34 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 35 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 36 | - ] | ||
| 37 | - cflags = [ | ||
| 38 | - "-g", | ||
| 39 | - "-O0", | ||
| 40 | - "-Wno-unused-variable", | ||
| 41 | - "-fno-omit-frame-pointer", | ||
| 42 | - ] | ||
| 43 | - if (target_cpu == "arm") { | ||
| 44 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | configs = [ | 19 | configs = [ |
| 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", | ||
| 48 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", | 21 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 49 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", | 22 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", |
| 50 | ] | 23 | ] |
| 51 | - | ||
| 52 | sources = [ | 24 | sources = [ |
| 53 | "${app_account_services_path}/src/account_mgr_service.cpp", | 25 | "${app_account_services_path}/src/account_mgr_service.cpp", |
| 54 | "cmdsetohosaccountinfostub_fuzzer.cpp", | 26 | "cmdsetohosaccountinfostub_fuzzer.cpp", |
| 55 | ] | 27 | ] |
| 56 | - | 28 | + deps = account_stub_deps |
| 57 | - deps = [ | 29 | + external_deps = account_stub_ext_deps |
| 58 | - "${innerkits_native_path}:account_stub", | ||
| 59 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 60 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 61 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 62 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 63 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 64 | - ] | ||
| 65 | - | ||
| 66 | - external_deps = [ | ||
| 67 | - "ability_base:want", | ||
| 68 | - "ability_runtime:app_manager", | ||
| 69 | - "ability_runtime:wantagent_innerkits", | ||
| 70 | - "access_token:libaccesstoken_sdk", | ||
| 71 | - "access_token:libtokenid_sdk", | ||
| 72 | - "bundle_framework:appexecfwk_base", | ||
| 73 | - "cJSON:cjson", | ||
| 74 | - "c_utils:utils", | ||
| 75 | - "hilog:libhilog", | ||
| 76 | - "ipc:ipc_single", | ||
| 77 | - "kv_store:distributeddata_inner", | ||
| 78 | - "safwk:system_ability_fwk", | ||
| 79 | - "samgr:samgr_proxy", | ||
| 80 | - ] | ||
| 81 | - | ||
| 82 | - defines = [ | ||
| 83 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 84 | - "LOG_DOMAIN = 0xD001B00", | ||
| 85 | - ] | ||
| 86 | } | 30 | } |
| @@ -11,39 +11,13 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../account_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CmdUpdateOhosAccountInfoStubFuzzTest") { | 16 | ohos_fuzztest("CmdUpdateOhosAccountInfoStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | ||
| 27 | - "${innerkits_path}/include", | ||
| 28 | - "${os_account_core_path}/include", | ||
| 29 | - "${os_account_interfaces_native_path}/include", | ||
| 30 | - "${os_account_path}/dfx/hidumper_adapter", | ||
| 31 | - "${os_account_path}/dfx/hitrace_adapter", | ||
| 32 | - "${services_path}/accountmgr/include", | ||
| 33 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 34 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 35 | - "${os_account_path}/test/fuzztest/appaccount_stub/fuzz_data", | ||
| 36 | - ] | ||
| 37 | - cflags = [ | ||
| 38 | - "-g", | ||
| 39 | - "-O0", | ||
| 40 | - "-Wno-unused-variable", | ||
| 41 | - "-fno-omit-frame-pointer", | ||
| 42 | - ] | ||
| 43 | - if (target_cpu == "arm") { | ||
| 44 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 45 | - } | ||
| 46 | configs = [ | 19 | configs = [ |
| 20 | + "${os_account_path}/test/fuzztest/account_stub:account_stub_fuzztest_config", | ||
| 47 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", | 21 | "${domain_account_framework_path}:frameworks_domain_account_interface_public_config", |
| 48 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", | 22 | "${os_account_innerkits_native_path}:frameworks_osaccount_interface_public_config", |
| 49 | ] | 23 | ] |
| @@ -51,34 +25,6 @@ ohos_fuzztest("CmdUpdateOhosAccountInfoStubFuzzTest") { | |||
| 51 | "${app_account_services_path}/src/account_mgr_service.cpp", | 25 | "${app_account_services_path}/src/account_mgr_service.cpp", |
| 52 | "cmdupdateohosaccountinfostub_fuzzer.cpp", | 26 | "cmdupdateohosaccountinfostub_fuzzer.cpp", |
| 53 | ] | 27 | ] |
| 54 | - | 28 | + deps = account_stub_deps |
| 55 | - deps = [ | 29 | + external_deps = account_stub_ext_deps |
| 56 | - "${innerkits_native_path}:account_stub", | ||
| 57 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 58 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 59 | - "${os_account_path}/frameworks/appaccount/native:app_account_innerkits", | ||
| 60 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 61 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 62 | - ] | ||
| 63 | - | ||
| 64 | - external_deps = [ | ||
| 65 | - "ability_base:want", | ||
| 66 | - "ability_runtime:app_manager", | ||
| 67 | - "ability_runtime:wantagent_innerkits", | ||
| 68 | - "access_token:libaccesstoken_sdk", | ||
| 69 | - "access_token:libtokenid_sdk", | ||
| 70 | - "bundle_framework:appexecfwk_base", | ||
| 71 | - "cJSON:cjson", | ||
| 72 | - "c_utils:utils", | ||
| 73 | - "hilog:libhilog", | ||
| 74 | - "ipc:ipc_single", | ||
| 75 | - "kv_store:distributeddata_inner", | ||
| 76 | - "safwk:system_ability_fwk", | ||
| 77 | - "samgr:samgr_proxy", | ||
| 78 | - ] | ||
| 79 | - | ||
| 80 | - defines = [ | ||
| 81 | - "ACCOUNT_LOG_TAG = \"AppAccountFuzzTest\"", | ||
| 82 | - "LOG_DOMAIN = 0xD001B00", | ||
| 83 | - ] | ||
| 84 | } | 30 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2024-2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -12,11 +12,86 @@ | |||
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | import("../../../os_account.gni") | 14 | import("../../../os_account.gni") |
| 15 | +import("../../../services/accountmgr/os_account_service.gni") | ||
| 16 | +import("//build/config/features.gni") | ||
| 17 | +import("//build/test.gni") | ||
| 18 | + | ||
| 19 | +config("osaccount_stub_common_config") { | ||
| 20 | + include_dirs = [ | ||
| 21 | + "${services_path}/accountmgr/include/bundle_manager_adapter", | ||
| 22 | + "${services_path}/accountmgr/include", | ||
| 23 | + "${services_path}/accountmgr/include/osaccount", | ||
| 24 | + "${os_account_innerkits_native_path}/include", | ||
| 25 | + "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 26 | + ] | ||
| 27 | + cflags = [ | ||
| 28 | + "-g", | ||
| 29 | + "-O0", | ||
| 30 | + "-Wno-unused-variable", | ||
| 31 | + "-fno-omit-frame-pointer", | ||
| 32 | + ] | ||
| 33 | + if (use_libfuzzer) { | ||
| 34 | + cflags += [ "-DFUZZ_TEST" ] | ||
| 35 | + } | ||
| 36 | + if (target_cpu == "arm") { | ||
| 37 | + cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 38 | + } | ||
| 39 | + defines = [ | ||
| 40 | + "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 41 | + "LOG_DOMAIN = 0xD001B00", | ||
| 42 | + ] | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +config("osaccount_stub_create_update_config") { | ||
| 46 | + include_dirs = [ | ||
| 47 | + "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 48 | + "${app_account_services_path}/test/mock/common", | ||
| 49 | + "${services_path}/accountmgr/test/mock/common", | ||
| 50 | + "${services_path}/accountmgr/test/mock/os_account", | ||
| 51 | + "${services_path}/accountmgr/include", | ||
| 52 | + "${services_path}/accountmgr/include/osaccount", | ||
| 53 | + "${services_path}/accountmgr/include/domain_account", | ||
| 54 | + "${services_path}/accountmgr/include/distributed_account", | ||
| 55 | + "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 56 | + "${services_path}/accountmgr/include/common/database/kvstore", | ||
| 57 | + "${services_path}/accountmgr/include/common/database", | ||
| 58 | + "${services_path}/accountmgr/test/mock/include", | ||
| 59 | + "${app_account_innerkits_native_path}/include", | ||
| 60 | + "${os_account_path}/frameworks/osaccount/core/include", | ||
| 61 | + "${os_account_dfx_path}/data_dfx", | ||
| 62 | + "${common_path}/log/include", | ||
| 63 | + "${common_path}/perf_stat/include", | ||
| 64 | + "${innerkits_common}/include", | ||
| 65 | + "${innerkits_path}/include", | ||
| 66 | + ] | ||
| 67 | + cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 68 | + if (has_user_idm_part) { | ||
| 69 | + cflags_cc += [ "-DHAS_USER_IDM_PART" ] | ||
| 70 | + } | ||
| 71 | + if (use_libfuzzer) { | ||
| 72 | + cflags_cc += [ "-DFUZZ_TEST" ] | ||
| 73 | + } | ||
| 74 | + if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 75 | + cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 76 | + if (has_huks_part) { | ||
| 77 | + cflags_cc += [ "-DHAS_HUKS_PART" ] | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + if (os_account_support_lock_os_account) { | ||
| 81 | + cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] | ||
| 82 | + } | ||
| 83 | + if (os_account_support_domain_accounts) { | ||
| 84 | + cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 85 | + } | ||
| 86 | + if (target_cpu == "arm64") { | ||
| 87 | + defines = [ "_ARM64_" ] | ||
| 88 | + } | ||
| 89 | +} | ||
| 90 | + | ||
| 15 | group("fuzztest") { | 91 | group("fuzztest") { |
| 16 | testonly = true | 92 | testonly = true |
| 17 | 93 | ||
| 18 | deps = [ | 94 | deps = [ |
| 19 | - # deps file | ||
| 20 | "activateosaccountstub_fuzzer:ActivateOsAccountStubFuzzTest", | 95 | "activateosaccountstub_fuzzer:ActivateOsAccountStubFuzzTest", |
| 21 | "checkosaccountconstraintenabledstub_fuzzer:CheckOsAccountConstraintEnabledStubFuzzTest", | 96 | "checkosaccountconstraintenabledstub_fuzzer:CheckOsAccountConstraintEnabledStubFuzzTest", |
| 22 | "createosaccountwithfullinfoinosaccountinfo_fuzzer:CreateOsAccountWithFullInfoInOsAccountInfoFuzzTest", | 97 | "createosaccountwithfullinfoinosaccountinfo_fuzzer:CreateOsAccountWithFullInfoInOsAccountInfoFuzzTest", |
| @@ -61,6 +136,7 @@ group("fuzztest") { | |||
| 61 | "subscribeosaccountconstraintstub_fuzzer:SubscribeOsAccountConstraintStubFuzzTest", | 136 | "subscribeosaccountconstraintstub_fuzzer:SubscribeOsAccountConstraintStubFuzzTest", |
| 62 | "subscribeosaccountstub_fuzzer:SubscribeOsAccountStubFuzzTest", | 137 | "subscribeosaccountstub_fuzzer:SubscribeOsAccountStubFuzzTest", |
| 63 | "unsubscribeosaccountconstraintstub_fuzzer:UnsubscribeOsAccountConstraintStubFuzzTest", | 138 | "unsubscribeosaccountconstraintstub_fuzzer:UnsubscribeOsAccountConstraintStubFuzzTest", |
| 139 | + "unsubscribeosaccountstub_fuzzer:UnsubscribeOsAccountStubFuzzTest", | ||
| 64 | "updateosaccountwithfullinfostub_fuzzer:UpdateOsAccountWithFullInfoStubFuzzTest", | 140 | "updateosaccountwithfullinfostub_fuzzer:UpdateOsAccountWithFullInfoStubFuzzTest", |
| 65 | "procgetcreatedosaccountnumfromdatabasestub_fuzzer:procgetcreatedosaccountnumfromdatabaseStubFuzzTest", | 141 | "procgetcreatedosaccountnumfromdatabasestub_fuzzer:procgetcreatedosaccountnumfromdatabaseStubFuzzTest", |
| 66 | "procgetserialnumberfromdatabasestub_fuzzer:procgetserialnumberfromdatabasestubFuzzTest", | 142 | "procgetserialnumberfromdatabasestub_fuzzer:procgetserialnumberfromdatabasestubFuzzTest", |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2023 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,66 +11,16 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("ActivateOsAccountStubFuzzTest") { | 16 | ohos_fuzztest("ActivateOsAccountStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | 19 | + configs = [ "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config" ] |
| 27 | - "${services_path}/accountmgr/include/bundle_manager_adapter", | ||
| 28 | - "${services_path}/accountmgr/include", | ||
| 29 | - "${services_path}/accountmgr/include/osaccount", | ||
| 30 | - "${os_account_innerkits_native_path}/include", | ||
| 31 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 32 | - ] | ||
| 33 | - cflags = [ | ||
| 34 | - "-g", | ||
| 35 | - "-O0", | ||
| 36 | - "-Wno-unused-variable", | ||
| 37 | - "-fno-omit-frame-pointer", | ||
| 38 | - ] | ||
| 39 | - if (use_libfuzzer) { | ||
| 40 | - cflags += [ "-DFUZZ_TEST" ] | ||
| 41 | - } | ||
| 42 | - if (target_cpu == "arm") { | ||
| 43 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 44 | - } | ||
| 45 | sources = [ | 20 | sources = [ |
| 46 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", | 21 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", |
| 47 | "activateosaccountstub_fuzzer.cpp", | 22 | "activateosaccountstub_fuzzer.cpp", |
| 48 | ] | 23 | ] |
| 49 | - | 24 | + deps = osaccount_stub_deps |
| 50 | - deps = [ | 25 | + external_deps = osaccount_stub_ext_deps |
| 51 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/native:os_account_innerkits", | ||
| 53 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 54 | - ] | ||
| 55 | - | ||
| 56 | - external_deps = [ | ||
| 57 | - "ability_base:want", | ||
| 58 | - "ability_runtime:app_manager", | ||
| 59 | - "ability_runtime:wantagent_innerkits", | ||
| 60 | - "access_token:libaccesstoken_sdk", | ||
| 61 | - "access_token:libtokenid_sdk", | ||
| 62 | - "bundle_framework:appexecfwk_base", | ||
| 63 | - "cJSON:cjson", | ||
| 64 | - "c_utils:utils", | ||
| 65 | - "hilog:libhilog", | ||
| 66 | - "ipc:ipc_single", | ||
| 67 | - "kv_store:distributeddata_inner", | ||
| 68 | - "safwk:system_ability_fwk", | ||
| 69 | - "samgr:samgr_proxy", | ||
| 70 | - ] | ||
| 71 | - | ||
| 72 | - defines = [ | ||
| 73 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 74 | - "LOG_DOMAIN = 0xD001B00", | ||
| 75 | - ] | ||
| 76 | } | 26 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,72 +11,23 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("BindDomainAccountStubFuzzTest") { | 16 | ohos_fuzztest("BindDomainAccountStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | 19 | + configs = [ "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config" ] |
| 27 | - "${services_path}/accountmgr/include/bundle_manager_adapter", | ||
| 28 | - "${services_path}/accountmgr/include", | ||
| 29 | - "${services_path}/accountmgr/include/osaccount", | ||
| 30 | - "${os_account_innerkits_native_path}/include", | ||
| 31 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 32 | - ] | ||
| 33 | - cflags = [ | ||
| 34 | - "-g", | ||
| 35 | - "-O0", | ||
| 36 | - "-Wno-unused-variable", | ||
| 37 | - "-fno-omit-frame-pointer", | ||
| 38 | - ] | ||
| 39 | - if (use_libfuzzer) { | ||
| 40 | - cflags += [ "-DFUZZ_TEST" ] | ||
| 41 | - } | ||
| 42 | - if (target_cpu == "arm") { | ||
| 43 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 44 | - } | ||
| 45 | sources = [ | 20 | sources = [ |
| 46 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", | 21 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", |
| 47 | "binddomainaccountstub_fuzzer.cpp", | 22 | "binddomainaccountstub_fuzzer.cpp", |
| 48 | ] | 23 | ] |
| 49 | - | 24 | + deps = osaccount_stub_deps + [ |
| 50 | - deps = [ | ||
| 51 | "${domain_account_framework_path}:domain_account_innerkits", | 25 | "${domain_account_framework_path}:domain_account_innerkits", |
| 52 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 53 | - "${os_account_path}/frameworks/osaccount/native:os_account_innerkits", | ||
| 54 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 55 | ] | 26 | ] |
| 56 | - | 27 | + external_deps = osaccount_stub_ext_deps + [ |
| 57 | - external_deps = [ | ||
| 58 | - "ability_base:want", | ||
| 59 | - "ability_runtime:app_manager", | ||
| 60 | - "ability_runtime:wantagent_innerkits", | ||
| 61 | - "access_token:libaccesstoken_sdk", | ||
| 62 | "access_token:libnativetoken_shared", | 28 | "access_token:libnativetoken_shared", |
| 63 | - "access_token:libtokenid_sdk", | ||
| 64 | "access_token:libtokensetproc_shared", | 29 | "access_token:libtokensetproc_shared", |
| 65 | - "bundle_framework:appexecfwk_base", | ||
| 66 | - "cJSON:cjson", | ||
| 67 | - "c_utils:utils", | ||
| 68 | - "hilog:libhilog", | ||
| 69 | - "ipc:ipc_single", | ||
| 70 | - "kv_store:distributeddata_inner", | ||
| 71 | - "safwk:system_ability_fwk", | ||
| 72 | - "samgr:samgr_proxy", | ||
| 73 | ] | 30 | ] |
| 74 | - | ||
| 75 | - defines = [ | ||
| 76 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 77 | - "LOG_DOMAIN = 0xD001B00", | ||
| 78 | - ] | ||
| 79 | - | ||
| 80 | cflags_cc = [] | 31 | cflags_cc = [] |
| 81 | if (os_account_support_domain_accounts) { | 32 | if (os_account_support_domain_accounts) { |
| 82 | cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | 33 | cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2023 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,66 +11,16 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | 15 | ||
| 16 | -#####################hydra-fuzz################### | ||
| 17 | -import("//build/config/features.gni") | ||
| 18 | -import("//build/ohos.gni") | ||
| 19 | -import("//build/test.gni") | ||
| 20 | - | ||
| 21 | -##############################fuzztest########################################## | ||
| 22 | ohos_fuzztest("CheckOsAccountConstraintEnabledStubFuzzTest") { | 16 | ohos_fuzztest("CheckOsAccountConstraintEnabledStubFuzzTest") { |
| 23 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 24 | - | ||
| 25 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 26 | - include_dirs = [ | 19 | + configs = [ "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config" ] |
| 27 | - "${services_path}/accountmgr/include/bundle_manager_adapter", | ||
| 28 | - "${services_path}/accountmgr/include", | ||
| 29 | - "${services_path}/accountmgr/include/osaccount", | ||
| 30 | - "${os_account_innerkits_native_path}/include", | ||
| 31 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 32 | - ] | ||
| 33 | - cflags = [ | ||
| 34 | - "-g", | ||
| 35 | - "-O0", | ||
| 36 | - "-Wno-unused-variable", | ||
| 37 | - "-fno-omit-frame-pointer", | ||
| 38 | - ] | ||
| 39 | - if (use_libfuzzer) { | ||
| 40 | - cflags += [ "-DFUZZ_TEST" ] | ||
| 41 | - } | ||
| 42 | - if (target_cpu == "arm") { | ||
| 43 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 44 | - } | ||
| 45 | sources = [ | 20 | sources = [ |
| 46 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", | 21 | "${os_account_path}/services/accountmgr/src/osaccount/os_account_manager_service.cpp", |
| 47 | "checkosaccountconstraintenabledstub_fuzzer.cpp", | 22 | "checkosaccountconstraintenabledstub_fuzzer.cpp", |
| 48 | ] | 23 | ] |
| 49 | - | 24 | + deps = osaccount_stub_deps |
| 50 | - deps = [ | 25 | + external_deps = osaccount_stub_ext_deps |
| 51 | - "${os_account_path}/frameworks/common:libaccount_common", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/native:os_account_innerkits", | ||
| 53 | - "${os_account_path}/services/accountmgr:accountmgr", | ||
| 54 | - ] | ||
| 55 | - | ||
| 56 | - external_deps = [ | ||
| 57 | - "ability_base:want", | ||
| 58 | - "ability_runtime:app_manager", | ||
| 59 | - "ability_runtime:wantagent_innerkits", | ||
| 60 | - "access_token:libaccesstoken_sdk", | ||
| 61 | - "access_token:libtokenid_sdk", | ||
| 62 | - "bundle_framework:appexecfwk_base", | ||
| 63 | - "cJSON:cjson", | ||
| 64 | - "c_utils:utils", | ||
| 65 | - "hilog:libhilog", | ||
| 66 | - "ipc:ipc_single", | ||
| 67 | - "kv_store:distributeddata_inner", | ||
| 68 | - "safwk:system_ability_fwk", | ||
| 69 | - "samgr:samgr_proxy", | ||
| 70 | - ] | ||
| 71 | - | ||
| 72 | - defines = [ | ||
| 73 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 74 | - "LOG_DOMAIN = 0xD001B00", | ||
| 75 | - ] | ||
| 76 | } | 26 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,193 +11,22 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | -import("../../../../services/accountmgr/os_account_service.gni") | ||
| 16 | - | ||
| 17 | -#####################hydra-fuzz################### | ||
| 18 | -import("//build/config/features.gni") | ||
| 19 | -import("//build/ohos.gni") | ||
| 20 | -import("//build/test.gni") | ||
| 21 | - | ||
| 22 | -##############################fuzztest########################################## | ||
| 23 | -config("os_account_manager_service_test_config") { | ||
| 24 | - include_dirs = [ | ||
| 25 | - "${services_path}/accountmgr/test/mock/common", | ||
| 26 | - "${services_path}/accountmgr/test/mock/os_account", | ||
| 27 | - "${services_path}/accountmgr/include", | ||
| 28 | - "${services_path}/accountmgr/include/osaccount", | ||
| 29 | - "${common_path}/log/include", | ||
| 30 | - "${common_path}/perf_stat/include", | ||
| 31 | - "${innerkits_common}/include", | ||
| 32 | - "${innerkits_path}/include", | ||
| 33 | - ] | ||
| 34 | -} | ||
| 35 | 15 | ||
| 36 | ohos_fuzztest("CreateOsAccountForDomainStubFuzzTest") { | 16 | ohos_fuzztest("CreateOsAccountForDomainStubFuzzTest") { |
| 37 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 38 | - | ||
| 39 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 40 | - | ||
| 41 | - defines = [ | ||
| 42 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 43 | - "LOG_DOMAIN = 0xD001B00", | ||
| 44 | - ] | ||
| 45 | - include_dirs = [ | ||
| 46 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 47 | - "${app_account_services_path}/test/mock/common", | ||
| 48 | - "${services_path}/accountmgr/include/domain_account", | ||
| 49 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 50 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 51 | - "${app_account_innerkits_native_path}/include", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/core/include", | ||
| 53 | - "${os_account_dfx_path}/data_dfx", | ||
| 54 | - "${services_path}/accountmgr/include/common/database/kvstore", | ||
| 55 | - "${services_path}/accountmgr/include/common/database", | ||
| 56 | - "${services_path}/accountmgr/test/mock/include", | ||
| 57 | - ] | ||
| 58 | - cflags = [ | ||
| 59 | - "-g", | ||
| 60 | - "-O0", | ||
| 61 | - "-Wno-unused-variable", | ||
| 62 | - "-fno-omit-frame-pointer", | ||
| 63 | - ] | ||
| 64 | - cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 65 | - if (use_libfuzzer) { | ||
| 66 | - cflags_cc += [ "-DFUZZ_TEST" ] | ||
| 67 | - } | ||
| 68 | - if (has_user_idm_part) { | ||
| 69 | - cflags_cc += [ "-DHAS_USER_IDM_PART" ] | ||
| 70 | - } | ||
| 71 | - if (target_cpu == "arm64") { | ||
| 72 | - defines += [ "_ARM64_" ] | ||
| 73 | - } | ||
| 74 | - if (target_cpu == "arm") { | ||
| 75 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 76 | - } | ||
| 77 | - sources = [ "createosaccountfordomainstub_fuzzer.cpp" ] | ||
| 78 | - sources += [ | ||
| 79 | - "${app_account_services_path}/src/ability_manager_adapter/ability_manager_adapter.cpp", | ||
| 80 | - "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp", | ||
| 81 | - "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp", | ||
| 82 | - "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp", | ||
| 83 | - "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp", | ||
| 84 | - "${services_path}/accountmgr/test/mock/os_account/os_account_interface.cpp", | ||
| 85 | - "${services_path}/accountmgr/test/mock/os_account/permission_kit.cpp", | ||
| 86 | - ] | ||
| 87 | - sources += [ | ||
| 88 | - "${common_path}/utils/src/account_permission_manager.cpp", | ||
| 89 | - "${domain_account_framework_path}/src/domain_account_callback_service.cpp", | ||
| 90 | - "${domain_account_framework_path}/src/domain_account_common.cpp", | ||
| 91 | - "${domain_account_framework_path}/src/domain_account_parcel.cpp", | ||
| 92 | - "${os_account_dfx_path}/data_dfx/data_size_report_adapter.cpp", | ||
| 93 | - "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", | ||
| 94 | - "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", | ||
| 95 | - "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", | ||
| 96 | - "${services_path}/accountmgr/src/appaccount/os_account_state_subscriber.cpp", | ||
| 97 | - "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", | ||
| 98 | - ] | ||
| 99 | - sources += account_service_sources_mock | ||
| 100 | - sources += account_data_storage_source | ||
| 101 | - sources += account_iam_source | ||
| 102 | - sources += app_account_sources_mock | ||
| 103 | - | ||
| 104 | configs = [ | 19 | configs = [ |
| 105 | - ":os_account_manager_service_test_config", | ||
| 106 | "${app_account_services_path}/test/mock:mock_accountmgr_config", | 20 | "${app_account_services_path}/test/mock:mock_accountmgr_config", |
| 107 | "${app_account_services_path}/test/mock:accountmgr_config", | 21 | "${app_account_services_path}/test/mock:accountmgr_config", |
| 22 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config", | ||
| 23 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_create_update_config", | ||
| 108 | ] | 24 | ] |
| 109 | - | 25 | + sources = [ "createosaccountfordomainstub_fuzzer.cpp" ] |
| 26 | + sources += osaccount_stub_create_update_sources | ||
| 110 | version_script = "${services_path}/accountmgr/libaccountmgr.map" | 27 | version_script = "${services_path}/accountmgr/libaccountmgr.map" |
| 111 | - | 28 | + deps = osaccount_stub_deps |
| 112 | - deps = [ | 29 | + deps += osaccount_stub_create_update_deps |
| 113 | - "${account_iam_framework_path}:account_iam_innerkits", | 30 | + external_deps = osaccount_stub_ext_deps |
| 114 | - "${account_iam_framework_path}:account_iam_stub", | 31 | + external_deps += osaccount_stub_create_update_ext_deps |
| 115 | - "${account_iam_framework_path}/test/unittest:account_iam_client_test", | ||
| 116 | - "${account_test_common}:account_test_common_source_set", | ||
| 117 | - "${common_path}:libaccount_common", | ||
| 118 | - "${innerkits_native_path}:account_stub", | ||
| 119 | - "${innerkits_native_path}:libaccountkits", | ||
| 120 | - "${os_account_innerkits_native_path}:os_account_event_proxy", | ||
| 121 | - "${os_account_innerkits_native_path}:os_account_event_stub", | ||
| 122 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 123 | - "${os_account_innerkits_native_path}:os_account_state_reply_callback_stub", | ||
| 124 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 125 | - ] | ||
| 126 | - deps += [ | ||
| 127 | - "${app_account_innerkits_native_path}:app_account_authenticator_callback_stub", | ||
| 128 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_proxy", | ||
| 129 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_stub", | ||
| 130 | - "${os_account_subspace_framework_path}:os_account_subspace_stub", | ||
| 131 | - "${app_account_innerkits_native_path}:app_account_authenticator_proxy", | ||
| 132 | - "${app_account_innerkits_native_path}:app_account_stub", | ||
| 133 | - "${domain_account_framework_path}:domain_account_callback_proxy", | ||
| 134 | - "${domain_account_framework_path}:domain_account_callback_stub", | ||
| 135 | - "${domain_account_framework_path}:domain_account_stub", | ||
| 136 | - ] | ||
| 137 | - | ||
| 138 | - external_deps = [ | ||
| 139 | - "ability_base:base", | ||
| 140 | - "ability_base:want", | ||
| 141 | - "ability_runtime:ability_connect_callback_stub", | ||
| 142 | - "ability_runtime:ability_manager", | ||
| 143 | - "ability_runtime:app_manager", | ||
| 144 | - "access_token:libtokensetproc_shared", | ||
| 145 | - "bundle_framework:appexecfwk_base", | ||
| 146 | - "bundle_framework:appexecfwk_core", | ||
| 147 | - "cJSON:cjson", | ||
| 148 | - "c_utils:utils", | ||
| 149 | - "common_event_service:cesfwk_innerkits", | ||
| 150 | - "config_policy:configpolicy_util", | ||
| 151 | - "hilog:libhilog", | ||
| 152 | - "ipc:ipc_single", | ||
| 153 | - "kv_store:distributeddata_inner", | ||
| 154 | - "openssl:libcrypto_shared", | ||
| 155 | - "safwk:system_ability_fwk", | ||
| 156 | - "samgr:samgr_proxy", | ||
| 157 | - ] | ||
| 158 | - | ||
| 159 | - external_deps += [ | ||
| 160 | - "ability_runtime:wantagent_innerkits", | ||
| 161 | - "access_token:libaccesstoken_sdk", | ||
| 162 | - "access_token:libtokenid_sdk", | ||
| 163 | - "access_token:libtokensetproc_shared", | ||
| 164 | - "hicollie:libhicollie", | ||
| 165 | - "hisysevent:libhisysevent", | ||
| 166 | - "hitrace:hitrace_meter", | ||
| 167 | - "init:libbegetutil", | ||
| 168 | - "selinux_adapter:librestorecon", | ||
| 169 | - "storage_service:storage_manager_sa_proxy", | ||
| 170 | - "user_auth_framework:userauth_client", | ||
| 171 | - ] | ||
| 172 | - | ||
| 173 | - if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 174 | - cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 175 | - sources += | ||
| 176 | - [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] | ||
| 177 | - if (has_huks_part) { | ||
| 178 | - external_deps += [ "huks:libhukssdk" ] | ||
| 179 | - cflags_cc += [ "-DHAS_HUKS_PART" ] | ||
| 180 | - } | ||
| 181 | - } | ||
| 182 | - if (os_account_enable_multiple_os_account_sub_profiles) { | ||
| 183 | - cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNT_SUBSPACE" ] | ||
| 184 | - sources += [ | ||
| 185 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_data_deal.cpp", | ||
| 186 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_manager.cpp", | ||
| 187 | - ] | ||
| 188 | - } | ||
| 189 | - if (os_account_support_lock_os_account) { | ||
| 190 | - cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - if (os_account_support_domain_accounts) { | ||
| 194 | - cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - if (security_guard_enabled) { | ||
| 198 | - external_deps += [ | ||
| 199 | - "security_guard:libsg_collect_sdk", | ||
| 200 | - "time_service:time_client", | ||
| 201 | - ] | ||
| 202 | - } | ||
| 203 | } | 32 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,193 +11,22 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | -import("../../../../services/accountmgr/os_account_service.gni") | ||
| 16 | - | ||
| 17 | -#####################hydra-fuzz################### | ||
| 18 | -import("//build/config/features.gni") | ||
| 19 | -import("//build/ohos.gni") | ||
| 20 | -import("//build/test.gni") | ||
| 21 | - | ||
| 22 | -##############################fuzztest########################################## | ||
| 23 | -config("os_account_manager_service_test_config") { | ||
| 24 | - include_dirs = [ | ||
| 25 | - "${services_path}/accountmgr/test/mock/common", | ||
| 26 | - "${services_path}/accountmgr/test/mock/os_account", | ||
| 27 | - "${services_path}/accountmgr/include", | ||
| 28 | - "${services_path}/accountmgr/include/osaccount", | ||
| 29 | - "${common_path}/log/include", | ||
| 30 | - "${common_path}/perf_stat/include", | ||
| 31 | - "${innerkits_common}/include", | ||
| 32 | - "${innerkits_path}/include", | ||
| 33 | - ] | ||
| 34 | -} | ||
| 35 | 15 | ||
| 36 | ohos_fuzztest("CreateOsAccountForDomainWithoutOptionsStubFuzzTest") { | 16 | ohos_fuzztest("CreateOsAccountForDomainWithoutOptionsStubFuzzTest") { |
| 37 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 38 | - | ||
| 39 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 40 | - | ||
| 41 | - defines = [ | ||
| 42 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 43 | - "LOG_DOMAIN = 0xD001B00", | ||
| 44 | - ] | ||
| 45 | - include_dirs = [ | ||
| 46 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 47 | - "${app_account_services_path}/test/mock/common", | ||
| 48 | - "${services_path}/accountmgr/include/domain_account", | ||
| 49 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 50 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 51 | - "${app_account_innerkits_native_path}/include", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/core/include", | ||
| 53 | - "${os_account_dfx_path}/data_dfx", | ||
| 54 | - "${services_path}/accountmgr/include/common/database/kvstore", | ||
| 55 | - "${services_path}/accountmgr/include/common/database", | ||
| 56 | - "${services_path}/accountmgr/test/mock/include/", | ||
| 57 | - ] | ||
| 58 | - cflags = [ | ||
| 59 | - "-g", | ||
| 60 | - "-O0", | ||
| 61 | - "-Wno-unused-variable", | ||
| 62 | - "-fno-omit-frame-pointer", | ||
| 63 | - ] | ||
| 64 | - cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 65 | - if (use_libfuzzer) { | ||
| 66 | - cflags_cc += [ "-DFUZZ_TEST" ] | ||
| 67 | - } | ||
| 68 | - if (has_user_idm_part) { | ||
| 69 | - cflags_cc += [ "-DHAS_USER_IDM_PART" ] | ||
| 70 | - } | ||
| 71 | - if (target_cpu == "arm64") { | ||
| 72 | - defines += [ "_ARM64_" ] | ||
| 73 | - } | ||
| 74 | - if (target_cpu == "arm") { | ||
| 75 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 76 | - } | ||
| 77 | - sources = [ "createosaccountfordomainwithoutoptionsstub_fuzzer.cpp" ] | ||
| 78 | - sources += [ | ||
| 79 | - "${app_account_services_path}/src/ability_manager_adapter/ability_manager_adapter.cpp", | ||
| 80 | - "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp", | ||
| 81 | - "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp", | ||
| 82 | - "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp", | ||
| 83 | - "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp", | ||
| 84 | - "${services_path}/accountmgr/test/mock/os_account/os_account_interface.cpp", | ||
| 85 | - "${services_path}/accountmgr/test/mock/os_account/permission_kit.cpp", | ||
| 86 | - ] | ||
| 87 | - sources += [ | ||
| 88 | - "${common_path}/utils/src/account_permission_manager.cpp", | ||
| 89 | - "${domain_account_framework_path}/src/domain_account_callback_service.cpp", | ||
| 90 | - "${domain_account_framework_path}/src/domain_account_common.cpp", | ||
| 91 | - "${domain_account_framework_path}/src/domain_account_parcel.cpp", | ||
| 92 | - "${os_account_dfx_path}/data_dfx/data_size_report_adapter.cpp", | ||
| 93 | - "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", | ||
| 94 | - "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", | ||
| 95 | - "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", | ||
| 96 | - "${services_path}/accountmgr/src/appaccount/os_account_state_subscriber.cpp", | ||
| 97 | - "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", | ||
| 98 | - ] | ||
| 99 | - sources += account_service_sources_mock | ||
| 100 | - sources += account_data_storage_source | ||
| 101 | - sources += account_iam_source | ||
| 102 | - sources += app_account_sources_mock | ||
| 103 | - | ||
| 104 | configs = [ | 19 | configs = [ |
| 105 | - ":os_account_manager_service_test_config", | ||
| 106 | "${app_account_services_path}/test/mock:mock_accountmgr_config", | 20 | "${app_account_services_path}/test/mock:mock_accountmgr_config", |
| 107 | "${app_account_services_path}/test/mock:accountmgr_config", | 21 | "${app_account_services_path}/test/mock:accountmgr_config", |
| 22 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config", | ||
| 23 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_create_update_config", | ||
| 108 | ] | 24 | ] |
| 109 | - | 25 | + sources = [ "createosaccountfordomainwithoutoptionsstub_fuzzer.cpp" ] |
| 26 | + sources += osaccount_stub_create_update_sources | ||
| 110 | version_script = "${services_path}/accountmgr/libaccountmgr.map" | 27 | version_script = "${services_path}/accountmgr/libaccountmgr.map" |
| 111 | - | 28 | + deps = osaccount_stub_deps |
| 112 | - deps = [ | 29 | + deps += osaccount_stub_create_update_deps |
| 113 | - "${account_iam_framework_path}:account_iam_innerkits", | 30 | + external_deps = osaccount_stub_ext_deps |
| 114 | - "${account_iam_framework_path}:account_iam_stub", | 31 | + external_deps += osaccount_stub_create_update_ext_deps |
| 115 | - "${account_iam_framework_path}/test/unittest:account_iam_client_test", | ||
| 116 | - "${account_test_common}:account_test_common_source_set", | ||
| 117 | - "${common_path}:libaccount_common", | ||
| 118 | - "${innerkits_native_path}:account_stub", | ||
| 119 | - "${innerkits_native_path}:libaccountkits", | ||
| 120 | - "${os_account_innerkits_native_path}:os_account_event_proxy", | ||
| 121 | - "${os_account_innerkits_native_path}:os_account_event_stub", | ||
| 122 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 123 | - "${os_account_innerkits_native_path}:os_account_state_reply_callback_stub", | ||
| 124 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 125 | - ] | ||
| 126 | - deps += [ | ||
| 127 | - "${app_account_innerkits_native_path}:app_account_authenticator_callback_stub", | ||
| 128 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_proxy", | ||
| 129 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_stub", | ||
| 130 | - "${os_account_subspace_framework_path}:os_account_subspace_stub", | ||
| 131 | - "${app_account_innerkits_native_path}:app_account_authenticator_proxy", | ||
| 132 | - "${app_account_innerkits_native_path}:app_account_stub", | ||
| 133 | - "${domain_account_framework_path}:domain_account_callback_proxy", | ||
| 134 | - "${domain_account_framework_path}:domain_account_callback_stub", | ||
| 135 | - "${domain_account_framework_path}:domain_account_stub", | ||
| 136 | - ] | ||
| 137 | - | ||
| 138 | - external_deps = [ | ||
| 139 | - "ability_base:base", | ||
| 140 | - "ability_base:want", | ||
| 141 | - "ability_runtime:ability_connect_callback_stub", | ||
| 142 | - "ability_runtime:ability_manager", | ||
| 143 | - "ability_runtime:app_manager", | ||
| 144 | - "access_token:libtokensetproc_shared", | ||
| 145 | - "bundle_framework:appexecfwk_base", | ||
| 146 | - "bundle_framework:appexecfwk_core", | ||
| 147 | - "cJSON:cjson", | ||
| 148 | - "c_utils:utils", | ||
| 149 | - "common_event_service:cesfwk_innerkits", | ||
| 150 | - "config_policy:configpolicy_util", | ||
| 151 | - "hilog:libhilog", | ||
| 152 | - "ipc:ipc_single", | ||
| 153 | - "kv_store:distributeddata_inner", | ||
| 154 | - "openssl:libcrypto_shared", | ||
| 155 | - "safwk:system_ability_fwk", | ||
| 156 | - "samgr:samgr_proxy", | ||
| 157 | - ] | ||
| 158 | - | ||
| 159 | - external_deps += [ | ||
| 160 | - "ability_runtime:wantagent_innerkits", | ||
| 161 | - "access_token:libaccesstoken_sdk", | ||
| 162 | - "access_token:libtokenid_sdk", | ||
| 163 | - "access_token:libtokensetproc_shared", | ||
| 164 | - "hicollie:libhicollie", | ||
| 165 | - "hisysevent:libhisysevent", | ||
| 166 | - "hitrace:hitrace_meter", | ||
| 167 | - "init:libbegetutil", | ||
| 168 | - "selinux_adapter:librestorecon", | ||
| 169 | - "storage_service:storage_manager_sa_proxy", | ||
| 170 | - "user_auth_framework:userauth_client", | ||
| 171 | - ] | ||
| 172 | - | ||
| 173 | - if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 174 | - cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 175 | - sources += | ||
| 176 | - [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] | ||
| 177 | - if (has_huks_part) { | ||
| 178 | - external_deps += [ "huks:libhukssdk" ] | ||
| 179 | - cflags_cc += [ "-DHAS_HUKS_PART" ] | ||
| 180 | - } | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - if (os_account_support_lock_os_account) { | ||
| 184 | - cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] | ||
| 185 | - } | ||
| 186 | - if (os_account_enable_multiple_os_account_sub_profiles) { | ||
| 187 | - cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNT_SUBSPACE" ] | ||
| 188 | - sources += [ | ||
| 189 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_data_deal.cpp", | ||
| 190 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_manager.cpp", | ||
| 191 | - ] | ||
| 192 | - } | ||
| 193 | - if (os_account_support_domain_accounts) { | ||
| 194 | - cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - if (security_guard_enabled) { | ||
| 198 | - external_deps += [ | ||
| 199 | - "security_guard:libsg_collect_sdk", | ||
| 200 | - "time_service:time_client", | ||
| 201 | - ] | ||
| 202 | - } | ||
| 203 | } | 32 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,194 +11,22 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | -import("../../../../services/accountmgr/os_account_service.gni") | ||
| 16 | - | ||
| 17 | -#####################hydra-fuzz################### | ||
| 18 | -import("//build/config/features.gni") | ||
| 19 | -import("//build/ohos.gni") | ||
| 20 | -import("//build/test.gni") | ||
| 21 | - | ||
| 22 | -##############################fuzztest########################################## | ||
| 23 | -config("os_account_manager_service_test_config") { | ||
| 24 | - include_dirs = [ | ||
| 25 | - "${services_path}/accountmgr/test/mock/common", | ||
| 26 | - "${services_path}/accountmgr/test/mock/os_account", | ||
| 27 | - "${services_path}/accountmgr/include", | ||
| 28 | - "${services_path}/accountmgr/include/osaccount", | ||
| 29 | - "${common_path}/log/include", | ||
| 30 | - "${common_path}/perf_stat/include", | ||
| 31 | - "${innerkits_common}/include", | ||
| 32 | - "${innerkits_path}/include", | ||
| 33 | - ] | ||
| 34 | -} | ||
| 35 | 15 | ||
| 36 | ohos_fuzztest("CreateOsAccountWithFullInfoInOsAccountInfoFuzzTest") { | 16 | ohos_fuzztest("CreateOsAccountWithFullInfoInOsAccountInfoFuzzTest") { |
| 37 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 38 | - | ||
| 39 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 40 | - | ||
| 41 | - defines = [ | ||
| 42 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 43 | - "LOG_DOMAIN = 0xD001B00", | ||
| 44 | - ] | ||
| 45 | - include_dirs = [ | ||
| 46 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 47 | - "${app_account_services_path}/test/mock/common", | ||
| 48 | - "${services_path}/accountmgr/include/domain_account", | ||
| 49 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 50 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 51 | - "${app_account_innerkits_native_path}/include", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/core/include", | ||
| 53 | - "${os_account_dfx_path}/data_dfx", | ||
| 54 | - "${services_path}/accountmgr/include/common/database/kvstore", | ||
| 55 | - "${services_path}/accountmgr/include/common/database", | ||
| 56 | - "${services_path}/accountmgr/test/mock/include/", | ||
| 57 | - ] | ||
| 58 | - cflags = [ | ||
| 59 | - "-g", | ||
| 60 | - "-O0", | ||
| 61 | - "-Wno-unused-variable", | ||
| 62 | - "-fno-omit-frame-pointer", | ||
| 63 | - ] | ||
| 64 | - cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 65 | - if (has_user_idm_part) { | ||
| 66 | - cflags_cc += [ "-DHAS_USER_IDM_PART" ] | ||
| 67 | - } | ||
| 68 | - if (target_cpu == "arm64") { | ||
| 69 | - defines += [ "_ARM64_" ] | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - if (use_libfuzzer) { | ||
| 73 | - cflags_cc += [ "-DFUZZ_TEST" ] | ||
| 74 | - } | ||
| 75 | - if (target_cpu == "arm") { | ||
| 76 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 77 | - } | ||
| 78 | - sources = [ "createosaccountwithfullinfoinosaccountinfo_fuzzer.cpp" ] | ||
| 79 | - sources += [ | ||
| 80 | - "${app_account_services_path}/src/ability_manager_adapter/ability_manager_adapter.cpp", | ||
| 81 | - "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp", | ||
| 82 | - "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp", | ||
| 83 | - "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp", | ||
| 84 | - "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp", | ||
| 85 | - "${services_path}/accountmgr/test/mock/os_account/os_account_interface.cpp", | ||
| 86 | - "${services_path}/accountmgr/test/mock/os_account/permission_kit.cpp", | ||
| 87 | - ] | ||
| 88 | - sources += [ | ||
| 89 | - "${common_path}/utils/src/account_permission_manager.cpp", | ||
| 90 | - "${domain_account_framework_path}/src/domain_account_callback_service.cpp", | ||
| 91 | - "${domain_account_framework_path}/src/domain_account_common.cpp", | ||
| 92 | - "${domain_account_framework_path}/src/domain_account_parcel.cpp", | ||
| 93 | - "${os_account_dfx_path}/data_dfx/data_size_report_adapter.cpp", | ||
| 94 | - "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", | ||
| 95 | - "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", | ||
| 96 | - "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", | ||
| 97 | - "${services_path}/accountmgr/src/appaccount/os_account_state_subscriber.cpp", | ||
| 98 | - "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", | ||
| 99 | - ] | ||
| 100 | - sources += account_service_sources_mock | ||
| 101 | - sources += account_data_storage_source | ||
| 102 | - sources += account_iam_source | ||
| 103 | - sources += app_account_sources_mock | ||
| 104 | - | ||
| 105 | configs = [ | 19 | configs = [ |
| 106 | - ":os_account_manager_service_test_config", | ||
| 107 | "${app_account_services_path}/test/mock:mock_accountmgr_config", | 20 | "${app_account_services_path}/test/mock:mock_accountmgr_config", |
| 108 | "${app_account_services_path}/test/mock:accountmgr_config", | 21 | "${app_account_services_path}/test/mock:accountmgr_config", |
| 22 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config", | ||
| 23 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_create_update_config", | ||
| 109 | ] | 24 | ] |
| 110 | - | 25 | + sources = [ "createosaccountwithfullinfoinosaccountinfo_fuzzer.cpp" ] |
| 26 | + sources += osaccount_stub_create_update_sources | ||
| 111 | version_script = "${services_path}/accountmgr/libaccountmgr.map" | 27 | version_script = "${services_path}/accountmgr/libaccountmgr.map" |
| 112 | - | 28 | + deps = osaccount_stub_deps |
| 113 | - deps = [ | 29 | + deps += osaccount_stub_create_update_deps |
| 114 | - "${account_iam_framework_path}:account_iam_innerkits", | 30 | + external_deps = osaccount_stub_ext_deps |
| 115 | - "${account_iam_framework_path}:account_iam_stub", | 31 | + external_deps += osaccount_stub_create_update_ext_deps |
| 116 | - "${account_iam_framework_path}/test/unittest:account_iam_client_test", | ||
| 117 | - "${account_test_common}:account_test_common_source_set", | ||
| 118 | - "${common_path}:libaccount_common", | ||
| 119 | - "${innerkits_native_path}:account_stub", | ||
| 120 | - "${innerkits_native_path}:libaccountkits", | ||
| 121 | - "${os_account_innerkits_native_path}:os_account_event_proxy", | ||
| 122 | - "${os_account_innerkits_native_path}:os_account_event_stub", | ||
| 123 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 124 | - "${os_account_innerkits_native_path}:os_account_state_reply_callback_stub", | ||
| 125 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 126 | - ] | ||
| 127 | - deps += [ | ||
| 128 | - "${app_account_innerkits_native_path}:app_account_authenticator_callback_stub", | ||
| 129 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_proxy", | ||
| 130 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_stub", | ||
| 131 | - "${os_account_subspace_framework_path}:os_account_subspace_stub", | ||
| 132 | - "${app_account_innerkits_native_path}:app_account_authenticator_proxy", | ||
| 133 | - "${app_account_innerkits_native_path}:app_account_stub", | ||
| 134 | - "${domain_account_framework_path}:domain_account_callback_proxy", | ||
| 135 | - "${domain_account_framework_path}:domain_account_callback_stub", | ||
| 136 | - "${domain_account_framework_path}:domain_account_stub", | ||
| 137 | - ] | ||
| 138 | - | ||
| 139 | - external_deps = [ | ||
| 140 | - "ability_base:base", | ||
| 141 | - "ability_base:want", | ||
| 142 | - "ability_runtime:ability_connect_callback_stub", | ||
| 143 | - "ability_runtime:ability_manager", | ||
| 144 | - "ability_runtime:app_manager", | ||
| 145 | - "access_token:libtokensetproc_shared", | ||
| 146 | - "bundle_framework:appexecfwk_base", | ||
| 147 | - "bundle_framework:appexecfwk_core", | ||
| 148 | - "cJSON:cjson", | ||
| 149 | - "c_utils:utils", | ||
| 150 | - "common_event_service:cesfwk_innerkits", | ||
| 151 | - "config_policy:configpolicy_util", | ||
| 152 | - "hilog:libhilog", | ||
| 153 | - "ipc:ipc_single", | ||
| 154 | - "kv_store:distributeddata_inner", | ||
| 155 | - "openssl:libcrypto_shared", | ||
| 156 | - "safwk:system_ability_fwk", | ||
| 157 | - "samgr:samgr_proxy", | ||
| 158 | - ] | ||
| 159 | - | ||
| 160 | - external_deps += [ | ||
| 161 | - "ability_runtime:wantagent_innerkits", | ||
| 162 | - "access_token:libaccesstoken_sdk", | ||
| 163 | - "access_token:libtokenid_sdk", | ||
| 164 | - "access_token:libtokensetproc_shared", | ||
| 165 | - "hicollie:libhicollie", | ||
| 166 | - "hisysevent:libhisysevent", | ||
| 167 | - "hitrace:hitrace_meter", | ||
| 168 | - "init:libbegetutil", | ||
| 169 | - "selinux_adapter:librestorecon", | ||
| 170 | - "storage_service:storage_manager_sa_proxy", | ||
| 171 | - "user_auth_framework:userauth_client", | ||
| 172 | - ] | ||
| 173 | - | ||
| 174 | - if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 175 | - cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 176 | - sources += | ||
| 177 | - [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] | ||
| 178 | - if (has_huks_part) { | ||
| 179 | - external_deps += [ "huks:libhukssdk" ] | ||
| 180 | - cflags_cc += [ "-DHAS_HUKS_PART" ] | ||
| 181 | - } | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - if (os_account_support_lock_os_account) { | ||
| 185 | - cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - if (os_account_support_domain_accounts) { | ||
| 189 | - cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 190 | - } | ||
| 191 | - if (os_account_enable_multiple_os_account_sub_profiles) { | ||
| 192 | - cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNT_SUBSPACE" ] | ||
| 193 | - sources += [ | ||
| 194 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_data_deal.cpp", | ||
| 195 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_manager.cpp", | ||
| 196 | - ] | ||
| 197 | - } | ||
| 198 | - if (security_guard_enabled) { | ||
| 199 | - external_deps += [ | ||
| 200 | - "security_guard:libsg_collect_sdk", | ||
| 201 | - "time_service:time_client", | ||
| 202 | - ] | ||
| 203 | - } | ||
| 204 | } | 32 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright (c) 2025 Huawei Device Co., Ltd. | 1 | +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. |
| 2 | # Licensed under the Apache License, Version 2.0 (the "License"); | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | # you may not use this file except in compliance with the License. | 3 | # you may not use this file except in compliance with the License. |
| 4 | # You may obtain a copy of the License at | 4 | # You may obtain a copy of the License at |
| @@ -11,194 +11,22 @@ | |||
| 11 | # See the License for the specific language governing permissions and | 11 | # See the License for the specific language governing permissions and |
| 12 | # limitations under the License. | 12 | # limitations under the License. |
| 13 | 13 | ||
| 14 | -import("../../../../os_account.gni") | 14 | +import("../osaccount_stub_shared.gni") |
| 15 | -import("../../../../services/accountmgr/os_account_service.gni") | ||
| 16 | - | ||
| 17 | -#####################hydra-fuzz################### | ||
| 18 | -import("//build/config/features.gni") | ||
| 19 | -import("//build/ohos.gni") | ||
| 20 | -import("//build/test.gni") | ||
| 21 | - | ||
| 22 | -##############################fuzztest########################################## | ||
| 23 | -config("os_account_manager_service_test_config") { | ||
| 24 | - include_dirs = [ | ||
| 25 | - "${services_path}/accountmgr/test/mock/common", | ||
| 26 | - "${services_path}/accountmgr/test/mock/os_account", | ||
| 27 | - "${services_path}/accountmgr/include", | ||
| 28 | - "${services_path}/accountmgr/include/osaccount", | ||
| 29 | - "${common_path}/log/include", | ||
| 30 | - "${common_path}/perf_stat/include", | ||
| 31 | - "${innerkits_common}/include", | ||
| 32 | - "${innerkits_path}/include", | ||
| 33 | - ] | ||
| 34 | -} | ||
| 35 | 15 | ||
| 36 | ohos_fuzztest("CreateOsAccountWithFullInfoStubFuzzTest") { | 16 | ohos_fuzztest("CreateOsAccountWithFullInfoStubFuzzTest") { |
| 37 | module_out_path = fuzz_output_path | 17 | module_out_path = fuzz_output_path |
| 38 | - | ||
| 39 | fuzz_config_file = "." | 18 | fuzz_config_file = "." |
| 40 | - | ||
| 41 | - defines = [ | ||
| 42 | - "ACCOUNT_LOG_TAG = \"OsAccountFuzzTest\"", | ||
| 43 | - "LOG_DOMAIN = 0xD001B00", | ||
| 44 | - ] | ||
| 45 | - include_dirs = [ | ||
| 46 | - "${os_account_path}/test/fuzztest/osaccount_stub/common", | ||
| 47 | - "${app_account_services_path}/test/mock/common", | ||
| 48 | - "${services_path}/accountmgr/include/domain_account", | ||
| 49 | - "${services_path}/accountmgr/include/distributed_account", | ||
| 50 | - "${services_path}/accountmgr/include/os_account_subprofile", | ||
| 51 | - "${app_account_innerkits_native_path}/include", | ||
| 52 | - "${os_account_path}/frameworks/osaccount/core/include", | ||
| 53 | - "${os_account_dfx_path}/data_dfx", | ||
| 54 | - "${services_path}/accountmgr/include/common/database/kvstore", | ||
| 55 | - "${services_path}/accountmgr/include/common/database", | ||
| 56 | - "${services_path}/accountmgr/test/mock/include", | ||
| 57 | - ] | ||
| 58 | - cflags = [ | ||
| 59 | - "-g", | ||
| 60 | - "-O0", | ||
| 61 | - "-Wno-unused-variable", | ||
| 62 | - "-fno-omit-frame-pointer", | ||
| 63 | - ] | ||
| 64 | - cflags_cc = [ "-DACCOUNT_TEST" ] | ||
| 65 | - if (has_user_idm_part) { | ||
| 66 | - cflags_cc += [ "-DHAS_USER_IDM_PART" ] | ||
| 67 | - } | ||
| 68 | - if (target_cpu == "arm64") { | ||
| 69 | - defines += [ "_ARM64_" ] | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - if (use_libfuzzer) { | ||
| 73 | - cflags_cc += [ "-DFUZZ_TEST" ] | ||
| 74 | - } | ||
| 75 | - if (target_cpu == "arm") { | ||
| 76 | - cflags += [ "-DBINDER_IPC_32BIT" ] | ||
| 77 | - } | ||
| 78 | - sources = [ "createosaccountwithfullinfostub_fuzzer.cpp" ] | ||
| 79 | - sources += [ | ||
| 80 | - "${app_account_services_path}/src/ability_manager_adapter/ability_manager_adapter.cpp", | ||
| 81 | - "${app_account_services_path}/src/appaccount/app_account_control_manager.cpp", | ||
| 82 | - "${app_account_services_path}/src/appaccount/app_account_manager_service.cpp", | ||
| 83 | - "${app_account_services_path}/src/appaccount/inner_app_account_manager.cpp", | ||
| 84 | - "${services_path}/accountmgr/test/mock/common/bundle_manager_adapter.cpp", | ||
| 85 | - "${services_path}/accountmgr/test/mock/os_account/os_account_interface.cpp", | ||
| 86 | - "${services_path}/accountmgr/test/mock/os_account/permission_kit.cpp", | ||
| 87 | - ] | ||
| 88 | - sources += [ | ||
| 89 | - "${common_path}/utils/src/account_permission_manager.cpp", | ||
| 90 | - "${domain_account_framework_path}/src/domain_account_callback_service.cpp", | ||
| 91 | - "${domain_account_framework_path}/src/domain_account_common.cpp", | ||
| 92 | - "${domain_account_framework_path}/src/domain_account_parcel.cpp", | ||
| 93 | - "${os_account_dfx_path}/data_dfx/data_size_report_adapter.cpp", | ||
| 94 | - "${os_account_dfx_path}/hidumper_adapter/account_dump_helper.cpp", | ||
| 95 | - "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp", | ||
| 96 | - "${os_account_dfx_path}/hitrace_adapter/hitrace_adapter.cpp", | ||
| 97 | - "${services_path}/accountmgr/src/appaccount/os_account_state_subscriber.cpp", | ||
| 98 | - "${services_path}/accountmgr/src/common/database/kvstore/kvstore_adapter_impl.cpp", | ||
| 99 | - ] | ||
| 100 | - sources += account_service_sources_mock | ||
| 101 | - sources += account_data_storage_source | ||
| 102 | - sources += account_iam_source | ||
| 103 | - sources += app_account_sources_mock | ||
| 104 | - | ||
| 105 | configs = [ | 19 | configs = [ |
| 106 | - ":os_account_manager_service_test_config", | ||
| 107 | "${app_account_services_path}/test/mock:mock_accountmgr_config", | 20 | "${app_account_services_path}/test/mock:mock_accountmgr_config", |
| 108 | "${app_account_services_path}/test/mock:accountmgr_config", | 21 | "${app_account_services_path}/test/mock:accountmgr_config", |
| 22 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_common_config", | ||
| 23 | + "${os_account_path}/test/fuzztest/osaccount_stub:osaccount_stub_create_update_config", | ||
| 109 | ] | 24 | ] |
| 110 | - | 25 | + sources = [ "createosaccountwithfullinfostub_fuzzer.cpp" ] |
| 26 | + sources += osaccount_stub_create_update_sources | ||
| 111 | version_script = "${services_path}/accountmgr/libaccountmgr.map" | 27 | version_script = "${services_path}/accountmgr/libaccountmgr.map" |
| 112 | - | 28 | + deps = osaccount_stub_deps |
| 113 | - deps = [ | 29 | + deps += osaccount_stub_create_update_deps |
| 114 | - "${account_iam_framework_path}:account_iam_innerkits", | 30 | + external_deps = osaccount_stub_ext_deps |
| 115 | - "${account_iam_framework_path}:account_iam_stub", | 31 | + external_deps += osaccount_stub_create_update_ext_deps |
| 116 | - "${account_iam_framework_path}/test/unittest:account_iam_client_test", | ||
| 117 | - "${account_test_common}:account_test_common_source_set", | ||
| 118 | - "${common_path}:libaccount_common", | ||
| 119 | - "${innerkits_native_path}:account_stub", | ||
| 120 | - "${innerkits_native_path}:libaccountkits", | ||
| 121 | - "${os_account_innerkits_native_path}:os_account_event_proxy", | ||
| 122 | - "${os_account_innerkits_native_path}:os_account_event_stub", | ||
| 123 | - "${os_account_innerkits_native_path}:os_account_innerkits", | ||
| 124 | - "${os_account_innerkits_native_path}:os_account_state_reply_callback_stub", | ||
| 125 | - "${os_account_innerkits_native_path}:os_account_stub", | ||
| 126 | - ] | ||
| 127 | - deps += [ | ||
| 128 | - "${app_account_innerkits_native_path}:app_account_authenticator_callback_stub", | ||
| 129 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_proxy", | ||
| 130 | - "${os_account_subspace_framework_path}:os_account_sub_profile_event_stub", | ||
| 131 | - "${os_account_subspace_framework_path}:os_account_subspace_stub", | ||
| 132 | - "${app_account_innerkits_native_path}:app_account_authenticator_proxy", | ||
| 133 | - "${app_account_innerkits_native_path}:app_account_stub", | ||
| 134 | - "${domain_account_framework_path}:domain_account_callback_proxy", | ||
| 135 | - "${domain_account_framework_path}:domain_account_callback_stub", | ||
| 136 | - "${domain_account_framework_path}:domain_account_stub", | ||
| 137 | - ] | ||
| 138 | - | ||
| 139 | - external_deps = [ | ||
| 140 | - "ability_base:base", | ||
| 141 | - "ability_base:want", | ||
| 142 | - "ability_runtime:ability_connect_callback_stub", | ||
| 143 | - "ability_runtime:ability_manager", | ||
| 144 | - "ability_runtime:app_manager", | ||
| 145 | - "access_token:libtokensetproc_shared", | ||
| 146 | - "bundle_framework:appexecfwk_base", | ||
| 147 | - "bundle_framework:appexecfwk_core", | ||
| 148 | - "cJSON:cjson", | ||
| 149 | - "c_utils:utils", | ||
| 150 | - "common_event_service:cesfwk_innerkits", | ||
| 151 | - "config_policy:configpolicy_util", | ||
| 152 | - "hilog:libhilog", | ||
| 153 | - "ipc:ipc_single", | ||
| 154 | - "kv_store:distributeddata_inner", | ||
| 155 | - "openssl:libcrypto_shared", | ||
| 156 | - "safwk:system_ability_fwk", | ||
| 157 | - "samgr:samgr_proxy", | ||
| 158 | - ] | ||
| 159 | - | ||
| 160 | - external_deps += [ | ||
| 161 | - "ability_runtime:wantagent_innerkits", | ||
| 162 | - "access_token:libaccesstoken_sdk", | ||
| 163 | - "access_token:libtokenid_sdk", | ||
| 164 | - "access_token:libtokensetproc_shared", | ||
| 165 | - "hicollie:libhicollie", | ||
| 166 | - "hisysevent:libhisysevent", | ||
| 167 | - "hitrace:hitrace_meter", | ||
| 168 | - "init:libbegetutil", | ||
| 169 | - "selinux_adapter:librestorecon", | ||
| 170 | - "storage_service:storage_manager_sa_proxy", | ||
| 171 | - "user_auth_framework:userauth_client", | ||
| 172 | - ] | ||
| 173 | - | ||
| 174 | - if (os_account_distributed_feature && !use_libfuzzer) { | ||
| 175 | - cflags_cc += [ "-DENABLE_FILE_WATCHER" ] | ||
| 176 | - sources += | ||
| 177 | - [ "${services_path}/accountmgr/src/account_file_watcher_manager.cpp" ] | ||
| 178 | - if (has_huks_part) { | ||
| 179 | - external_deps += [ "huks:libhukssdk" ] | ||
| 180 | - cflags_cc += [ "-DHAS_HUKS_PART" ] | ||
| 181 | - } | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - if (os_account_support_lock_os_account) { | ||
| 185 | - cflags_cc += [ "-DSUPPORT_LOCK_OS_ACCOUNT" ] | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - if (os_account_support_domain_accounts) { | ||
| 189 | - cflags_cc += [ "-DSUPPORT_DOMAIN_ACCOUNTS" ] | ||
| 190 | - } | ||
| 191 | - if (os_account_enable_multiple_os_account_sub_profiles) { | ||
| 192 | - cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNT_SUBSPACE" ] | ||
| 193 | - sources += [ | ||
| 194 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_data_deal.cpp", | ||
| 195 | - "${services_path}/accountmgr/src/distributed_account/os_account_subspace_manager.cpp", | ||
| 196 | - ] | ||
| 197 | - } | ||
| 198 | - if (security_guard_enabled) { | ||
| 199 | - external_deps += [ | ||
| 200 | - "security_guard:libsg_collect_sdk", | ||
| 201 | - "time_service:time_client", | ||
| 202 | - ] | ||
| 203 | - } | ||
| 204 | } | 32 | } |