diff --git a/frameworks/ets/ani/include/sts_subscribe.h b/frameworks/ets/ani/include/sts_subscribe.h index be90cc4717418bcc4215cf021bacff5b0679e800..8be5ddd3df7c13172b7948e1f4a42faf3af79358 100644 --- a/frameworks/ets/ani/include/sts_subscribe.h +++ b/frameworks/ets/ani/include/sts_subscribe.h @@ -46,8 +46,8 @@ private: class StsSubscriberInstance : public OHOS::Notification::NotificationSubscriber { public: - StsSubscriberInstance(); - virtual ~StsSubscriberInstance(); + StsSubscriberInstance(){}; + virtual ~StsSubscriberInstance(){}; virtual void OnCanceled(const std::shared_ptr &request, const std::shared_ptr &sortingMap, int32_t deleteReason) override; diff --git a/frameworks/ets/ani/src/sts_subscribe.cpp b/frameworks/ets/ani/src/sts_subscribe.cpp index 524ed688f2a8c0699994b989d557ea3c367b86ea..e746269986c19afe5dea5f4979bc4dd3c27ed687 100644 --- a/frameworks/ets/ani/src/sts_subscribe.cpp +++ b/frameworks/ets/ani/src/sts_subscribe.cpp @@ -89,23 +89,19 @@ void StsDistributedOperationCallback::SetVm(ani_vm *vm) etsVm_ = vm; } -StsSubscriberInstance::StsSubscriberInstance() -{} -StsSubscriberInstance::~StsSubscriberInstance() -{} void StsSubscriberInstance::OnCanceled( const std::shared_ptr &request, const std::shared_ptr &sortingMap, int32_t deleteReason) { - ANS_LOGD("enter"); + ANS_LOGD("OnCanceled enter"); std::lock_guard l(lock_); ani_env* etsEnv; ani_status aniResult = ANI_ERROR; ani_options aniArgs { 0, nullptr }; aniResult = vm_->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &etsEnv); if (aniResult != ANI_OK) { - ANS_LOGD("AttachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("AttachCurrentThread error. result: %{public}d.", aniResult); return; } std::vector vec; @@ -114,27 +110,27 @@ void StsSubscriberInstance::OnCanceled( vec.push_back(obj); CallFunction(etsEnv, "onCancel", vec); } else { - ANS_LOGD("WarpSubscribeCallbackData faild"); + ANS_LOGE("WarpSubscribeCallbackData faild"); } aniResult = vm_->DetachCurrentThread(); if (aniResult != ANI_OK) { - ANS_LOGD("DetachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("DetachCurrentThread error. result: %{public}d.", aniResult); return; } - ANS_LOGD("done"); + ANS_LOGD("OnCanceled done"); } void StsSubscriberInstance::OnConsumed( const std::shared_ptr &request, const std::shared_ptr &sortingMap) { - ANS_LOGD("enter"); + ANS_LOGD("OnConsumed enter"); std::lock_guard l(lock_); ani_env* etsEnv; ani_status aniResult = ANI_ERROR; ani_options aniArgs { 0, nullptr }; aniResult = vm_->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &etsEnv); if (aniResult != ANI_OK) { - ANS_LOGD("AttachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("AttachCurrentThread error. result: %{public}d.", aniResult); return; } std::vector vec; @@ -143,25 +139,25 @@ void StsSubscriberInstance::OnConsumed( vec.push_back(obj); CallFunction(etsEnv, "onConsume", vec); } else { - ANS_LOGD("WarpSubscribeCallbackData faild"); + ANS_LOGE("WarpSubscribeCallbackData faild"); } aniResult = vm_->DetachCurrentThread(); if (aniResult != ANI_OK) { - ANS_LOGD("DetachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("DetachCurrentThread error. result: %{public}d.", aniResult); return; } - ANS_LOGD("done"); + ANS_LOGD("OnConsumed done"); } void StsSubscriberInstance::OnUpdate(const std::shared_ptr &sortingMap) { - ANS_LOGD("enter"); + ANS_LOGD("OnUpdate enter"); std::lock_guard l(lock_); ani_env* etsEnv; ani_status aniResult = ANI_ERROR; ani_options aniArgs { 0, nullptr }; aniResult = vm_->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &etsEnv); if (aniResult != ANI_OK) { - ANS_LOGD("AttachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("AttachCurrentThread error. result: %{public}d.", aniResult); return; } std::vector vec; @@ -170,14 +166,14 @@ void StsSubscriberInstance::OnUpdate(const std::shared_ptrDetachCurrentThread(); if (aniResult != ANI_OK) { - ANS_LOGD("DetachCurrentThread error. result: %{public}d.", aniResult); + ANS_LOGE("DetachCurrentThread error. result: %{public}d.", aniResult); return; } - ANS_LOGD("done"); + ANS_LOGD("OnUpdate done"); } void StsSubscriberInstance::OnConnected() {