mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-02-21 08:22:29 +00:00
Description: 添加display hook接口
Signed-off-by: licong <licong113@huawei.com>
This commit is contained in:
parent
4406d703c2
commit
94478877e4
@ -89,7 +89,6 @@ public:
|
||||
virtual void DisablePowerOffRenderControl(ScreenId screenId);
|
||||
virtual DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy);
|
||||
virtual DMError ResetAllFreezeStatus();
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo);
|
||||
|
||||
private:
|
||||
static inline SingletonDelegator<DisplayManagerAdapter> delegator;
|
||||
|
@ -51,7 +51,6 @@ public:
|
||||
sptr<Display> GetDisplayById(DisplayId displayId);
|
||||
DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow);
|
||||
bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId);
|
||||
void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo);
|
||||
bool IsFoldable();
|
||||
bool IsCaptured();
|
||||
FoldStatus GetFoldStatus();
|
||||
@ -1876,14 +1875,4 @@ DMError DisplayManager::Impl::ResetAllFreezeStatus()
|
||||
{
|
||||
return SingletonContainer::Get<DisplayManagerAdapter>().ResetAllFreezeStatus();
|
||||
}
|
||||
|
||||
void DisplayManager::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo)
|
||||
{
|
||||
pImpl_->UpdateDisplayHookInfo(uid, enable, hookInfo);
|
||||
}
|
||||
|
||||
void DisplayManager::Impl::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo)
|
||||
{
|
||||
SingletonContainer::Get<DisplayManagerAdapter>().UpdateDisplayHookInfo(uid, enable, hookInfo);
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
@ -506,13 +506,6 @@ bool DisplayManagerAdapter::ConvertScreenIdToRsScreenId(ScreenId screenId, Scree
|
||||
return displayManagerServiceProxy_->ConvertScreenIdToRsScreenId(screenId, rsScreenId);
|
||||
}
|
||||
|
||||
void DisplayManagerAdapter::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN();
|
||||
|
||||
return displayManagerServiceProxy_->UpdateDisplayHookInfo(uid, enable, hookInfo);
|
||||
}
|
||||
|
||||
DMError DisplayManagerAdapter::HasImmersiveWindow(bool& immersive)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) = 0;
|
||||
virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) = 0;
|
||||
virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) { return false; };
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo) {};
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo) {};
|
||||
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent) = 0;
|
||||
|
@ -615,15 +615,6 @@ public:
|
||||
*/
|
||||
DMError ResetAllFreezeStatus();
|
||||
|
||||
/**
|
||||
* @brief hook diaplayinfo deepending on the window size.
|
||||
*
|
||||
* @param uid uid.
|
||||
* @param enable add HookInfo or delete HookInfo.
|
||||
* @param hookInfo display HookInfo.
|
||||
*/
|
||||
void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo);
|
||||
|
||||
constexpr static int32_t MAX_RESOLUTION_SIZE_SCREENSHOT = 3840; // max resolution, 4K
|
||||
|
||||
private:
|
||||
|
@ -479,4 +479,13 @@ void ScreenSessionManagerClient::SetVirtualPixelRatioSystem(ScreenId screenId, f
|
||||
}
|
||||
screenSession->SetScreenSceneDpi(virtualPixelRatio);
|
||||
}
|
||||
|
||||
void ScreenSessionManager::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo)
|
||||
{
|
||||
if (!screenSessionManager_) {
|
||||
WLOGFE("screenSessionManager_ is null");
|
||||
return;
|
||||
}
|
||||
screenSessionManager_->UpdateDisplayHookInfo(uid, enable, hookInfo);
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
@ -171,7 +171,7 @@ public:
|
||||
void NotifyPrivateWindowListChanged(DisplayId id, std::vector<std::string> privacyWindowList);
|
||||
DMError HasPrivateWindow(DisplayId id, bool& hasPrivateWindow) override;
|
||||
bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
|
||||
void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo) override;
|
||||
void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo) override;
|
||||
|
||||
void OnScreenConnect(const sptr<ScreenInfo> screenInfo);
|
||||
void OnScreenDisconnect(ScreenId screenId);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override {return nullptr; }
|
||||
virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override { return DMError::DM_OK; }
|
||||
virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override { return true; }
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo) override {};
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo) override {};
|
||||
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent) override { return -1; }
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
|
||||
virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override;
|
||||
virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo) override;
|
||||
virtual void UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo) override;
|
||||
|
||||
virtual void DumpAllScreensInfo(std::string& dumpInfo) override;
|
||||
virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override;
|
||||
|
@ -8989,23 +8989,14 @@ WMError SceneSessionManager::ClearMainSessions(const std::vector<int32_t>& persi
|
||||
WMError SceneSessionManager::UpdateDisplayHookInfo(uint32_t uid, uint32_t width, uint32_t height, float_t density,
|
||||
bool enable)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "UpdateDisplayHookInfo width: %{public}d, height: %{public}d, \
|
||||
density: %{public}f, bool: %{public}u", width, height, density, enable);
|
||||
HookInfo HookInfo;
|
||||
HookInfo.width_ = width;
|
||||
HookInfo.height_ = height;
|
||||
HookInfo.density_ = density;
|
||||
if (enable) {
|
||||
displayHookMap_[uid] = HookInfo;
|
||||
} else {
|
||||
displayHookMap_.erase(uid);
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "UpdateDisplayHookInfo width: %{public}u, height: %{public}u, \
|
||||
density: %{public}f, bool: %{public}d", width, height, density, enable);
|
||||
|
||||
DMHookInfo dmHookInfo;
|
||||
dmHookInfo.width_ = width;
|
||||
dmHookInfo.height_ = height;
|
||||
dmHookInfo.density_ = density;
|
||||
SingletonContainer::Get<DisplayManager>().UpdateDisplayHookInfo(uid, enable, dmHookInfo);
|
||||
ScreenSessionManagerClient::GetInstance().UpdateDisplayHookInfo(uid, enable, dmHookInfo);
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -631,7 +631,7 @@ sptr<DisplayInfo> ScreenSessionManager::GetDisplayInfoById(DisplayId displayId)
|
||||
TLOGD(WmsLogTag::DMS, "GetDisplayInfoById success");
|
||||
if (displayHookMap_.find(uid) != displayHookMap_.end()) {
|
||||
auto info = displayHookMap_[uid];
|
||||
TLOGI(WmsLogTag::DMS, "GetDisplayInfoById hookWidth: %{public}d, hookHeight: %{public}d,\
|
||||
TLOGI(WmsLogTag::DMS, "GetDisplayInfoById hookWidth: %{public}u, hookHeight: %{public}u,\
|
||||
hookDensity: %{public}f", info.width_, info.height_, info.density_);
|
||||
displayInfo->SetWidth(info.width_);
|
||||
displayInfo->SetHeight(info.height_);
|
||||
@ -742,7 +742,7 @@ bool ScreenSessionManager::ConvertScreenIdToRsScreenId(ScreenId screenId, Screen
|
||||
return screenIdManager_.ConvertToRsScreenId(screenId, rsScreenId);
|
||||
}
|
||||
|
||||
void ScreenSessionManager::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo)
|
||||
void ScreenSessionManager::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo)
|
||||
{
|
||||
if (!SessionPermission::IsSystemCalling()) {
|
||||
TLOGE(WmsLogTag::DMS, "UpdateDisplayHookInfo permission denied!");
|
||||
|
@ -2595,11 +2595,11 @@ DMError ScreenSessionManagerProxy::ResetAllFreezeStatus()
|
||||
return static_cast<DMError>(reply.ReadInt32());
|
||||
}
|
||||
|
||||
void OHOS::Rosen::ScreenSessionManagerProxy::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo& hookInfo)
|
||||
void OHOS::Rosen::ScreenSessionManagerProxy::UpdateDisplayHookInfo(uint32_t uid, bool enable, DMHookInfo hookInfo)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
WLOGFW("remote is nullptr");
|
||||
TLOGE("remote is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2608,29 +2608,29 @@ void OHOS::Rosen::ScreenSessionManagerProxy::UpdateDisplayHookInfo(uint32_t uid,
|
||||
MessageParcel data;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
TLOGE("WriteInterfaceToken failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteUint32(uid)) {
|
||||
WLOGFE("Write uid failed");
|
||||
TLOGE("Write uid failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteBool(enable)) {
|
||||
WLOGFE("Write enable failed");
|
||||
TLOGE("Write enable failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteUint32(hookInfo.width_) || !data.WriteUint32(hookInfo.height_) ||
|
||||
!data.WriteFloat(hookInfo.density_)) {
|
||||
WLOGFE("Write hookInfo failed");
|
||||
TLOGE("Write hookInfo failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (remote->SendRequest(static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_DISPLAY_HOOK_INFO),
|
||||
data, reply, option) != ERR_NONE) {
|
||||
WLOGFW("UpdateDisplayHookInfo SendRequest failed");
|
||||
TLOGE("UpdateDisplayHookInfo SendRequest failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user