From 7fc96263652867d6d50d34aac985dcc155c1a97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 11:30:17 +0000 Subject: [PATCH 01/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../js_scene_session_manager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index 5a66b0d5b2..e9f55c886a 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -1932,7 +1932,7 @@ napi_value JsSceneSessionManager::OnNotifyAINavigationBarShowStatus(napi_env env size_t argc = 4; napi_value argv[4] = {nullptr}; napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); - if (argc < ARGC_TWO) { + if (argc < ARGC_THREE) { WLOGFE("[NAPI]Argc is invalid: %{public}zu", argc); napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); @@ -1952,7 +1952,14 @@ napi_value JsSceneSessionManager::OnNotifyAINavigationBarShowStatus(napi_env env "Input parameter is missing or invalid")); return NapiGetUndefined(env); } - SceneSessionManager::GetInstance().NotifyAINavigationBarShowStatus(isVisible, barArea); + int32_t displayId = -1; + if (!ConvertFromJsValue(env, argv[2], displayId)) { + WLOGFE("[NAPI]Failed to convert parameter to displayId"); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + return NapiGetUndefined(env); + } + SceneSessionManager::GetInstance().NotifyAINavigationBarShowStatus(isVisible, barArea, displayId); return NapiGetUndefined(env); } -- Gitee From b91eb8ed96d7f3b466700843d68cf31cce80dbda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 11:34:52 +0000 Subject: [PATCH 02/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session/host/include/scene_session.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index 31812366d2..186eaba438 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -34,12 +34,13 @@ using SpecificSessionCreateCallback = std::function(const SessionInfo& info, sptr property)>; using SpecificSessionDestroyCallback = std::function; using CameraFloatSessionChangeCallback = std::function; -using GetSceneSessionVectorByTypeCallback = std::function>(WindowType type)>; +using GetSceneSessionVectorByTypeCallback = std::function>( + WindowType type, uint64_t displayId)>; using UpdateAvoidAreaCallback = std::function; using NotifyWindowInfoUpdateCallback = std::function; using NotifyWindowPidChangeCallback = std::function; using NotifySessionTouchOutsideCallback = std::function; -using GetAINavigationBarArea = std::function; +using GetAINavigationBarArea = std::function; using RecoveryCallback = std::function; using NotifyBindDialogSessionFunc = std::function& session)>; using NotifySessionRectChangeFunc = std::function; -- Gitee From c5b98ce3199c5976f296002de893217b4c9f8a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 11:50:12 +0000 Subject: [PATCH 03/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../session/host/src/scene_session.cpp | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 1fd834691a..2d24f6b778 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -40,6 +40,7 @@ #include "wm_math.h" #include #include "singleton_container.h" +#include "screen_session_manager/include/screen_session_manager_client.h" namespace OHOS::Rosen { namespace { @@ -760,12 +761,15 @@ void SceneSession::GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea) if (GetSessionProperty()->GetWindowFlags() & static_cast(WindowFlag::WINDOW_FLAG_NEED_AVOID)) { return; } + uint64_t displayId = GetSessionProperty()->GetDisplayId(); + auto screenSession = ScreenSessionManagerClient::GetInstance().GetScreenSession(displayId); if ((Session::GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING || Session::GetWindowMode() == WindowMode::WINDOW_MODE_SPLIT_PRIMARY || Session::GetWindowMode() == WindowMode::WINDOW_MODE_SPLIT_SECONDARY) && WindowHelper::IsMainWindow(Session::GetWindowType()) && (system::GetParameter("const.product.devicetype", "unknown") == "phone" || - system::GetParameter("const.product.devicetype", "unknown") == "tablet")) { + system::GetParameter("const.product.devicetype", "unknown") == "tablet") && + (!screenSession || screenSession->GetName() != "HiCar")) { float miniScale = 0.316f; // Pressed mini floating Scale with 0.001 precision if (Session::GetFloatingScale() <= miniScale) { return; @@ -780,8 +784,8 @@ void SceneSession::GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea) avoidArea.topRect_.width_ = display->GetWidth(); return; } - std::vector> statusBarVector = - specificCallback_->onGetSceneSessionVectorByType_(WindowType::WINDOW_TYPE_STATUS_BAR); + std::vector> statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); for (auto& statusBar : statusBarVector) { if (!(statusBar->isVisible_)) { continue; @@ -803,8 +807,12 @@ void SceneSession::GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea) system::GetParameter("const.product.devicetype", "unknown") == "tablet")) { return; } - std::vector> inputMethodVector = - specificCallback_->onGetSceneSessionVectorByType_(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT); + if (!GetSessionProperty()) { + TLOGE(WmsLogTag::WMS_IMMS, "Failed to get session property"); + return; + } + std::vector> inputMethodVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT, GetSessionProperty()->GetDisplayId()); for (auto& inputMethod : inputMethodVector) { if (inputMethod->GetSessionState() != SessionState::STATE_FOREGROUND && inputMethod->GetSessionState() != SessionState::STATE_ACTIVE) { @@ -859,7 +867,11 @@ void SceneSession::GetAINavigationBarArea(WSRect rect, AvoidArea& avoidArea) Session::GetWindowMode() == WindowMode::WINDOW_MODE_PIP) { return; } - WSRect barArea = specificCallback_->onGetAINavigationBarArea_(); + if (!GetSessionProperty()) { + TLOGE(WmsLogTag::WMS_IMMS, "Failed to get session property"); + return; + } + WSRect barArea = specificCallback_->onGetAINavigationBarArea_(GetSessionProperty()->GetDisplayId()); CalculateAvoidAreaRect(rect, barArea, avoidArea); } @@ -1359,9 +1371,13 @@ void SceneSession::UpdateWinRectForSystemBar(WSRect& rect) WLOGFE("specificCallback_ is null!"); return; } + if (!GetSessionProperty()) { + WLOGFE("get session property is null!"); + return; + } float tmpPosY = 0.0; - std::vector> statusBarVector = - specificCallback_->onGetSceneSessionVectorByType_(WindowType::WINDOW_TYPE_STATUS_BAR); + std::vector> statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); for (auto& statusBar : statusBarVector) { if (!(statusBar->isVisible_)) { continue; -- Gitee From c63558a5cdabe5b9b9438c4c96253f0bf712478e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 11:55:18 +0000 Subject: [PATCH 04/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../session_manager/include/scene_session_manager.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index f56fcd8433..cfe731a5f4 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -262,8 +262,8 @@ public: WSError UpdateSessionDisplayId(int32_t persistentId, uint64_t screenId); void NotifySessionUpdate(const SessionInfo& sessionInfo, ActionType type, ScreenId fromScreenId = SCREEN_ID_INVALID); - WSError NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea); - WSRect GetAINavigationBarArea(); + WSError NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea, uint64_t displayId); + WSRect GetAINavigationBarArea(uint64_t displayId); bool UpdateImmersiveState(); WMError GetSurfaceNodeIdsFromMissionIds(std::vector& missionIds, std::vector& surfaceNodeIds); @@ -356,14 +356,14 @@ private: WSError UpdateParentSessionForDialog(const sptr& sceneSession, sptr property); void UpdateCameraFloatWindowStatus(uint32_t accessTokenId, bool isShowing); void UpdateFocusableProperty(int32_t persistentId); - std::vector> GetSceneSessionVectorByType(WindowType type); + std::vector> GetSceneSessionVectorByType(WindowType type, uint64_t displayId); bool UpdateSessionAvoidAreaIfNeed(const int32_t& persistentId, const sptr& sceneSession, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType); void UpdateAvoidSessionAvoidArea(WindowType type, bool& needUpdate); void UpdateNormalSessionAvoidArea(const int32_t& persistentId, sptr& sceneSession, bool& needUpdate); void UpdateAvoidArea(const int32_t& persistentId); void NotifyMMIWindowPidChange(int32_t windowId, bool startMoving); - int32_t GetStatusBarHeight(); + int32_t GetStatusBarHeight(uint64_t displayId); sptr GetBundleManager(); std::shared_ptr GetResourceManager(const AppExecFwk::AbilityInfo& abilityInfo); @@ -488,7 +488,7 @@ private: sptr appAnrListener_; bool isAINavigationBarVisible_ = false; - WSRect currAINavigationBarArea_; + std::map currAINavigationBarAreaMap_; std::shared_ptr eventLoop_; std::shared_ptr eventHandler_; -- Gitee From 0a07c30edcc2364933a8726fd67e812af1044aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 11:59:03 +0000 Subject: [PATCH 05/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/include/screen_scene_config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/window_scene/session_manager/include/screen_scene_config.h b/window_scene/session_manager/include/screen_scene_config.h index e8c19cf3d1..17b37b60f7 100644 --- a/window_scene/session_manager/include/screen_scene_config.h +++ b/window_scene/session_manager/include/screen_scene_config.h @@ -34,8 +34,8 @@ public: static const std::map>& GetIntNumbersConfig(); static const std::map& GetStringConfig(); static void DumpConfig(); - static std::vector GetCutoutBoundaryRect(); - static void SetCutoutSvgPath(const std::string& svgPath); + static std::vector GetCutoutBoundaryRect(uint64_t displayId); + static void SetCutoutSvgPath(uint64_t displayId, const std::string& svgPath); static bool IsWaterfallDisplay(); static void SetCurvedCompressionAreaInLandscape(); static std::vector GetCurvedScreenBoundaryConfig(); @@ -45,7 +45,7 @@ private: static std::map enableConfig_; static std::map> intNumbersConfig_; static std::map stringConfig_; - static std::vector cutoutBoundaryRect_; + static std::map> cutoutBoundaryRectMap_; static bool isWaterfallDisplay_; static bool isScreenCompressionEnableInLandscape_; static uint32_t curvedAreaInLandscape_; -- Gitee From c0435f5c4d2645613dfe21e11a8c74f3adaf7faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:15:57 +0000 Subject: [PATCH 06/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../src/scene_session_manager.cpp | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 738a05aa7d..eefe03a76e 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -859,13 +859,16 @@ sptr SceneSessionManager::GetSceneSessionByName(const std::string& return nullptr; } -std::vector> SceneSessionManager::GetSceneSessionVectorByType(WindowType type) +std::vector> SceneSessionManager::GetSceneSessionVectorByType( + WindowType type, uint64_t displayId) { std::vector> sceneSessionVector; std::shared_lock lock(sceneSessionMapMutex_); for (const auto &item : sceneSessionMap_) { auto sceneSession = item.second; - if (sceneSession->GetWindowType() == type) { + if (sceneSession->GetWindowType() == type && + sceneSession->GetSessionProperty() && + sceneSession->GetSessionProperty()->GetDisplayId == displayId) { sceneSessionVector.emplace_back(sceneSession); } } @@ -914,7 +917,7 @@ sptr SceneSessionManager::CreateSpecificS specificCb->onCameraFloatSessionChange_ = std::bind(&SceneSessionManager::UpdateCameraFloatWindowStatus, this, std::placeholders::_1, std::placeholders::_2); specificCb->onGetSceneSessionVectorByType_ = std::bind(&SceneSessionManager::GetSceneSessionVectorByType, - this, std::placeholders::_1); + this, std::placeholders::_1, std::placeholders::_2); specificCb->onUpdateAvoidArea_ = std::bind(&SceneSessionManager::UpdateAvoidArea, this, std::placeholders::_1); specificCb->onWindowInfoUpdate_ = std::bind(&SceneSessionManager::NotifyWindowInfoChange, this, std::placeholders::_1, std::placeholders::_2); @@ -922,7 +925,8 @@ sptr SceneSessionManager::CreateSpecificS this, std::placeholders::_1, std::placeholders::_2); specificCb->onSessionTouchOutside_ = std::bind(&SceneSessionManager::NotifySessionTouchOutside, this, std::placeholders::_1); - specificCb->onGetAINavigationBarArea_ = std::bind(&SceneSessionManager::GetAINavigationBarArea, this); + specificCb->onGetAINavigationBarArea_ = std::bind(&SceneSessionManager::GetAINavigationBarArea, + this, std::placeholders::_1); specificCb->onOutsideDownEvent_ = std::bind(&SceneSessionManager::OnOutsideDownEvent, this, std::placeholders::_1, std::placeholders::_2); specificCb->onHandleSecureSessionShouldHide_ = std::bind(&SceneSessionManager::HandleSecureSessionShouldHide, @@ -5237,11 +5241,12 @@ void SceneSessionManager::StartWindowInfoReportLoop() isReportTaskStart_ = true; } -int32_t SceneSessionManager::GetStatusBarHeight() +int32_t SceneSessionManager::GetStatusBarHeight(uint64_t displayId) { int32_t statusBarHeight = 0; int32_t height = 0; - std::vector> statusBarVector = GetSceneSessionVectorByType(WindowType::WINDOW_TYPE_STATUS_BAR); + std::vector> statusBarVector = GetSceneSessionVectorByType( + WindowType::WINDOW_TYPE_STATUS_BAR, displayId); for (auto& statusBar : statusBarVector) { if (statusBar == nullptr || !IsSessionVisible(statusBar)) { continue; @@ -5260,6 +5265,10 @@ void SceneSessionManager::ResizeSoftInputCallingSessionIfNeed( TLOGI(WmsLogTag::WMS_KEYBOARD, "calling session is nullptr"); return; } + if (!sceneSession->GetSessionProperty()) { + TLOGI(WmsLogTag::WMS_KEYBOARD, "scene session property is nullptr"); + return; + } SessionGravity gravity; uint32_t percent = 0; sceneSession->GetSessionProperty()->GetSessionGravity(gravity, percent); @@ -5291,7 +5300,7 @@ void SceneSessionManager::ResizeSoftInputCallingSessionIfNeed( } WSRect newRect = callingSessionRect; - int32_t statusHeight = GetStatusBarHeight(); + int32_t statusHeight = GetStatusBarHeight(sceneSession->GetSessionProperty()->GetDisplayId()); if (isCallingSessionFloating && callingSessionRect.posY_ > statusHeight) { // calculate new rect of calling window newRect.posY_ = softInputSessionRect.posY_ - static_cast(newRect.height_); @@ -6157,17 +6166,19 @@ void SceneSessionManager::UpdateAvoidArea(const int32_t& persistentId) return; } -WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea) +WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea, uint64_t displayId) { - WLOGFI("NotifyAINavigationBarShowStatus: isVisible: %{public}u, area{%{public}d,%{public}d,%{public}d,%{public}d}", - isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_); - auto task = [this, isVisible, barArea]() { - if (isAINavigationBarVisible_ != isVisible || currAINavigationBarArea_ != barArea) { + WLOGFI("NotifyAINavigationBarShowStatus: isVisible: %{public}u, " \ + "area{%{public}d,%{public}d,%{public}d,%{public}d}, displayId: %{public}" PRIu64"", + isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_, displayId); + auto task = [this, isVisible, barArea, displayId]() { + if (isAINavigationBarVisible_ != isVisible || currAINavigationBarAreaMap_[displayId] != barArea) { isAINavigationBarVisible_ = isVisible; - currAINavigationBarArea_ = barArea; + currAINavigationBarAreaMap_.clear(); + currAINavigationBarAreaMap_[displayId] = barArea; if (!isVisible && !barArea.IsEmpty()) { WLOGFD("NotifyAINavigationBarShowStatus: barArea should be empty if invisible"); - currAINavigationBarArea_ = WSRect(); + currAINavigationBarAreaMap_[displayId] = WSRect(); } WLOGFI("NotifyAINavigationBarShowStatus: enter: %{public}u, {%{public}d,%{public}d,%{public}d,%{public}d}", isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_); @@ -6194,9 +6205,12 @@ WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSR return WSError::WS_OK; } -WSRect SceneSessionManager::GetAINavigationBarArea() +WSRect SceneSessionManager::GetAINavigationBarArea(uint64_t displayId) { - return currAINavigationBarArea_; + if (currAINavigationBarAreaMap_.count(displayId) < 1) { + return {}; + } + return currAINavigationBarAreaMap_[displayId]; } WSError SceneSessionManager::UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener) -- Gitee From 51626a3573e37acf41ab61100cbdf5dec2f47df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:17:15 +0000 Subject: [PATCH 07/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/screen_cutout_controller.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/window_scene/session_manager/src/screen_cutout_controller.cpp b/window_scene/session_manager/src/screen_cutout_controller.cpp index ca36ab836f..01d9fcc876 100644 --- a/window_scene/session_manager/src/screen_cutout_controller.cpp +++ b/window_scene/session_manager/src/screen_cutout_controller.cpp @@ -37,7 +37,7 @@ sptr ScreenCutoutController::GetScreenCutoutInfo(DisplayId displayId { WLOGFD("get screen cutout info."); std::vector boundaryRects; - if (!ScreenSceneConfig::GetCutoutBoundaryRect().empty()) { + if (!ScreenSceneConfig::GetCutoutBoundaryRect(displayId).empty()) { ConvertBoundaryRectsByRotation(boundaryRects, displayId); } @@ -62,7 +62,7 @@ void ScreenCutoutController::ConvertBoundaryRectsByRotation(std::vector& (ScreenSessionManager::GetInstance().GetFoldStatus() == FoldStatus::FOLDED)) { displayBoundaryRects = {{ 507, 18, 66, 66}}; // x:507, y:18, w:66, h:66 } else { - displayBoundaryRects = ScreenSceneConfig::GetCutoutBoundaryRect(); + displayBoundaryRects = ScreenSceneConfig::GetCutoutBoundaryRect(displayId); } CheckBoundaryRects(displayBoundaryRects, displayInfo); if (currentRotation == Rotation::ROTATION_0) { -- Gitee From cc4fa36becbea8ca2cae3597458d1c95034122d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:22:04 +0000 Subject: [PATCH 08/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../session_manager/src/screen_scene_config.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/window_scene/session_manager/src/screen_scene_config.cpp b/window_scene/session_manager/src/screen_scene_config.cpp index 9d707dcd38..1d96aca672 100644 --- a/window_scene/session_manager/src/screen_scene_config.cpp +++ b/window_scene/session_manager/src/screen_scene_config.cpp @@ -44,7 +44,7 @@ constexpr uint32_t NO_WATERFALL_DISPLAY_COMPRESSION_SIZE = 0; std::map ScreenSceneConfig::enableConfig_; std::map> ScreenSceneConfig::intNumbersConfig_; std::map ScreenSceneConfig::stringConfig_; -std::vector ScreenSceneConfig::cutoutBoundaryRect_; +std::vector ScreenSceneConfig::cutoutBoundaryRectMap_; bool ScreenSceneConfig::isWaterfallDisplay_ = false; bool ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false; uint32_t ScreenSceneConfig::curvedAreaInLandscape_ = 0; @@ -245,10 +245,10 @@ void ScreenSceneConfig::DumpConfig() } } -void ScreenSceneConfig::SetCutoutSvgPath(const std::string& svgPath) +void ScreenSceneConfig::SetCutoutSvgPath(uint64_t displayId, const std::string& svgPath) { - cutoutBoundaryRect_.clear(); - cutoutBoundaryRect_.emplace_back(CalcCutoutBoundaryRect(svgPath)); + cutoutBoundaryRectMap_.clear(); + cutoutBoundaryRectMap_[displayId].emplace_back(CalcCutoutBoundaryRect(svgPath)); } DMRect ScreenSceneConfig::CalcCutoutBoundaryRect(std::string svgPath) @@ -284,9 +284,12 @@ DMRect ScreenSceneConfig::CalcCutoutBoundaryRect(std::string svgPath) return cutoutMinOuterRect; } -std::vector ScreenSceneConfig::GetCutoutBoundaryRect() +std::vector ScreenSceneConfig::GetCutoutBoundaryRect(uint64_t displayId) { - return cutoutBoundaryRect_; + if (cutoutBoundaryRectMap_.count(displayId) < 1) { + return {}; + } + return cutoutBoundaryRectMap_[displayId]; } bool ScreenSceneConfig::IsWaterfallDisplay() -- Gitee From 7e93cfe2ee03f4c8df891246d1a06b1c8330fd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:23:15 +0000 Subject: [PATCH 09/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/screen_session_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/screen_session_manager.cpp b/window_scene/session_manager/src/screen_session_manager.cpp index 0fa1386bf6..1785df9be4 100644 --- a/window_scene/session_manager/src/screen_session_manager.cpp +++ b/window_scene/session_manager/src/screen_session_manager.cpp @@ -261,7 +261,7 @@ void ScreenSessionManager::ConfigureScreenScene() if (stringConfig.count("defaultDisplayCutoutPath") != 0) { std::string defaultDisplayCutoutPath = static_cast(stringConfig["defaultDisplayCutoutPath"]); WLOGFD("defaultDisplayCutoutPath = %{public}s.", defaultDisplayCutoutPath.c_str()); - ScreenSceneConfig::SetCutoutSvgPath(defaultDisplayCutoutPath); + ScreenSceneConfig::SetCutoutSvgPath(GetDefaultScreenId(), defaultDisplayCutoutPath); } ConfigureWaterfallDisplayCompressionParams(); -- Gitee From ab66e90ff9059586754adf948a040ebb0c81af86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:24:48 +0000 Subject: [PATCH 10/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/test/unittest/scene_session_manager_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/window_scene/test/unittest/scene_session_manager_test.cpp b/window_scene/test/unittest/scene_session_manager_test.cpp index 706aafd5a5..5325fb4138 100644 --- a/window_scene/test/unittest/scene_session_manager_test.cpp +++ b/window_scene/test/unittest/scene_session_manager_test.cpp @@ -1785,7 +1785,8 @@ HWTEST_F(SceneSessionManagerTest, GetSceneSessionByName, Function | SmallTest | HWTEST_F(SceneSessionManagerTest, GetSceneSessionVectorByType, Function | SmallTest | Level3) { int ret = 0; - ssm_->GetSceneSessionVectorByType(WindowType::APP_MAIN_WINDOW_BASE); + uint64_t displayId = 0; + ssm_->GetSceneSessionVectorByType(WindowType::APP_MAIN_WINDOW_BASE, displayId); ASSERT_EQ(ret, 0); } -- Gitee From 844c76068734fc0aa6cf8497b4fdc531c9160f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:26:18 +0000 Subject: [PATCH 11/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/test/unittest/scene_session_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/window_scene/test/unittest/scene_session_test.cpp b/window_scene/test/unittest/scene_session_test.cpp index e10a701f11..2dc6dbe2fa 100644 --- a/window_scene/test/unittest/scene_session_test.cpp +++ b/window_scene/test/unittest/scene_session_test.cpp @@ -755,7 +755,8 @@ HWTEST_F(SceneSessionTest, GetKeyboardAvoidArea, Function | SmallTest | Level2) sptr specificCallback_ = new (std::nothrow) SceneSession::SpecificSessionCallback(); EXPECT_NE(specificCallback_, nullptr); - specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type) -> std::vector> { + specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type, + uint64_t displayId) -> std::vector> { std::vector> backgroundSession; return backgroundSession; }; @@ -892,7 +893,8 @@ HWTEST_F(SceneSessionTest, GetAvoidAreaByType, Function | SmallTest | Level2) sptr specificCallback_ = new (std::nothrow) SceneSession::SpecificSessionCallback(); EXPECT_NE(specificCallback_, nullptr); - specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type)-> std::vector> + specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type, + uint64_t displayId)-> std::vector> { SessionInfo info_; info_.abilityName_ = "Background01"; -- Gitee From b750929d6ae89e9802f3df1da35373f971d919d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Fri, 22 Mar 2024 12:28:31 +0000 Subject: [PATCH 12/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/test/unittest/screen_scene_config_test.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/window_scene/test/unittest/screen_scene_config_test.cpp b/window_scene/test/unittest/screen_scene_config_test.cpp index ff43835e83..e33697d412 100644 --- a/window_scene/test/unittest/screen_scene_config_test.cpp +++ b/window_scene/test/unittest/screen_scene_config_test.cpp @@ -310,7 +310,8 @@ HWTEST_F(ScreenSceneConfigTest, GetCurvedScreenBoundaryConfig, Function | SmallT */ HWTEST_F(ScreenSceneConfigTest, GetCutoutBoundaryRect, Function | SmallTest | Level3) { - auto result = ScreenSceneConfig::GetCutoutBoundaryRect(); + uint64_t displayId = -1; + auto result = ScreenSceneConfig::GetCutoutBoundaryRect(displayId); ASSERT_FALSE(result.size() > 0); } @@ -368,8 +369,9 @@ HWTEST_F(ScreenSceneConfigTest, CalcCutoutBoundaryRect, Function | SmallTest | L */ HWTEST_F(ScreenSceneConfigTest, SetCutoutSvgPath, Function | SmallTest | Level3) { - ScreenSceneConfig::SetCutoutSvgPath("oo"); - auto result_ = ScreenSceneConfig::GetCutoutBoundaryRect(); + uint64_t displayId = 0; + ScreenSceneConfig::SetCutoutSvgPath(displayId, "oo"); + auto result_ = ScreenSceneConfig::GetCutoutBoundaryRect(displayId); ASSERT_NE(0, result_.size()); } -- Gitee From 92b10cde227f903958cc4b8d5f1622c112d8be96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 02:42:42 +0000 Subject: [PATCH 13/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session/host/src/scene_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 2d24f6b778..f9ce176a79 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -785,7 +785,7 @@ void SceneSession::GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea) return; } std::vector> statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( - WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); + WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); for (auto& statusBar : statusBarVector) { if (!(statusBar->isVisible_)) { continue; -- Gitee From 47789d57cc39b57c2171f6c37f4119217f72469c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 02:52:19 +0000 Subject: [PATCH 14/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/screen_scene_config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/screen_scene_config.cpp b/window_scene/session_manager/src/screen_scene_config.cpp index 1d96aca672..0184347bdc 100644 --- a/window_scene/session_manager/src/screen_scene_config.cpp +++ b/window_scene/session_manager/src/screen_scene_config.cpp @@ -44,7 +44,7 @@ constexpr uint32_t NO_WATERFALL_DISPLAY_COMPRESSION_SIZE = 0; std::map ScreenSceneConfig::enableConfig_; std::map> ScreenSceneConfig::intNumbersConfig_; std::map ScreenSceneConfig::stringConfig_; -std::vector ScreenSceneConfig::cutoutBoundaryRectMap_; +std::map> ScreenSceneConfig::cutoutBoundaryRectMap_; bool ScreenSceneConfig::isWaterfallDisplay_ = false; bool ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false; uint32_t ScreenSceneConfig::curvedAreaInLandscape_ = 0; -- Gitee From f64d8f1f938bee5b73e841839934d4b6bf1a51ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 02:56:40 +0000 Subject: [PATCH 15/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/test/unittest/scene_session_manager_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/window_scene/test/unittest/scene_session_manager_test.cpp b/window_scene/test/unittest/scene_session_manager_test.cpp index 5325fb4138..40cf58295f 100644 --- a/window_scene/test/unittest/scene_session_manager_test.cpp +++ b/window_scene/test/unittest/scene_session_manager_test.cpp @@ -3006,7 +3006,8 @@ HWTEST_F(SceneSessionManagerTest, NotifyAINavigationBarShowStatus, Function | Sm { bool isVisible = false; WSRect barArea = { 0, 0, 320, 240}; // width: 320, height: 240 - WSError result = ssm_->NotifyAINavigationBarShowStatus(isVisible, barArea); + uint64_t displayId = 0; + WSError result = ssm_->NotifyAINavigationBarShowStatus(isVisible, barArea, displayId); ASSERT_EQ(result, WSError::WS_OK); } -- Gitee From 87d6e86dce86911b109b68f07048147a1eb4b34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 03:11:22 +0000 Subject: [PATCH 16/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/window_scene/session/BUILD.gn b/window_scene/session/BUILD.gn index 1e6c60d2d2..2d7db58257 100755 --- a/window_scene/session/BUILD.gn +++ b/window_scene/session/BUILD.gn @@ -73,6 +73,8 @@ ohos_shared_library("scene_session") { "${window_base_path}/utils:libwmutil", "${window_base_path}/window_scene/common:window_scene_common", "${window_base_path}/window_scene/intention_event/service:intention_event_anr_manager", + "${window_base_path}/window_scene/screen_session_manager:screen_session_manager_client", + "${window_base_path}/window_scene/session:screen_session", ] public_deps = -- Gitee From 1a3d247e6089574693b7da445169bcf04de1d36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 03:48:41 +0000 Subject: [PATCH 17/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/scene_session_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index eefe03a76e..fd0bcc5f08 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -868,7 +868,7 @@ std::vector> SceneSessionManager::GetSceneSessionVectorByType auto sceneSession = item.second; if (sceneSession->GetWindowType() == type && sceneSession->GetSessionProperty() && - sceneSession->GetSessionProperty()->GetDisplayId == displayId) { + sceneSession->GetSessionProperty()->GetDisplayId() == displayId) { sceneSessionVector.emplace_back(sceneSession); } } -- Gitee From 5bdc332fad0841a87a4aebeeb33474b064cf9fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 07:09:39 +0000 Subject: [PATCH 18/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../napi/scene_session_manager/js_scene_session_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index e9f55c886a..53aa0a7c93 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -1953,7 +1953,7 @@ napi_value JsSceneSessionManager::OnNotifyAINavigationBarShowStatus(napi_env env return NapiGetUndefined(env); } int32_t displayId = -1; - if (!ConvertFromJsValue(env, argv[2], displayId)) { + if (!ConvertFromJsValue(env, argv[ARG_INDEX_2], displayId)) { WLOGFE("[NAPI]Failed to convert parameter to displayId"); napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); -- Gitee From 069da842d5a2e88065c3c8ef63612552ab19dd90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 07:15:34 +0000 Subject: [PATCH 19/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../session_manager/src/scene_session_manager.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index fd0bcc5f08..faddfc4120 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -5277,13 +5277,8 @@ void SceneSessionManager::ResizeSoftInputCallingSessionIfNeed( return; } - bool isCallingSessionFloating; - if (callingSession_->GetSessionProperty() && - callingSession_->GetSessionProperty()->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING) { - isCallingSessionFloating = true; - } else { - isCallingSessionFloating = false; - } + bool isCallingSessionFloating = callingSession_->GetSessionProperty() && + callingSession_->GetSessionProperty()->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING; const WSRect& softInputSessionRect = sceneSession->GetSessionRect(); WSRect callingSessionRect; -- Gitee From 838a6000c3018337b3795e4d553dab7245c7aec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 07:49:30 +0000 Subject: [PATCH 20/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../src/scene_session_manager.cpp | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index faddfc4120..d9951556e9 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -6178,21 +6178,7 @@ WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSR WLOGFI("NotifyAINavigationBarShowStatus: enter: %{public}u, {%{public}d,%{public}d,%{public}d,%{public}d}", isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_); for (auto persistentId : avoidAreaListenerSessionSet_) { - auto sceneSession = GetSceneSession(persistentId); - if (sceneSession == nullptr || !IsSessionVisible(sceneSession)) { - continue; - } - AvoidArea avoidArea = sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_NAVIGATION_INDICATOR); - if (!CheckAvoidAreaForAINavigationBar(isAINavigationBarVisible_, avoidArea, - sceneSession->GetSessionRect().posY_ + sceneSession->GetSessionRect().height_)) { - continue; - } - WLOGFI("NotifyAINavigationBarShowStatus: persistentId: %{public}d, " - "{%{public}d,%{public}d,%{public}d,%{public}d}", persistentId, - avoidArea.bottomRect_.posX_, avoidArea.bottomRect_.posY_, - avoidArea.bottomRect_.width_, avoidArea.bottomRect_.height_); - UpdateSessionAvoidAreaIfNeed(persistentId, sceneSession, avoidArea, - AvoidAreaType::TYPE_NAVIGATION_INDICATOR); + NotifySessionAINavigationBarChange(persistentId); } } }; @@ -6200,6 +6186,25 @@ WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSR return WSError::WS_OK; } +void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentId) +{ + auto sceneSession = GetSceneSession(persistentId); + if (sceneSession == nullptr || !IsSessionVisible(sceneSession)) { + return; + } + AvoidArea avoidArea = sceneSession->GetAvoidAreaByType(AvoidAreaType::TYPE_NAVIGATION_INDICATOR); + if (!CheckAvoidAreaForAINavigationBar(isAINavigationBarVisible_, avoidArea, + sceneSession->GetSessionRect().posY_ + sceneSession->GetSessionRect().height_)) { + return; + } + WLOGFI("NotifyAINavigationBarShowStatus: persistentId: %{public}d, " + "{%{public}d,%{public}d,%{public}d,%{public}d}", persistentId, + avoidArea.bottomRect_.posX_, avoidArea.bottomRect_.posY_, + avoidArea.bottomRect_.width_, avoidArea.bottomRect_.height_); + UpdateSessionAvoidAreaIfNeed(persistentId, sceneSession, avoidArea, + AvoidAreaType::TYPE_NAVIGATION_INDICATOR); +} + WSRect SceneSessionManager::GetAINavigationBarArea(uint64_t displayId) { if (currAINavigationBarAreaMap_.count(displayId) < 1) { -- Gitee From 1a6490693872c9be12a3e5e1df80465522b52f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 07:50:32 +0000 Subject: [PATCH 21/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/include/scene_session_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index cfe731a5f4..f40e1ce94e 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -430,6 +430,7 @@ private: WMError UpdatePropertyRaiseEnabled(const sptr& property, const sptr& sceneSession); void ClosePipWindowIfExist(WindowType type); + void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentId) WSError DestroyAndDisconnectSpecificSessionInner(sptr sceneSession); sptr rootSceneSession_; -- Gitee From 63361e4775f413381cf8a9189faec23f423bed6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 08:13:30 +0000 Subject: [PATCH 22/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/include/scene_session_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index f40e1ce94e..9726937df9 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -430,7 +430,7 @@ private: WMError UpdatePropertyRaiseEnabled(const sptr& property, const sptr& sceneSession); void ClosePipWindowIfExist(WindowType type); - void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentId) + void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentId); WSError DestroyAndDisconnectSpecificSessionInner(sptr sceneSession); sptr rootSceneSession_; -- Gitee From 4d26862391dc2821beaaf85aa5d720af945fa37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Sat, 23 Mar 2024 08:38:40 +0000 Subject: [PATCH 23/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/include/scene_session_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index 9726937df9..ad7231cfdd 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -430,7 +430,7 @@ private: WMError UpdatePropertyRaiseEnabled(const sptr& property, const sptr& sceneSession); void ClosePipWindowIfExist(WindowType type); - void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentId); + void NotifySessionAINavigationBarChange(int32_t persistentId); WSError DestroyAndDisconnectSpecificSessionInner(sptr sceneSession); sptr rootSceneSession_; -- Gitee From 3d7245a227208ebd2cdb26ea477d4e2b962516a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Mon, 25 Mar 2024 10:14:55 +0000 Subject: [PATCH 24/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/scene_session_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index d9951556e9..9c4e940d82 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -6167,7 +6167,8 @@ WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSR "area{%{public}d,%{public}d,%{public}d,%{public}d}, displayId: %{public}" PRIu64"", isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_, displayId); auto task = [this, isVisible, barArea, displayId]() { - if (isAINavigationBarVisible_ != isVisible || currAINavigationBarAreaMap_[displayId] != barArea) { + if (isAINavigationBarVisible_ != isVisible || currAINavigationBarAreaMap_.count(displayId) < 1 || + currAINavigationBarAreaMap_[displayId] != barArea) { isAINavigationBarVisible_ = isVisible; currAINavigationBarAreaMap_.clear(); currAINavigationBarAreaMap_[displayId] = barArea; -- Gitee From ae66cd71c052b03ba3a2c09fb47259d6fdfb667a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Wed, 27 Mar 2024 07:46:04 +0000 Subject: [PATCH 25/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../js_scene_session_manager.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index 53aa0a7c93..cbbacbd780 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -47,7 +47,7 @@ constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "JsScen constexpr int WAIT_FOR_SECONDS = 2; constexpr int MIN_ARG_COUNT = 3; constexpr int ARG_INDEX_1 = 1; -constexpr int ARG_INDEX_2 = 2; +constexpr int ARG_INDEX_TWO = 2; constexpr int ARG_INDEX_3 = 3; const std::string CREATE_SYSTEM_SESSION_CB = "createSpecificSession"; const std::string RECOVER_SCENE_SESSION_CB = "recoverSceneSession"; @@ -1800,7 +1800,7 @@ napi_value JsSceneSessionManager::OnRequestFocusStatus(napi_env env, napi_callba return NapiGetUndefined(env); } bool byForeground = false; - if (!ConvertFromJsValue(env, argv[ARG_INDEX_2], byForeground)) { + if (!ConvertFromJsValue(env, argv[ARG_INDEX_TWO], byForeground)) { WLOGFE("[NAPI]Failed to convert parameter to byForeground"); napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); @@ -1952,9 +1952,9 @@ napi_value JsSceneSessionManager::OnNotifyAINavigationBarShowStatus(napi_env env "Input parameter is missing or invalid")); return NapiGetUndefined(env); } - int32_t displayId = -1; - if (!ConvertFromJsValue(env, argv[ARG_INDEX_2], displayId)) { - WLOGFE("[NAPI]Failed to convert parameter to displayId"); + int64_t displayId = -1; + if (!ConvertFromJsValue(env, argv[ARG_INDEX_TWO], displayId)) { + TLOGE(WmsLogTag::WMS_LIFE, "[NAPI]Failed to convert parameter to displayId"); napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); return NapiGetUndefined(env); @@ -2071,7 +2071,7 @@ napi_value JsSceneSessionManager::OnReportData(napi_env env, napi_callback_info } std::unordered_map mapPayload; - if (!ConvertStringMapFromJs(env, argv[ARG_INDEX_2], mapPayload)) { + if (!ConvertStringMapFromJs(env, argv[ARG_INDEX_TWO], mapPayload)) { WLOGFE("[NAPI]Failed to convert parameter to pauloadPid"); napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); -- Gitee From 2663844db07f4cc242bf394407401a5e44228a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Wed, 27 Mar 2024 07:48:17 +0000 Subject: [PATCH 26/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/include/scene_session_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index ad7231cfdd..9ad418d9dd 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -489,6 +489,7 @@ private: sptr appAnrListener_; bool isAINavigationBarVisible_ = false; + std::shared_mutex currAINavigationBarAreaMapMutex_; std::map currAINavigationBarAreaMap_; std::shared_ptr eventLoop_; -- Gitee From 518b5e0e41453d20d20e1b3d17d24629b265abe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Wed, 27 Mar 2024 08:01:26 +0000 Subject: [PATCH 27/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../src/scene_session_manager.cpp | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 9c4e940d82..2166c67bf2 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -862,6 +862,10 @@ sptr SceneSessionManager::GetSceneSessionByName(const std::string& std::vector> SceneSessionManager::GetSceneSessionVectorByType( WindowType type, uint64_t displayId) { + if (displayId == DISPLAY_ID_INVALID) { + TLOGE(WmsLogTag::WMS_LIFE, "displayId is invalid"); + return {}; + } std::vector> sceneSessionVector; std::shared_lock lock(sceneSessionMapMutex_); for (const auto &item : sceneSessionMap_) { @@ -6167,15 +6171,23 @@ WSError SceneSessionManager::NotifyAINavigationBarShowStatus(bool isVisible, WSR "area{%{public}d,%{public}d,%{public}d,%{public}d}, displayId: %{public}" PRIu64"", isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_, displayId); auto task = [this, isVisible, barArea, displayId]() { - if (isAINavigationBarVisible_ != isVisible || currAINavigationBarAreaMap_.count(displayId) < 1 || - currAINavigationBarAreaMap_[displayId] != barArea) { - isAINavigationBarVisible_ = isVisible; - currAINavigationBarAreaMap_.clear(); - currAINavigationBarAreaMap_[displayId] = barArea; - if (!isVisible && !barArea.IsEmpty()) { + bool isNeedUpdate = false; + { + std::unique_lock lock(currAINavigationBarAreaMapMutex_); + isNeedUpdate = isAINavigationBarVisible_ != isVisible || + currAINavigationBarAreaMap_.count(displayId) == 0 || + currAINavigationBarAreaMap_[displayId] != barArea; + if (isNeedUpdate) { + isAINavigationBarVisible_ = isVisible; + currAINavigationBarAreaMap_.clear(); + currAINavigationBarAreaMap_[displayId] = barArea; + } + if (isNeedUpdate && !isVisible && !barArea.IsEmpty()) { WLOGFD("NotifyAINavigationBarShowStatus: barArea should be empty if invisible"); currAINavigationBarAreaMap_[displayId] = WSRect(); } + } + if (isNeedUpdate) { WLOGFI("NotifyAINavigationBarShowStatus: enter: %{public}u, {%{public}d,%{public}d,%{public}d,%{public}d}", isVisible, barArea.posX_, barArea.posY_, barArea.width_, barArea.height_); for (auto persistentId : avoidAreaListenerSessionSet_) { @@ -6208,7 +6220,8 @@ void SceneSessionManager::NotifySessionAINavigationBarChange(int32_t persistentI WSRect SceneSessionManager::GetAINavigationBarArea(uint64_t displayId) { - if (currAINavigationBarAreaMap_.count(displayId) < 1) { + std::shared_lock lock(currAINavigationBarAreaMapMutex_); + if (currAINavigationBarAreaMap_.count(displayId) == 0) { return {}; } return currAINavigationBarAreaMap_[displayId]; -- Gitee From 7452255397f1bb3ff1a787f2d1ed44ed2b28fdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Wed, 27 Mar 2024 08:04:00 +0000 Subject: [PATCH 28/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- window_scene/session_manager/src/screen_scene_config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/screen_scene_config.cpp b/window_scene/session_manager/src/screen_scene_config.cpp index 0184347bdc..47aa7455cd 100644 --- a/window_scene/session_manager/src/screen_scene_config.cpp +++ b/window_scene/session_manager/src/screen_scene_config.cpp @@ -286,7 +286,7 @@ DMRect ScreenSceneConfig::CalcCutoutBoundaryRect(std::string svgPath) std::vector ScreenSceneConfig::GetCutoutBoundaryRect(uint64_t displayId) { - if (cutoutBoundaryRectMap_.count(displayId) < 1) { + if (cutoutBoundaryRectMap_.count(displayId) == 0) { return {}; } return cutoutBoundaryRectMap_[displayId]; -- Gitee From 3e40ab6fd67fec602aee2cef01cd4de735be7fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=B0=94=E9=BE=99?= Date: Wed, 27 Mar 2024 11:12:39 +0000 Subject: [PATCH 29/29] =?UTF-8?q?=E5=8C=BA=E5=88=86=E9=81=BF=E8=AE=A9?= =?UTF-8?q?=E5=8C=BAdisplayId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 神气龙 --- .../session/host/src/scene_session.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index f9ce176a79..461d4e5860 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -784,8 +784,11 @@ void SceneSession::GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea) avoidArea.topRect_.width_ = display->GetWidth(); return; } - std::vector> statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( - WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); + std::vector> statusBarVector; + if (specificCallback_ != nullptr && specificCallback_->onGetSceneSessionVectorByType_) { + statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); + } for (auto& statusBar : statusBarVector) { if (!(statusBar->isVisible_)) { continue; @@ -811,8 +814,11 @@ void SceneSession::GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea) TLOGE(WmsLogTag::WMS_IMMS, "Failed to get session property"); return; } - std::vector> inputMethodVector = specificCallback_->onGetSceneSessionVectorByType_( - WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT, GetSessionProperty()->GetDisplayId()); + std::vector> inputMethodVector; + if (specificCallback_ != nullptr && specificCallback_->onGetSceneSessionVectorByType_) { + inputMethodVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT, GetSessionProperty()->GetDisplayId()); + } for (auto& inputMethod : inputMethodVector) { if (inputMethod->GetSessionState() != SessionState::STATE_FOREGROUND && inputMethod->GetSessionState() != SessionState::STATE_ACTIVE) { @@ -871,7 +877,10 @@ void SceneSession::GetAINavigationBarArea(WSRect rect, AvoidArea& avoidArea) TLOGE(WmsLogTag::WMS_IMMS, "Failed to get session property"); return; } - WSRect barArea = specificCallback_->onGetAINavigationBarArea_(GetSessionProperty()->GetDisplayId()); + WSRect barArea; + if (specificCallback_ != nullptr && specificCallback_->onGetAINavigationBarArea_) { + barArea = specificCallback_->onGetAINavigationBarArea_(GetSessionProperty()->GetDisplayId()); + } CalculateAvoidAreaRect(rect, barArea, avoidArea); } @@ -1376,8 +1385,11 @@ void SceneSession::UpdateWinRectForSystemBar(WSRect& rect) return; } float tmpPosY = 0.0; - std::vector> statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( - WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); + std::vector> statusBarVector; + if (specificCallback_->onGetSceneSessionVectorByType_) { + statusBarVector = specificCallback_->onGetSceneSessionVectorByType_( + WindowType::WINDOW_TYPE_STATUS_BAR, GetSessionProperty()->GetDisplayId()); + } for (auto& statusBar : statusBarVector) { if (!(statusBar->isVisible_)) { continue; -- Gitee