From d86ca432c4a29a7356fcf0922c62aa1c56f0bd53 Mon Sep 17 00:00:00 2001 From: heguokai Date: Wed, 2 Jul 2025 14:38:39 +0800 Subject: [PATCH] fixed for notificationRequestEnable return err code with 1600013 Signed-off-by: heguokai --- frameworks/ets/ani/include/sts_throw_erro.h | 2 +- frameworks/ets/ani/src/manager/ani_ans_dialog_callback.cpp | 3 +++ frameworks/ets/ani/src/manager/ani_request_enable.cpp | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frameworks/ets/ani/include/sts_throw_erro.h b/frameworks/ets/ani/include/sts_throw_erro.h index b24125a28..e6d1ad593 100644 --- a/frameworks/ets/ani/include/sts_throw_erro.h +++ b/frameworks/ets/ani/include/sts_throw_erro.h @@ -100,7 +100,7 @@ static const std::vector> ERRORS_CONVERT = { inline int32_t GetExternalCode(uint32_t errCode) { - int32_t ExternalCode = ERROR_INTERNAL_ERROR; + int32_t ExternalCode = ERR_OK; for (const auto &errorConvert : ERRORS_CONVERT) { if (errCode == errorConvert.first) { ExternalCode = errorConvert.second; diff --git a/frameworks/ets/ani/src/manager/ani_ans_dialog_callback.cpp b/frameworks/ets/ani/src/manager/ani_ans_dialog_callback.cpp index 88ce9d3bd..8d01d9702 100755 --- a/frameworks/ets/ani/src/manager/ani_ans_dialog_callback.cpp +++ b/frameworks/ets/ani/src/manager/ani_ans_dialog_callback.cpp @@ -56,6 +56,7 @@ void StsAnsDialogCallback::ProcessDialogStatusChanged(const DialogStatusData &da aniResult = vm_->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &env); if (aniResult != ANI_OK) { ANS_LOGD("AttachCurrentThread error. result: %{public}d.", aniResult); + AnsDialogHostClient::Destroy(); return; } if (complete_) { @@ -64,8 +65,10 @@ void StsAnsDialogCallback::ProcessDialogStatusChanged(const DialogStatusData &da aniResult = vm_->DetachCurrentThread(); if (aniResult != ANI_OK) { ANS_LOGD("DetachCurrentThread error. result: %{public}d.", aniResult); + AnsDialogHostClient::Destroy(); return; } + AnsDialogHostClient::Destroy(); } int32_t StsAnsDialogCallback::GetErrCodeFromStatus(EnabledDialogStatus status) diff --git a/frameworks/ets/ani/src/manager/ani_request_enable.cpp b/frameworks/ets/ani/src/manager/ani_request_enable.cpp index 2dab90030..824b14baf 100755 --- a/frameworks/ets/ani/src/manager/ani_request_enable.cpp +++ b/frameworks/ets/ani/src/manager/ani_request_enable.cpp @@ -72,6 +72,7 @@ void RequestEnableExecute(std::shared_ptr &info) errCode, canPop); if (canPop == false) { info->errorCode = errCode; + AnsDialogHostClient::Destroy(); return; } info->bundleName = bundleName; @@ -169,11 +170,13 @@ void RequestEnableComplete(ani_env *env, std::shared_ptr info->errorCode = ERR_ANS_DIALOG_POP_SUCCEEDED; } else { info->errorCode = ERROR_INTERNAL_ERROR; + AnsDialogHostClient::Destroy(); NotificationHelper::RemoveEnableNotificationDialog(); } } if (info->errorCode != ERR_ANS_DIALOG_POP_SUCCEEDED) { ANS_LOGE("error, code is %{public}d.", info->errorCode); + AnsDialogHostClient::Destroy(); StsAsyncCompleteCallbackRequestEnableNotification(env, info); return; } @@ -183,6 +186,7 @@ void RequestEnableComplete(ani_env *env, std::shared_ptr !AnsDialogHostClient::SetDialogCallbackInterface(std::move(StsCallback)) ) { ANS_LOGE("error"); + AnsDialogHostClient::Destroy(); info->errorCode = ERROR_INTERNAL_ERROR; StsAsyncCompleteCallbackRequestEnableNotification(env, info); return; -- Gitee