适配存储错误码

Signed-off-by: cc_ggboy <chenweimin8@huawei.com>
This commit is contained in:
cc_ggboy 2025-02-10 12:03:12 +08:00
parent e8dca7d0ca
commit 44b27c108c
9 changed files with 40 additions and 5 deletions

View File

@ -179,6 +179,10 @@ ohos_moduletest("domain_account_frameworks_module_mock_test") {
}
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
external_deps += [ "user_auth_framework:userauth_client" ]
@ -278,6 +282,10 @@ ohos_moduletest("domain_account_client_mock_plugin_so_module_test") {
}
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
external_deps += [ "user_auth_framework:userauth_client" ]

View File

@ -166,6 +166,9 @@ ohos_moduletest("AccountInnerSdkModuleMockTest") {
cflags_cc += [ "-DHAS_HUKS_PART" ]
}
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
external_deps += [ "user_auth_framework:userauth_client" ]

View File

@ -181,6 +181,9 @@ ohos_moduletest("os_account_frameworks_module_mock_test") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
cflags_cc = []
if (os_account_multiple_active_accounts) {
cflags_cc += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ]
@ -296,6 +299,9 @@ ohos_moduletest("os_account_manager_no_bms_mock_test") {
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]

View File

@ -91,7 +91,6 @@ const uint64_t REENROLL_WAIT_TIME = 3;
// an error code of ipc which means peer end is dead
const int32_t E_IPC_ERROR = 29189;
const int32_t E_IPC_SA_DIED = 32;
const int32_t ERROR_STORAGE_KEY_NOT_EXIST = -2;
// max size of subscribed states
constexpr uint8_t MAX_SUBSCRIBED_STATES_SIZE = 32;

View File

@ -31,6 +31,7 @@
#endif // SUPPORT_DOMAIN_ACCOUNTS
#include "ipc_skeleton.h"
#include "os_account_delete_user_idm_callback.h"
#include "storage_service_errno.h"
#include "token_setproc.h"
#include "user_auth_client.h"
#include "user_idm_client.h"
@ -186,7 +187,7 @@ ErrCode AuthCallback::UnlockAccount(int32_t accountId, const std::vector<uint8_t
if (needActivateKey) {
// el2 file decryption
ret = InnerAccountIAMManager::GetInstance().ActivateUserKey(accountId, token, secret);
if (ret != 0 && ret != Constants::ERROR_STORAGE_KEY_NOT_EXIST) {
if (ret != 0 && ret != ErrNo::E_PARAMS_NULLPTR_ERR) {
ACCOUNT_LOGE("Failed to activate user key");
ReportOsAccountOperationFail(accountId, "auth", ret, "Failed to activate user key");
return ret;

View File

@ -25,6 +25,9 @@
#include "inner_domain_account_manager.h"
#endif // SUPPORT_DOMAIN_ACCOUNTS
#include "iservice_registry.h"
#ifdef HAS_STORAGE_PART
#include "storage_service_errno.h"
#endif
#include "system_ability_definition.h"
#include "user_access_ctrl_client.h"
#include "user_auth_client.h"
@ -564,7 +567,7 @@ ErrCode InnerAccountIAMManager::InnerUpdateStorageUserAuth(int32_t userId, uint6
}
ErrCode code = storageMgrProxy->UpdateUserAuth(userId, secureUid, token, oldSecret, newSecret);
if ((code != ERR_OK) && (code != Constants::ERROR_STORAGE_KEY_NOT_EXIST)) {
if ((code != ERR_OK) && (code != ErrNo::E_PARAMS_NULLPTR_ERR)) {
ACCOUNT_LOGE("Fail to update user auth, userId=%{public}d, code=%{public}d", userId, code);
return code;
}

View File

@ -39,6 +39,7 @@
#include "os_account_subscribe_manager.h"
#ifdef HAS_STORAGE_PART
#include "storage_manager_proxy.h"
#include "storage_service_errno.h"
#endif
#include "iinner_os_account_manager.h"
#include "system_ability_definition.h"
@ -58,7 +59,6 @@ const char OPERATION_START[] = "start";
#ifdef HAS_STORAGE_PART
constexpr uint32_t CRYPTO_FLAG_EL1 = 1;
constexpr uint32_t CRYPTO_FLAG_EL2 = 2;
constexpr int32_t E_ACTIVE_EL2 = 30;
#endif
constexpr int32_t DELAY_FOR_EXCEPTION = 100;
@ -490,7 +490,7 @@ int32_t OsAccountInterface::UnlockUser(const int localId)
std::vector<uint8_t> emptyData;
errCode = proxy->ActiveUserKey(localId, emptyData, emptyData);
ACCOUNT_LOGI("ActiveUserKey end, ret %{public}d.", errCode);
if (errCode != E_ACTIVE_EL2) {
if (errCode != ErrNo::E_ACTIVE_EL2_FAILED) {
errCode = proxy->PrepareStartUser(localId);
ACCOUNT_LOGI("PrepareStartUser end, errCode %{public}d.", errCode);
if (errCode != 0) {

View File

@ -472,6 +472,9 @@ ohos_unittest("OsAccountInnerAccmgrBundleAdapterMockTest") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
cflags_cc = []
if (os_account_distributed_feature) {
cflags_cc += [ "-DENABLE_FILE_WATCHER" ]
@ -596,6 +599,9 @@ ohos_unittest("OsAccountInnerAccmgrPluginMockTest") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
cflags_cc = []
if (os_account_distributed_feature) {
cflags_cc += [ "-DENABLE_FILE_WATCHER" ]
@ -710,6 +716,9 @@ ohos_unittest("OsAccountEventManagerMultipleThreadTest") {
"samgr:samgr_proxy",
]
cflags_cc = []
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
if (os_account_distributed_feature) {
cflags_cc += [ "-DENABLE_FILE_WATCHER" ]
sources +=

View File

@ -145,6 +145,9 @@ ohos_moduletest("account_command_create_module_mock_test") {
"samgr:samgr_proxy",
]
cflags_cc = []
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
if (os_account_distributed_feature) {
cflags_cc += [ "-DENABLE_FILE_WATCHER" ]
sources +=
@ -255,6 +258,9 @@ ohos_moduletest("account_command_delete_module_mock_test") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
}
cflags_cc = []
if (os_account_distributed_feature) {
cflags_cc += [ "-DENABLE_FILE_WATCHER" ]