【toast】添加维测日志

Signed-off-by: huzhanjiang <huzhanjiang@huawei.com>
Change-Id: I3bd2dd46b0851bed65aef51fa53049cb311c9f67
This commit is contained in:
huzhanjiang 2024-09-20 23:15:01 +08:00
parent e2eab5d025
commit c069011f30
3 changed files with 22 additions and 1 deletions

View File

@ -1381,6 +1381,13 @@ void OverlayManager::ShowToast(const NG::ToastInfo& toastInfo, const std::functi
callback(callbackToastId);
}
OpenToastAnimation(toastNode, toastInfo.duration);
if (toastInfo.showMode == NG::ToastShowMode::DEFAULT) {
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show toast DEFAULT");
} else if (toastInfo.showMode == NG::ToastShowMode::TOP_MOST) {
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show toast TOP_MOST");
} else if (toastInfo.showMode == NG::ToastShowMode::SYSTEM_TOP_MOST) {
TAG_LOGD(AceLogTag::ACE_OVERLAY, "show toast SYSTEM_TOP_MOST");
}
}
void OverlayManager::CloseToast(int32_t toastId, const std::function<void(int32_t)>& callback)

View File

@ -128,6 +128,8 @@ bool ToastPattern::OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty,
if (!IsDefaultToast()) {
OffsetT<Dimension> displayWindowOffset = { Dimension(context->GetDisplayWindowRectInfo().GetOffset().GetX()),
Dimension(context->GetDisplayWindowRectInfo().GetOffset().GetY()) };
TAG_LOGD(AceLogTag::ACE_OVERLAY, "toast displayWindowOffset, x: %{public}.2f vp, y: %{public}.2f vp",
displayWindowOffset.GetX().ConvertToVp(), displayWindowOffset.GetY().ConvertToVp());
offset += displayWindowOffset;
}
auto func = [toastContext, offset]() { toastContext->UpdateOffset(offset); };
@ -211,6 +213,10 @@ Dimension ToastPattern::GetOffsetY(const RefPtr<LayoutWrapper>& layoutWrapper)
if ((showMode == ToastShowMode::TOP_MOST) && (offsetY.Value() + textHeight > deviceHeight - keyboardOffset)) {
offsetY = Dimension(deviceHeight - keyboardOffset - defaultBottom_.ConvertToPx() - textHeight);
}
TAG_LOGD(AceLogTag::ACE_OVERLAY,
"toast device height: %{public}.2f, keyboardOffset: %{public}d, "
"textHeight: %{public}.2f, offsetY: %{public}.2f",
deviceHeight, keyboardOffset, textHeight, offsetY.Value());
return offsetY + toastProp->GetToastOffsetValue(DimensionOffset()).GetY();
}
@ -380,6 +386,10 @@ double ToastPattern::GetTextMaxHeight()
auto windowGlobalRect = pipelineContext->GetDisplayWindowRectInfo();
deviceHeight = windowGlobalRect.Height();
}
if (LessOrEqual(deviceHeight, 0.0)) {
TAG_LOGE(AceLogTag::ACE_OVERLAY,
"toast get device height is invalid, containerId: %{public}d", containerId);
}
auto safeAreaManager = pipelineContext->GetSafeAreaManager();
auto bottom = safeAreaManager ? safeAreaManager->GetSafeAreaWithoutProcess().bottom_.Length() : 0;
auto top = safeAreaManager ? safeAreaManager->GetSafeAreaWithoutProcess().top_.Length() : 0;
@ -405,6 +415,10 @@ double ToastPattern::GetTextMaxWidth()
auto windowGlobalRect = pipelineContext->GetDisplayWindowRectInfo();
deviceWidth = windowGlobalRect.Width();
}
if (LessOrEqual(deviceWidth, 0.0)) {
TAG_LOGE(AceLogTag::ACE_OVERLAY,
"toast get device width is invalid, containerId: %{public}d", containerId);
}
auto toastTheme = pipelineContext->GetTheme<ToastTheme>();
CHECK_NULL_RETURN(toastTheme, 0.0);

View File

@ -87,7 +87,7 @@ bool GetToastMessage(napi_env env, napi_value messageNApi, std::string& messageS
return false;
}
if (messageString.size() == 0) {
TAG_LOGD(AceLogTag::ACE_DIALOG, "Toast message is empty");
TAG_LOGE(AceLogTag::ACE_DIALOG, "Toast message is empty");
}
} else {
NapiThrow(env, "The type of message is incorrect.", ERROR_CODE_PARAM_INVALID);