diff --git a/frameworks/ets/ani/include/sts_throw_erro.h b/frameworks/ets/ani/include/sts_throw_erro.h index b24125a28294e00883fd0fb6db8f0c2be5acb82b..e6d1ad5930ae523b6e036057cd791a568cf0235f 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 88ce9d3bd290d46421190db29cb8acd9b7748efe..8d01d9702e62031abcbfb4a854c44fe2b7b28e20 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 2dab900305bb64cf7cab4fbde891d4fdb060c36f..824b14baf9b93c7f48fc855c784b3ea8255b7165 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;