1、无线扩展屏设置屏幕大小时,上报reason为CHANGE_MODE

2、修复概率freeze问题
Signed-off-by: peixu <peixu1@huawei.com>
This commit is contained in:
peixu
2026-06-23 11:57:03 +08:00
parent da227d5ec5
commit d6d59764d5
5 changed files with 27 additions and 7 deletions
+2
View File
@@ -89,6 +89,7 @@ ohos_static_library("libdm_static") {
"runtime_core:ani",
"runtime_core:ani_helpers",
"eventhandler:libeventhandler",
"ffrt:libffrt",
]
part_name = "window_manager"
@@ -150,6 +151,7 @@ ohos_shared_library("libdm") {
"runtime_core:ani",
"runtime_core:ani_helpers",
"eventhandler:libeventhandler",
"ffrt:libffrt",
]
innerapi_tags = [ "platformsdk" ]
+3 -1
View File
@@ -32,6 +32,7 @@
namespace OHOS::Rosen {
class BaseAdapter {
public:
BaseAdapter();
virtual ~BaseAdapter();
virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
DisplayManagerAgentType type);
@@ -40,7 +41,8 @@ public:
virtual void Clear();
protected:
bool InitDMSProxy();
std::recursive_mutex mutex_;
class Impl;
std::unique_ptr<Impl> pImpl_;
sptr<IScreenSessionManager> screenSessionManagerServiceProxy_ = nullptr;
sptr<IDisplayManager> displayManagerServiceProxy_ = nullptr;
sptr<IRemoteObject::DeathRecipient> dmsDeath_ = nullptr;
+10 -4
View File
@@ -26,7 +26,7 @@
#include "window_manager_hilog.h"
#include "zidl/screen_session_manager_interface.h"
#include "dms_global_mutex.h"
#include "ffrt.h"
namespace OHOS::Rosen {
WM_IMPLEMENT_SINGLE_INSTANCE(DisplayManagerAdapter)
WM_IMPLEMENT_SINGLE_INSTANCE(ScreenManagerAdapter)
@@ -871,10 +871,16 @@ bool DisplayManagerAdapter::SetFreeze(std::vector<DisplayId> displayIds, bool is
displayManagerServiceProxy_->SetFreeze(displayIds, isFreeze, isSucc);
return isSucc;
}
class BaseAdapter::Impl {
public:
ffrt::recursive_mutex mutex_;
};
BaseAdapter::BaseAdapter() : pImpl_(std::make_unique<Impl>()) {}
bool BaseAdapter::InitDMSProxy()
{
std::lock_guard<std::recursive_mutex> lock(mutex_);
std::lock_guard<ffrt::recursive_mutex> lock(pImpl_->mutex_);
if (isProxyValid_) {
return true;
}
@@ -950,7 +956,7 @@ void DMSDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& wptrDeath)
BaseAdapter::~BaseAdapter()
{
TLOGI(WmsLogTag::DMS, "destroy!");
std::lock_guard<std::recursive_mutex> lock(mutex_);
std::lock_guard<ffrt::recursive_mutex> lock(pImpl_->mutex_);
Clear();
screenSessionManagerServiceProxy_ = nullptr;
displayManagerServiceProxy_ = nullptr;
@@ -959,7 +965,7 @@ BaseAdapter::~BaseAdapter()
void BaseAdapter::Clear()
{
TLOGD(WmsLogTag::DMS, "Clear!");
std::lock_guard<std::recursive_mutex> lock(mutex_);
std::lock_guard<ffrt::recursive_mutex> lock(pImpl_->mutex_);
if ((screenSessionManagerServiceProxy_ != nullptr) && (screenSessionManagerServiceProxy_->AsObject() != nullptr)) {
screenSessionManagerServiceProxy_->AsObject()->RemoveDeathRecipient(dmsDeath_);
}
@@ -8767,6 +8767,14 @@ DMError ScreenSessionManager::SetVirtualMirrorScreenCanvasRotation(ScreenId scre
return DMError::DM_OK;
}
void UpdatePropertyChangeReason(sptr<ScreenSession> screenSession, ScreenPropertyChangeReason& reason)
{
if (reason == ScreenPropertyChangeReason::VIRTUAL_SCREEN_RESIZE
&& screenSession->GetDisplaySourceMode() == DisplaySourceMode::EXTEND) {
reason = ScreenPropertyChangeReason::CHANGE_MODE;
}
}
DMError ScreenSessionManager::ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height,
uint32_t renderWidth, uint32_t renderHeight)
{
@@ -8804,8 +8812,9 @@ DMError ScreenSessionManager::ResizeVirtualScreen(ScreenId screenId, uint32_t wi
}
ApplyVirtualScreenScale(screenSession, width, height, renderWidth, renderHeight);
screenSession->Resize(width, height);
screenSession->PropertyChange(screenSession->GetScreenProperty(),
ScreenPropertyChangeReason::VIRTUAL_SCREEN_RESIZE);
ScreenPropertyChangeReason reason = ScreenPropertyChangeReason::VIRTUAL_SCREEN_RESIZE;
UpdatePropertyChangeReason(screenSession, reason);
screenSession->PropertyChange(screenSession->GetScreenProperty(), reason);
return DMError::DM_OK;
}
@@ -173,6 +173,7 @@
OHOS::Rosen::ScreenSession::GetScreenHDRFormat*;
OHOS::Rosen::ScreenSession::GetScreenId*;
OHOS::Rosen::ScreenSession::GetScreenModes*;
OHOS::Rosen::ScreenSession::GetDisplaySourceMode*;
OHOS::Rosen::ScreenSession::GetScreenProperty*;
OHOS::Rosen::ScreenSession::GetScreenRequestedOrientation*;
OHOS::Rosen::ScreenSession::GetScreenSnapshot*;