diff --git a/dmserver/src/abstract_screen_controller.cpp b/dmserver/src/abstract_screen_controller.cpp index d40f8716..70a2a5fe 100644 --- a/dmserver/src/abstract_screen_controller.cpp +++ b/dmserver/src/abstract_screen_controller.cpp @@ -626,8 +626,13 @@ bool AbstractScreenController::SetOrientation(ScreenId screenId, Orientation new Rotation rotationAfter = screen->CalcRotation(newOrientation); if (rotationAfter != screen->rotation_) { WLOGI("set orientation. roatiton %{public}u", rotationAfter); - if (!rsInterface_.RequestRotation(screenId, static_cast(rotationAfter))) { - WLOGE("rotate screen fail. %{public}" PRIu64"", screenId); + ScreenId rsScreenId; + if (!screenIdManager_.ConvertToRsScreenId(screenId, rsScreenId)) { + WLOGE("Convert to RsScreenId fail. screenId: %{public}" PRIu64"", screenId); + return false; + } + if (!rsInterface_.RequestRotation(rsScreenId, static_cast(rotationAfter))) { + WLOGE("rotate screen fail. rsScreenId: %{public}" PRIu64"", rsScreenId); return false; } } else { diff --git a/wmserver/include/window_controller.h b/wmserver/include/window_controller.h index bb94e30b..93ae8deb 100644 --- a/wmserver/include/window_controller.h +++ b/wmserver/include/window_controller.h @@ -72,7 +72,7 @@ private: WMError SetSystemBarProperty(uint32_t windowId, WindowType type, const SystemBarProperty& property); WMError ResizeRect(uint32_t windowId, const Rect& rect, WindowSizeChangeReason reason); WMError SetWindowMode(uint32_t windowId, WindowMode dstMode); - void ReSizeSystemBarPropertySizeIfNeed(sptr node); + void ResizeSystemBarPropertySizeIfNeed(const sptr& node); void HandleTurnScreenOn(const sptr& node); void ProcessSystemBarChange(const sptr& displayInfo); void NotifyOutsidePressed(const sptr& node); @@ -80,7 +80,7 @@ private: sptr windowRoot_; sptr inputWindowMonitor_; std::atomic windowId_ { INVALID_WINDOW_ID }; - // Remove 'sysBarWinId_' after SystemUI resize 'systembar' + // Remove 'sysBarWinId_' after SystemUI resize 'systembar', systemBar only exist on default display currently std::unordered_map sysBarWinId_ { { WindowType::WINDOW_TYPE_STATUS_BAR, INVALID_WINDOW_ID }, { WindowType::WINDOW_TYPE_NAVIGATION_BAR, INVALID_WINDOW_ID }, diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index a70f7d0d..2577600a 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -200,14 +200,14 @@ WMError WindowController::AddWindowNode(sptr& property) if (node->GetWindowType() == WindowType::WINDOW_TYPE_STATUS_BAR || node->GetWindowType() == WindowType::WINDOW_TYPE_NAVIGATION_BAR) { sysBarWinId_[node->GetWindowType()] = node->GetWindowId(); - ReSizeSystemBarPropertySizeIfNeed(node); + ResizeSystemBarPropertySizeIfNeed(node); } StopBootAnimationIfNeed(node->GetWindowType()); MinimizeApp::ExecuteMinimizeAll(); return WMError::WM_OK; } -void WindowController::ReSizeSystemBarPropertySizeIfNeed(sptr node) +void WindowController::ResizeSystemBarPropertySizeIfNeed(const sptr& node) { auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(node->GetDisplayId()); if (displayInfo == nullptr) { @@ -441,14 +441,21 @@ void WindowController::ProcessSystemBarChange(const sptr& displayIn if (statusBarRectIter != systemBarRect_[WindowType::WINDOW_TYPE_STATUS_BAR][displayWidth].end()) { newRect = statusBarRectIter->second; } - ResizeRect(sysBarWinId_[WindowType::WINDOW_TYPE_STATUS_BAR], newRect, WindowSizeChangeReason::DRAG); + const auto& statusBarNode = windowRoot_->GetWindowNode(sysBarWinId_[WindowType::WINDOW_TYPE_STATUS_BAR]); + if (statusBarNode->GetDisplayId() == displayId) { + ResizeRect(sysBarWinId_[WindowType::WINDOW_TYPE_STATUS_BAR], newRect, WindowSizeChangeReason::DRAG); + } + newRect = { 0, displayInfo->GetHeight() - static_cast(height), width, height }; auto navigationBarRectIter = systemBarRect_[WindowType::WINDOW_TYPE_NAVIGATION_BAR][displayWidth].find(displayHeight); if (navigationBarRectIter != systemBarRect_[WindowType::WINDOW_TYPE_NAVIGATION_BAR][displayWidth].end()) { newRect = navigationBarRectIter->second; } - ResizeRect(sysBarWinId_[WindowType::WINDOW_TYPE_NAVIGATION_BAR], newRect, WindowSizeChangeReason::DRAG); + const auto& naviBarNode = windowRoot_->GetWindowNode(sysBarWinId_[WindowType::WINDOW_TYPE_NAVIGATION_BAR]); + if (naviBarNode->GetDisplayId() == displayId) { + ResizeRect(sysBarWinId_[WindowType::WINDOW_TYPE_NAVIGATION_BAR], newRect, WindowSizeChangeReason::DRAG); + } } void WindowController::ProcessDisplayChange(DisplayId displayId, DisplayStateChangeType type)