From ae186e9a88b3a32799b0a84b681e8a735697606d Mon Sep 17 00:00:00 2001 From: leafly2021 Date: Fri, 24 Jun 2022 08:35:52 +0800 Subject: [PATCH] remove MaxmizeWindow Signed-off-by: leafly2021 Change-Id: I267d482c4c0ac06aee0048e4eac314353a9f98c6 --- interfaces/innerkits/wm/window.h | 14 ++++++++ wm/include/window_adapter.h | 1 - wm/src/window_adapter.cpp | 7 ---- .../windowipc_fuzzer/windowipc_fuzzer.cpp | 3 -- wm/test/unittest/mock_window_adapter.h | 1 - wmserver/include/window_controller.h | 1 - wmserver/include/window_manager_service.h | 1 - wmserver/include/window_node_container.h | 1 - wmserver/include/window_root.h | 1 - .../include/zidl/window_manager_interface.h | 2 -- wmserver/include/zidl/window_manager_proxy.h | 1 - wmserver/src/window_controller.cpp | 11 ------ wmserver/src/window_manager_service.cpp | 8 ----- wmserver/src/window_node_container.cpp | 34 +++---------------- wmserver/src/window_root.cpp | 19 ----------- wmserver/src/zidl/window_manager_proxy.cpp | 22 ------------ wmserver/src/zidl/window_manager_stub.cpp | 4 --- 17 files changed, 19 insertions(+), 112 deletions(-) diff --git a/interfaces/innerkits/wm/window.h b/interfaces/innerkits/wm/window.h index c7f91340..2cdea581 100644 --- a/interfaces/innerkits/wm/window.h +++ b/interfaces/innerkits/wm/window.h @@ -127,8 +127,22 @@ public: class Window : public RefBase { public: + /** + * @brief create window, include main_window/sub_window/system_window + * + * @param windowName window name, identify window instance + * @param option window propertion + * @param context ability context + * @return sptr If create window success,return window instance;Otherwise, return nullptr + */ static sptr Create(const std::string& windowName, sptr& option, const std::shared_ptr& context = nullptr); + /** + * @brief find window by windowName + * + * @param windowName + * @return sptr Return the window instance founded + */ static sptr Find(const std::string& windowName); static sptr GetTopWindowWithContext(const std::shared_ptr& context = nullptr); static sptr GetTopWindowWithId(uint32_t mainWinId); diff --git a/wm/include/window_adapter.h b/wm/include/window_adapter.h index 8c1095e8..a659fd86 100644 --- a/wm/include/window_adapter.h +++ b/wm/include/window_adapter.h @@ -49,7 +49,6 @@ public: virtual void ProcessPointUp(uint32_t windowId); virtual void MinimizeAllAppWindows(DisplayId displayId); virtual WMError ToggleShownStateForAllAppWindows(); - virtual WMError MaximizeWindow(uint32_t windowId); virtual WMError SetWindowLayoutMode(WindowLayoutMode mode); virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action); virtual WMError GetSystemConfig(SystemConfig& systemConfig); diff --git a/wm/src/window_adapter.cpp b/wm/src/window_adapter.cpp index ac9c77db..6ae6be3f 100644 --- a/wm/src/window_adapter.cpp +++ b/wm/src/window_adapter.cpp @@ -149,13 +149,6 @@ WMError WindowAdapter::ToggleShownStateForAllAppWindows() return windowManagerServiceProxy_->ToggleShownStateForAllAppWindows(); } -WMError WindowAdapter::MaximizeWindow(uint32_t windowId) -{ - INIT_PROXY_CHECK_RETURN(WMError::WM_ERROR_SAMGR); - - return windowManagerServiceProxy_->MaximizeWindow(windowId); -} - WMError WindowAdapter::GetSystemConfig(SystemConfig& systemConfig) { INIT_PROXY_CHECK_RETURN(WMError::WM_ERROR_SAMGR); diff --git a/wm/test/fuzztest/windowipc_fuzzer/windowipc_fuzzer.cpp b/wm/test/fuzztest/windowipc_fuzzer/windowipc_fuzzer.cpp index 3b90ebc2..90d1f2fe 100644 --- a/wm/test/fuzztest/windowipc_fuzzer/windowipc_fuzzer.cpp +++ b/wm/test/fuzztest/windowipc_fuzzer/windowipc_fuzzer.cpp @@ -130,9 +130,6 @@ void IPCSpecificInterfaceFuzzTest2(sptr proxy, MessageParcel& sen sendData, reply, option); proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE), sendData, reply, option); - - proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_MAXIMIZE_WINDOW), - sendData, reply, option); proxy->SendRequest(static_cast(IWindowManager::WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY), sendData, reply, option); proxy->SendRequest( diff --git a/wm/test/unittest/mock_window_adapter.h b/wm/test/unittest/mock_window_adapter.h index 8eeca6ba..4b7d529a 100644 --- a/wm/test/unittest/mock_window_adapter.h +++ b/wm/test/unittest/mock_window_adapter.h @@ -32,7 +32,6 @@ public: MOCK_METHOD2(SetWindowBackgroundBlur, WMError(uint32_t windowId, WindowBlurLevel level)); MOCK_METHOD2(SetAlpha, WMError(uint32_t windowId, float alpha)); MOCK_METHOD2(UpdateProperty, WMError(sptr& windowProperty, PropertyChangeAction action)); - MOCK_METHOD1(MaximizeWindow, WMError(uint32_t windowId)); }; } } // namespace OHOS diff --git a/wmserver/include/window_controller.h b/wmserver/include/window_controller.h index 86f44fed..37a7e16c 100644 --- a/wmserver/include/window_controller.h +++ b/wmserver/include/window_controller.h @@ -51,7 +51,6 @@ public: WMError ProcessPointUp(uint32_t windowId); void MinimizeAllAppWindows(DisplayId displayId); WMError ToggleShownStateForAllAppWindows(); - WMError MaximizeWindow(uint32_t windowId); WMError SetWindowLayoutMode(WindowLayoutMode mode); WMError UpdateProperty(sptr& property, PropertyChangeAction action); void NotifySystemBarTints(); diff --git a/wmserver/include/window_manager_service.h b/wmserver/include/window_manager_service.h index b92d1c75..c9a5fe13 100644 --- a/wmserver/include/window_manager_service.h +++ b/wmserver/include/window_manager_service.h @@ -83,7 +83,6 @@ public: WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override; void MinimizeAllAppWindows(DisplayId displayId) override; WMError ToggleShownStateForAllAppWindows() override; - WMError MaximizeWindow(uint32_t windowId) override; WMError SetWindowLayoutMode(WindowLayoutMode mode) override; WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) override; WMError GetAccessibilityWindowInfo(sptr& windowInfo) override; diff --git a/wmserver/include/window_node_container.h b/wmserver/include/window_node_container.h index 1afda27d..ac147ec4 100644 --- a/wmserver/include/window_node_container.h +++ b/wmserver/include/window_node_container.h @@ -81,7 +81,6 @@ public: bool IsAppWindowsEmpty() const; void ProcessWindowStateChange(WindowState state, WindowStateChangeReason reason); void NotifySystemBarTints(std::vector displayIdVec); - void NotifySystemBarDismiss(sptr& node); WMError MinimizeAppNodeExceptOptions(MinimizeReason reason, const std::vector &exceptionalIds = {}, const std::vector &exceptionalModes = {}); WMError SetWindowMode(sptr& node, WindowMode dstMode); diff --git a/wmserver/include/window_root.h b/wmserver/include/window_root.h index 243d9d39..f09cdf09 100644 --- a/wmserver/include/window_root.h +++ b/wmserver/include/window_root.h @@ -61,7 +61,6 @@ public: WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); void MinimizeAllAppWindows(DisplayId displayId); WMError ToggleShownStateForAllAppWindows(); - WMError MaximizeWindow(uint32_t windowId); WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode); void ProcessWindowStateChange(WindowState state, WindowStateChangeReason reason); diff --git a/wmserver/include/zidl/window_manager_interface.h b/wmserver/include/zidl/window_manager_interface.h index 2f4a3c99..a77c7d3f 100644 --- a/wmserver/include/zidl/window_manager_interface.h +++ b/wmserver/include/zidl/window_manager_interface.h @@ -52,7 +52,6 @@ public: TRANS_ID_SET_BACKGROUND_BLUR, TRANS_ID_SET_ALPHA, TRANS_ID_UPDATE_LAYOUT_MODE, - TRANS_ID_MAXIMIZE_WINDOW, TRANS_ID_UPDATE_PROPERTY, TRANS_ID_GET_ACCESSIBILITY_WINDOW_INFO_ID, TRANS_ID_ANIMATION_SET_CONTROLLER, @@ -76,7 +75,6 @@ public: virtual void ProcessPointUp(uint32_t windowId) = 0; virtual void MinimizeAllAppWindows(DisplayId displayId) = 0; virtual WMError ToggleShownStateForAllAppWindows() = 0; - virtual WMError MaximizeWindow(uint32_t windowId) = 0; virtual WMError SetWindowLayoutMode(WindowLayoutMode mode) = 0; virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) = 0; virtual void RegisterWindowManagerAgent(WindowManagerAgentType type, diff --git a/wmserver/include/zidl/window_manager_proxy.h b/wmserver/include/zidl/window_manager_proxy.h index 19ef06e1..f7e5d869 100644 --- a/wmserver/include/zidl/window_manager_proxy.h +++ b/wmserver/include/zidl/window_manager_proxy.h @@ -44,7 +44,6 @@ public: void ProcessPointUp(uint32_t windowId) override; void MinimizeAllAppWindows(DisplayId displayId) override; WMError ToggleShownStateForAllAppWindows() override; - WMError MaximizeWindow(uint32_t windowId) override; WMError SetWindowLayoutMode(WindowLayoutMode mode) override; WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action) override; diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index c243b623..bf0d6144 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -690,17 +690,6 @@ WMError WindowController::ToggleShownStateForAllAppWindows() return windowRoot_->ToggleShownStateForAllAppWindows(); } -WMError WindowController::MaximizeWindow(uint32_t windowId) -{ - WMError ret = SetWindowMode(windowId, WindowMode::WINDOW_MODE_FULLSCREEN); - if (ret != WMError::WM_OK) { - return ret; - } - ret = windowRoot_->MaximizeWindow(windowId); - FlushWindowInfo(windowId); - return ret; -} - WMError WindowController::GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) { return windowRoot_->GetTopWindowId(mainWinId, topWinId); diff --git a/wmserver/src/window_manager_service.cpp b/wmserver/src/window_manager_service.cpp index f36feb3b..1b4987c6 100644 --- a/wmserver/src/window_manager_service.cpp +++ b/wmserver/src/window_manager_service.cpp @@ -546,14 +546,6 @@ WMError WindowManagerService::ToggleShownStateForAllAppWindows() return WMError::WM_OK; } -WMError WindowManagerService::MaximizeWindow(uint32_t windowId) -{ - return wmsTaskLooper_->ScheduleTask([this, windowId]() { - WM_SCOPED_TRACE("wms:MaximizeWindow"); - return windowController_->MaximizeWindow(windowId); - }).get(); -} - WMError WindowManagerService::GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) { return wmsTaskLooper_->ScheduleTask([this, &topWinId, mainWinId]() { diff --git a/wmserver/src/window_node_container.cpp b/wmserver/src/window_node_container.cpp index 9d19a91a..72e4e93b 100644 --- a/wmserver/src/window_node_container.cpp +++ b/wmserver/src/window_node_container.cpp @@ -868,44 +868,20 @@ void WindowNodeContainer::NotifyIfKeyboardRegionChanged(const sptr& WLOGFE("does not have correct callingWindowMode for input method window"); } -void WindowNodeContainer::NotifySystemBarDismiss(sptr& node) -{ - WM_FUNCTION_TRACE(); - if (node == nullptr) { - WLOGE("could not find window"); - return; - } - SystemBarRegionTints tints; - auto& sysBarPropMapNode = node->GetSystemBarProperty(); - SysBarTintMap& sysBarTintMap = displayGroupController_->sysBarTintMaps_[node->GetDisplayId()]; - for (auto it : sysBarPropMapNode) { - it.second.enable_ = false; - node->SetSystemBarProperty(it.first, it.second); - WLOGFI("set system bar enable to false, id: %{public}u, type: %{public}d", - node->GetWindowId(), static_cast(it.first)); - if (sysBarTintMap[it.first].prop_.enable_) { - sysBarTintMap[it.first].prop_.enable_ = false; - tints.emplace_back(sysBarTintMap[it.first]); - WLOGFI("notify system bar dismiss, type: %{public}d", static_cast(it.first)); - } - } - WindowManagerAgentController::GetInstance().UpdateSystemBarRegionTints(node->GetDisplayId(), tints); -} - void WindowNodeContainer::NotifySystemBarTints(std::vector displayIdVec) { WM_FUNCTION_TRACE(); if (displayIdVec.size() != displayGroupController_->sysBarTintMaps_.size()) { - WLOGE("the number of display is error"); + WLOGE("[Immersive] the number of display is error"); } for (auto displayId : displayIdVec) { SystemBarRegionTints tints; SysBarTintMap& sysBarTintMap = displayGroupController_->sysBarTintMaps_[displayId]; for (auto it : sysBarTintMap) { - WLOGFI("system bar cur notify, type: %{public}d, " \ - "visible: %{public}d, color: %{public}x | %{public}x, " \ - "region: [%{public}d, %{public}d, %{public}d, %{public}d]", + WLOGFI("[Immersive] system bar cur notify, T: %{public}d, " \ + "V: %{public}d, C: %{public}x | %{public}x, " \ + "R: [%{public}d, %{public}d, %{public}d, %{public}d]", static_cast(it.first), sysBarTintMap[it.first].prop_.enable_, sysBarTintMap[it.first].prop_.backgroundColor_, sysBarTintMap[it.first].prop_.contentColor_, @@ -920,7 +896,7 @@ void WindowNodeContainer::NotifySystemBarTints(std::vector displayIdV void WindowNodeContainer::NotifyDockWindowStateChanged(sptr& node, bool isEnable) { WM_FUNCTION_TRACE(); - WLOGFI("begin isEnable: %{public}d", isEnable); + WLOGFI("[Immersive] begin isEnable: %{public}d", isEnable); if (isEnable) { for (auto& windowNode : appWindowNode_->children_) { if (windowNode->GetWindowId() == node->GetWindowId()) { diff --git a/wmserver/src/window_root.cpp b/wmserver/src/window_root.cpp index 4f7b1263..d6ae2bac 100644 --- a/wmserver/src/window_root.cpp +++ b/wmserver/src/window_root.cpp @@ -331,25 +331,6 @@ WMError WindowRoot::ToggleShownStateForAllAppWindows() return res; } -WMError WindowRoot::MaximizeWindow(uint32_t windowId) -{ - auto node = GetWindowNode(windowId); - if (node == nullptr) { - WLOGFE("could not find window"); - return WMError::WM_ERROR_NULLPTR; - } - auto container = GetOrCreateWindowNodeContainer(node->GetDisplayId()); - if (container == nullptr) { - WLOGFE("add window failed, window container could not be found"); - return WMError::WM_ERROR_NULLPTR; - } - auto property = node->GetWindowProperty(); - uint32_t flags = property->GetWindowFlags() & (~(static_cast(WindowFlag::WINDOW_FLAG_NEED_AVOID))); - property->SetWindowFlags(flags); - container->NotifySystemBarDismiss(node); - return WMError::WM_OK; -} - void WindowRoot::DestroyLeakStartingWindow() { WLOGFI("DestroyLeakStartingWindow is called"); diff --git a/wmserver/src/zidl/window_manager_proxy.cpp b/wmserver/src/zidl/window_manager_proxy.cpp index 0a7b7dcf..fe9b5390 100644 --- a/wmserver/src/zidl/window_manager_proxy.cpp +++ b/wmserver/src/zidl/window_manager_proxy.cpp @@ -432,28 +432,6 @@ WMError WindowManagerProxy::ToggleShownStateForAllAppWindows() return static_cast(ret); } -WMError WindowManagerProxy::MaximizeWindow(uint32_t windowId) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - WLOGFE("WriteInterfaceToken failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (!data.WriteUint32(windowId)) { - WLOGFE("Write windowId failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (Remote()->SendRequest(static_cast(WindowManagerMessage::TRANS_ID_MAXIMIZE_WINDOW), - data, reply, option) != ERR_NONE) { - return WMError::WM_ERROR_IPC_FAILED; - } - - int32_t ret = reply.ReadInt32(); - return static_cast(ret); -} - WMError WindowManagerProxy::SetWindowLayoutMode(WindowLayoutMode mode) { MessageParcel data; diff --git a/wmserver/src/zidl/window_manager_stub.cpp b/wmserver/src/zidl/window_manager_stub.cpp index 86f7e5c8..b886abae 100644 --- a/wmserver/src/zidl/window_manager_stub.cpp +++ b/wmserver/src/zidl/window_manager_stub.cpp @@ -148,10 +148,6 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M reply.WriteInt32(static_cast(errCode)); break; } - case WindowManagerMessage::TRANS_ID_MAXIMIZE_WINDOW: { - MaximizeWindow(data.ReadUint32()); - break; - } case WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE: { WindowLayoutMode mode = static_cast(data.ReadUint32()); WMError errCode = SetWindowLayoutMode(mode);