!10711 修复display问题

Merge pull request !10711 from Shulssins/displayfix
This commit is contained in:
openharmony_ci 2024-11-11 12:52:59 +00:00 committed by Gitee
commit 88530a7c98
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 31 additions and 12 deletions

View File

@ -210,11 +210,8 @@ void SuperFoldStateManager::HandleDisplayNotify(SuperFoldStatusChangeEvents chan
void SuperFoldStateManager::HandleExtendToHalfFoldDisplayNotify(sptr<ScreenSession> screenSession)
{
ScreenProperty screenProperty = screenSession->GetScreenProperty();
uint32_t screenWidth = screenProperty.GetFakeBounds().rect_.GetWidth();
uint32_t screenHeight = screenProperty.GetFakeBounds().rect_.GetHeight();
screenSession->UpdatePropertyByResolution(screenWidth, screenHeight);
screenSession->UpdatePropertyByFakeInUse(true);
screenSession->SetIsBScreenHalf(true);
ScreenSessionManager::GetInstance().NotifyDisplayChanged(
screenSession->ConvertToDisplayInfo(), DisplayChangeEvent::SUPER_FOLD_RESOLUTION_CHANGED);
sptr<ScreenSession> fakeScreenSession = screenSession->GetFakeScreenSession();
@ -226,11 +223,8 @@ void SuperFoldStateManager::HandleExtendToHalfFoldDisplayNotify(sptr<ScreenSessi
void SuperFoldStateManager::HandleHalfFoldToExtendDisplayNotify(sptr<ScreenSession> screenSession)
{
ScreenProperty screenProperty = screenSession->GetScreenProperty();
uint32_t screenWidth = screenProperty.GetFakeBounds().rect_.GetWidth();
uint32_t screenHeight = screenProperty.GetFakeBounds().rect_.GetHeight();
screenSession->UpdatePropertyByResolution(screenWidth, screenHeight * HALF_SCREEN_PARAM);
screenSession->UpdatePropertyByFakeInUse(false);
screenSession->SetIsBScreenHalf(false);
sptr<ScreenSession> fakeScreenSession = screenSession->GetFakeScreenSession();
sptr<DisplayInfo> fakeDisplayInfo = fakeScreenSession->ConvertToDisplayInfo();
if (fakeDisplayInfo == nullptr) {
@ -249,6 +243,7 @@ void SuperFoldStateManager::HandleHalfFoldToExtendDisplayNotify(sptr<ScreenSessi
void SuperFoldStateManager::HandleKeyboardOnDisplayNotify(sptr<ScreenSession> screenSession)
{
screenSession->UpdatePropertyByFakeInUse(false);
screenSession->SetIsBScreenHalf(true);
sptr<ScreenSession> fakeScreenSession = screenSession->GetFakeScreenSession();
sptr<DisplayInfo> fakeDisplayInfo = fakeScreenSession->ConvertToDisplayInfo();
if (fakeDisplayInfo == nullptr) {
@ -264,6 +259,7 @@ void SuperFoldStateManager::HandleKeyboardOnDisplayNotify(sptr<ScreenSession> sc
void SuperFoldStateManager::HandleKeyboardOffDisplayNotify(sptr<ScreenSession> screenSession)
{
screenSession->UpdatePropertyByFakeInUse(true);
screenSession->SetIsBScreenHalf(true);
sptr<ScreenSession> fakeScreenSession = screenSession->GetFakeScreenSession();
ScreenSessionManager::GetInstance().NotifyDisplayCreate(
fakeScreenSession->ConvertToDisplayInfo());

View File

@ -5199,6 +5199,10 @@ bool ScreenSessionManager::IsMultiScreenCollaboration()
FoldStatus ScreenSessionManager::GetFoldStatus()
{
DmsXcollie dmsXcollie("DMS:GetFoldStatus", XCOLLIE_TIMEOUT_10S);
if (FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
SuperFoldStatus status = SuperFoldStateManager::GetInstance().GetCurrentStatus();
return SuperFoldStateManager::GetInstance().MatchSuperFoldStatusToFoldStatus(status);
}
if (!g_foldScreenFlag) {
return FoldStatus::UNKNOWN;
}

View File

@ -163,7 +163,7 @@ private:
RRect bounds_;
RRect phyBounds_;
RRect fakeBounds_;
bool isFakeInUse_ = false;
bool isFakeInUse_ = false; // is fake bounds in use
float scaleX_ { 1.0f };
float scaleY_ { 1.0f };

View File

@ -209,6 +209,8 @@ public:
bool GetIsCurrentInUse() const;
void SetIsFakeInUse(bool isFakeInUse);
bool GetIsFakeInUse() const;
void SetIsBScreenHalf(bool isBScreenHalf);
bool GetIsBScreenHalf() const;
bool isPrimary_ { false };
bool isInternal_ { false };
@ -263,7 +265,8 @@ private:
ScreenCombination combination_ { ScreenCombination::SCREEN_ALONE };
VirtualScreenFlag screenFlag_ { VirtualScreenFlag::DEFAULT };
bool hasPrivateWindowForeground_ = false;
bool isFakeInUse_ = false;
bool isFakeInUse_ = false; // is fake session in use
bool isBScreenHalf_ = false;
bool isPhysicalMirrorSwitch_ = false;
mutable std::shared_mutex displayNodeMutex_;
std::atomic<bool> touchEnabled_ { true };

View File

@ -261,8 +261,14 @@ sptr<DisplayInfo> ScreenSession::ConvertToDisplayInfo()
RRect bounds = property_.GetBounds();
RRect phyBounds = property_.GetPhyBounds();
displayInfo->name_ = name_;
displayInfo->SetWidth(bounds.rect_.GetWidth());
displayInfo->SetHeight(bounds.rect_.GetHeight());
if (isBScreenHalf_) {
displayInfo->SetWidth(bounds.rect_.GetWidth());
displayInfo->SetHeight(bounds.rect_.GetHeight() / HALF_SCREEN_PARAM);
} else {
displayInfo->SetWidth(bounds.rect_.GetWidth());
displayInfo->SetHeight(bounds.rect_.GetHeight());
}
displayInfo->SetPhysicalWidth(phyBounds.rect_.GetWidth());
displayInfo->SetPhysicalHeight(phyBounds.rect_.GetHeight());
displayInfo->SetScreenId(screenId_);
@ -348,6 +354,16 @@ bool ScreenSession::GetIsFakeInUse() const
return isFakeInUse_;
}
void ScreenSession::SetIsBScreenHalf(bool isBScreenHalf)
{
isBScreenHalf_ = isBScreenHalf;
}
bool ScreenSession::GetIsBScreenHalf() const
{
return isBScreenHalf_;
}
void ScreenSession::SetFakeScreenSession(sptr<ScreenSession> fakeScreenSession)
{
fakeScreenSession_ = fakeScreenSession;