From 72cb5f175eff8f32db2f4ca284d48b6790cc9f8b Mon Sep 17 00:00:00 2001 From: Haryslee Date: Sat, 1 Mar 2025 17:11:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E7=AA=97=E5=8F=A3=E9=81=AE=E6=8C=A1=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Haryslee --- .../sec_comp_info_helper.h | 2 +- .../sa/sa_main/window_info_helper.cpp | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/security_component_common/sec_comp_info_helper.h b/interfaces/inner_api/security_component_common/sec_comp_info_helper.h index 4acb1a3..7d5a44e 100644 --- a/interfaces/inner_api/security_component_common/sec_comp_info_helper.h +++ b/interfaces/inner_api/security_component_common/sec_comp_info_helper.h @@ -47,11 +47,11 @@ struct ScreenInfo { static bool CheckComponentValid(SecCompBase* comp, std::string& message); static bool CheckRectValid(const SecCompRect& rect, const SecCompRect& windowRect, const ScreenInfo& screenInfo, std::string& message); + static double GetDistance(DimensionT x1, DimensionT y1, DimensionT x2, DimensionT y2); private: static float GetWindowScale(int32_t windowId); static void AdjustSecCompRect(SecCompBase* comp, float scale); - static double GetDistance(DimensionT x1, DimensionT y1, DimensionT x2, DimensionT y2); static bool IsOutOfWatchScreen(const SecCompRect& rect, double radius, std::string& message); static bool IsOutOfScreen(const SecCompRect& rect, double curScreenWidth, double curScreenHeight, std::string& message, bool isWearable); diff --git a/services/security_component_service/sa/sa_main/window_info_helper.cpp b/services/security_component_service/sa/sa_main/window_info_helper.cpp index ac99691..c119cce 100644 --- a/services/security_component_service/sa/sa_main/window_info_helper.cpp +++ b/services/security_component_service/sa/sa_main/window_info_helper.cpp @@ -15,6 +15,7 @@ #include "window_info_helper.h" #include +#include "sec_comp_info_helper.h" #include "sec_comp_log.h" #include "window_manager.h" @@ -79,6 +80,32 @@ static bool IsRectInWindRect(const Rosen::Rect& windRect, const SecCompRect& sec (secRect.y_ >= windRect.posY_ + static_cast(windRect.height_))) { return false; } + if ((GreatOrEqual(windRect.posX_, secRect.x_ + secRect.width_ - secRect.borderRadius_.rightBottom) && + GreatOrEqual(windRect.posY_, secRect.y_ + secRect.height_ - secRect.borderRadius_.rightBottom))) { + auto distance = SecCompInfoHelper::GetDistance(secRect.x_ + secRect.width_ - secRect.borderRadius_.rightBottom, + secRect.y_ + secRect.height_ - secRect.borderRadius_.rightBottom, windRect.posX_, windRect.posY_); + return !GreatNotEqual(distance, secRect.borderRadius_.rightBottom - 1.0); + } + if ((GreatOrEqual(secRect.x_ + secRect.borderRadius_.leftBottom, windRect.posX_ + windRect.width_) && + GreatOrEqual(windRect.posY_, secRect.y_ + secRect.height_ - secRect.borderRadius_.leftBottom))) { + auto distance = SecCompInfoHelper::GetDistance(secRect.x_ + secRect.borderRadius_.leftBottom, + secRect.y_ + secRect.height_ - secRect.borderRadius_.leftBottom, windRect.posX_ + windRect.width_, + windRect.posY_); + return !GreatNotEqual(distance, secRect.borderRadius_.leftBottom - 1.0); + } + if ((GreatOrEqual(windRect.posX_, secRect.x_ + secRect.width_ - secRect.borderRadius_.rightTop) && + GreatOrEqual(secRect.y_ + secRect.borderRadius_.rightTop, windRect.posY_ + windRect.height_))) { + auto distance = SecCompInfoHelper::GetDistance(secRect.x_ + secRect.width_ - secRect.borderRadius_.rightTop, + secRect.y_ + secRect.borderRadius_.rightTop, windRect.posX_, windRect.posY_ + windRect.height_); + return !GreatNotEqual(distance, secRect.borderRadius_.rightTop - 1.0); + } + if ((GreatOrEqual(secRect.x_ + secRect.borderRadius_.leftTop, windRect.posX_ + windRect.width_) && + GreatOrEqual(secRect.y_ + secRect.borderRadius_.leftTop, windRect.posY_ + windRect.height_))) { + auto distance = SecCompInfoHelper::GetDistance(secRect.x_ + secRect.borderRadius_.leftTop, + secRect.y_ + secRect.borderRadius_.leftTop, windRect.posX_ + windRect.width_, + windRect.posY_ + windRect.height_); + return !GreatNotEqual(distance, secRect.borderRadius_.leftTop - 1.0); + } return true; } -- Gitee