已合并
add virtual screen symbol #19695
add virtual screen symbol #19695
已合并
wsen创建于 7月17日
共 13 个文件变更+65-36
@@ -48,6 +48,7 @@ private:
48 48 
49 bool IsValidDigitString(const std::string& idStr) const;49 bool IsValidDigitString(const std::string& idStr) const;
50 std::string TransferTypeToString(ScreenType type) const;50 std::string TransferTypeToString(ScreenType type) const;
51+ std::string TransferDisplayModeToString(DisplayMode type) const;
51 void GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostringstream& oss) const;52 void GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostringstream& oss) const;
52 void GetDisplayInfo(const sptr<AbstractDisplay>& display, std::ostringstream& oss) const;53 void GetDisplayInfo(const sptr<AbstractDisplay>& display, std::ostringstream& oss) const;
53 54 
@@ -276,7 +276,7 @@ void AbstractScreen::SetPropertyForDisplayNode(const std::shared_ptr<RSDisplayNo
276void AbstractScreen::InitRSDisplayNode(const RSDisplayNodeConfig& config, const Point& startPoint)276void AbstractScreen::InitRSDisplayNode(const RSDisplayNodeConfig& config, const Point& startPoint)
277{277{
278 if (rsDisplayNode_ != nullptr) {278 if (rsDisplayNode_ != nullptr) {
279- rsDisplayNode_->SetDisplayNodeMirrorConfig(config);279+ rsDisplayNode_->SetDisplayNodeConfig(config);
280 TLOGD(WmsLogTag::DMS, "RSDisplayNode is not null");280 TLOGD(WmsLogTag::DMS, "RSDisplayNode is not null");
281 } else {281 } else {
282 TLOGD(WmsLogTag::DMS, "Create rsDisplayNode");282 TLOGD(WmsLogTag::DMS, "Create rsDisplayNode");
@@ -620,9 +620,10 @@ bool AbstractScreenGroup::GetRSDisplayNodeConfig(sptr<AbstractScreen>& dmsScreen
620 TLOGE(WmsLogTag::DMS, "dmsScreen is nullptr.");620 TLOGE(WmsLogTag::DMS, "dmsScreen is nullptr.");
621 return false;621 return false;
622 }622 }
623- config = { dmsScreen->rsId_ };623+ config = { dmsScreen->rsId_, DisplayMode::EXPAND };
624 switch (combination_) {624 switch (combination_) {
625 case ScreenCombination::SCREEN_ALONE:625 case ScreenCombination::SCREEN_ALONE:
626+ config.displayMode = DisplayMode::INVALID;
626 [[fallthrough]];627 [[fallthrough]];
627 case ScreenCombination::SCREEN_EXPAND:628 case ScreenCombination::SCREEN_EXPAND:
628 break;629 break;
@@ -647,7 +648,7 @@ bool AbstractScreenGroup::GetRSDisplayNodeConfig(sptr<AbstractScreen>& dmsScreen
647 NodeId nodeId = displayNode->GetId();648 NodeId nodeId = displayNode->GetId();
648 TLOGI(WmsLogTag::DMS, "AddChild, mirrorScreenId_:%{public}" PRIu64", rsId_:%{public}" PRIu64", "649 TLOGI(WmsLogTag::DMS, "AddChild, mirrorScreenId_:%{public}" PRIu64", rsId_:%{public}" PRIu64", "
649 "nodeId:%{public}" PRIu64"", mirrorScreenId_, dmsScreen->rsId_, nodeId);650 "nodeId:%{public}" PRIu64"", mirrorScreenId_, dmsScreen->rsId_, nodeId);
650- config = {dmsScreen->rsId_, true, nodeId};651+ config = { dmsScreen->rsId_, DisplayMode::MIRROR, nodeId };
651 break;652 break;
652 }653 }
653 default:654 default:
@@ -46,7 +46,7 @@ constexpr int W_SCREEN_ROTATION = 9;
46constexpr int W_ORIENTATION = 12;46constexpr int W_ORIENTATION = 12;
47constexpr int W_REQUESTED_ORIENTATION = 19;47constexpr int W_REQUESTED_ORIENTATION = 19;
48constexpr int W_NODE_ID = 21;48constexpr int W_NODE_ID = 21;
49-constexpr int W_MIRROR_TYPE = 11;49+constexpr int W_DISPLAY_MODE_TYPE = 11;
50constexpr int W_MIRROR_NODE_ID = 13;50constexpr int W_MIRROR_NODE_ID = 13;
51// set the output width of display51// set the output width of display
52constexpr int W_DISPLAY_ID = 10;52constexpr int W_DISPLAY_ID = 10;
@@ -226,7 +226,7 @@ DMError DisplayDumper::DumpSpecifiedScreenInfo(ScreenId screenId, std::string& d
226 name : name.substr(0, SCREEN_NAME_MAX_LENGTH);226 name : name.substr(0, SCREEN_NAME_MAX_LENGTH);
227 std::string isGroup = screen->isScreenGroup_ ? "true" : "false";227 std::string isGroup = screen->isScreenGroup_ ? "true" : "false";
228 std::string screenType = TransferTypeToString(screen->type_);228 std::string screenType = TransferTypeToString(screen->type_);
229- std::string isMirrored = screen->rSDisplayNodeConfig_.isMirrored ? "true" : "false";229+ std::string displayModeStr = TransferDisplayModeToString(screen->rSDisplayNodeConfig_.displayMode);
230 NodeId nodeId = (screen->rsDisplayNode_ == nullptr) ? SCREEN_ID_INVALID : screen->rsDisplayNode_->GetId();230 NodeId nodeId = (screen->rsDisplayNode_ == nullptr) ? SCREEN_ID_INVALID : screen->rsDisplayNode_->GetId();
231 std::ostringstream oss;231 std::ostringstream oss;
232 oss << "ScreenName: " << screenName << std::endl;232 oss << "ScreenName: " << screenName << std::endl;
@@ -241,7 +241,7 @@ DMError DisplayDumper::DumpSpecifiedScreenInfo(ScreenId screenId, std::string& d
241 oss << "Orientation: " << static_cast<uint32_t>(screen->orientation_) << std::endl;241 oss << "Orientation: " << static_cast<uint32_t>(screen->orientation_) << std::endl;
242 oss << "RequestOrientation: " << static_cast<uint32_t>(screen->screenRequestedOrientation_) << std::endl;242 oss << "RequestOrientation: " << static_cast<uint32_t>(screen->screenRequestedOrientation_) << std::endl;
243 oss << "NodeId: " << nodeId << std::endl;243 oss << "NodeId: " << nodeId << std::endl;
244- oss << "IsMirrored: " << isMirrored << std::endl;244+ oss << "DisplayModeStr: " << displayModeStr << std::endl;
245 oss << "MirrorNodeId: " << screen->rSDisplayNodeConfig_.mirrorNodeId << std::endl;245 oss << "MirrorNodeId: " << screen->rSDisplayNodeConfig_.mirrorNodeId << std::endl;
246 dumpInfo.append(oss.str());246 dumpInfo.append(oss.str());
247 return DMError::DM_OK;247 return DMError::DM_OK;
@@ -324,6 +324,26 @@ std::string DisplayDumper::TransferTypeToString(ScreenType type) const
324 return screenType;324 return screenType;
325}325}
326 326 
327+std::string DisplayDumper::TransferDisplayModeToString(DisplayMode type) const
328+{
329+ std::string displayMode;
330+ switch (type) {
331+ case DisplayMode::MIRROR:
332+ displayMode = "MIRROR";
333+ break;
334+ case DisplayMode::EXPAND:
335+ displayMode = "EXPAND";
336+ break;
337+ case DisplayMode::INDEPENDENT:
338+ displayMode = "INDEPENDENT";
339+ break;
340+ default:
341+ displayMode = "INVALID";
342+ break;
343+ }
344+ return displayMode;
345+}
346+ 
327void DisplayDumper::GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostringstream& oss) const347void DisplayDumper::GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostringstream& oss) const
328{348{
329 if (screen == nullptr) {349 if (screen == nullptr) {
@@ -336,7 +356,7 @@ void DisplayDumper::GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostri
336 name : name.substr(0, SCREEN_NAME_MAX_LENGTH);356 name : name.substr(0, SCREEN_NAME_MAX_LENGTH);
337 std::string isGroup = screen->isScreenGroup_ ? "true" : "false";357 std::string isGroup = screen->isScreenGroup_ ? "true" : "false";
338 std::string screenType = TransferTypeToString(screen->type_);358 std::string screenType = TransferTypeToString(screen->type_);
339- std::string isMirrored = screen->rSDisplayNodeConfig_.isMirrored ? "true" : "false";359+ std::string displayModeStr = TransferDisplayModeToString(screen->rSDisplayNodeConfig_.displayMode);
340 NodeId nodeId = (screen->rsDisplayNode_ == nullptr) ? SCREEN_ID_INVALID : screen->rsDisplayNode_->GetId();360 NodeId nodeId = (screen->rsDisplayNode_ == nullptr) ? SCREEN_ID_INVALID : screen->rsDisplayNode_->GetId();
341 // std::setw is used to set the output width and different width values are set to keep the format aligned.361 // std::setw is used to set the output width and different width values are set to keep the format aligned.
342 oss << std::left << std::setw(W_SCREEN_NAME) << screenName362 oss << std::left << std::setw(W_SCREEN_NAME) << screenName
@@ -350,7 +370,7 @@ void DisplayDumper::GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostri
350 << std::left << std::setw(W_ORIENTATION) << static_cast<uint32_t>(screen->orientation_)370 << std::left << std::setw(W_ORIENTATION) << static_cast<uint32_t>(screen->orientation_)
351 << std::left << std::setw(W_REQUESTED_ORIENTATION) << static_cast<uint32_t>(screen->screenRequestedOrientation_)371 << std::left << std::setw(W_REQUESTED_ORIENTATION) << static_cast<uint32_t>(screen->screenRequestedOrientation_)
352 << std::left << std::setw(W_NODE_ID) << nodeId372 << std::left << std::setw(W_NODE_ID) << nodeId
353- << std::left << std::setw(W_MIRROR_TYPE) << isMirrored373+ << std::left << std::setw(W_DISPLAY_MODE_TYPE) << displayModeStr
354 << std::left << std::setw(W_MIRROR_NODE_ID) << screen->rSDisplayNodeConfig_.mirrorNodeId374 << std::left << std::setw(W_MIRROR_NODE_ID) << screen->rSDisplayNodeConfig_.mirrorNodeId
355 << std::endl;375 << std::endl;
356}376}
@@ -954,7 +954,7 @@ DMError SuperFoldStateManager::RefreshMirrorRegionInner(
954 secondarySession->SetMirrorScreenRegion(secondarySession->GetScreenId(), mirrorRegion);954 secondarySession->SetMirrorScreenRegion(secondarySession->GetScreenId(), mirrorRegion);
955 secondarySession->SetIsPhysicalMirrorSwitch(true);955 secondarySession->SetIsPhysicalMirrorSwitch(true);
956 secondarySession->EnableMirrorScreenRegion();956 secondarySession->EnableMirrorScreenRegion();
957- RSDisplayNodeConfig config = { secondarySession->rsId_, true, displayNode->GetId() };957+ RSDisplayNodeConfig config = { secondarySession->rsId_, DisplayMode::MIRROR, displayNode->GetId() };
958 secondarySession->ReuseDisplayNode(config);958 secondarySession->ReuseDisplayNode(config);
959 return DMError::DM_OK;959 return DMError::DM_OK;
960}960}
@@ -405,7 +405,7 @@ void MultiScreenChangeUtils::CreateMirrorSession(sptr<ScreenSession>& mainSessio
405 SuperFoldStateManager::GetInstance().RefreshExternalRegion();405 SuperFoldStateManager::GetInstance().RefreshExternalRegion();
406 } else {406 } else {
407#endif407#endif
408- RSDisplayNodeConfig config = { screenSession->rsId_, true, displayNode->GetId() };408+ RSDisplayNodeConfig config = { screenSession->rsId_, DisplayMode::MIRROR, displayNode->GetId() };
409 screenSession->ReuseDisplayNode(config);409 screenSession->ReuseDisplayNode(config);
410#ifdef FOLD_ABILITY_ENABLE410#ifdef FOLD_ABILITY_ENABLE
411 }411 }
@@ -439,7 +439,7 @@ void MultiScreenChangeUtils::CreateExtendSession(sptr<ScreenSession>& screenSess
439 }439 }
440 screenSession->SetIsExtend(true);440 screenSession->SetIsExtend(true);
441 screenSession->SetScreenCombination(ScreenCombination::SCREEN_EXTEND);441 screenSession->SetScreenCombination(ScreenCombination::SCREEN_EXTEND);
442- RSDisplayNodeConfig config = { screenSession->rsId_, false, INVALID_NODEID };442+ RSDisplayNodeConfig config = { screenSession->rsId_, DisplayMode::EXPAND, INVALID_NODEID };
443 screenSession->ReuseDisplayNode(config);443 screenSession->ReuseDisplayNode(config);
444}444}
445 445 
@@ -137,7 +137,7 @@ DMError MultiScreenManager::PhysicalScreenMirrorSwitch(const ScreenId mainScreen
137 TLOGW(WmsLogTag::DMS, "already mirror and get a same region.");137 TLOGW(WmsLogTag::DMS, "already mirror and get a same region.");
138 return DMError::DM_OK;138 return DMError::DM_OK;
139 }139 }
140- RSDisplayNodeConfig config = { screenSession->rsId_, true, nodeId, true};140+ RSDisplayNodeConfig config = { screenSession->rsId_, DisplayMode::MIRROR, nodeId, true };
141 if (rotationOption.needSetRotation_) {141 if (rotationOption.needSetRotation_) {
142 config.mirrorSourceRotation = static_cast<uint32_t>(rotationOption.rotation_);142 config.mirrorSourceRotation = static_cast<uint32_t>(rotationOption.rotation_);
143 }143 }
@@ -169,7 +169,7 @@ DMError MultiScreenManager::PhysicalScreenUniqueSwitch(const std::vector<ScreenI
169 continue;169 continue;
170 }170 }
171 TLOGW(WmsLogTag::DMS, "switch to unique physical ScreenId: %{public}" PRIu64, physicalScreenId);171 TLOGW(WmsLogTag::DMS, "switch to unique physical ScreenId: %{public}" PRIu64, physicalScreenId);
172- RSDisplayNodeConfig config = { screenSession->rsId_, false, INVALID_NODEID };172+ RSDisplayNodeConfig config = { screenSession->rsId_, DisplayMode::INDEPENDENT, INVALID_NODEID };
173 screenSession->ReuseDisplayNode(config);173 screenSession->ReuseDisplayNode(config);
174 screenSession->SetScreenCombination(ScreenCombination::SCREEN_UNIQUE);174 screenSession->SetScreenCombination(ScreenCombination::SCREEN_UNIQUE);
175 screenSession->SetVirtualPixelRatio(screenSession->GetScreenProperty().GetDefaultDensity());175 screenSession->SetVirtualPixelRatio(screenSession->GetScreenProperty().GetDefaultDensity());
@@ -226,11 +226,11 @@ void MultiScreenPowerChangeManager::CreateExternalScreenDisplayNodeOnly(sptr<Scr
226 sptr<ScreenSession>& externalScreen, ScreenCombination combination)226 sptr<ScreenSession>& externalScreen, ScreenCombination combination)
227{227{
228 TLOGW(WmsLogTag::DMS, "create extend screen rsId=%{public}" PRIu64, innerScreen->rsId_);228 TLOGW(WmsLogTag::DMS, "create extend screen rsId=%{public}" PRIu64, innerScreen->rsId_);
229- RSDisplayNodeConfig config = { innerScreen->rsId_, false, INVALID_NODEID};229+ RSDisplayNodeConfig config = { innerScreen->rsId_, DisplayMode::EXPAND, INVALID_NODEID };
230 if (combination == ScreenCombination::SCREEN_MIRROR) {230 if (combination == ScreenCombination::SCREEN_MIRROR) {
231 NodeId nodeId = externalScreen->GetDisplayNode() == nullptr ? 0 : externalScreen->GetDisplayNode()->GetId();231 NodeId nodeId = externalScreen->GetDisplayNode() == nullptr ? 0 : externalScreen->GetDisplayNode()->GetId();
232 TLOGW(WmsLogTag::DMS, "config screen mirror displayNodeId=%{public}" PRIu64, nodeId);232 TLOGW(WmsLogTag::DMS, "config screen mirror displayNodeId=%{public}" PRIu64, nodeId);
233- config = { innerScreen->rsId_, true, nodeId };233+ config = { innerScreen->rsId_, DisplayMode::MIRROR, nodeId };
234 }234 }
235 innerScreen->ReuseDisplayNode(config);235 innerScreen->ReuseDisplayNode(config);
236 TLOGW(WmsLogTag::DMS, "create screen displayNode end.");236 TLOGW(WmsLogTag::DMS, "create screen displayNode end.");
@@ -15035,7 +15035,7 @@ void ScreenSessionManager::CreateExtendVirtualScreen(ScreenId mainScreenId, Scre
15035 }15035 }
15036 if (secondarySession->GetDisplayNode() == nullptr) {15036 if (secondarySession->GetDisplayNode() == nullptr) {
15037 ScreenId rsScreenId = secondarySession->GetRSScreenId();15037 ScreenId rsScreenId = secondarySession->GetRSScreenId();
15038- Rosen::RSDisplayNodeConfig rsConfig = {rsScreenId, true, mianDisplayNode->GetId()};15038+ Rosen::RSDisplayNodeConfig rsConfig = { rsScreenId, DisplayMode::MIRROR, mianDisplayNode->GetId() };
15039 secondarySession->CreateDisplayNode(rsConfig);15039 secondarySession->CreateDisplayNode(rsConfig);
15040 secondarySession->SetDisplayNodeScreenId(rsScreenId);15040 secondarySession->SetDisplayNodeScreenId(rsScreenId);
15041 secondarySession->SetDisplayNodeSecurity();15041 secondarySession->SetDisplayNodeSecurity();
@@ -17030,7 +17030,7 @@ void ScreenSessionManager::MakeMirrorAfterSwitchUser()
17030 }17030 }
17031 }17031 }
17032 for (auto session : mirrorScreenSessions) {17032 for (auto session : mirrorScreenSessions) {
17033- session->ReuseDisplayNode({ session->rsId_, true, mainSession->GetDisplayNode()->GetId() });17033+ session->ReuseDisplayNode({ session->rsId_, DisplayMode::MIRROR, mainSession->GetDisplayNode()->GetId() });
17034 }17034 }
17035}17035}
17036 17036 
@@ -96,7 +96,7 @@ ScreenSession::ScreenSession(const ScreenSessionConfig& config, ScreenSessionRea
96 }96 }
97 case ScreenSessionReason::CREATE_SESSION_FOR_MIRROR: {97 case ScreenSessionReason::CREATE_SESSION_FOR_MIRROR: {
98 rsConfig.screenId = rsId_;98 rsConfig.screenId = rsId_;
99- rsConfig.isMirrored = true;99+ rsConfig.displayMode = DisplayMode::MIRROR;
100 rsConfig.mirrorNodeId = config.mirrorNodeId;100 rsConfig.mirrorNodeId = config.mirrorNodeId;
101 rsConfig.isSync = true;101 rsConfig.isSync = true;
102 break;102 break;
@@ -125,8 +125,8 @@ ScreenSession::ScreenSession(const ScreenSessionConfig& config, ScreenSessionRea
125void ScreenSession::CreateDisplayNode(const Rosen::RSDisplayNodeConfig& config)125void ScreenSession::CreateDisplayNode(const Rosen::RSDisplayNodeConfig& config)
126{126{
127 TLOGI(WmsLogTag::DMS,127 TLOGI(WmsLogTag::DMS,
128- "[DPNODE]config screenId: %{public}" PRIu64", mirrorNodeId: %{public}" PRIu64", isMirrored: %{public}d",128+ "[DPNODE]config screenId: %{public}" PRIu64", mirrorNodeId: %{public}" PRIu64", displayMode: %{public}d",
129- config.screenId, config.mirrorNodeId, config.isMirrored);129+ config.screenId, config.mirrorNodeId, static_cast<int32_t>(config.displayMode));
130 {130 {
131 std::unique_lock<std::shared_mutex> displayNodeLock(displayNodeMutex_);131 std::unique_lock<std::shared_mutex> displayNodeLock(displayNodeMutex_);
132 displayNode_ = Rosen::RSDisplayNode::Create(config, GetRSUIContext());132 displayNode_ = Rosen::RSDisplayNode::Create(config, GetRSUIContext());
@@ -139,7 +139,7 @@ void ScreenSession::CreateDisplayNode(const Rosen::RSDisplayNodeConfig& config)
139 const auto& rect = property_.GetBounds().rect_;139 const auto& rect = property_.GetBounds().rect_;
140 displayNode_->SetFrame(rect.left_, rect.top_, rect.width_, rect.height_);140 displayNode_->SetFrame(rect.left_, rect.top_, rect.width_, rect.height_);
141 displayNode_->SetBounds(rect.left_, rect.top_, rect.width_, rect.height_);141 displayNode_->SetBounds(rect.left_, rect.top_, rect.width_, rect.height_);
142- if (config.isMirrored) {142+ if (config.displayMode == DisplayMode::MIRROR) {
143 EnableMirrorScreenRegion();143 EnableMirrorScreenRegion();
144 }144 }
145 if (property_.GetNeedCastScale()) {145 if (property_.GetNeedCastScale()) {
@@ -155,7 +155,7 @@ void ScreenSession::ReuseDisplayNode(const RSDisplayNodeConfig& config)
155 {155 {
156 std::unique_lock<std::shared_mutex> lock(displayNodeMutex_);156 std::unique_lock<std::shared_mutex> lock(displayNodeMutex_);
157 if (displayNode_) {157 if (displayNode_) {
158- displayNode_->SetDisplayNodeMirrorConfig(config);158+ displayNode_->SetDisplayNodeConfig(config);
159 RSTransactionAdapter::FlushImplicitTransaction(displayNode_);159 RSTransactionAdapter::FlushImplicitTransaction(displayNode_);
160 return;160 return;
161 }161 }
@@ -214,8 +214,8 @@ ScreenSession::ScreenSession(ScreenId screenId, const ScreenProperty& property,
214 rsId_ = screenId;214 rsId_ = screenId;
215 property_.SetRsId(rsId_);215 property_.SetRsId(rsId_);
216 RSAdapterUtil::InitRSUIDirector(rsUIDirector_, renderSession_);216 RSAdapterUtil::InitRSUIDirector(rsUIDirector_, renderSession_);
217- Rosen::RSDisplayNodeConfig config = { .screenId = screenId_, .isMirrored = true, .mirrorNodeId = nodeId,217+ Rosen::RSDisplayNodeConfig config = { .screenId = screenId_, .displayMode = DisplayMode::MIRROR,
218- .isSync = true};218+ .mirrorNodeId = nodeId, .isSync = true };
219 displayNode_ = Rosen::RSDisplayNode::Create(config, GetRSUIContext());219 displayNode_ = Rosen::RSDisplayNode::Create(config, GetRSUIContext());
220 TLOGD(WmsLogTag::WMS_SCB,220 TLOGD(WmsLogTag::WMS_SCB,
221 "Create RSDisplayNode: %{public}s", RSAdapterUtil::RSNodeToStr(displayNode_).c_str());221 "Create RSDisplayNode: %{public}s", RSAdapterUtil::RSNodeToStr(displayNode_).c_str());
@@ -2438,7 +2438,7 @@ void ScreenSession::InitRSDisplayNode(RSDisplayNodeConfig& config, Point& startP
2438{2438{
2439 std::unique_lock<std::shared_mutex> displayNodeLock(displayNodeMutex_);2439 std::unique_lock<std::shared_mutex> displayNodeLock(displayNodeMutex_);
2440 if (displayNode_ != nullptr) {2440 if (displayNode_ != nullptr) {
2441- displayNode_->SetDisplayNodeMirrorConfig(config);2441+ displayNode_->SetDisplayNodeConfig(config);
2442 if (screenId_ == 0 && isFold_) {2442 if (screenId_ == 0 && isFold_) {
2443 TLOGI(WmsLogTag::DMS, "Return InitRSDisplayNode foldScreen0");2443 TLOGI(WmsLogTag::DMS, "Return InitRSDisplayNode foldScreen0");
2444 return;2444 return;
@@ -2489,7 +2489,7 @@ void ScreenSession::InitRSDisplayNode(RSDisplayNodeConfig& config, Point& startP
2489 displayNode_->SetPivot(0.0F, 0.0F);2489 displayNode_->SetPivot(0.0F, 0.0F);
2490 displayNode_->SetScale(property_.GetCastScaleX(), property_.GetCastScaleY());2490 displayNode_->SetScale(property_.GetCastScaleX(), property_.GetCastScaleY());
2491 }2491 }
2492- if (config.isMirrored) {2492+ if (config.displayMode == DisplayMode::MIRROR) {
2493 EnableMirrorScreenRegion();2493 EnableMirrorScreenRegion();
2494 }2494 }
2495 RSTransactionAdapter::FlushImplicitTransaction(GetRSUIContext());2495 RSTransactionAdapter::FlushImplicitTransaction(GetRSUIContext());
@@ -2519,13 +2519,15 @@ bool ScreenSessionGroup::GetRSDisplayNodeConfig(sptr<ScreenSession>& screenSessi
2519 TLOGE(WmsLogTag::DMS, "screenSession is nullptr.");2519 TLOGE(WmsLogTag::DMS, "screenSession is nullptr.");
2520 return false;2520 return false;
2521 }2521 }
2522- config = { screenSession->rsId_ };2522+ config = { screenSession->rsId_, DisplayMode::EXPAND};
2523 switch (combination_) {2523 switch (combination_) {
2524 case ScreenCombination::SCREEN_ALONE:2524 case ScreenCombination::SCREEN_ALONE:
2525+ config = { screenSession->rsId_, DisplayMode::INVALID};
2525 [[fallthrough]];2526 [[fallthrough]];
2526 case ScreenCombination::SCREEN_EXPAND:2527 case ScreenCombination::SCREEN_EXPAND:
2527 break;2528 break;
2528 case ScreenCombination::SCREEN_UNIQUE:2529 case ScreenCombination::SCREEN_UNIQUE:
2530+ config = { screenSession->rsId_, DisplayMode::INDEPENDENT};
2529 break;2531 break;
2530 case ScreenCombination::SCREEN_MIRROR: {2532 case ScreenCombination::SCREEN_MIRROR: {
2531 if (GetChildCount() == 0 || mirrorScreenId_ == screenSession->screenId_) {2533 if (GetChildCount() == 0 || mirrorScreenId_ == screenSession->screenId_) {
@@ -2544,7 +2546,7 @@ bool ScreenSessionGroup::GetRSDisplayNodeConfig(sptr<ScreenSession>& screenSessi
2544 NodeId nodeId = displayNode->GetId();2546 NodeId nodeId = displayNode->GetId();
2545 TLOGI(WmsLogTag::DMS, "mirrorScreenId_:%{public}" PRIu64", rsId_:%{public}" PRIu64", \2547 TLOGI(WmsLogTag::DMS, "mirrorScreenId_:%{public}" PRIu64", rsId_:%{public}" PRIu64", \
2546 nodeId:%{public}" PRIu64"", mirrorScreenId_, screenSession->rsId_, nodeId);2548 nodeId:%{public}" PRIu64"", mirrorScreenId_, screenSession->rsId_, nodeId);
2547- config = {screenSession->rsId_, true, nodeId, true};2549+ config = {screenSession->rsId_, DisplayMode::MIRROR, nodeId, true};
2548 break;2550 break;
2549 }2551 }
2550 default:2552 default:
@@ -545,10 +545,15 @@ using RSSurfaceTextureAttachCallBack = std::function<void(int64_t textureId, boo
545using RSSurfaceTextureUpdateCallBack = std::function<void(std::vector<float>&)>;545using RSSurfaceTextureUpdateCallBack = std::function<void(std::vector<float>&)>;
546using RSSurfaceTextureInitTypeCallBack = std::function<void(int32_t&)>;546using RSSurfaceTextureInitTypeCallBack = std::function<void(int32_t&)>;
547// codes for arkui-x end547// codes for arkui-x end
548- 548+enum class DisplayMode : uint8_t {
549+ INVALID = 0,
550+ MIRROR,
551+ EXPAND,
552+ INDEPENDENT,
553+};
549struct RSDisplayNodeConfig {554struct RSDisplayNodeConfig {
550 uint64_t screenId = 0;555 uint64_t screenId = 0;
551- bool isMirrored = false;556+ DisplayMode displayMode = DisplayMode::INVALID;
552 NodeId mirrorNodeId = 0;557 NodeId mirrorNodeId = 0;
553 bool isSync = false;558 bool isSync = false;
554 uint32_t mirrorSourceRotation = 4; // default INVALID_SCREEN_ROTATION559 uint32_t mirrorSourceRotation = 4; // default INVALID_SCREEN_ROTATION
@@ -40,7 +40,7 @@ public:
40 void SetScreenId(uint64_t screenId) {}40 void SetScreenId(uint64_t screenId) {}
41 void SetSecurityDisplay(bool isSecurityDisplay) {}41 void SetSecurityDisplay(bool isSecurityDisplay) {}
42 void SetScreenRotation(const uint32_t& rotation) {}42 void SetScreenRotation(const uint32_t& rotation) {}
43- void SetDisplayNodeMirrorConfig(const RSDisplayNodeConfig& displayNodeConfig)43+ void SetDisplayNodeConfig(const RSDisplayNodeConfig& displayNodeConfig)
44 {44 {
45 displayNodeConfig_ = displayNodeConfig;45 displayNodeConfig_ = displayNodeConfig;
46 }46 }
@@ -1789,7 +1789,7 @@ HWTEST_F(ScreenSessionManagerTest, SetScreenSessionScale_WithDisplayNode, TestSi
1789 // Create displayNode first so GetDisplayNode returns non-null1789 // Create displayNode first so GetDisplayNode returns non-null
1790 RSDisplayNodeConfig rsConfig;1790 RSDisplayNodeConfig rsConfig;
1791 rsConfig.screenId = screenId;1791 rsConfig.screenId = screenId;
1792- rsConfig.isMirrored = false;1792+ rsConfig.displayMode = DisplayMode::EXPAND;
1793 screenSession->CreateDisplayNode(rsConfig);1793 screenSession->CreateDisplayNode(rsConfig);
1794 ASSERT_NE(screenSession->GetDisplayNode(), nullptr);1794 ASSERT_NE(screenSession->GetDisplayNode(), nullptr);
1795 float scaleX = 1.5f;1795 float scaleX = 1.5f;
@@ -185,7 +185,7 @@ HWTEST_F(ScreenSessionTest, CreateDisplayNode, TestSize.Level0)
185 .rsId = 101,185 .rsId = 101,
186 .name = "OpenHarmony",186 .name = "OpenHarmony",
187 };187 };
188- rsConfig.isMirrored = true;188+ rsConfig.displayMode = DisplayMode::MIRROR;
189 rsConfig.screenId = 101;189 rsConfig.screenId = 101;
190 sptr<ScreenSession> screenSession = sptr<ScreenSession>::MakeSptr(config,190 sptr<ScreenSession> screenSession = sptr<ScreenSession>::MakeSptr(config,
191 ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);191 ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);
@@ -242,7 +242,7 @@ HWTEST_F(ScreenSessionTest, SetMirrorScreenType, TestSize.Level1)
242 .name = "OpenHarmony",242 .name = "OpenHarmony",
243 };243 };
244 Rosen::RSDisplayNodeConfig rsConfig;244 Rosen::RSDisplayNodeConfig rsConfig;
245- rsConfig.isMirrored = true;245+ rsConfig.displayMode = DisplayMode::MIRROR;
246 rsConfig.screenId = 101;246 rsConfig.screenId = 101;
247 sptr<ScreenSession> screenSession = sptr<ScreenSession>::MakeSptr(config,247 sptr<ScreenSession> screenSession = sptr<ScreenSession>::MakeSptr(config,
248 ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);248 ScreenSessionReason::CREATE_SESSION_FOR_VIRTUAL);
@@ -3387,7 +3387,7 @@ HWTEST_F(ScreenSessionTest, UpdateDisplayNodeRotation, Function | SmallTest | Le
3387 ASSERT_EQ(screenSession->isExtended_, false);3387 ASSERT_EQ(screenSession->isExtended_, false);
3388 3388 
3389 Rosen::RSDisplayNodeConfig rsConfig;3389 Rosen::RSDisplayNodeConfig rsConfig;
3390- rsConfig.isMirrored = true;3390+ rsConfig.displayMode = DisplayMode::MIRROR;
3391 rsConfig.screenId = 101;3391 rsConfig.screenId = 101;
3392 screenSession->CreateDisplayNode(rsConfig);3392 screenSession->CreateDisplayNode(rsConfig);
3393 screenSession->UpdateDisplayNodeRotation(FoldDisplayMode::MAIN);3393 screenSession->UpdateDisplayNodeRotation(FoldDisplayMode::MAIN);
@@ -3552,7 +3552,7 @@ HWTEST_F(ScreenSessionTest, ReuseDisplayNode, TestSize.Level1)
3552 screenSession->SetDisplayNode(nullptr);3552 screenSession->SetDisplayNode(nullptr);
3553 screenSession->ReuseDisplayNode(rsConfig);3553 screenSession->ReuseDisplayNode(rsConfig);
3554 3554 
3555- rsConfig.isMirrored = true;3555+ rsConfig.displayMode = DisplayMode::MIRROR;
3556 rsConfig.screenId = 101;3556 rsConfig.screenId = 101;
3557 std::shared_ptr<RSDisplayNode> displayNode = RSDisplayNode::Create(rsConfig);3557 std::shared_ptr<RSDisplayNode> displayNode = RSDisplayNode::Create(rsConfig);
3558 screenSession->SetDisplayNode(displayNode);3558 screenSession->SetDisplayNode(displayNode);