mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-03-04 05:37:27 +00:00
update displayGroupInfo
Signed-off-by: l00574490 <liuqi149@huawei.com> Change-Id: Idab000d881bd0a8d58b138bcbff67026bed38133
This commit is contained in:
parent
8014261b27
commit
d67eb63b26
@ -111,8 +111,8 @@ enum class WindowState : uint32_t {
|
||||
STATE_HIDDEN,
|
||||
STATE_FROZEN,
|
||||
STATE_DESTROYED,
|
||||
STATE_BOTTOM = STATE_DESTROYED,
|
||||
STATE_UNFROZEN,
|
||||
STATE_BOTTOM = STATE_DESTROYED,
|
||||
};
|
||||
|
||||
enum class WMError : int32_t {
|
||||
|
@ -87,7 +87,7 @@ void WindowRootFuzzPart1(sptr<WindowRoot> windowRoot, sptr<WindowNode> windowNod
|
||||
windowRoot->GetWindowNodeContainer(displayId);
|
||||
|
||||
auto displayInfo = CreateDisplayInfo(data, size);
|
||||
windowRoot->CreateWindowNodeContainer(displayInfo);
|
||||
windowRoot->CreateWindowNodeContainer(0, displayInfo);
|
||||
|
||||
uint32_t windowId;
|
||||
startPos += GetObject<uint32_t>(windowId, data + startPos, size - startPos);
|
||||
@ -177,7 +177,6 @@ void WindowRootFuzzPart3(sptr<WindowRoot> windowRoot, sptr<WindowNode> windowNod
|
||||
|
||||
DisplayId displayId;
|
||||
startPos += GetObject<DisplayId>(displayId, data + startPos, size - startPos);
|
||||
windowRoot->GetVirtualPixelRatio(displayId);
|
||||
windowRoot->GetDisplayGroupRect(displayId);
|
||||
|
||||
WindowSizeChangeReason windowSizeChangeReason;
|
||||
@ -311,14 +310,13 @@ void WindowRootFuzzPart6(sptr<WindowRoot> windowRoot, sptr<WindowNode> windowNod
|
||||
startPos += GetObject<bool>(isRecordedDisplay, data + startPos, size - startPos);
|
||||
|
||||
windowRoot->GetScreenGroupId(displayId, isRecordedDisplay);
|
||||
|
||||
|
||||
std::vector<DisplayId> infos;
|
||||
for (size_t i = 0; i < VECTOR_MAX_LEN; i++) {
|
||||
DisplayId disId;
|
||||
startPos += GetObject<DisplayId>(disId, data + startPos, size - startPos);
|
||||
infos.emplace_back(disId);
|
||||
}
|
||||
windowRoot->GetAllDisplayInfos(infos);
|
||||
|
||||
DisplayId defaultDisplayId;
|
||||
startPos += GetObject<DisplayId>(defaultDisplayId, data + startPos, size - startPos);
|
||||
|
@ -36,9 +36,8 @@ class WindowNodeContainer;
|
||||
|
||||
class DisplayGroupController : public RefBase {
|
||||
public:
|
||||
DisplayGroupController(const sptr<WindowNodeContainer>& windowNodeContainer,
|
||||
const sptr<DisplayGroupInfo>& displayGroupInfo)
|
||||
: windowNodeContainer_(windowNodeContainer), displayGroupInfo_(displayGroupInfo) {}
|
||||
DisplayGroupController(const sptr<WindowNodeContainer>& windowNodeContainer)
|
||||
: windowNodeContainer_(windowNodeContainer) {}
|
||||
~DisplayGroupController() = default;
|
||||
|
||||
void InitNewDisplay(DisplayId displayId);
|
||||
@ -80,7 +79,6 @@ private:
|
||||
void ProcessSystemBarRotation(const sptr<WindowNode>& node, const std::map<DisplayId, Rect>& displayRectMap);
|
||||
|
||||
sptr<WindowNodeContainer> windowNodeContainer_;
|
||||
sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
std::map<DisplayId, sptr<WindowPair>> windowPairMap_;
|
||||
DisplayId defaultDisplayId_ { 0 };
|
||||
};
|
||||
|
@ -21,13 +21,14 @@
|
||||
|
||||
#include "display_info.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_single_instance.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
class DisplayGroupInfo : public RefBase {
|
||||
WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayGroupInfo);
|
||||
public:
|
||||
DisplayGroupInfo(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo);
|
||||
~DisplayGroupInfo() = default;
|
||||
void Init(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo);
|
||||
void AddDisplayInfo(const sptr<DisplayInfo>& displayInfo);
|
||||
void RemoveDisplayInfo(DisplayId displayId);
|
||||
void UpdateLeftAndRightDisplayId();
|
||||
@ -36,21 +37,30 @@ public:
|
||||
void SetDisplayOrientation(DisplayId displayId, DisplayOrientation orientation);
|
||||
void SetDisplayVirtualPixelRatio(DisplayId displayId, float vpr);
|
||||
void SetDisplayRect(DisplayId displayId, Rect displayRect);
|
||||
void SetDefaultDisplayId(DisplayId defaultDisplayId);
|
||||
|
||||
Rotation GetDisplayRotation(DisplayId displayId) const;
|
||||
float GetDisplayVirtualPixelRatio(DisplayId displayId) const;
|
||||
std::map<DisplayId, Rect> GetAllDisplayRects() const;
|
||||
Rect GetDisplayRect(DisplayId displayId) const;
|
||||
sptr<DisplayInfo> GetDisplayInfo(DisplayId displayId) const;
|
||||
sptr<DisplayInfo> GetDefaultDisplayInfo() const;
|
||||
void UpdateDisplayInfo(sptr<DisplayInfo> displayInfo) const;
|
||||
std::vector<sptr<DisplayInfo>> GetAllDisplayInfo() const;
|
||||
std::vector<DisplayId> GetAllDisplayIds() const;
|
||||
DisplayId GetLeftDisplayId() const;
|
||||
DisplayId GetRightDisplayId() const;
|
||||
DisplayId GetDefaultDisplayId() const;
|
||||
|
||||
protected:
|
||||
DisplayGroupInfo() = default;
|
||||
~DisplayGroupInfo() = default;
|
||||
|
||||
private:
|
||||
ScreenId displayGroupId_;
|
||||
DisplayId leftDisplayId_ { 0 };
|
||||
DisplayId rightDisplayId_ { 0 };
|
||||
DisplayId defaultDisplayId_ { 0 };
|
||||
DisplayId leftDisplayId_ { 0 }; // the displayId at left in expand-mode
|
||||
DisplayId rightDisplayId_ { 0 }; // the displayId at right in expand-mode
|
||||
mutable std::map<DisplayId, sptr<DisplayInfo>> displayInfosMap_;
|
||||
};
|
||||
} // namespace Rosen
|
||||
|
@ -75,7 +75,6 @@ public:
|
||||
void HandleWindowRemovedOrDestroyed(uint32_t windowId);
|
||||
void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
uint32_t GetActiveWindowId() const;
|
||||
void SetDisplayGroupInfo(sptr<DisplayGroupInfo> displayGroupInfo);
|
||||
void HandleDisplayLimitRectChange(const std::map<DisplayId, Rect>& limitRectMap);
|
||||
void SetInputEventConsumer();
|
||||
|
||||
@ -98,7 +97,6 @@ private:
|
||||
|
||||
sptr<WindowProperty> windowProperty_;
|
||||
sptr<MoveDragProperty> moveDragProperty_;
|
||||
sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
uint32_t activeWindowId_ = INVALID_WINDOW_ID;
|
||||
std::shared_ptr<MMI::PointerEvent> moveEvent_ = nullptr;
|
||||
std::shared_ptr<MMI::IInputEventConsumer> inputListener_ = nullptr;
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
void CompleteFirstFrameDrawing(const wptr<WindowNode> &node);
|
||||
|
||||
void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
void SetDisplayGroupInfo(sptr<DisplayGroupInfo> displayGroupInfo);
|
||||
void NotifyDisplayLimitRectChange(const std::map<DisplayId, Rect>& limitRectMap);
|
||||
bool NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty,
|
||||
sptr<MoveDragProperty>& moveDragProperty);
|
||||
|
@ -40,7 +40,7 @@ enum class DockWindowShowState : uint32_t {
|
||||
class WindowLayoutPolicy : public RefBase {
|
||||
public:
|
||||
WindowLayoutPolicy() = delete;
|
||||
WindowLayoutPolicy(const sptr<DisplayGroupInfo>& displayGroupInfo, DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
WindowLayoutPolicy(DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
~WindowLayoutPolicy() = default;
|
||||
virtual void Launch();
|
||||
virtual void Reorder();
|
||||
@ -111,7 +111,6 @@ protected:
|
||||
Rect displayGroupRect_;
|
||||
Rect displayGroupLimitRect_;
|
||||
bool isMultiDisplay_ = false;
|
||||
sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
mutable std::map<DisplayId, Rect> limitRectMap_;
|
||||
DisplayGroupWindowTree& displayGroupWindowTree_;
|
||||
std::map<DisplayId, Rect> restoringDividerWindowRects_;
|
||||
|
@ -29,8 +29,7 @@ namespace Rosen {
|
||||
class WindowLayoutPolicyCascade : public WindowLayoutPolicy {
|
||||
public:
|
||||
WindowLayoutPolicyCascade() = delete;
|
||||
WindowLayoutPolicyCascade(const sptr<DisplayGroupInfo>& displayGroupInfo,
|
||||
DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
WindowLayoutPolicyCascade(DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
~WindowLayoutPolicyCascade() = default;
|
||||
void Launch() override;
|
||||
void Reorder() override;
|
||||
|
@ -30,8 +30,7 @@ namespace Rosen {
|
||||
class WindowLayoutPolicyTile : public WindowLayoutPolicy {
|
||||
public:
|
||||
WindowLayoutPolicyTile() = delete;
|
||||
WindowLayoutPolicyTile(const sptr<DisplayGroupInfo>& displayGroupInfo,
|
||||
DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
WindowLayoutPolicyTile(DisplayGroupWindowTree& displayGroupWindowTree);
|
||||
~WindowLayoutPolicyTile() = default;
|
||||
void Launch() override;
|
||||
bool IsTileRectSatisfiedWithSizeLimits(const sptr<WindowNode>& node) override;
|
||||
|
@ -59,7 +59,6 @@ public:
|
||||
AvoidArea GetAvoidAreaByType(const sptr<WindowNode>& node, AvoidAreaType avoidAreaType) const;
|
||||
WMError MinimizeStructuredAppWindowsExceptSelf(const sptr<WindowNode>& node);
|
||||
void TraverseContainer(std::vector<sptr<WindowNode>>& windowNodes) const;
|
||||
Rect GetDisplayRect(DisplayId displayId) const;
|
||||
std::unordered_map<WindowType, SystemBarProperty> GetExpectImmersiveProperty(DisplayId id) const;
|
||||
uint32_t GetWindowCountByType(WindowType windowType);
|
||||
uint32_t GetMainFloatingWindowCount();
|
||||
@ -96,10 +95,6 @@ public:
|
||||
void SetMinimizedByOther(bool isMinimizedByOther);
|
||||
void GetModeChangeHotZones(DisplayId displayId,
|
||||
ModeChangeHotZones& hotZones, const ModeChangeHotZonesConfig& config);
|
||||
sptr<DisplayInfo> GetDisplayInfo(DisplayId displayId);
|
||||
void UpdateDisplayInfo(sptr<DisplayInfo> displayInfo);
|
||||
std::vector<sptr<DisplayInfo>> GetAllDisplayInfo();
|
||||
float GetDisplayVirtualPixelRatio(DisplayId displayId) const;
|
||||
|
||||
// parentDisplayId is the same as displayId in single-display mode
|
||||
bool AddNodeOnRSTree(sptr<WindowNode>& node, DisplayId displayId, DisplayId parentDisplayId,
|
||||
@ -204,7 +199,6 @@ private:
|
||||
sptr<WindowLayoutPolicy> layoutPolicy_;
|
||||
sptr<AvoidAreaController> avoidController_;
|
||||
sptr<DisplayGroupController> displayGroupController_;
|
||||
sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
|
||||
// if isFloatWindowHigher_ is true, FloatWindow should be above the full screen window.
|
||||
static bool isFloatWindowAboveFullWindow_;
|
||||
|
@ -40,9 +40,9 @@ public:
|
||||
|
||||
sptr<WindowNodeContainer> GetOrCreateWindowNodeContainer(DisplayId displayId);
|
||||
sptr<WindowNodeContainer> GetWindowNodeContainer(DisplayId displayId);
|
||||
sptr<WindowNodeContainer> CreateWindowNodeContainer(sptr<DisplayInfo> displayInfo);
|
||||
sptr<WindowNodeContainer> CreateWindowNodeContainer(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo);
|
||||
sptr<WindowNode> GetWindowNode(uint32_t windowId) const;
|
||||
void GetBackgroundNodesByScreenId(ScreenId screenGroupId, std::vector<sptr<WindowNode>>& windowNodes) const;
|
||||
void GetBackgroundNodesByScreenId(ScreenId screenGroupId, std::vector<sptr<WindowNode>>& windowNodes);
|
||||
|
||||
WMError SaveWindow(const sptr<WindowNode>& node);
|
||||
void AddDeathRecipient(sptr<WindowNode> node);
|
||||
@ -79,7 +79,6 @@ public:
|
||||
void NotifySystemBarTints();
|
||||
WMError RaiseZOrderForAppWindow(sptr<WindowNode>& node);
|
||||
void FocusFaultDetection() const;
|
||||
float GetVirtualPixelRatio(DisplayId displayId) const;
|
||||
Rect GetDisplayGroupRect(DisplayId displayId) const;
|
||||
WMError UpdateSizeChangeReason(uint32_t windowId, WindowSizeChangeReason reason);
|
||||
void SetBrightness(uint32_t windowId, float brightness);
|
||||
@ -141,7 +140,6 @@ private:
|
||||
ScreenId GetScreenGroupId(DisplayId displayId, bool& isRecordedDisplay);
|
||||
void ProcessExpandDisplayCreate(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo,
|
||||
std::map<DisplayId, Rect>& displayRectMap);
|
||||
std::map<DisplayId, sptr<DisplayInfo>> GetAllDisplayInfos(const std::vector<DisplayId>& displayIdVec);
|
||||
std::map<DisplayId, Rect> GetAllDisplayRectsByDMS(sptr<DisplayInfo> displayInfo);
|
||||
std::map<DisplayId, Rect> GetAllDisplayRectsByDisplayInfo(
|
||||
const std::map<DisplayId, sptr<DisplayInfo>>& displayInfoMap);
|
||||
@ -162,7 +160,6 @@ private:
|
||||
std::shared_ptr<RSOcclusionData> lastOcclusionData_ = std::make_shared<RSOcclusionData>();
|
||||
std::map<ScreenId, sptr<WindowNodeContainer>> windowNodeContainerMap_;
|
||||
std::map<ScreenId, std::vector<DisplayId>> displayIdMap_;
|
||||
|
||||
bool needCheckFocusWindow = false;
|
||||
|
||||
std::map<WindowManagerAgentType, std::vector<sptr<IWindowManagerAgent>>> windowManagerAgents_;
|
||||
|
@ -142,9 +142,10 @@ void DisplayGroupController::ProcessCrossNodes(DisplayId defaultDisplayId, Displ
|
||||
|
||||
void DisplayGroupController::UpdateWindowShowingDisplays(const sptr<WindowNode>& node)
|
||||
{
|
||||
auto leftDisplayId = displayGroupInfo_->GetLeftDisplayId();
|
||||
auto rightDisplayId = displayGroupInfo_->GetRightDisplayId();
|
||||
auto displayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
auto& displayGroupInfo = DisplayGroupInfo::GetInstance();
|
||||
auto leftDisplayId = displayGroupInfo.GetLeftDisplayId();
|
||||
auto rightDisplayId = displayGroupInfo.GetRightDisplayId();
|
||||
auto displayRectMap = displayGroupInfo.GetAllDisplayRects();
|
||||
auto showingDisplays = std::vector<DisplayId>();
|
||||
const auto& winRect = node->GetWindowRect();
|
||||
for (auto& elem : displayRectMap) {
|
||||
@ -193,7 +194,7 @@ void DisplayGroupController::UpdateWindowDisplayIdIfNeeded(const sptr<WindowNode
|
||||
} else {
|
||||
// if more than half width of the window is showing on the display, means the window belongs to this display
|
||||
int32_t halfWidth = static_cast<int32_t>(winRect.width_ * 0.5);
|
||||
const auto& displayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
const auto& displayRectMap = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
for (auto& elem : displayRectMap) {
|
||||
auto& displayRect = elem.second;
|
||||
if ((winRect.posX_ < displayRect.posX_) &&
|
||||
@ -226,7 +227,7 @@ void DisplayGroupController::UpdateWindowDisplayIdIfNeeded(const sptr<WindowNode
|
||||
void DisplayGroupController::ChangeToRectInDisplayGroup(const sptr<WindowNode>& node, DisplayId displayId)
|
||||
{
|
||||
Rect requestRect = node->GetRequestRect();
|
||||
const Rect& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const Rect& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
requestRect.posX_ += displayRect.posX_;
|
||||
requestRect.posY_ += displayRect.posY_;
|
||||
node->SetRequestRect(requestRect);
|
||||
@ -316,8 +317,8 @@ void DisplayGroupController::MoveNotCrossNodeToDefaultDisplay(const sptr<WindowN
|
||||
{
|
||||
WLOGFD("windowId: %{public}d, displayId: %{public}" PRIu64"", node->GetWindowId(), displayId);
|
||||
// update new rect in display group
|
||||
const Rect& srcDisplayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const Rect& dstDisplayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayId_);
|
||||
const Rect& srcDisplayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
const Rect& dstDisplayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(defaultDisplayId_);
|
||||
Rect newRect = node->GetRequestRect();
|
||||
if (node->GetWindowType() == WindowType::WINDOW_TYPE_POINTER) {
|
||||
newRect.posX_ = static_cast<int32_t>(dstDisplayRect.width_ / 2); // default pointerX : displayRect.width / 2
|
||||
@ -399,7 +400,7 @@ void DisplayGroupController::ProcessDisplayCreate(DisplayId defaultDisplayId, sp
|
||||
InitNewDisplay(displayId);
|
||||
|
||||
// add displayInfo in displayGroupInfo
|
||||
displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
DisplayGroupInfo::GetInstance().AddDisplayInfo(displayInfo);
|
||||
|
||||
// modify RSTree and window tree of displayGroup for cross-display nodes
|
||||
ProcessCrossNodes(defaultDisplayId, DisplayStateChangeType::CREATE);
|
||||
@ -416,8 +417,9 @@ void DisplayGroupController::ProcessDisplayDestroy(DisplayId defaultDisplayId, s
|
||||
const std::map<DisplayId, Rect>& displayRectMap,
|
||||
std::vector<uint32_t>& windowIds)
|
||||
{
|
||||
defaultDisplayId_ = defaultDisplayId;
|
||||
DisplayGroupInfo::GetInstance().SetDefaultDisplayId(defaultDisplayId);
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
|
||||
// delete nodes and map element of deleted display
|
||||
ProcessNotCrossNodesOnDestroyedDisplay(displayId, windowIds);
|
||||
// modify RSTree and window tree of displayGroup for cross-display nodes
|
||||
@ -479,12 +481,15 @@ void DisplayGroupController::ProcessDisplayChange(DisplayId defaultDisplayId, sp
|
||||
const std::map<DisplayId, Rect>& displayRectMap,
|
||||
DisplayStateChangeType type)
|
||||
{
|
||||
defaultDisplayId_ = defaultDisplayId;
|
||||
auto& displayGroupInfo = DisplayGroupInfo::GetInstance();
|
||||
displayGroupInfo.SetDefaultDisplayId(defaultDisplayId);
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
WLOGI("display change, displayId: %{public}" PRIu64", type: %{public}d", displayId, type);
|
||||
switch (type) {
|
||||
case DisplayStateChangeType::UPDATE_ROTATION: {
|
||||
displayGroupInfo_->SetDisplayRotation(displayId, displayInfo->GetRotation());
|
||||
displayGroupInfo_->SetDisplayOrientation(displayId, displayInfo->GetDisplayOrientation());
|
||||
displayGroupInfo.SetDisplayRotation(displayId, displayInfo->GetRotation());
|
||||
displayGroupInfo.SetDisplayOrientation(displayId, displayInfo->GetDisplayOrientation());
|
||||
[[fallthrough]];
|
||||
}
|
||||
case DisplayStateChangeType::DISPLAY_COMPRESS:
|
||||
@ -493,7 +498,7 @@ void DisplayGroupController::ProcessDisplayChange(DisplayId defaultDisplayId, sp
|
||||
break;
|
||||
}
|
||||
case DisplayStateChangeType::VIRTUAL_PIXEL_RATIO_CHANGE: {
|
||||
displayGroupInfo_->SetDisplayVirtualPixelRatio(displayId, displayInfo->GetVirtualPixelRatio());
|
||||
displayGroupInfo.SetDisplayVirtualPixelRatio(displayId, displayInfo->GetVirtualPixelRatio());
|
||||
windowNodeContainer_->GetLayoutPolicy()->ProcessDisplayVprChange(displayId);
|
||||
break;
|
||||
}
|
||||
@ -524,7 +529,7 @@ void DisplayGroupController::ClearMapOfDestroyedDisplay(DisplayId displayId)
|
||||
sysBarTintMaps_.erase(displayId);
|
||||
sysBarNodeMaps_.erase(displayId);
|
||||
displayGroupWindowTree_.erase(displayId);
|
||||
displayGroupInfo_->RemoveDisplayInfo(displayId);
|
||||
DisplayGroupInfo::GetInstance().RemoveDisplayInfo(displayId);
|
||||
windowPairMap_.erase(displayId);
|
||||
}
|
||||
|
||||
@ -538,7 +543,7 @@ sptr<WindowPair> DisplayGroupController::GetWindowPairByDisplayId(DisplayId disp
|
||||
|
||||
void DisplayGroupController::ProcessWindowPairWhenDisplayChange(bool rotateDisplay)
|
||||
{
|
||||
for (auto& elem : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& elem : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
const auto& displayId = elem.first;
|
||||
const auto& windowPair = GetWindowPairByDisplayId(displayId);
|
||||
if (windowPair == nullptr) {
|
||||
@ -562,7 +567,7 @@ void DisplayGroupController::ProcessWindowPairWhenDisplayChange(bool rotateDispl
|
||||
|
||||
void DisplayGroupController::SetSplitRatioConfig(const SplitRatioConfig& splitRatioConfig)
|
||||
{
|
||||
for (auto& elem : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& elem : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
const auto& displayId = elem.first;
|
||||
const auto& windowPair = GetWindowPairByDisplayId(displayId);
|
||||
if (windowPair == nullptr) {
|
||||
@ -581,7 +586,7 @@ void DisplayGroupController::UpdateSplitRatioPoints(DisplayId displayId)
|
||||
WLOGFE("WindowPair is nullptr, displayId: %{public}" PRIu64"", displayId);
|
||||
return;
|
||||
}
|
||||
auto displayRects = displayGroupInfo_->GetAllDisplayRects();
|
||||
auto displayRects = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
if (displayRects.find(displayId) == displayRects.end()) {
|
||||
return;
|
||||
}
|
||||
|
@ -23,8 +23,9 @@ namespace Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "DisplayGroupInfo"};
|
||||
}
|
||||
WM_IMPLEMENT_SINGLE_INSTANCE(DisplayGroupInfo)
|
||||
|
||||
DisplayGroupInfo::DisplayGroupInfo(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo)
|
||||
void DisplayGroupInfo::Init(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo)
|
||||
{
|
||||
displayGroupId_ = displayGroupId;
|
||||
AddDisplayInfo(displayInfo);
|
||||
@ -108,6 +109,11 @@ void DisplayGroupInfo::SetDisplayRect(DisplayId displayId, Rect displayRect)
|
||||
displayInfo->SetHeight(displayRect.height_);
|
||||
}
|
||||
|
||||
void DisplayGroupInfo::SetDefaultDisplayId(DisplayId defaultDisplayId)
|
||||
{
|
||||
defaultDisplayId_ = defaultDisplayId;
|
||||
}
|
||||
|
||||
Rotation DisplayGroupInfo::GetDisplayRotation(DisplayId displayId) const
|
||||
{
|
||||
Rotation rotation = Rotation::ROTATION_0;
|
||||
@ -159,6 +165,14 @@ sptr<DisplayInfo> DisplayGroupInfo::GetDisplayInfo(DisplayId displayId) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<DisplayInfo> DisplayGroupInfo::GetDefaultDisplayInfo() const
|
||||
{
|
||||
if (displayInfosMap_.find(defaultDisplayId_) != displayInfosMap_.end()) {
|
||||
return displayInfosMap_[defaultDisplayId_];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DisplayGroupInfo::UpdateDisplayInfo(sptr<DisplayInfo> displayInfo) const
|
||||
{
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
@ -177,6 +191,15 @@ std::vector<sptr<DisplayInfo>> DisplayGroupInfo::GetAllDisplayInfo() const
|
||||
return displayInfos;
|
||||
}
|
||||
|
||||
std::vector<DisplayId> DisplayGroupInfo::GetAllDisplayIds() const
|
||||
{
|
||||
std::vector<DisplayId> displayIds;
|
||||
for (auto& iter : displayInfosMap_) {
|
||||
displayIds.push_back(iter.first);
|
||||
}
|
||||
return displayIds;
|
||||
}
|
||||
|
||||
DisplayId DisplayGroupInfo::GetLeftDisplayId() const
|
||||
{
|
||||
return leftDisplayId_;
|
||||
@ -186,5 +209,10 @@ DisplayId DisplayGroupInfo::GetRightDisplayId() const
|
||||
{
|
||||
return rightDisplayId_;
|
||||
}
|
||||
|
||||
DisplayId DisplayGroupInfo::GetDefaultDisplayId() const
|
||||
{
|
||||
return defaultDisplayId_;
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "display_zoom_controller.h"
|
||||
#include "display_group_info.h"
|
||||
#include "window_helper.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
@ -30,7 +31,7 @@ void DisplayZoomController::SetAnchorAndScale(int32_t x, int32_t y, float scale)
|
||||
} else if (zoomInfo_.scale * scale > DISPLAY_ZOOM_MAX_SCALE) {
|
||||
scale = DISPLAY_ZOOM_MAX_SCALE / zoomInfo_.scale;
|
||||
}
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
sptr<WindowNodeContainer> windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(displayId);
|
||||
if (windowNodeContainer == nullptr) {
|
||||
return;
|
||||
@ -63,7 +64,7 @@ void DisplayZoomController::SetAnchorAndScale(int32_t x, int32_t y, float scale)
|
||||
void DisplayZoomController::SetAnchorOffset(int32_t deltaX, int32_t deltaY)
|
||||
{
|
||||
WLOGFD("DisplayZoom: SetAnchorOffset");
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
sptr<WindowNodeContainer> windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(displayId);
|
||||
if (windowNodeContainer == nullptr) {
|
||||
return;
|
||||
@ -88,7 +89,7 @@ void DisplayZoomController::SetAnchorOffset(int32_t deltaX, int32_t deltaY)
|
||||
void DisplayZoomController::OffWindowZoom()
|
||||
{
|
||||
WLOGFD("DisplayZoom: Off");
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
sptr<WindowNodeContainer> windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(displayId);
|
||||
if (windowNodeContainer == nullptr) {
|
||||
return;
|
||||
@ -110,7 +111,7 @@ void DisplayZoomController::UpdateAllWindowsZoomInfo(DisplayId displayId)
|
||||
if (zoomInfo_.scale == DISPLAY_ZOOM_OFF_SCALE) {
|
||||
return;
|
||||
}
|
||||
DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId defaultDisplayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
if (defaultDisplayId != displayId) {
|
||||
return;
|
||||
}
|
||||
@ -142,7 +143,7 @@ void DisplayZoomController::UpdateWindowZoomInfo(uint32_t windowId)
|
||||
if (!node->currentVisibility_) {
|
||||
return;
|
||||
}
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
if (node->GetDisplayId() != displayId) {
|
||||
return;
|
||||
}
|
||||
@ -191,7 +192,7 @@ bool DisplayZoomController::UpdateZoomTranslateInfo(sptr<WindowNodeContainer> wi
|
||||
deskTop->ComputeTransform();
|
||||
zoomRect = WindowHelper::TransformRect(deskTop->GetWindowProperty()->GetTransformMat(), originalRect);
|
||||
}
|
||||
sptr<DisplayInfo> displayInfo = windowNodeContainer->GetDisplayInfo(displayId);
|
||||
sptr<DisplayInfo> displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(displayId);
|
||||
if (displayInfo == nullptr) {
|
||||
WLOGFE("DisplayZoom: can't get displayInfo");
|
||||
return false;
|
||||
|
@ -249,16 +249,11 @@ void MoveDragController::HandleWindowRemovedOrDestroyed(uint32_t windowId)
|
||||
|
||||
void MoveDragController::ConvertPointerPosToDisplayGroupPos(DisplayId displayId, int32_t& posX, int32_t& posY)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
auto displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
posX += displayRect.posX_;
|
||||
posY += displayRect.posY_;
|
||||
}
|
||||
|
||||
void MoveDragController::SetDisplayGroupInfo(sptr<DisplayGroupInfo> displayGroupInfo)
|
||||
{
|
||||
displayGroupInfo_ = displayGroupInfo;
|
||||
}
|
||||
|
||||
void MoveDragController::HandleDisplayLimitRectChange(const std::map<DisplayId, Rect>& limitRectMap)
|
||||
{
|
||||
limitRectMap_.clear();
|
||||
@ -350,7 +345,7 @@ void MoveDragController::CalculateNewWindowRect(Rect& newRect, DisplayId display
|
||||
int32_t diffX = posX - startPointPosX;
|
||||
int32_t diffY = posY - startPointPosY;
|
||||
|
||||
float vpr = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
float vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
if (MathHelper::NearZero(vpr)) {
|
||||
return;
|
||||
}
|
||||
@ -393,7 +388,7 @@ void MoveDragController::HandleDragEvent(DisplayId displayId, int32_t posX, int3
|
||||
Rect newRect = moveDragProperty_->startPointRect_;
|
||||
CalculateNewWindowRect(newRect, displayId, posX, posY);
|
||||
|
||||
if (!CheckWindowRect(displayId, displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId), newRect)) {
|
||||
if (!CheckWindowRect(displayId, DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId), newRect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <ipc_skeleton.h>
|
||||
#include <ability_manager_client.h>
|
||||
|
||||
#include "display_group_info.h"
|
||||
#include "display_manager_service_inner.h"
|
||||
#include "dm_common.h"
|
||||
#include "window_helper.h"
|
||||
@ -66,7 +67,7 @@ void InputWindowMonitor::UpdateInputWindowByDisplayId(DisplayId displayId)
|
||||
WLOGFE("can not get window node container.");
|
||||
return;
|
||||
}
|
||||
auto displayInfos = container->GetAllDisplayInfo();
|
||||
auto displayInfos = DisplayGroupInfo::GetInstance().GetAllDisplayInfo();
|
||||
if (displayInfos.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <hitrace_meter.h>
|
||||
#include <string>
|
||||
#include <transaction/rs_transaction.h>
|
||||
|
||||
#include "display_group_info.h"
|
||||
#include "minimize_app.h"
|
||||
#include "parameters.h"
|
||||
#include "starting_window.h"
|
||||
@ -309,7 +311,7 @@ void RemoteAnimation::GetExpectRect(const sptr<WindowNode>& dstNode, const sptr<
|
||||
avoidRect.posX_, avoidRect.posY_, avoidRect.width_, avoidRect.height_);
|
||||
if (WindowHelper::IsMainFullScreenWindow(dstNode->GetWindowType(), dstNode->GetWindowMode())) {
|
||||
auto boundsRect = RectF(avoidRect.posX_, avoidRect.posY_, avoidRect.width_, avoidRect.height_);
|
||||
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(dstNode->GetDisplayId());
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(dstNode->GetDisplayId());
|
||||
if (displayInfo && WmsUtils::IsExpectedRotatableWindow(dstNode->GetRequestedOrientation(),
|
||||
displayInfo->GetDisplayOrientation())) {
|
||||
WLOGFD("[FixOrientation] the window is expected rotatable, pre-calculate bounds");
|
||||
@ -665,7 +667,7 @@ sptr<RSWindowAnimationTarget> RemoteAnimation::CreateWindowAnimationTarget(sptr<
|
||||
auto rect = windowNode->GetWindowRect();
|
||||
// 0, 1, 2, 3: convert bounds to RectF
|
||||
auto boundsRect = RectF(rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(windowNode->GetDisplayId());
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(windowNode->GetDisplayId());
|
||||
if (displayInfo && WmsUtils::IsExpectedRotatableWindow(windowNode->GetRequestedOrientation(),
|
||||
displayInfo->GetDisplayOrientation(), windowNode->GetWindowMode())) {
|
||||
WLOGFD("[FixOrientation] the window %{public}u is expected rotatable, pre-calculate bounds, rect:"
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <display_manager_service_inner.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
|
||||
#include "display_group_info.h"
|
||||
#include "remote_animation.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_inner_manager.h"
|
||||
@ -85,7 +87,7 @@ sptr<WindowNode> StartingWindow::CreateWindowNode(const sptr<WindowTransitionInf
|
||||
|
||||
property->SetDisplayId(info->GetDisplayId());
|
||||
property->SetWindowType(info->GetWindowType());
|
||||
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(info->GetDisplayId());
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(info->GetDisplayId());
|
||||
if (!(displayInfo && WmsUtils::IsExpectedRotatableWindow(orientation,
|
||||
displayInfo->GetDisplayOrientation(), property->GetWindowMode()))) {
|
||||
property->AddWindowFlag(WindowFlag::WINDOW_FLAG_NEED_AVOID);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <transaction/rs_transaction.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "display_group_info.h"
|
||||
#include "display_manager_service_inner.h"
|
||||
#include "minimize_app.h"
|
||||
#include "persistent_storage.h"
|
||||
@ -180,7 +181,7 @@ WMError WindowController::GetFocusWindowNode(DisplayId displayId, sptr<WindowNod
|
||||
|
||||
WMError WindowController::GetFocusWindowInfo(sptr<IRemoteObject>& abilityToken)
|
||||
{
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
sptr<WindowNode> windowNode;
|
||||
WMError res = GetFocusWindowNode(displayId, windowNode);
|
||||
if (res == WMError::WM_OK) {
|
||||
@ -250,7 +251,7 @@ WMError WindowController::CreateWindow(sptr<IWindow>& window, sptr<WindowPropert
|
||||
// for system and subwindow
|
||||
WindowSystemEffect::SetWindowEffect(node);
|
||||
WLOGFD("createWindow id:%{public}u", windowId);
|
||||
|
||||
|
||||
node->stateMachine_.SetWindowId(windowId);
|
||||
node->stateMachine_.SetWindowType(property->GetWindowType());
|
||||
return windowRoot_->SaveWindow(node);
|
||||
@ -365,7 +366,7 @@ void WindowController::RelayoutKeyboard(const sptr<WindowNode>& node)
|
||||
};
|
||||
container->TraverseWindowTree(func, true); // FromTopToBottom
|
||||
|
||||
sptr<DisplayInfo> defaultDisplayInfo = DisplayManagerServiceInner::GetInstance().GetDefaultDisplay();
|
||||
sptr<DisplayInfo> defaultDisplayInfo = DisplayGroupInfo::GetInstance().GetDefaultDisplayInfo();
|
||||
if (defaultDisplayInfo == nullptr) {
|
||||
WLOGFE("defaultDisplayInfo is null");
|
||||
return;
|
||||
@ -698,7 +699,7 @@ void WindowController::ProcessDisplayChange(DisplayId defaultDisplayId, sptr<Dis
|
||||
auto windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(displayInfo->GetDisplayId());
|
||||
if (windowNodeContainer != nullptr) {
|
||||
windowNodeContainer->BeforeProcessWindowAvoidAreaChangeWhenDisplayChange();
|
||||
windowNodeContainer->UpdateDisplayInfo(displayInfo);
|
||||
DisplayGroupInfo::GetInstance().UpdateDisplayInfo(displayInfo);
|
||||
}
|
||||
switch (type) {
|
||||
case DisplayStateChangeType::DISPLAY_COMPRESS:
|
||||
@ -785,7 +786,7 @@ void WindowController::StopBootAnimationIfNeed(const sptr<WindowNode>& node)
|
||||
WLOGFE("Node is nullptr");
|
||||
return;
|
||||
}
|
||||
if (node->GetDisplayId() != DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId()) {
|
||||
if (node->GetDisplayId() != DisplayGroupInfo::GetInstance().GetDefaultDisplayId()) {
|
||||
return;
|
||||
}
|
||||
auto windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(node->GetDisplayId());
|
||||
@ -1375,7 +1376,7 @@ WMError WindowController::SetAspectRatio(uint32_t windowId, float ratio)
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
if (!WindowHelper::IsAspectRatioSatisfiedWithSizeLimits(node->GetWindowUpdatedSizeLimits(), ratio,
|
||||
windowRoot_->GetVirtualPixelRatio(node->GetDisplayId()))) {
|
||||
DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId()))) {
|
||||
return WMError::WM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
@ -1560,21 +1561,21 @@ void WindowController::OnScreenshot(DisplayId displayId)
|
||||
void WindowController::SetAnchorOffset(int32_t deltaX, int32_t deltaY)
|
||||
{
|
||||
displayZoomController_->SetAnchorOffset(deltaX, deltaY);
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
FlushWindowInfoWithDisplayId(displayId);
|
||||
}
|
||||
|
||||
void WindowController::OffWindowZoom()
|
||||
{
|
||||
displayZoomController_->OffWindowZoom();
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
FlushWindowInfoWithDisplayId(displayId);
|
||||
}
|
||||
|
||||
void WindowController::SetAnchorAndScale(int32_t x, int32_t y, float scale)
|
||||
{
|
||||
displayZoomController_->SetAnchorAndScale(x, y, scale);
|
||||
DisplayId displayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
DisplayId displayId = DisplayGroupInfo::GetInstance().GetDefaultDisplayId();
|
||||
FlushWindowInfoWithDisplayId(displayId);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "display_manager_service_inner.h"
|
||||
#include "string_ex.h"
|
||||
#include "unique_fd.h"
|
||||
#include "display_group_info.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "window_manager_service.h"
|
||||
#include "wm_common.h"
|
||||
@ -131,7 +132,7 @@ WMError WindowDumper::DumpScreenGroupWindowInfo(ScreenId screenGroupId,
|
||||
WMError WindowDumper::DumpAllWindowInfo(std::string& dumpInfo) const
|
||||
{
|
||||
std::map<ScreenId, sptr<WindowNodeContainer>> windowNodeContainers;
|
||||
std::vector<DisplayId> displayIds = DisplayManagerServiceInner::GetInstance().GetAllDisplayIds();
|
||||
std::vector<DisplayId> displayIds = DisplayGroupInfo::GetInstance().GetAllDisplayIds();
|
||||
for (DisplayId displayId : displayIds) {
|
||||
auto windowNodeContainer = windowRoot_->GetOrCreateWindowNodeContainer(displayId);
|
||||
if (!windowNodeContainer) {
|
||||
|
@ -247,14 +247,6 @@ void WindowInnerManager::SetInputEventConsumer()
|
||||
moveDragController_->SetInputEventConsumer();
|
||||
}
|
||||
|
||||
void WindowInnerManager::SetDisplayGroupInfo(sptr<DisplayGroupInfo> displayGroupInfo)
|
||||
{
|
||||
if (moveDragController_ == nullptr || displayGroupInfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
moveDragController_->SetDisplayGroupInfo(displayGroupInfo);
|
||||
}
|
||||
|
||||
void WindowInnerManager::NotifyDisplayLimitRectChange(const std::map<DisplayId, Rect>& limitRectMap)
|
||||
{
|
||||
if (moveDragController_ == nullptr) {
|
||||
|
@ -32,13 +32,10 @@ namespace {
|
||||
|
||||
uint32_t WindowLayoutPolicy::floatingBottomPosY_ = 0;
|
||||
|
||||
WindowLayoutPolicy::WindowLayoutPolicy(const sptr<DisplayGroupInfo>& displayGroupInfo,
|
||||
DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: displayGroupInfo_(displayGroupInfo), displayGroupWindowTree_(displayGroupWindowTree)
|
||||
WindowLayoutPolicy::WindowLayoutPolicy(DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: displayGroupWindowTree_(displayGroupWindowTree)
|
||||
{
|
||||
if (displayGroupInfo) {
|
||||
limitRectMap_ = displayGroupInfo->GetAllDisplayRects();
|
||||
}
|
||||
limitRectMap_ = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
}
|
||||
|
||||
void WindowLayoutPolicy::Launch()
|
||||
@ -54,7 +51,7 @@ void WindowLayoutPolicy::Reorder()
|
||||
void WindowLayoutPolicy::LimitWindowToBottomRightCorner(const sptr<WindowNode>& node)
|
||||
{
|
||||
Rect windowRect = node->GetRequestRect();
|
||||
Rect displayRect = displayGroupInfo_->GetDisplayRect(node->GetDisplayId());
|
||||
Rect displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(node->GetDisplayId());
|
||||
windowRect.posX_ = std::max(windowRect.posX_, displayRect.posX_);
|
||||
windowRect.posY_ = std::max(windowRect.posY_, displayRect.posY_);
|
||||
windowRect.width_ = std::min(windowRect.width_, displayRect.width_);
|
||||
@ -85,7 +82,7 @@ void WindowLayoutPolicy::UpdateDisplayGroupRect()
|
||||
{
|
||||
Rect newDisplayGroupRect = { 0, 0, 0, 0 };
|
||||
// current multi-display is only support left-right combination, maxNum is two
|
||||
for (auto& elem : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& elem : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
newDisplayGroupRect.posX_ = std::min(displayGroupRect_.posX_, elem.second.posX_);
|
||||
newDisplayGroupRect.posY_ = std::min(displayGroupRect_.posY_, elem.second.posY_);
|
||||
newDisplayGroupRect.width_ += elem.second.width_;
|
||||
@ -148,7 +145,7 @@ bool WindowLayoutPolicy::IsMultiDisplay()
|
||||
|
||||
void WindowLayoutPolicy::UpdateMultiDisplayFlag()
|
||||
{
|
||||
if (displayGroupInfo_->GetAllDisplayRects().size() > 1) {
|
||||
if (DisplayGroupInfo::GetInstance().GetAllDisplayIds().size() > 1) {
|
||||
isMultiDisplay_ = true;
|
||||
WLOGFD("Current mode is multi-display");
|
||||
} else {
|
||||
@ -187,20 +184,20 @@ void WindowLayoutPolicy::UpdateDisplayRectAndDisplayGroupInfo(const std::map<Dis
|
||||
for (auto& elem : displayRectMap) {
|
||||
auto& displayId = elem.first;
|
||||
auto& displayRect = elem.second;
|
||||
displayGroupInfo_->SetDisplayRect(displayId, displayRect);
|
||||
DisplayGroupInfo::GetInstance().SetDisplayRect(displayId, displayRect);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowLayoutPolicy::PostProcessWhenDisplayChange()
|
||||
{
|
||||
displayGroupInfo_->UpdateLeftAndRightDisplayId();
|
||||
DisplayGroupInfo::GetInstance().UpdateLeftAndRightDisplayId();
|
||||
UpdateMultiDisplayFlag();
|
||||
Launch();
|
||||
}
|
||||
|
||||
void WindowLayoutPolicy::ProcessDisplayCreate(DisplayId displayId, const std::map<DisplayId, Rect>& displayRectMap)
|
||||
{
|
||||
const auto& oriDisplayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
const auto& oriDisplayRectMap = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
// check displayId and displayRectMap size
|
||||
if (oriDisplayRectMap.find(displayId) == oriDisplayRectMap.end() ||
|
||||
displayRectMap.size() != oriDisplayRectMap.size()) {
|
||||
@ -227,7 +224,7 @@ void WindowLayoutPolicy::ProcessDisplayCreate(DisplayId displayId, const std::ma
|
||||
|
||||
void WindowLayoutPolicy::ProcessDisplayDestroy(DisplayId displayId, const std::map<DisplayId, Rect>& displayRectMap)
|
||||
{
|
||||
const auto& oriDisplayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
const auto& oriDisplayRectMap = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
// check displayId and displayRectMap size
|
||||
if (oriDisplayRectMap.find(displayId) != oriDisplayRectMap.end() ||
|
||||
displayRectMap.size() != oriDisplayRectMap.size()) {
|
||||
@ -258,7 +255,7 @@ void WindowLayoutPolicy::ProcessDisplayDestroy(DisplayId displayId, const std::m
|
||||
void WindowLayoutPolicy::ProcessDisplaySizeChangeOrRotation(DisplayId displayId,
|
||||
const std::map<DisplayId, Rect>& displayRectMap)
|
||||
{
|
||||
const auto& oriDisplayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
const auto& oriDisplayRectMap = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
// check displayId and displayRectMap size
|
||||
if (oriDisplayRectMap.find(displayId) == oriDisplayRectMap.end() ||
|
||||
displayRectMap.size() != oriDisplayRectMap.size()) {
|
||||
@ -326,7 +323,7 @@ void WindowLayoutPolicy::NotifyAnimationSizeChangeIfNeeded()
|
||||
void WindowLayoutPolicy::LayoutWindowTree(DisplayId displayId)
|
||||
{
|
||||
// reset limit rect
|
||||
limitRectMap_[displayId] = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
limitRectMap_[displayId] = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
displayGroupLimitRect_ = displayGroupRect_;
|
||||
|
||||
// ensure that the avoid area windows are traversed first
|
||||
@ -364,7 +361,8 @@ void WindowLayoutPolicy::LayoutWindowNode(const sptr<WindowNode>& node)
|
||||
|
||||
bool WindowLayoutPolicy::IsVerticalDisplay(DisplayId displayId) const
|
||||
{
|
||||
return displayGroupInfo_->GetDisplayRect(displayId).width_ < displayGroupInfo_->GetDisplayRect(displayId).height_;
|
||||
return DisplayGroupInfo::GetInstance().GetDisplayRect(displayId).width_ <
|
||||
DisplayGroupInfo::GetInstance().GetDisplayRect(displayId).height_;
|
||||
}
|
||||
|
||||
void WindowLayoutPolicy::NotifyClientAndAnimation(const sptr<WindowNode>& node,
|
||||
@ -397,7 +395,7 @@ Rect WindowLayoutPolicy::CalcEntireWindowHotZone(const sptr<WindowNode>& node, c
|
||||
rect.height_ += (hotZoneY + hotZoneY);
|
||||
}
|
||||
} else if (node->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT) {
|
||||
rect = displayGroupInfo_->GetDisplayRect(node->GetDisplayId());
|
||||
rect = DisplayGroupInfo::GetInstance().GetDisplayRect(node->GetDisplayId());
|
||||
} else if (WindowHelper::IsMainFloatingWindow(node->GetWindowType(), node->GetWindowMode())) {
|
||||
rect.posX_ -= static_cast<int32_t>(hotZoneX);
|
||||
rect.posY_ -= static_cast<int32_t>(hotZoneY);
|
||||
@ -409,7 +407,7 @@ Rect WindowLayoutPolicy::CalcEntireWindowHotZone(const sptr<WindowNode>& node, c
|
||||
|
||||
void WindowLayoutPolicy::CalcAndSetNodeHotZone(const Rect& winRect, const sptr<WindowNode>& node) const
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
TransformHelper::Vector2 hotZoneScale(1, 1);
|
||||
if (node->GetWindowProperty()->isNeedComputerTransform()) {
|
||||
node->ComputeTransform();
|
||||
@ -478,8 +476,8 @@ WindowSizeLimits WindowLayoutPolicy::GetSystemSizeLimits(const sptr<WindowNode>&
|
||||
|
||||
void WindowLayoutPolicy::UpdateWindowSizeLimits(const sptr<WindowNode>& node)
|
||||
{
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(node->GetDisplayId());
|
||||
const auto& virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(node->GetDisplayId());
|
||||
const auto& virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
const auto& systemLimits = GetSystemSizeLimits(node, displayRect, virtualPixelRatio);
|
||||
const auto& customizedLimits = node->GetWindowSizeLimits();
|
||||
|
||||
@ -533,12 +531,12 @@ void WindowLayoutPolicy::UpdateWindowSizeLimits(const sptr<WindowNode>& node)
|
||||
|
||||
AvoidPosType WindowLayoutPolicy::GetAvoidPosType(const Rect& rect, DisplayId displayId) const
|
||||
{
|
||||
const auto& displayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
const auto& displayRectMap = DisplayGroupInfo::GetInstance().GetAllDisplayRects();
|
||||
if (displayRectMap.find(displayId) == std::end(displayRectMap)) {
|
||||
WLOGFE("GetAvoidPosType fail. Get display fail. displayId: %{public}" PRIu64"", displayId);
|
||||
return AvoidPosType::AVOID_POS_UNKNOWN;
|
||||
}
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
return WindowHelper::GetAvoidPosType(rect, displayRect);
|
||||
}
|
||||
|
||||
@ -626,8 +624,7 @@ static void AdjustFixedOrientationRSSurfaceNode(const sptr<WindowNode>& node, co
|
||||
surfaceNode->SetRotation(rotation);
|
||||
}
|
||||
|
||||
static void SetBounds(const sptr<WindowNode>& node, const Rect& winRect, const Rect& preRect,
|
||||
sptr<DisplayGroupInfo> displayGroupInfo)
|
||||
static void SetBounds(const sptr<WindowNode>& node, const Rect& winRect, const Rect& preRect)
|
||||
{
|
||||
if (node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT ||
|
||||
node->GetWindowSizeChangeReason() == WindowSizeChangeReason::TRANSFORM) {
|
||||
@ -650,6 +647,7 @@ static void SetBounds(const sptr<WindowNode>& node, const Rect& winRect, const R
|
||||
"winRect: [%{public}d, %{public}d, %{public}d, %{public}d], %{public}u", node->GetWindowName().c_str(),
|
||||
node->GetWindowId(), preRect.posX_, preRect.posY_, preRect.width_, preRect.height_,
|
||||
winRect.posX_, winRect.posY_, winRect.width_, winRect.height_, node->GetWindowSizeChangeReason());
|
||||
auto& displayGroupInfo = DisplayGroupInfo::GetInstance();
|
||||
if (node->leashWinSurfaceNode_) {
|
||||
if (winRect != preRect) {
|
||||
// avoid animation interpreted when client coming
|
||||
@ -662,25 +660,24 @@ static void SetBounds(const sptr<WindowNode>& node, const Rect& winRect, const R
|
||||
node->surfaceNode_->SetBounds(0, 0, winRect.width_, winRect.height_);
|
||||
}
|
||||
AdjustFixedOrientationRSSurfaceNode(node, winRect, node->leashWinSurfaceNode_,
|
||||
displayGroupInfo->GetDisplayInfo(node->GetDisplayId()));
|
||||
displayGroupInfo.GetDisplayInfo(node->GetDisplayId()));
|
||||
} else if (node->surfaceNode_) {
|
||||
node->surfaceNode_->SetBounds(winRect.posX_, winRect.posY_, winRect.width_, winRect.height_);
|
||||
AdjustFixedOrientationRSSurfaceNode(node, winRect, node->surfaceNode_,
|
||||
displayGroupInfo->GetDisplayInfo(node->GetDisplayId()));
|
||||
displayGroupInfo.GetDisplayInfo(node->GetDisplayId()));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowLayoutPolicy::UpdateSurfaceBounds(const sptr<WindowNode>& node, const Rect& winRect, const Rect& preRect)
|
||||
{
|
||||
wptr<WindowNode> weakNode = node;
|
||||
wptr<DisplayGroupInfo> displayGroupInfo = displayGroupInfo_;
|
||||
auto SetBoundsFunc = [weakNode, winRect, preRect, displayGroupInfo]() {
|
||||
auto SetBoundsFunc = [weakNode, winRect, preRect]() {
|
||||
auto winNode = weakNode.promote();
|
||||
if (winNode == nullptr) {
|
||||
WLOGI("winNode is nullptr");
|
||||
return;
|
||||
}
|
||||
SetBounds(winNode, winRect, preRect, displayGroupInfo.promote());
|
||||
SetBounds(winNode, winRect, preRect);
|
||||
};
|
||||
|
||||
switch (node->GetWindowSizeChangeReason()) {
|
||||
@ -764,8 +761,8 @@ void WindowLayoutPolicy::GetStoragedAspectRatio(const sptr<WindowNode>& node)
|
||||
void WindowLayoutPolicy::FixWindowRectWithinDisplay(const sptr<WindowNode>& node) const
|
||||
{
|
||||
auto displayId = node->GetDisplayId();
|
||||
const Rect& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
auto displayInfo = displayGroupInfo_->GetDisplayInfo(displayId);
|
||||
const Rect& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(displayId);
|
||||
auto type = node->GetWindowType();
|
||||
Rect rect = node->GetRequestRect();
|
||||
switch (type) {
|
||||
|
@ -31,9 +31,8 @@ namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "Cascade"};
|
||||
}
|
||||
|
||||
WindowLayoutPolicyCascade::WindowLayoutPolicyCascade(const sptr<DisplayGroupInfo>& displayGroupInfo,
|
||||
DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: WindowLayoutPolicy(displayGroupInfo, displayGroupWindowTree)
|
||||
WindowLayoutPolicyCascade::WindowLayoutPolicyCascade(DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: WindowLayoutPolicy(displayGroupWindowTree)
|
||||
{
|
||||
CascadeRects cascadeRects {
|
||||
.primaryRect_ = {0, 0, 0, 0},
|
||||
@ -41,7 +40,7 @@ WindowLayoutPolicyCascade::WindowLayoutPolicyCascade(const sptr<DisplayGroupInfo
|
||||
.dividerRect_ = {0, 0, 0, 0},
|
||||
.defaultCascadeRect_ = {0, 0, 0, 0},
|
||||
};
|
||||
for (auto& iter : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& iter : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
cascadeRectsMap_.insert(std::make_pair(iter.first, cascadeRects));
|
||||
}
|
||||
}
|
||||
@ -55,7 +54,7 @@ void WindowLayoutPolicyCascade::Launch()
|
||||
void WindowLayoutPolicyCascade::Reorder()
|
||||
{
|
||||
WLOGFD("Cascade reorder start");
|
||||
for (auto& iter : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& iter : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
DisplayId displayId = iter.first;
|
||||
Rect rect = cascadeRectsMap_[displayId].defaultCascadeRect_;
|
||||
bool isFirstReorderedWindow = true;
|
||||
@ -98,7 +97,7 @@ void WindowLayoutPolicyCascade::Reorder()
|
||||
void WindowLayoutPolicyCascade::InitAllRects()
|
||||
{
|
||||
UpdateDisplayGroupRect();
|
||||
for (auto& iter : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& iter : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
auto displayId = iter.first;
|
||||
InitSplitRects(displayId);
|
||||
LayoutWindowTree(displayId);
|
||||
@ -252,8 +251,8 @@ void WindowLayoutPolicyCascade::InitCascadeRect(DisplayId displayId)
|
||||
* Calculate default width and height, if width or height is
|
||||
* smaller than minWidth or minHeight, use the minimum limits
|
||||
*/
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
auto vpr = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
auto vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
uint32_t defaultW = std::max(static_cast<uint32_t>(displayRect.width_ * ratio),
|
||||
static_cast<uint32_t>(MIN_FLOATING_WIDTH * vpr));
|
||||
uint32_t defaultH = std::max(static_cast<uint32_t>(displayRect.height_ * ratio),
|
||||
@ -277,7 +276,7 @@ bool WindowLayoutPolicyCascade::CheckAspectRatioBySizeLimits(const sptr<WindowNo
|
||||
{
|
||||
// get new limit config with the settings of system and app
|
||||
const auto& sizeLimits = node->GetWindowUpdatedSizeLimits();
|
||||
float vpr = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t winFrameW = static_cast<uint32_t>(WINDOW_FRAME_WIDTH * vpr) * 2; // 2 mean double decor width
|
||||
uint32_t winFrameH = static_cast<uint32_t>(WINDOW_FRAME_WIDTH * vpr) +
|
||||
static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * vpr); // decor height
|
||||
@ -317,7 +316,7 @@ void WindowLayoutPolicyCascade::ComputeRectByAspectRatio(const sptr<WindowNode>&
|
||||
return;
|
||||
}
|
||||
|
||||
float vpr = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t winFrameW = static_cast<uint32_t>(WINDOW_FRAME_WIDTH * vpr) * 2; // 2 mean double decor width
|
||||
uint32_t winFrameH = static_cast<uint32_t>(WINDOW_FRAME_WIDTH * vpr) +
|
||||
static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * vpr); // decor height
|
||||
@ -374,7 +373,7 @@ void WindowLayoutPolicyCascade::ComputeDecoratedRequestRect(const sptr<WindowNod
|
||||
return;
|
||||
}
|
||||
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t winFrameW = static_cast<uint32_t>(WINDOW_FRAME_WIDTH * virtualPixelRatio);
|
||||
uint32_t winTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
|
||||
@ -437,8 +436,8 @@ void WindowLayoutPolicyCascade::UpdateLayoutRect(const sptr<WindowNode>& node)
|
||||
break;
|
||||
case WindowMode::WINDOW_MODE_FULLSCREEN: {
|
||||
bool needAvoid = (node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
|
||||
winRect = needAvoid ? limitRectMap_[displayId] : displayGroupInfo_->GetDisplayRect(displayId);
|
||||
auto displayInfo = displayGroupInfo_->GetDisplayInfo(displayId);
|
||||
winRect = needAvoid ? limitRectMap_[displayId] : DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(displayId);
|
||||
if (displayInfo && WmsUtils::IsExpectedRotatableWindow(node->GetRequestedOrientation(),
|
||||
displayInfo->GetDisplayOrientation())) {
|
||||
WLOGFD("[FixOrientation] the window is expected rotatable, pre-calculated");
|
||||
@ -492,10 +491,10 @@ void WindowLayoutPolicyCascade::LimitDividerPositionBySplitRatio(DisplayId displ
|
||||
|
||||
void WindowLayoutPolicyCascade::InitSplitRects(DisplayId displayId)
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
uint32_t dividerWidth = static_cast<uint32_t>(DIVIDER_WIDTH * virtualPixelRatio);
|
||||
auto& dividerRect = cascadeRectsMap_[displayId].dividerRect_;
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
if (!IsVerticalDisplay(displayId)) {
|
||||
dividerRect = { static_cast<uint32_t>((displayRect.width_ - dividerWidth) * DEFAULT_SPLIT_RATIO), 0,
|
||||
dividerWidth, displayRect.height_ };
|
||||
@ -511,7 +510,7 @@ void WindowLayoutPolicyCascade::SetSplitRectByDivider(const Rect& divRect, Displ
|
||||
auto& dividerRect = cascadeRectsMap_[displayId].dividerRect_;
|
||||
auto& primaryRect = cascadeRectsMap_[displayId].primaryRect_;
|
||||
auto& secondaryRect = cascadeRectsMap_[displayId].secondaryRect_;
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
|
||||
dividerRect.width_ = divRect.width_;
|
||||
dividerRect.height_ = divRect.height_;
|
||||
@ -580,7 +579,7 @@ Rect WindowLayoutPolicyCascade::GetCurCascadeRect(const sptr<WindowNode>& node)
|
||||
|
||||
Rect WindowLayoutPolicyCascade::StepCascadeRect(Rect rect, DisplayId displayId) const
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
uint32_t cascadeWidth = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
uint32_t cascadeHeight = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
|
||||
@ -651,7 +650,7 @@ DockWindowShowState WindowLayoutPolicyCascade::GetDockWindowShowState(DisplayId
|
||||
}
|
||||
|
||||
dockWinRect = node->GetWindowRect();
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
auto displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
WLOGI("begin dockWinRect :[%{public}d, %{public}d, %{public}u, %{public}u]",
|
||||
dockWinRect.posX_, dockWinRect.posY_, dockWinRect.width_, dockWinRect.height_);
|
||||
if (dockWinRect.height_ < dockWinRect.width_) {
|
||||
@ -679,7 +678,7 @@ void WindowLayoutPolicyCascade::LimitFloatingWindowSize(const sptr<WindowNode>&
|
||||
return;
|
||||
}
|
||||
Rect oriWinRect = winRect;
|
||||
const Rect& displayRect = displayGroupInfo_->GetDisplayRect(node->GetDisplayId());
|
||||
const Rect& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(node->GetDisplayId());
|
||||
UpdateFloatingWindowSizeBySizeLimits(node, displayRect, winRect);
|
||||
UpdateFloatingWindowSizeForStretchableWindow(node, displayRect, winRect);
|
||||
|
||||
@ -761,7 +760,7 @@ void WindowLayoutPolicyCascade::FixWindowSizeByRatioIfDragBeyondLimitRegion(cons
|
||||
return;
|
||||
}
|
||||
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
Rect limitRect = (node->isShowingOnMultiDisplays_) ? displayGroupLimitRect_ : limitRectMap_[node->GetDisplayId()];
|
||||
int32_t limitMinPosX = limitRect.posX_ + static_cast<int32_t>(windowTitleBarH);
|
||||
@ -879,7 +878,7 @@ void WindowLayoutPolicyCascade::FixWindowRectWhenDrag(const sptr<WindowNode>& no
|
||||
|
||||
void WindowLayoutPolicyCascade::LimitWindowPositionWhenDrag(const sptr<WindowNode>& node, Rect& winRect) const
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
const Rect& lastRect = node->GetWindowRect();
|
||||
Rect oriWinRect = winRect;
|
||||
@ -936,7 +935,7 @@ void WindowLayoutPolicyCascade::LimitWindowPositionWhenDrag(const sptr<WindowNod
|
||||
|
||||
void WindowLayoutPolicyCascade::LimitWindowPositionWhenInitRectOrMove(const sptr<WindowNode>& node, Rect& winRect) const
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
|
||||
// if is cross-display window, the limit rect should be full limitRect
|
||||
|
@ -31,15 +31,14 @@ namespace {
|
||||
constexpr uint32_t MID_INTERVAL = 24;
|
||||
}
|
||||
|
||||
WindowLayoutPolicyTile::WindowLayoutPolicyTile(const sptr<DisplayGroupInfo>& displayGroupInfo,
|
||||
DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: WindowLayoutPolicy(displayGroupInfo, displayGroupWindowTree)
|
||||
WindowLayoutPolicyTile::WindowLayoutPolicyTile(DisplayGroupWindowTree& displayGroupWindowTree)
|
||||
: WindowLayoutPolicy(displayGroupWindowTree)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowLayoutPolicyTile::Launch()
|
||||
{
|
||||
for (auto& iter : displayGroupInfo_->GetAllDisplayRects()) {
|
||||
for (auto& iter : DisplayGroupInfo::GetInstance().GetAllDisplayRects()) {
|
||||
const auto& displayId = iter.first;
|
||||
/*
|
||||
* Init tile rects and layout tile queue
|
||||
@ -61,7 +60,7 @@ void WindowLayoutPolicyTile::Launch()
|
||||
|
||||
uint32_t WindowLayoutPolicyTile::GetMaxTileWinNum(DisplayId displayId) const
|
||||
{
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
constexpr uint32_t half = 2;
|
||||
uint32_t edgeIntervalVp = static_cast<uint32_t>(EDGE_INTERVAL * half * virtualPixelRatio);
|
||||
uint32_t midIntervalVp = static_cast<uint32_t>(MID_INTERVAL * virtualPixelRatio);
|
||||
@ -73,14 +72,14 @@ uint32_t WindowLayoutPolicyTile::GetMaxTileWinNum(DisplayId displayId) const
|
||||
void WindowLayoutPolicyTile::InitTileRects(DisplayId displayId)
|
||||
{
|
||||
// TileLayout don't consider limitRect yet, limitDisplay equals to displayRect
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
if (WindowHelper::IsEmptyRect(displayRect)) {
|
||||
WLOGFE("DisplayRect is empty, displayRect: %{public}" PRIu64"", displayId);
|
||||
return;
|
||||
}
|
||||
|
||||
limitRectMap_[displayId] = displayRect;
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
float virtualPixelRatio = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(displayId);
|
||||
uint32_t edgeIntervalVp = static_cast<uint32_t>(EDGE_INTERVAL * virtualPixelRatio);
|
||||
uint32_t midIntervalVp = static_cast<uint32_t>(MID_INTERVAL * virtualPixelRatio);
|
||||
|
||||
@ -356,7 +355,7 @@ void WindowLayoutPolicyTile::UpdateLayoutRect(const sptr<WindowNode>& node)
|
||||
winRect.posX_, winRect.posY_, winRect.width_, winRect.height_);
|
||||
|
||||
if (!floatingWindow) { // fullscreen window
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(node->GetDisplayId());
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(node->GetDisplayId());
|
||||
const auto& limitDisplayRect = limitRectMap_[node->GetDisplayId()];
|
||||
winRect = needAvoid ? limitDisplayRect : displayRect;
|
||||
}
|
||||
|
@ -57,20 +57,20 @@ namespace {
|
||||
AnimationConfig WindowNodeContainer::animationConfig_;
|
||||
bool WindowNodeContainer::isFloatWindowAboveFullWindow_ = false;
|
||||
uint32_t WindowNodeContainer::maxMainFloatingWindowNumber_ = 100;
|
||||
|
||||
|
||||
WindowNodeContainer::WindowNodeContainer(const sptr<DisplayInfo>& displayInfo, ScreenId displayGroupId)
|
||||
{
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
|
||||
// create and displayGroupInfo and displayGroupController
|
||||
displayGroupInfo_ = new DisplayGroupInfo(displayGroupId, displayInfo);
|
||||
displayGroupController_ = new DisplayGroupController(this, displayGroupInfo_);
|
||||
DisplayGroupInfo::GetInstance().Init(displayGroupId, displayInfo);
|
||||
displayGroupController_ = new DisplayGroupController(this);
|
||||
displayGroupController_->InitNewDisplay(displayId);
|
||||
|
||||
// init layout policy
|
||||
layoutPolicies_[WindowLayoutMode::CASCADE] = new WindowLayoutPolicyCascade(displayGroupInfo_,
|
||||
displayGroupController_->displayGroupWindowTree_);
|
||||
layoutPolicies_[WindowLayoutMode::TILE] = new WindowLayoutPolicyTile(displayGroupInfo_,
|
||||
layoutPolicies_[WindowLayoutMode::CASCADE] = new WindowLayoutPolicyCascade(
|
||||
displayGroupController_->displayGroupWindowTree_);
|
||||
layoutPolicies_[WindowLayoutMode::TILE] = new WindowLayoutPolicyTile(
|
||||
displayGroupController_->displayGroupWindowTree_);
|
||||
layoutPolicy_ = layoutPolicies_[WindowLayoutMode::CASCADE];
|
||||
layoutPolicy_->Launch();
|
||||
@ -84,8 +84,8 @@ WindowNodeContainer::WindowNodeContainer(const sptr<DisplayInfo>& displayInfo, S
|
||||
|
||||
// init avoidAreaController
|
||||
avoidController_ = new AvoidAreaController(focusedWindow_);
|
||||
WindowInnerManager::GetInstance().SetDisplayGroupInfo(displayGroupInfo_);
|
||||
WindowInnerManager::GetInstance().NotifyDisplayLimitRectChange(displayGroupInfo_->GetAllDisplayRects());
|
||||
WindowInnerManager::GetInstance().NotifyDisplayLimitRectChange(
|
||||
DisplayGroupInfo::GetInstance().GetAllDisplayRects());
|
||||
}
|
||||
|
||||
WindowNodeContainer::~WindowNodeContainer()
|
||||
@ -1107,7 +1107,7 @@ std::unordered_map<WindowType, SystemBarProperty> WindowNodeContainer::GetExpect
|
||||
}
|
||||
if (WindowHelper::IsFullScreenWindow((*iter)->GetWindowMode())
|
||||
&& (*iter)->GetWindowType() != WindowType::WINDOW_TYPE_PANEL) {
|
||||
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(id);
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(id);
|
||||
if (displayInfo && WmsUtils::IsExpectedRotateLandscapeWindow((*iter)->GetRequestedOrientation(),
|
||||
displayInfo->GetDisplayOrientation())) {
|
||||
WLOGFI("Horizontal window id: %{public}d make it immersive", (*iter)->GetWindowId());
|
||||
@ -1471,14 +1471,10 @@ void WindowNodeContainer::DumpScreenWindowTree()
|
||||
WLOGD("------ dump window info end -------");
|
||||
}
|
||||
|
||||
Rect WindowNodeContainer::GetDisplayRect(DisplayId displayId) const
|
||||
{
|
||||
return displayGroupInfo_->GetDisplayRect(displayId);
|
||||
}
|
||||
|
||||
bool WindowNodeContainer::IsVerticalDisplay(DisplayId displayId) const
|
||||
{
|
||||
return displayGroupInfo_->GetDisplayRect(displayId).width_ < displayGroupInfo_->GetDisplayRect(displayId).height_;
|
||||
return DisplayGroupInfo::GetInstance().GetDisplayRect(displayId).width_ <
|
||||
DisplayGroupInfo::GetInstance().GetDisplayRect(displayId).height_;
|
||||
}
|
||||
|
||||
void WindowNodeContainer::ProcessWindowStateChange(WindowState state, WindowStateChangeReason reason)
|
||||
@ -1881,7 +1877,7 @@ void WindowNodeContainer::BackUpAllAppWindows()
|
||||
void WindowNodeContainer::RestoreAllAppWindows(std::function<bool(uint32_t, WindowMode)> restoreFunc)
|
||||
{
|
||||
std::vector<uint32_t> backupWindowIds(backupWindowIds_);
|
||||
auto displayIds = DisplayManagerServiceInner::GetInstance().GetAllDisplayIds();
|
||||
auto displayIds = DisplayGroupInfo::GetInstance().GetAllDisplayIds();
|
||||
std::vector<sptr<WindowPair>> windowPairs;
|
||||
for (auto displayId : displayIds) {
|
||||
auto windowPair = displayGroupController_->GetWindowPairByDisplayId(displayId);
|
||||
@ -2235,7 +2231,7 @@ WMError WindowNodeContainer::SetWindowMode(sptr<WindowNode>& node, WindowMode ds
|
||||
NotifyDockWindowStateChanged(node, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (node->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN &&
|
||||
WindowHelper::IsAppWindow(node->GetWindowType())) {
|
||||
// minimize other app window.
|
||||
@ -2299,7 +2295,7 @@ void WindowNodeContainer::ResetWindowZOrderPriorityWhenSetMode(sptr<WindowNode>&
|
||||
void WindowNodeContainer::GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones,
|
||||
const ModeChangeHotZonesConfig& config)
|
||||
{
|
||||
const auto& displayRect = displayGroupInfo_->GetDisplayRect(displayId);
|
||||
const auto& displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
|
||||
hotZones.fullscreen_.width_ = displayRect.width_;
|
||||
hotZones.fullscreen_.height_ = config.fullscreenRange_;
|
||||
@ -2312,26 +2308,6 @@ void WindowNodeContainer::GetModeChangeHotZones(DisplayId displayId, ModeChangeH
|
||||
hotZones.secondary_.height_ = displayRect.height_;
|
||||
}
|
||||
|
||||
float WindowNodeContainer::GetDisplayVirtualPixelRatio(DisplayId displayId) const
|
||||
{
|
||||
return displayGroupInfo_->GetDisplayVirtualPixelRatio(displayId);
|
||||
}
|
||||
|
||||
sptr<DisplayInfo> WindowNodeContainer::GetDisplayInfo(DisplayId displayId)
|
||||
{
|
||||
return displayGroupInfo_->GetDisplayInfo(displayId);
|
||||
}
|
||||
|
||||
void WindowNodeContainer::UpdateDisplayInfo(sptr<DisplayInfo> displayInfo)
|
||||
{
|
||||
displayGroupInfo_->UpdateDisplayInfo(displayInfo);
|
||||
}
|
||||
|
||||
std::vector<sptr<DisplayInfo>> WindowNodeContainer::GetAllDisplayInfo()
|
||||
{
|
||||
return displayGroupInfo_->GetAllDisplayInfo();
|
||||
}
|
||||
|
||||
void WindowNodeContainer::UpdateCameraFloatWindowStatus(const sptr<WindowNode>& node, bool isShowing)
|
||||
{
|
||||
if (node->GetWindowType() == WindowType::WINDOW_TYPE_FLOAT_CAMERA) {
|
||||
|
@ -78,7 +78,8 @@ sptr<WindowNodeContainer> WindowRoot::GetOrCreateWindowNodeContainer(DisplayId d
|
||||
// In case of have no container for default display, create container
|
||||
WLOGI("Create container for current display, displayId: %{public}" PRIu64 "", displayId);
|
||||
sptr<DisplayInfo> displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(displayId);
|
||||
return CreateWindowNodeContainer(displayInfo);
|
||||
DisplayId defaultDisplayId = DisplayManagerServiceInner::GetInstance().GetDefaultDisplayId();
|
||||
return CreateWindowNodeContainer(defaultDisplayId, displayInfo);
|
||||
}
|
||||
|
||||
sptr<WindowNodeContainer> WindowRoot::GetWindowNodeContainer(DisplayId displayId)
|
||||
@ -101,13 +102,15 @@ sptr<WindowNodeContainer> WindowRoot::GetWindowNodeContainer(DisplayId displayId
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sptr<WindowNodeContainer> WindowRoot::CreateWindowNodeContainer(sptr<DisplayInfo> displayInfo)
|
||||
sptr<WindowNodeContainer> WindowRoot::CreateWindowNodeContainer(DisplayId defaultDisplayId,
|
||||
sptr<DisplayInfo> displayInfo)
|
||||
{
|
||||
if (displayInfo == nullptr || !CheckDisplayInfo(displayInfo)) {
|
||||
WLOGFE("get display failed or get invalid display info");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DisplayGroupInfo::GetInstance().SetDefaultDisplayId(defaultDisplayId);
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
ScreenId displayGroupId = displayInfo->GetScreenGroupId();
|
||||
WLOGI("create new container for display, width: %{public}d, height: %{public}d, "
|
||||
@ -147,11 +150,22 @@ sptr<WindowNode> WindowRoot::GetWindowNode(uint32_t windowId) const
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
void WindowRoot::GetBackgroundNodesByScreenId(ScreenId screenGroupId, std::vector<sptr<WindowNode>>& windowNodes) const
|
||||
void WindowRoot::GetBackgroundNodesByScreenId(ScreenId screenGroupId, std::vector<sptr<WindowNode>>& windowNodes)
|
||||
{
|
||||
for (const auto& it : windowNodeMap_) {
|
||||
if (it.second && screenGroupId == DisplayManagerServiceInner::GetInstance().GetScreenGroupIdByDisplayId(
|
||||
it.second->GetDisplayId()) && !it.second->currentVisibility_) {
|
||||
wptr<WindowNodeContainer> container = GetWindowNodeContainer(it.second->GetDisplayId());
|
||||
if (container == nullptr) {
|
||||
continue;
|
||||
}
|
||||
auto iter = std::find_if(windowNodeContainerMap_.begin(), windowNodeContainerMap_.end(),
|
||||
[container](const std::map<uint64_t, sptr<WindowNodeContainer>>::value_type& containerPair) {
|
||||
return container.promote() == containerPair.second;
|
||||
});
|
||||
ScreenId screenGroupIdOfNode = INVALID_SCREEN_ID;
|
||||
if (iter != windowNodeContainerMap_.end()) {
|
||||
screenGroupIdOfNode = iter->first;
|
||||
}
|
||||
if (it.second && screenGroupId == screenGroupIdOfNode && !it.second->currentVisibility_) {
|
||||
windowNodes.push_back(it.second);
|
||||
}
|
||||
}
|
||||
@ -416,7 +430,7 @@ void WindowRoot::MinimizeAllAppWindows(DisplayId displayId)
|
||||
|
||||
WMError WindowRoot::ToggleShownStateForAllAppWindows()
|
||||
{
|
||||
std::vector<DisplayId> displays = DisplayManagerServiceInner::GetInstance().GetAllDisplayIds();
|
||||
std::vector<DisplayId> displays = DisplayGroupInfo::GetInstance().GetAllDisplayIds();
|
||||
std::vector<sptr<WindowNodeContainer>> containers;
|
||||
bool isAllAppWindowsEmpty = true;
|
||||
for (auto displayId : displays) {
|
||||
@ -552,9 +566,9 @@ Rect WindowRoot::GetDisplayRectWithoutSystemBarAreas(const sptr<WindowNode> dstN
|
||||
WLOGFE("failed, window container could not be found");
|
||||
return {0, 0, 0, 0}; // empty rect
|
||||
}
|
||||
auto displayRect = container->GetDisplayRect(displayId);
|
||||
auto displayRect = DisplayGroupInfo::GetInstance().GetDisplayRect(displayId);
|
||||
Rect targetRect = displayRect;
|
||||
auto displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(displayId);
|
||||
auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(displayId);
|
||||
if (displayInfo && WmsUtils::IsExpectedRotatableWindow(dstNode->GetRequestedOrientation(),
|
||||
displayInfo->GetDisplayOrientation(), dstNode->GetWindowMode())) {
|
||||
WLOGFD("[FixOrientation] the window is expected rotatable, pre-calculated");
|
||||
@ -1356,6 +1370,7 @@ void WindowRoot::ProcessExpandDisplayCreate(DisplayId defaultDisplayId, sptr<Dis
|
||||
WLOGFE("get display failed or get invalid display info");
|
||||
return;
|
||||
}
|
||||
DisplayGroupInfo::GetInstance().SetDefaultDisplayId(defaultDisplayId);
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
ScreenId displayGroupId = displayInfo->GetScreenGroupId();
|
||||
auto container = windowNodeContainerMap_[displayGroupId];
|
||||
@ -1369,17 +1384,6 @@ void WindowRoot::ProcessExpandDisplayCreate(DisplayId defaultDisplayId, sptr<Dis
|
||||
WLOGI("Container exist, add new display, displayId: %{public}" PRIu64"", displayId);
|
||||
}
|
||||
|
||||
std::map<DisplayId, sptr<DisplayInfo>> WindowRoot::GetAllDisplayInfos(const std::vector<DisplayId>& displayIdVec)
|
||||
{
|
||||
std::map<DisplayId, sptr<DisplayInfo>> displayInfoMap;
|
||||
for (auto& displayId : displayIdVec) {
|
||||
const sptr<DisplayInfo> displayInfo = DisplayManagerServiceInner::GetInstance().GetDisplayById(displayId);
|
||||
displayInfoMap.insert(std::make_pair(displayId, displayInfo));
|
||||
WLOGI("Get latest displayInfo, displayId: %{public}" PRIu64"", displayId);
|
||||
}
|
||||
return displayInfoMap;
|
||||
}
|
||||
|
||||
std::map<DisplayId, Rect> WindowRoot::GetAllDisplayRectsByDMS(sptr<DisplayInfo> displayInfo)
|
||||
{
|
||||
std::map<DisplayId, Rect> displayRectMap;
|
||||
@ -1423,7 +1427,7 @@ void WindowRoot::ProcessDisplayCreate(DisplayId defaultDisplayId, sptr<DisplayIn
|
||||
ScreenId displayGroupId = (displayInfo == nullptr) ? SCREEN_ID_INVALID : displayInfo->GetScreenGroupId();
|
||||
auto iter = windowNodeContainerMap_.find(displayGroupId);
|
||||
if (iter == windowNodeContainerMap_.end()) {
|
||||
CreateWindowNodeContainer(displayInfo);
|
||||
CreateWindowNodeContainer(defaultDisplayId, displayInfo);
|
||||
WLOGI("Create new container for display, displayId: %{public}" PRIu64"", displayId);
|
||||
} else {
|
||||
auto& displayIdVec = displayIdMap_[displayGroupId];
|
||||
@ -1529,16 +1533,6 @@ void WindowRoot::ProcessDisplayChange(DisplayId defaultDisplayId, sptr<DisplayIn
|
||||
container->GetDisplayGroupController()->ProcessDisplayChange(defaultDisplayId, displayInfo, displayRectMap, type);
|
||||
}
|
||||
|
||||
float WindowRoot::GetVirtualPixelRatio(DisplayId displayId) const
|
||||
{
|
||||
auto container = const_cast<WindowRoot*>(this)->GetOrCreateWindowNodeContainer(displayId);
|
||||
if (container == nullptr) {
|
||||
WLOGFE("window container could not be found");
|
||||
return 1.0; // Use DefaultVPR 1.0
|
||||
}
|
||||
return container->GetDisplayVirtualPixelRatio(displayId);
|
||||
}
|
||||
|
||||
Rect WindowRoot::GetDisplayGroupRect(DisplayId displayId) const
|
||||
{
|
||||
Rect fullDisplayRect;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <common/rs_common_def.h>
|
||||
#include "color_parser.h"
|
||||
#include "display_group_info.h"
|
||||
#include "remote_animation.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_inner_manager.h"
|
||||
@ -58,7 +59,7 @@ WMError WindowSystemEffect::SetCornerRadius(const sptr<WindowNode>& node)
|
||||
if (!IsAppMainOrSubOrFloatingWindow(node)) {
|
||||
return WMError::WM_DO_NOTHING;
|
||||
}
|
||||
auto vpr = winRoot->GetVirtualPixelRatio(node->GetDisplayId());
|
||||
auto vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
auto fullscreenRadius = windowSystemEffectConfig_.fullScreenCornerRadius_ * vpr;
|
||||
auto splitRadius = windowSystemEffectConfig_.splitCornerRadius_ * vpr;
|
||||
auto floatRadius = windowSystemEffectConfig_.floatCornerRadius_ * vpr;
|
||||
@ -143,7 +144,7 @@ WMError WindowSystemEffect::SetWindowShadow(const sptr<WindowNode>& node)
|
||||
WLOGFI("[WEffect][id:%{public}d] focused: %{public}u, [%{public}f, %{public}s, %{public}f, %{public}f, %{public}f]",
|
||||
node->GetWindowId(), node->isFocused_, shadow.elevation_, shadow.color_.c_str(),
|
||||
shadow.offsetX_, shadow.offsetY_, shadow.alpha_);
|
||||
auto vpr = winRoot->GetVirtualPixelRatio(node->GetDisplayId());
|
||||
auto vpr = DisplayGroupInfo::GetInstance().GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
surfaceNode->SetShadowElevation(shadow.elevation_ * vpr);
|
||||
surfaceNode->SetShadowColor(colorValue);
|
||||
surfaceNode->SetShadowOffsetX(shadow.offsetX_);
|
||||
|
@ -40,12 +40,12 @@ public:
|
||||
static void SetDisplayGroupInfo(DisplayId displayId, Rect displayRect);
|
||||
private:
|
||||
static sptr<WindowNodeContainer> container_;
|
||||
static sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
static DisplayGroupInfo& displayGroupInfo_;
|
||||
static sptr<DisplayGroupController> displayGroupController_;
|
||||
};
|
||||
|
||||
sptr<WindowNodeContainer> DisplayGroupControllerTest::container_ = nullptr;
|
||||
sptr<DisplayGroupInfo> DisplayGroupControllerTest::displayGroupInfo_ = nullptr;
|
||||
DisplayGroupInfo& DisplayGroupControllerTest::displayGroupInfo_ = DisplayGroupInfo::GetInstance();
|
||||
sptr<DisplayGroupController> DisplayGroupControllerTest::displayGroupController_ = nullptr;
|
||||
|
||||
void DisplayGroupControllerTest::SetUpTestCase()
|
||||
@ -54,13 +54,13 @@ void DisplayGroupControllerTest::SetUpTestCase()
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
container_ = new WindowNodeContainer(display->GetDisplayInfo(), display->GetScreenId());
|
||||
displayGroupController_ = container_->displayGroupController_;
|
||||
displayGroupInfo_ = displayGroupController_->displayGroupInfo_;
|
||||
|
||||
DisplayGroupInfo::GetInstance().Init(0, display->GetDisplayInfo());
|
||||
}
|
||||
|
||||
void DisplayGroupControllerTest::TearDownTestCase()
|
||||
{
|
||||
container_ = nullptr;
|
||||
displayGroupInfo_ = nullptr;
|
||||
displayGroupController_ = nullptr;
|
||||
}
|
||||
|
||||
@ -96,9 +96,9 @@ void DisplayGroupControllerTest::SetDisplayGroupInfo(DisplayId displayId, Rect d
|
||||
displayInfo->SetOffsetY(displayRect.posY_);
|
||||
displayInfo->SetWidth(displayRect.width_);
|
||||
displayInfo->SetHeight(displayRect.height_);
|
||||
displayGroupInfo_->displayInfosMap_[displayId] = displayInfo;
|
||||
displayGroupInfo_->leftDisplayId_ = 0;
|
||||
displayGroupInfo_->rightDisplayId_ = 1;
|
||||
displayGroupInfo_.displayInfosMap_[displayId] = displayInfo;
|
||||
displayGroupInfo_.leftDisplayId_ = 0;
|
||||
displayGroupInfo_.rightDisplayId_ = 1;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -772,7 +772,7 @@ HWTEST_F(DisplayGroupControllerTest, UpdateNodeSizeChangeReasonWithRotation01, F
|
||||
std::vector<sptr<WindowNode>>* rootApp = displayGroupController_->GetWindowNodesByDisplayIdAndRootType(
|
||||
0, WindowRootNodeType::APP_WINDOW_NODE);
|
||||
rootApp->push_back(node1);
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_->GetAllDisplayRects());
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_.GetAllDisplayRects());
|
||||
ASSERT_EQ(WindowSizeChangeReason::ROTATION, node1->GetWindowSizeChangeReason());
|
||||
}
|
||||
|
||||
@ -788,7 +788,7 @@ HWTEST_F(DisplayGroupControllerTest, UpdateNodeSizeChangeReasonWithRotation02, F
|
||||
std::vector<sptr<WindowNode>>* rootApp = displayGroupController_->GetWindowNodesByDisplayIdAndRootType(
|
||||
0, WindowRootNodeType::ABOVE_WINDOW_NODE);
|
||||
rootApp->push_back(node1);
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_->GetAllDisplayRects());
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_.GetAllDisplayRects());
|
||||
ASSERT_NE(WindowSizeChangeReason::ROTATION, node1->GetWindowSizeChangeReason());
|
||||
}
|
||||
|
||||
@ -802,7 +802,7 @@ HWTEST_F(DisplayGroupControllerTest, UpdateNodeSizeChangeReasonWithRotation03, F
|
||||
displayGroupController_->displayGroupWindowTree_[0].erase(WindowRootNodeType::ABOVE_WINDOW_NODE);
|
||||
ASSERT_EQ(nullptr, displayGroupController_->GetWindowNodesByDisplayIdAndRootType(
|
||||
0, WindowRootNodeType::ABOVE_WINDOW_NODE));
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_->GetAllDisplayRects());
|
||||
displayGroupController_->UpdateNodeSizeChangeReasonWithRotation(0, displayGroupInfo_.GetAllDisplayRects());
|
||||
ASSERT_EQ(nullptr, displayGroupController_->GetWindowNodesByDisplayIdAndRootType(
|
||||
0, WindowRootNodeType::ABOVE_WINDOW_NODE));
|
||||
}
|
||||
@ -817,15 +817,15 @@ HWTEST_F(DisplayGroupControllerTest, ProcessDisplayChange01, Function | SmallTes
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
ASSERT_NE(nullptr, displayInfo);
|
||||
displayInfo->SetDisplayId(0);
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::UPDATE_ROTATION);
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::DISPLAY_COMPRESS);
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::SIZE_CHANGE);
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::VIRTUAL_PIXEL_RATIO_CHANGE);
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplayChange(0, displayInfo, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::DESTROY);
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ HWTEST_F(DisplayGroupControllerTest, ProcessDisplaySizeChangeOrRotation01, Funct
|
||||
{
|
||||
auto oriLayoutPolicy = container_->GetLayoutPolicy();
|
||||
container_->layoutPolicy_ = nullptr;
|
||||
displayGroupController_->ProcessDisplaySizeChangeOrRotation(0, 0, displayGroupInfo_->GetAllDisplayRects(),
|
||||
displayGroupController_->ProcessDisplaySizeChangeOrRotation(0, 0, displayGroupInfo_.GetAllDisplayRects(),
|
||||
DisplayStateChangeType::UPDATE_ROTATION);
|
||||
ASSERT_EQ(nullptr, container_->GetLayoutPolicy());
|
||||
container_->layoutPolicy_ = oriLayoutPolicy;
|
||||
|
@ -54,7 +54,8 @@ void DisplayGroupInfoTest::SetUp()
|
||||
displayInfo->SetOffsetY(1);
|
||||
displayInfo->SetWidth(1);
|
||||
displayInfo->SetHeight(1);
|
||||
displayGroupInfo_ = new DisplayGroupInfo(displayGroupId, displayInfo);
|
||||
displayGroupInfo_ = new DisplayGroupInfo();
|
||||
displayGroupInfo_->Init(displayGroupId, displayInfo);
|
||||
AddTestDisplayInfo(displayGroupInfo_->displayInfosMap_);
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,10 @@ void DragControllerTest::SetUpTestCase()
|
||||
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
ASSERT_TRUE((display->GetDisplayInfo() != nullptr));
|
||||
moveDragController_->SetDisplayGroupInfo(new DisplayGroupInfo(display->GetDisplayInfo()->GetScreenGroupId(),
|
||||
display->GetDisplayInfo()));
|
||||
ASSERT_TRUE(moveDragController_);
|
||||
inputListener_ = moveDragController_->inputListener_;
|
||||
ASSERT_TRUE(inputListener_);
|
||||
@ -191,7 +192,7 @@ HWTEST_F(DragControllerTest, ConvertPointerPosToDisplayGroupPos, Function | Smal
|
||||
displayInfo->SetHeight(1280); // displayHeight: 1280
|
||||
displayInfo->SetOffsetX(0);
|
||||
displayInfo->SetOffsetY(0);
|
||||
moveDragController_->displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
DisplayGroupInfo::GetInstance().AddDisplayInfo(displayInfo);
|
||||
|
||||
int32_t posX = 0;
|
||||
int32_t posY = 0;
|
||||
@ -199,7 +200,7 @@ HWTEST_F(DragControllerTest, ConvertPointerPosToDisplayGroupPos, Function | Smal
|
||||
|
||||
moveDragController_->ConvertPointerPosToDisplayGroupPos(1, posX, posY);
|
||||
moveDragController_->ConvertPointerPosToDisplayGroupPos(0, posX, posY);
|
||||
moveDragController_->displayGroupInfo_->RemoveDisplayInfo(0);
|
||||
DisplayGroupInfo::GetInstance().RemoveDisplayInfo(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,7 +250,7 @@ HWTEST_F(DragControllerTest, GetHotZoneRect, Function | SmallTest | Level2)
|
||||
displayInfo->SetHeight(1280); // displayHeight: 1280
|
||||
displayInfo->SetOffsetX(0);
|
||||
displayInfo->SetOffsetY(0);
|
||||
moveDragController_->displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
DisplayGroupInfo::GetInstance().AddDisplayInfo(displayInfo);
|
||||
moveDragController_->moveDragProperty_ = new MoveDragProperty();
|
||||
moveDragController_->moveDragProperty_->targetDisplayId_ = 0;
|
||||
moveDragController_->moveDragProperty_->startRectExceptCorner_ = { 0, 0, 40, 40 };
|
||||
|
@ -112,7 +112,7 @@ void RemoteAnimationTest::CreateWindowNodeContainer()
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
}
|
||||
|
||||
sptr<WindowProperty> RemoteAnimationTest::CreateWindowProperty(uint32_t windowId)
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "iremote_object_mocker.h"
|
||||
#include "mock_RSIWindowAnimationController.h"
|
||||
#include "remote_animation.h"
|
||||
@ -55,6 +57,10 @@ void StartingWindowTest::TearDownTestCase()
|
||||
|
||||
void StartingWindowTest::SetUp()
|
||||
{
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
transitionInfo_ = new WindowTransitionInfo();
|
||||
animationController_ = new RSIWindowAnimationControllerMocker();
|
||||
ASSERT_EQ(WMError::WM_OK, RemoteAnimation::SetWindowAnimationController(animationController_));
|
||||
|
@ -73,7 +73,7 @@ HWTEST_F(WindowDisplayZoomControllerTest, WindowDisplayZoomControllerTest01, Fun
|
||||
ASSERT_NE(display, nullptr);
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_NE(displayInfo, nullptr);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_NE(container, nullptr);
|
||||
|
||||
// windowNodeContainer is not null
|
||||
|
@ -14,6 +14,8 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "window_dumper.h"
|
||||
#include "window_manager_service.h"
|
||||
#include "window_impl.h"
|
||||
@ -34,6 +36,13 @@ public:
|
||||
|
||||
void WindowDumperTest::SetUpTestCase()
|
||||
{
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
|
||||
displayInfo->SetScreenGroupId(0);
|
||||
WindowManagerService::GetInstance().windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
}
|
||||
|
||||
void WindowDumperTest::TearDownTestCase()
|
||||
|
@ -49,14 +49,14 @@ public:
|
||||
|
||||
static WindowInfo windowInfo_;
|
||||
static sptr<WindowNodeContainer> container_;
|
||||
static sptr<DisplayGroupInfo> displayGroupInfo_;
|
||||
static DisplayGroupInfo& displayGroupInfo_;
|
||||
static sptr<DisplayInfo> defaultDisplayInfo_;
|
||||
static sptr<DisplayGroupController> displayGroupController_;
|
||||
static sptr<WindowLayoutPolicyCascade> layoutPolicy_;
|
||||
};
|
||||
|
||||
sptr<WindowNodeContainer> WindowLayoutPolicyTest::container_ = nullptr;
|
||||
sptr<DisplayGroupInfo> WindowLayoutPolicyTest::displayGroupInfo_ = nullptr;
|
||||
DisplayGroupInfo& WindowLayoutPolicyTest::displayGroupInfo_ = DisplayGroupInfo::GetInstance();
|
||||
sptr<DisplayGroupController> WindowLayoutPolicyTest::displayGroupController_ = nullptr;
|
||||
sptr<WindowLayoutPolicyCascade> WindowLayoutPolicyTest::layoutPolicy_ = nullptr;
|
||||
sptr<DisplayInfo> WindowLayoutPolicyTest::defaultDisplayInfo_ = nullptr;
|
||||
@ -74,6 +74,8 @@ void WindowLayoutPolicyTest::SetUpTestCase()
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
|
||||
DisplayGroupInfo::GetInstance().Init(0, display->GetDisplayInfo());
|
||||
|
||||
defaultDisplayInfo_ = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((defaultDisplayInfo_ != nullptr));
|
||||
|
||||
@ -87,7 +89,6 @@ void WindowLayoutPolicyTest::SetUpTestCase()
|
||||
};
|
||||
|
||||
container_ = new WindowNodeContainer(defaultDisplayInfo_, display->GetScreenId());
|
||||
displayGroupInfo_ = container_->displayGroupInfo_;
|
||||
displayGroupController_ = container_->displayGroupController_;
|
||||
layoutPolicy_ = static_cast<WindowLayoutPolicyCascade*>(container_->GetLayoutPolicy().GetRefPtr());
|
||||
}
|
||||
@ -95,7 +96,6 @@ void WindowLayoutPolicyTest::SetUpTestCase()
|
||||
void WindowLayoutPolicyTest::TearDownTestCase()
|
||||
{
|
||||
container_ = nullptr;
|
||||
displayGroupInfo_ = nullptr;
|
||||
defaultDisplayInfo_ = nullptr;
|
||||
displayGroupController_ = nullptr;
|
||||
layoutPolicy_ = nullptr;
|
||||
@ -103,12 +103,12 @@ void WindowLayoutPolicyTest::TearDownTestCase()
|
||||
|
||||
void WindowLayoutPolicyTest::SetUp()
|
||||
{
|
||||
displayGroupInfo_->AddDisplayInfo(defaultDisplayInfo_);
|
||||
displayGroupInfo_.AddDisplayInfo(defaultDisplayInfo_);
|
||||
}
|
||||
|
||||
void WindowLayoutPolicyTest::TearDown()
|
||||
{
|
||||
displayGroupInfo_->displayInfosMap_.clear();
|
||||
displayGroupInfo_.displayInfosMap_.clear();
|
||||
}
|
||||
|
||||
sptr<WindowNode> WindowLayoutPolicyTest::CreateWindowNode(const WindowInfo& windowInfo)
|
||||
@ -165,7 +165,7 @@ HWTEST_F(WindowLayoutPolicyTest, CalcEntireWindowHotZone, Function | SmallTest |
|
||||
property->SetWindowType(WindowType::WINDOW_TYPE_LAUNCHER_RECENT);
|
||||
sptr<WindowNode> node2 = new WindowNode(property, nullptr, nullptr);
|
||||
auto actRect2 = layoutPolicy_->CalcEntireWindowHotZone(node2, winRect, 10, 2.f, hotZoneScale); // param: 10, 2.0
|
||||
Rect expRect2 = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());;
|
||||
Rect expRect2 = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());;
|
||||
ASSERT_EQ(expRect2, actRect2);
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow03,
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner01, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
windowInfo_.winRect_ = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_ * 0.5), // ratio: 0.5
|
||||
@ -256,7 +256,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner01, Function | Sm
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner02, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
windowInfo_.winRect_ = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_ * 0.5), // ratio: 0.5
|
||||
@ -286,7 +286,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner02, Function | Sm
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner03, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
windowInfo_.winRect_ = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_ * 0.5), // ratio: 0.5
|
||||
@ -309,7 +309,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowToBottomRightCorner03, Function | Sm
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupRect, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
Rect newDisplayRect = {
|
||||
@ -320,10 +320,10 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupRect, Function | SmallTest |
|
||||
};
|
||||
auto displayInfo = CreateDisplayInfo(newDisplayRect);
|
||||
ASSERT_TRUE(displayInfo != nullptr);
|
||||
displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
displayGroupInfo_.AddDisplayInfo(displayInfo);
|
||||
layoutPolicy_->UpdateDisplayGroupRect();
|
||||
|
||||
displayGroupInfo_->displayInfosMap_.clear();
|
||||
displayGroupInfo_.displayInfosMap_.clear();
|
||||
layoutPolicy_->UpdateDisplayGroupRect();
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupRect, Function | SmallTest |
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupLimitRect, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
Rect newDisplayRect = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_),
|
||||
@ -344,8 +344,8 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupLimitRect, Function | SmallTe
|
||||
};
|
||||
auto displayInfo = CreateDisplayInfo(newDisplayRect);
|
||||
ASSERT_TRUE(displayInfo != nullptr);
|
||||
displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
auto allDisplayRect = displayGroupInfo_->GetAllDisplayRects();
|
||||
displayGroupInfo_.AddDisplayInfo(displayInfo);
|
||||
auto allDisplayRect = displayGroupInfo_.GetAllDisplayRects();
|
||||
layoutPolicy_->limitRectMap_ = allDisplayRect;
|
||||
layoutPolicy_->UpdateDisplayGroupLimitRect();
|
||||
|
||||
@ -360,7 +360,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayGroupLimitRect, Function | SmallTe
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateRectInDisplayGroup, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
windowInfo_.winRect_ = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_ * 0.5), // ratio: 0.5
|
||||
@ -395,7 +395,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateMultiDisplayFlag, Function | SmallTest |
|
||||
{
|
||||
layoutPolicy_->UpdateMultiDisplayFlag();
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
Rect newDisplayRect = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_),
|
||||
@ -405,7 +405,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateMultiDisplayFlag, Function | SmallTest |
|
||||
};
|
||||
auto displayInfo = CreateDisplayInfo(newDisplayRect);
|
||||
ASSERT_TRUE(displayInfo != nullptr);
|
||||
displayGroupInfo_->AddDisplayInfo(displayInfo);
|
||||
displayGroupInfo_.AddDisplayInfo(displayInfo);
|
||||
layoutPolicy_->UpdateMultiDisplayFlag();
|
||||
}
|
||||
|
||||
@ -416,7 +416,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateMultiDisplayFlag, Function | SmallTest |
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateRectInDisplayGroupForAllNodes01, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
Rect newDisplayRect = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_),
|
||||
@ -451,7 +451,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateRectInDisplayGroupForAllNodes01, Function
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateRectInDisplayGroupForAllNodes02, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
Rect newDisplayRect = {
|
||||
.posX_ = static_cast<int32_t>(displayRect.posX_ + displayRect.width_),
|
||||
@ -491,7 +491,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayRectAndDisplayGroupInfo, Function
|
||||
{
|
||||
std::map<DisplayId, Rect> displayRectMap = {};
|
||||
layoutPolicy_->UpdateDisplayRectAndDisplayGroupInfo(displayRectMap);
|
||||
displayRectMap = displayGroupInfo_->GetAllDisplayRects();
|
||||
displayRectMap = displayGroupInfo_.GetAllDisplayRects();
|
||||
layoutPolicy_->UpdateDisplayRectAndDisplayGroupInfo(displayRectMap);
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ HWTEST_F(WindowLayoutPolicyTest, ProcessDisplayCreate, Function | SmallTest | Le
|
||||
|
||||
layoutPolicy_->ProcessDisplayCreate(1, newDisplayRectMap);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
newDisplayRectMap.insert(std::make_pair(0, displayRect));
|
||||
Rect newDisplayRect = {
|
||||
@ -535,7 +535,7 @@ HWTEST_F(WindowLayoutPolicyTest, ProcessDisplayDestroy, Function | SmallTest | L
|
||||
|
||||
layoutPolicy_->ProcessDisplayDestroy(1, newDisplayRectMap);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
}
|
||||
|
||||
@ -551,7 +551,7 @@ HWTEST_F(WindowLayoutPolicyTest, ProcessDisplaySizeChangeOrRotation, Function |
|
||||
|
||||
layoutPolicy_->ProcessDisplayDestroy(1, newDisplayRectMap);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion02,
|
||||
node->SetWindowRect(newRect);
|
||||
layoutPolicy_->FixWindowSizeByRatioIfDragBeyondLimitRegion(node, finalRect);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
layoutPolicy_->limitRectMap_[0] = displayRect;
|
||||
}
|
||||
@ -710,7 +710,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion03,
|
||||
Rect newRect = { 200, 200, 300, 200 }; // rect: 200, 200, 300, 200
|
||||
node->SetWindowRect(newRect);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
layoutPolicy_->limitRectMap_[0] = displayRect;
|
||||
|
||||
@ -759,7 +759,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion04,
|
||||
Rect newRect = { 200, 200, 300, 200 }; // rect: 200, 200, 300, 200
|
||||
node->SetWindowRect(newRect);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
layoutPolicy_->limitRectMap_[0] = displayRect;
|
||||
windowInfo_.winType_ = WindowType::WINDOW_TYPE_LAUNCHER_DOCK;
|
||||
@ -772,7 +772,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion04,
|
||||
Rect finalRect;
|
||||
layoutPolicy_->FixWindowSizeByRatioIfDragBeyondLimitRegion(node, finalRect);
|
||||
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = displayGroupInfo_.GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
int32_t limitMaxPosX = displayRect.posX_ + static_cast<int32_t>(displayRect.width_ - windowTitleBarH);
|
||||
|
||||
@ -798,7 +798,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion05,
|
||||
Rect newRect = { 200, 200, 300, 200 }; // rect: 200, 200, 300, 200
|
||||
node->SetWindowRect(newRect);
|
||||
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
layoutPolicy_->limitRectMap_[0] = displayRect;
|
||||
windowInfo_.winType_ = WindowType::WINDOW_TYPE_LAUNCHER_DOCK;
|
||||
@ -816,7 +816,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion05,
|
||||
Rect finalRect;
|
||||
layoutPolicy_->FixWindowSizeByRatioIfDragBeyondLimitRegion(node, finalRect);
|
||||
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = displayGroupInfo_.GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
int32_t limitMinPosX = displayRect.posX_ + static_cast<int32_t>(windowTitleBarH);
|
||||
|
||||
@ -834,7 +834,7 @@ HWTEST_F(WindowLayoutPolicyTest, FixWindowSizeByRatioIfDragBeyondLimitRegion05,
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, GetSystemSizeLimits, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node1 = CreateWindowNode(windowInfo_);
|
||||
@ -854,7 +854,7 @@ HWTEST_F(WindowLayoutPolicyTest, GetSystemSizeLimits, Function | SmallTest | Lev
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateWindowSizeLimits, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node1 = CreateWindowNode(windowInfo_);
|
||||
@ -874,7 +874,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateWindowSizeLimits, Function | SmallTest |
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow04, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -917,7 +917,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow04,
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow05, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -945,7 +945,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeForStretchableWindow05,
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeBySizeLimits, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -991,7 +991,7 @@ HWTEST_F(WindowLayoutPolicyTest, UpdateFloatingWindowSizeBySizeLimits, Function
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitFloatingWindowSize, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -1049,7 +1049,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitMainFloatingWindowPosition, Function | Sma
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenDrag, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -1085,7 +1085,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenDrag, Function | SmallTe
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenDrag01, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -1094,7 +1094,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenDrag01, Function | Small
|
||||
node->SetWindowRect(winRect);
|
||||
|
||||
layoutPolicy_->limitRectMap_[node->GetDisplayId()] = displayRect;
|
||||
float virtualPixelRatio = displayGroupInfo_->GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
float virtualPixelRatio = displayGroupInfo_.GetDisplayVirtualPixelRatio(node->GetDisplayId());
|
||||
uint32_t windowTitleBarH = static_cast<uint32_t>(WINDOW_TITLE_BAR_HEIGHT * virtualPixelRatio);
|
||||
int32_t limitMinPosX = displayRect.posX_ + static_cast<int32_t>(windowTitleBarH);
|
||||
int32_t limitMaxPosX = displayRect.posX_ + static_cast<int32_t>(displayRect.width_ - windowTitleBarH);
|
||||
@ -1134,7 +1134,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenDrag01, Function | Small
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenInitRectOrMove, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
sptr<WindowNode> node = CreateWindowNode(windowInfo_);
|
||||
@ -1174,7 +1174,7 @@ HWTEST_F(WindowLayoutPolicyTest, LimitWindowPositionWhenInitRectOrMove, Function
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, GetDockWindowShowState, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
Rect dockWinRect = { 200, 200, 50, 20 }; // rect : 200, 200, 50, 20
|
||||
@ -1208,7 +1208,7 @@ HWTEST_F(WindowLayoutPolicyTest, GetDockWindowShowState, Function | SmallTest |
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, GetAvoidPosType, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
Rect winRect = { 200, 200, 50, 20 }; // rect : 200, 200, 50, 20
|
||||
@ -1236,7 +1236,7 @@ HWTEST_F(WindowLayoutPolicyTest, GetAvoidPosType, Function | SmallTest | Level2)
|
||||
*/
|
||||
HWTEST_F(WindowLayoutPolicyTest, UpdateDisplayLimitRect, Function | SmallTest | Level2)
|
||||
{
|
||||
auto displayRect = displayGroupInfo_->GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
auto displayRect = displayGroupInfo_.GetDisplayRect(defaultDisplayInfo_->GetDisplayId());
|
||||
ASSERT_FALSE(WindowHelper::IsEmptyRect(displayRect));
|
||||
|
||||
Rect limitRect = displayRect;
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "window_pair.h"
|
||||
#include "minimize_app.h"
|
||||
#include "common_test_utils.h"
|
||||
@ -34,6 +36,10 @@ public:
|
||||
|
||||
void WindowPairTest::SetUpTestCase()
|
||||
{
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
}
|
||||
|
||||
void WindowPairTest::TearDownTestCase()
|
||||
@ -67,7 +73,7 @@ HWTEST_F(WindowPairTest, NotifyShowRecent01, Function | SmallTest | Level2)
|
||||
sptr<WindowNode> node0 = new WindowNode(property);
|
||||
windowPair->primary_ = node0;
|
||||
windowPair->NotifyShowRecent(node0);
|
||||
|
||||
|
||||
if (windowPair->secondary_ != nullptr) {
|
||||
ASSERT_EQ(WindowType::WINDOW_TYPE_LAUNCHER_RECENT, windowPair->secondary_->GetWindowType());
|
||||
}
|
||||
@ -498,7 +504,7 @@ HWTEST_F(WindowPairTest, GetOrderedPair03, Function | SmallTest | Level2)
|
||||
windowPair->primary_ = node1;
|
||||
windowPair->secondary_ = new WindowNode(property1);
|
||||
windowPair->divider_ = new WindowNode(property2);
|
||||
|
||||
|
||||
ASSERT_EQ(3, windowPair->GetOrderedPair(node1).size());
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,10 @@ void WindowRootTest::TearDownTestCase()
|
||||
void WindowRootTest::SetUp()
|
||||
{
|
||||
windowRoot_ = new WindowRoot(nullptr);
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
}
|
||||
|
||||
void WindowRootTest::TearDown()
|
||||
@ -114,20 +118,20 @@ HWTEST_F(WindowRootTest, WindowRootTest03, Function | SmallTest | Level2)
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
|
||||
displayInfo->SetWidth(49);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_EQ(container, nullptr);
|
||||
|
||||
displayInfo->SetWidth(7681);
|
||||
container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_EQ(container, nullptr);
|
||||
|
||||
displayInfo->SetWidth(50);
|
||||
displayInfo->SetHeight(49);
|
||||
container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_EQ(container, nullptr);
|
||||
|
||||
displayInfo->SetHeight(7681);
|
||||
container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_EQ(container, nullptr);
|
||||
}
|
||||
|
||||
@ -144,7 +148,7 @@ HWTEST_F(WindowRootTest, WindowRootTest04, Function | SmallTest | Level2)
|
||||
ASSERT_NE(displayInfo, nullptr);
|
||||
displayInfo->SetDisplayId(0);
|
||||
displayInfo->SetScreenGroupId(SCREEN_ID_INVALID);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(displayInfo);
|
||||
auto container = windowRoot_->CreateWindowNodeContainer(0, displayInfo);
|
||||
ASSERT_NE(container, nullptr);
|
||||
|
||||
windowRoot_->GetWindowNodeContainer(DISPLAY_ID_INVALID);
|
||||
@ -368,38 +372,6 @@ HWTEST_F(WindowRootTest, WindowRootTest18, Function | SmallTest | Level2)
|
||||
ASSERT_EQ(true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: WindowRootTest19
|
||||
* @tc.desc: test WindowRoot PostProcessAddWindowNode
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowRootTest, WindowRootTest19, Function | SmallTest | Level2)
|
||||
{
|
||||
WMError ret;
|
||||
sptr<WindowNode> node = new WindowNode();
|
||||
sptr<WindowNode> parentNode = nullptr;
|
||||
sptr<DisplayInfo> displayInfo = new DisplayInfo();
|
||||
sptr<WindowNodeContainer> container = new WindowNodeContainer(displayInfo, SCREEN_ID_INVALID);
|
||||
|
||||
ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
|
||||
ASSERT_EQ(ret, WMError::WM_DO_NOTHING);
|
||||
|
||||
node->currentVisibility_ = true;
|
||||
node->GetWindowProperty()->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
|
||||
ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_TYPE);
|
||||
|
||||
node->currentVisibility_ = true;
|
||||
node->property_->SetWindowType(WindowType::WINDOW_TYPE_STATUS_BAR);
|
||||
node->GetWindowProperty()->SetFocusable(false);
|
||||
sptr<WindowNode> child = new WindowNode();
|
||||
child->currentVisibility_ = true;
|
||||
node->children_.push_back(child);
|
||||
node->children_.push_back(nullptr);
|
||||
ret = windowRoot_->PostProcessAddWindowNode(node, parentNode, container);
|
||||
ASSERT_EQ(ret, WMError::WM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: WindowRootTest20
|
||||
* @tc.desc: test WindowRoot LayoutWhenAddWindowNode
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "iremote_object_mocker.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_system_effect.h"
|
||||
@ -48,6 +50,10 @@ void WindowSystemEffectTest::TearDownTestCase()
|
||||
|
||||
void WindowSystemEffectTest::SetUp()
|
||||
{
|
||||
auto display = DisplayManager::GetInstance().GetDefaultDisplay();
|
||||
ASSERT_TRUE((display != nullptr));
|
||||
sptr<DisplayInfo> displayInfo = display->GetDisplayInfo();
|
||||
ASSERT_TRUE((displayInfo != nullptr));
|
||||
node_ = new WindowNode(CreateWindowProperty()); // 101 is windowId
|
||||
node_->SetWindowRect({0, 0, 100, 100}); // 100 test data
|
||||
node_->leashWinSurfaceNode_ = CreateRSSurfaceNode("leashSurfaceNodeTest");
|
||||
@ -139,7 +145,7 @@ HWTEST_F(WindowSystemEffectTest, SetWindowShadow01, Function | SmallTest | Level
|
||||
|
||||
// fullscreen
|
||||
node_->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
ASSERT_EQ(WMError::WM_DO_NOTHING, WindowSystemEffect::SetWindowShadow(node_));
|
||||
ASSERT_EQ(WMError::WM_OK, WindowSystemEffect::SetWindowShadow(node_));
|
||||
// float
|
||||
node_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
ASSERT_EQ(WMError::WM_OK, WindowSystemEffect::SetWindowShadow(node_));
|
||||
|
@ -66,7 +66,7 @@ HWTEST_F(WindowZorderPolicyTest, GetWindowPriority02, Function | SmallTest | Lev
|
||||
{
|
||||
sptr<WindowZorderPolicy> zorderPolicy = new WindowZorderPolicy();
|
||||
int32_t zorder = zorderPolicy->GetWindowPriority(static_cast<WindowType>(3000));
|
||||
ASSERT_EQ(zorder, 0);
|
||||
ASSERT_EQ(zorder, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user