diff --git a/services/base/BUILD.gn b/services/base/BUILD.gn index c71140c50d1025e4ee23bf3b53740889a198aed0..c8bb87834e937a368be8a8cfc86fef56e655832c 100644 --- a/services/base/BUILD.gn +++ b/services/base/BUILD.gn @@ -47,6 +47,7 @@ ohos_source_set("userauth_service_base") { "access_token:libaccesstoken_sdk", "c_utils:utils", "drivers_interface_user_auth:libuser_auth_proxy_3.0", + "hdf_core:libhdf_utils", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", diff --git a/services/context/BUILD.gn b/services/context/BUILD.gn index 7e1676d3ff761048ebcd799f02125abb9e628426..45953159b3e0a0b626c7fb34d8fb7e2e292ff0c9 100644 --- a/services/context/BUILD.gn +++ b/services/context/BUILD.gn @@ -81,6 +81,7 @@ ohos_source_set("userauth_service_context") { "access_token:libaccesstoken_sdk", "c_utils:utils", "drivers_interface_user_auth:libuser_auth_proxy_3.0", + "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:hitrace_meter", "init:libbegetutil", diff --git a/services/context/src/simple_auth_context.cpp b/services/context/src/simple_auth_context.cpp index a2a9a1b657a9e229b78b0b3e69ad4cc0f82d5362..a5919d8d5d17bac92bf2933aa11b99535aae0810 100644 --- a/services/context/src/simple_auth_context.cpp +++ b/services/context/src/simple_auth_context.cpp @@ -31,6 +31,7 @@ namespace OHOS { namespace UserIam { namespace UserAuth { + constexpr int32_t RESULT_NOT_FOUND = VENDOR_ERROR_CODE_BEGIN + 0x6; std::optional> SimpleAuthContext::GetPropertyTemplateIds( Authentication::AuthResultInfo &resultInfo) { @@ -214,7 +215,11 @@ bool SimpleAuthContext::OnStop() bool cancelRet = auth_->Cancel(); if (!cancelRet) { IAM_LOGE("%{public}s auth stop fail", GetDescription()); - SetLatestError(auth_->GetLatestError()); + int32_t resultCode = auth_->GetLatestError(); + if (resultCode == RESULT_NOT_FOUND) { + resultCode = INVALID_CONTEXT_ID; + } + SetLatestError(resultCode); return cancelRet; } return true; diff --git a/services/core/BUILD.gn b/services/core/BUILD.gn index 628409b60101d1458524d2fc564ef8bca7eab585..185cb305c3370bc76669d60f838fce1f8c8fd951 100644 --- a/services/core/BUILD.gn +++ b/services/core/BUILD.gn @@ -96,6 +96,7 @@ ohos_source_set("userauth_service_core") { "c_utils:utils", "device_manager:devicemanagersdk", "drivers_interface_user_auth:libuser_auth_proxy_3.0", + "hdf_core:libhdf_utils", "hdf_core:libhdi", "hilog:libhilog", "hitrace:hitrace_meter", diff --git a/services/ipc/BUILD.gn b/services/ipc/BUILD.gn index e8b8affc7396cc73b4d69e23d28cacc85b458b45..848207599fddc29e40d24cff32c7c62a90eb2e0c 100644 --- a/services/ipc/BUILD.gn +++ b/services/ipc/BUILD.gn @@ -65,6 +65,7 @@ ohos_source_set("userauth_services_ipc") { "device_manager:devicemanagersdk", "drivers_interface_user_auth:libuser_auth_proxy_3.0", "dsoftbus:softbus_client", + "hdf_core:libhdf_utils", "hdf_core:libhdi", "hilog:libhilog", "hitrace:hitrace_meter",