diff --git a/wmserver/include/window_node_container.h b/wmserver/include/window_node_container.h index 30a73267..b4b7901c 100644 --- a/wmserver/include/window_node_container.h +++ b/wmserver/include/window_node_container.h @@ -73,7 +73,7 @@ public: sptr GetNextActiveWindow(uint32_t windowId) const; void MinimizeAllAppWindows(DisplayId displayId); void MinimizeOldestAppWindow(); - void ToggleShownStateForAllAppWindows(std::function restoreFunc, bool restore); + WMError ToggleShownStateForAllAppWindows(std::function restoreFunc, bool restore); void RestoreAllAppWindows(std::function restoreFunc); bool IsAppWindowsEmpty() const; void ProcessWindowStateChange(WindowState state, WindowStateChangeReason reason); diff --git a/wmserver/include/window_root.h b/wmserver/include/window_root.h index 7a9bf4a1..5c73eda8 100644 --- a/wmserver/include/window_root.h +++ b/wmserver/include/window_root.h @@ -58,7 +58,7 @@ public: std::shared_ptr GetSurfaceNodeByAbilityToken(const sptr& abilityToken) const; WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); void MinimizeAllAppWindows(DisplayId displayId); - void ToggleShownStateForAllAppWindows(); + WMError ToggleShownStateForAllAppWindows(); WMError MaxmizeWindow(uint32_t windowId); WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode); diff --git a/wmserver/src/window_controller.cpp b/wmserver/src/window_controller.cpp index 4e2e9833..abe759ca 100644 --- a/wmserver/src/window_controller.cpp +++ b/wmserver/src/window_controller.cpp @@ -634,8 +634,7 @@ WMError WindowController::ToggleShownStateForAllAppWindows() if (isScreenLocked_) { return WMError::WM_DO_NOTHING; } - windowRoot_->ToggleShownStateForAllAppWindows(); - return WMError::WM_OK; + return windowRoot_->ToggleShownStateForAllAppWindows(); } WMError WindowController::MaxmizeWindow(uint32_t windowId) diff --git a/wmserver/src/window_node_container.cpp b/wmserver/src/window_node_container.cpp index 273dd39a..09bf31a9 100644 --- a/wmserver/src/window_node_container.cpp +++ b/wmserver/src/window_node_container.cpp @@ -1316,10 +1316,15 @@ void WindowNodeContainer::MinimizeOldestAppWindow() WLOGFI("no window needs to minimize"); } -void WindowNodeContainer::ToggleShownStateForAllAppWindows( +WMError WindowNodeContainer::ToggleShownStateForAllAppWindows( std::function restoreFunc, bool restore) { WLOGFI("ToggleShownStateForAllAppWindows"); + for (auto node : aboveAppWindowNode_->children_) { + if (node->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT) { + return WMError::WM_DO_NOTHING; + } + } // to do, backup reentry: 1.ToggleShownStateForAllAppWindows fast; 2.this display should reset backupWindowIds_. if (!restore && appWindowNode_->children_.empty() && !backupWindowIds_.empty()) { backupWindowIds_.clear(); @@ -1359,6 +1364,7 @@ void WindowNodeContainer::ToggleShownStateForAllAppWindows( } else { WLOGFI("do nothing because shown app windows is empty or backup windows is empty."); } + return WMError::WM_OK; } void WindowNodeContainer::RestoreAllAppWindows(std::function restoreFunc) diff --git a/wmserver/src/window_root.cpp b/wmserver/src/window_root.cpp index 48220113..9b223c61 100644 --- a/wmserver/src/window_root.cpp +++ b/wmserver/src/window_root.cpp @@ -274,7 +274,7 @@ void WindowRoot::MinimizeAllAppWindows(DisplayId displayId) return container->MinimizeAllAppWindows(displayId); } -void WindowRoot::ToggleShownStateForAllAppWindows() +WMError WindowRoot::ToggleShownStateForAllAppWindows() { std::vector displays = DisplayManagerServiceInner::GetInstance().GetAllDisplayIds(); std::vector> containers; @@ -288,8 +288,9 @@ void WindowRoot::ToggleShownStateForAllAppWindows() containers.emplace_back(container); isAllAppWindowsEmpty = isAllAppWindowsEmpty && container->IsAppWindowsEmpty(); } + WMError res = WMError::WM_OK; std::for_each(containers.begin(), containers.end(), - [this, isAllAppWindowsEmpty] (sptr container) { + [this, isAllAppWindowsEmpty, &res] (sptr container) { auto restoreFunc = [this](uint32_t windowId, WindowMode mode) { auto windowNode = GetWindowNode(windowId); if (windowNode == nullptr) { @@ -310,12 +311,15 @@ void WindowRoot::ToggleShownStateForAllAppWindows() WindowManagerService::GetInstance().HandleAddWindow(property); return true; }; + WMError tmpRes = WMError::WM_OK; if (isAllAppWindowsEmpty) { - container->ToggleShownStateForAllAppWindows(restoreFunc, true); + tmpRes = container->ToggleShownStateForAllAppWindows(restoreFunc, true); } else { - container->ToggleShownStateForAllAppWindows(restoreFunc, false); + tmpRes = container->ToggleShownStateForAllAppWindows(restoreFunc, false); } + res = (res == WMError::WM_OK) ? tmpRes : res; }); + return res; } WMError WindowRoot::MaxmizeWindow(uint32_t windowId)