diff --git a/wmserver/include/window_manager_service.h b/wmserver/include/window_manager_service.h index 31a3b1d3..80069cc3 100644 --- a/wmserver/include/window_manager_service.h +++ b/wmserver/include/window_manager_service.h @@ -97,7 +97,8 @@ public: void MinimizeAllAppWindows(DisplayId displayId) override; WMError ToggleShownStateForAllAppWindows() override; WMError SetWindowLayoutMode(WindowLayoutMode mode) override; - WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) override; + WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action, + bool isAsyncTask = false) override; WMError GetAccessibilityWindowInfo(sptr& windowInfo) override; void RegisterWindowManagerAgent(WindowManagerAgentType type, diff --git a/wmserver/include/zidl/window_manager_interface.h b/wmserver/include/zidl/window_manager_interface.h index 4ca18b3e..05813bcc 100644 --- a/wmserver/include/zidl/window_manager_interface.h +++ b/wmserver/include/zidl/window_manager_interface.h @@ -78,7 +78,8 @@ public: virtual void MinimizeAllAppWindows(DisplayId displayId) = 0; virtual WMError ToggleShownStateForAllAppWindows() = 0; virtual WMError SetWindowLayoutMode(WindowLayoutMode mode) = 0; - virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) = 0; + virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action, + bool isAsyncTask = false) = 0; virtual void RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) = 0; virtual void UnregisterWindowManagerAgent(WindowManagerAgentType type, diff --git a/wmserver/include/zidl/window_manager_proxy.h b/wmserver/include/zidl/window_manager_proxy.h index f6366666..c4a2b12e 100644 --- a/wmserver/include/zidl/window_manager_proxy.h +++ b/wmserver/include/zidl/window_manager_proxy.h @@ -44,8 +44,8 @@ public: void MinimizeAllAppWindows(DisplayId displayId) override; WMError ToggleShownStateForAllAppWindows() override; WMError SetWindowLayoutMode(WindowLayoutMode mode) override; - WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) override; - + WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action, + bool isAsyncTask = false) override; void RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) override; void UnregisterWindowManagerAgent(WindowManagerAgentType type, diff --git a/wmserver/src/drag_controller.cpp b/wmserver/src/drag_controller.cpp index 17a6f847..7594be82 100644 --- a/wmserver/src/drag_controller.cpp +++ b/wmserver/src/drag_controller.cpp @@ -329,7 +329,7 @@ void MoveDragController::HandleDragEvent(int32_t posX, int32_t posY, int32_t poi windowProperty_->SetRequestRect(newRect); windowProperty_->SetWindowSizeChangeReason(WindowSizeChangeReason::DRAG); windowProperty_->SetDragType(moveDragProperty_->dragType_); - WindowManagerService::GetInstance().UpdateProperty(windowProperty_, PropertyChangeAction::ACTION_UPDATE_RECT); + WindowManagerService::GetInstance().UpdateProperty(windowProperty_, PropertyChangeAction::ACTION_UPDATE_RECT, true); } void MoveDragController::HandleMoveEvent(int32_t posX, int32_t posY, int32_t pointId) @@ -349,7 +349,7 @@ void MoveDragController::HandleMoveEvent(int32_t posX, int32_t posY, int32_t poi windowProperty_->GetWindowId(), newRect.posX_, newRect.posY_, newRect.width_, newRect.height_); windowProperty_->SetRequestRect(newRect); windowProperty_->SetWindowSizeChangeReason(WindowSizeChangeReason::MOVE); - WindowManagerService::GetInstance().UpdateProperty(windowProperty_, PropertyChangeAction::ACTION_UPDATE_RECT); + WindowManagerService::GetInstance().UpdateProperty(windowProperty_, PropertyChangeAction::ACTION_UPDATE_RECT, true); } void MoveDragController::HandlePointerEvent(const std::shared_ptr& pointerEvent) diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index ceecfbad..1b53d32b 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -949,7 +949,7 @@ WMError WindowController::UpdateProperty(sptr& property, Propert case PropertyChangeAction::ACTION_UPDATE_TOUCH_HOT_AREA: { std::vector rects; property->GetTouchHotAreas(rects); - UpdateTouchHotAreas(node, rects); + ret = UpdateTouchHotAreas(node, rects); break; } case PropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG: { diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp index 9510ef56..271bd284 100644 --- a/wmserver/src/window_manager_service.cpp +++ b/wmserver/src/window_manager_service.cpp @@ -787,27 +787,42 @@ WMError WindowManagerService::SetWindowLayoutMode(WindowLayoutMode mode) }); } -WMError WindowManagerService::UpdateProperty(sptr& windowProperty, PropertyChangeAction action) +WMError WindowManagerService::UpdateProperty(sptr& windowProperty, PropertyChangeAction action, + bool isAsyncTask) { if (windowProperty == nullptr) { WLOGFE("windowProperty is nullptr"); return WMError::WM_ERROR_NULLPTR; } + if (action == PropertyChangeAction::ACTION_UPDATE_TRANSFORM_PROPERTY) { PostAsyncTask([this, windowProperty, action]() mutable { windowController_->UpdateProperty(windowProperty, action); }); return WMError::WM_OK; } - PostAsyncTask([this, windowProperty, action]() mutable { + + if (isAsyncTask) { + PostAsyncTask([this, windowProperty, action]() mutable { + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:UpdateProperty"); + WMError res = windowController_->UpdateProperty(windowProperty, action); + if (action == PropertyChangeAction::ACTION_UPDATE_RECT && res == WMError::WM_OK && + windowProperty->GetWindowSizeChangeReason() == WindowSizeChangeReason::MOVE) { + dragController_->UpdateDragInfo(windowProperty->GetWindowId()); + } + }); + return WMError::WM_OK; + } + + return PostSyncTask([this, &windowProperty, action]() { HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:UpdateProperty"); WMError res = windowController_->UpdateProperty(windowProperty, action); if (action == PropertyChangeAction::ACTION_UPDATE_RECT && res == WMError::WM_OK && windowProperty->GetWindowSizeChangeReason() == WindowSizeChangeReason::MOVE) { dragController_->UpdateDragInfo(windowProperty->GetWindowId()); } + return res; }); - return WMError::WM_OK; } WMError WindowManagerService::GetAccessibilityWindowInfo(sptr& windowInfo) diff --git a/wmserver/src/zidl/window_manager_proxy.cpp b/wmserver/src/zidl/window_manager_proxy.cpp index 6ef07d44..633374bd 100644 --- a/wmserver/src/zidl/window_manager_proxy.cpp +++ b/wmserver/src/zidl/window_manager_proxy.cpp @@ -390,7 +390,8 @@ WMError WindowManagerProxy::SetWindowLayoutMode(WindowLayoutMode mode) return static_cast(ret); } -WMError WindowManagerProxy::UpdateProperty(sptr& windowProperty, PropertyChangeAction action) +WMError WindowManagerProxy::UpdateProperty(sptr& windowProperty, PropertyChangeAction action, + bool isAsyncTask) { MessageParcel data; MessageParcel reply;