From 441ada4de49cf452ed83230348f7bf16ca98ad81 Mon Sep 17 00:00:00 2001 From: francis Date: Tue, 16 Jul 2024 10:08:17 +0000 Subject: [PATCH] update wm/src/window_adapter.cpp. Signed-off-by: francis --- wm/src/window_adapter.cpp | 222 +++++++++++++++++++++++++++++++++++++- 1 file changed, 221 insertions(+), 1 deletion(-) diff --git a/wm/src/window_adapter.cpp b/wm/src/window_adapter.cpp index e2b3153769..2dc8524e83 100644 --- a/wm/src/window_adapter.cpp +++ b/wm/src/window_adapter.cpp @@ -649,6 +649,7 @@ WMError WindowAdapter::GetWindowAnimationTargets(std::vector missionId CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_ERROR_SAMGR); return wmsProxy->GetWindowAnimationTargets(missionIds, targets); } + void WindowAdapter::SetMaximizeMode(MaximizeMode maximizeMode) { INIT_PROXY_CHECK_RETURN(); @@ -913,6 +914,225 @@ sptr WindowAdapter::GetWindowManagerServiceProxy() const std::lock_guard lock(mutex_); return windowManagerServiceProxy_; } - +// +diff --git a/window_window_manager-master/interfaces/innerkits/wm/window.h b/window_window_manager-master/interfaces/innerkits/wm/window.h +index a9ee85d..1b6e3a1 100644 +--- a/window_window_manager-master/interfaces/innerkits/wm/window.h ++++ b/window_window_manager-master/interfaces/innerkits/wm/window.h +@@ -1705,7 +1705,7 @@ public: + */ + virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } + +- /* ++ /** + * @brief Register listener, if timeout(seconds) pass with no interaction, the listener will be executed. + * + * @param listener IWindowNoInteractionListenerSptr. +diff --git a/window_window_manager-master/wm/include/window_adapter.h b/window_window_manager-master/wm/include/window_adapter.h +index 0d666d1..275f8e2 100644 +--- a/window_window_manager-master/wm/include/window_adapter.h ++++ b/window_window_manager-master/wm/include/window_adapter.h +@@ -96,6 +96,8 @@ public: + virtual WMError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener); + virtual WMError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible); + virtual WMError UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener); ++ virtual WMError RaiseWindowToTop(int32_t persistentId); ++ virtual WMError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId); + virtual void CreateAndConnectSpecificSession(const sptr& sessionStage, + const sptr& eventChannel, const std::shared_ptr& surfaceNode, + sptr property, int32_t& persistentId, sptr& session, +@@ -116,8 +118,6 @@ public: + virtual WMError SetSessionGravity(int32_t persistentId, SessionGravity gravity, uint32_t percent); + virtual WMError BindDialogSessionTarget(uint64_t persistentId, sptr targetToken); + virtual WMError RequestFocusStatus(int32_t persistentId, bool isFocused); +- virtual WMError RaiseWindowToTop(int32_t persistentId); +- virtual WMError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId); + virtual void AddExtensionWindowStageToSCB(const sptr& sessionStage, + const sptr& token, uint64_t surfaceNodeId); + virtual void UpdateModalExtensionRect(const sptr& token, Rect rect); +diff --git a/window_window_manager-master/wm/include/window_impl.h b/window_window_manager-master/wm/include/window_impl.h +index 721b859..2b7b8b1 100644 +--- a/window_window_manager-master/wm/include/window_impl.h ++++ b/window_window_manager-master/wm/include/window_impl.h +@@ -315,6 +315,7 @@ public: + const std::map& propertyFlags) override; + virtual WMError GetSystemBarProperties(std::map& properties) override; + virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override; ++ virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) override; + + private: + template WMError RegisterListener(std::vector>& holder, const sptr& listener); +@@ -438,7 +439,6 @@ private: + static std::map>> subWindowMap_; + static std::map>> appFloatingWindowMap_; + static std::map>> appDialogWindowMap_; +- static bool enableImmersiveMode_; + sptr property_; + WindowState state_ { WindowState::STATE_INITIAL }; + WindowState subWindowState_ {WindowState::STATE_INITIAL}; +@@ -495,6 +495,7 @@ private: + std::shared_ptr handler_ = nullptr; + bool needNotifyFocusLater_ = false; + bool escKeyEventTriggered_ = false; ++ bool enableImmersiveMode_ = false; + std::shared_ptr vsyncStation_ = nullptr; + + std::string restoredRouterStack_; // It was set and get in same thread, which is js thread. +diff --git a/window_window_manager-master/wm/src/root_scene.cpp b/window_window_manager-master/wm/src/root_scene.cpp +index 0bc4242..9129ad7 100644 +--- a/window_window_manager-master/wm/src/root_scene.cpp ++++ b/window_window_manager-master/wm/src/root_scene.cpp +@@ -17,13 +17,13 @@ + + #include + #include ++#include "fold_screen_state_internel.h" + #include + #include + #include + #include + + #include "app_mgr_client.h" +-#include "fold_screen_state_internel.h" + #include "input_transfer_station.h" + #include "singleton.h" + #include "singleton_container.h" +@@ -240,7 +240,7 @@ void RootScene::SetUiDvsyncSwitch(bool dvsyncSwitch) + { + std::lock_guard lock(mutex_); + if (vsyncStation_ == nullptr) { +- TLOGE(WmsLogTag::WMS_MAIN, "set dvsync switch failed, vsyncStation is nullptr"); ++ TLOGE(WmsLogTag::WMS_MAIN, "set dvsync switch failed, vsyncStation is nullptr"); + return; + } + vsyncStation_->SetUiDvsyncSwitch(dvsyncSwitch); +diff --git a/window_window_manager-master/wm/src/window_adapter.cpp b/window_window_manager-master/wm/src/window_adapter.cpp +index 059c0ab..f1deb9f 100644 +--- a/window_window_manager-master/wm/src/window_adapter.cpp ++++ b/window_window_manager-master/wm/src/window_adapter.cpp +@@ -649,6 +649,7 @@ WMError WindowAdapter::GetWindowAnimationTargets(std::vector missionId + CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_ERROR_SAMGR); + return wmsProxy->GetWindowAnimationTargets(missionIds, targets); + } ++ + void WindowAdapter::SetMaximizeMode(MaximizeMode maximizeMode) + { + INIT_PROXY_CHECK_RETURN(); +@@ -695,6 +696,44 @@ WMError WindowAdapter::UpdateSessionTouchOutsideListener(int32_t& persistentId, + wmsProxy->UpdateSessionTouchOutsideListener(persistentId, haveListener)); + } + ++WMError WindowAdapter::NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) ++{ ++ INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); ++ ++ auto wmsProxy = GetWindowManagerServiceProxy(); ++ CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); ++ return static_cast(wmsProxy->NotifyWindowExtensionVisibilityChange(pid, uid, visible)); ++} ++ ++WMError WindowAdapter::RaiseWindowToTop(int32_t persistentId) ++{ ++ INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); ++ ++ auto wmsProxy = GetWindowManagerServiceProxy(); ++ CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); ++ return static_cast(wmsProxy->RaiseWindowToTop(persistentId)); ++} ++ ++WMError WindowAdapter::UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener) ++{ ++ INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); ++ ++ auto wmsProxy = GetWindowManagerServiceProxy(); ++ CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); ++ WSError ret = wmsProxy->UpdateSessionWindowVisibilityListener(persistentId, haveListener); ++ return static_cast(ret); ++} ++ ++WMError WindowAdapter::ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) ++{ ++ INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); ++ ++ auto wmsProxy = GetWindowManagerServiceProxy(); ++ CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); ++ return static_cast( ++ wmsProxy->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId)); ++} ++ + void WindowAdapter::CreateAndConnectSpecificSession(const sptr& sessionStage, + const sptr& eventChannel, const std::shared_ptr& surfaceNode, + sptr property, int32_t& persistentId, sptr& session, +@@ -786,44 +825,6 @@ WMError WindowAdapter::RequestFocusStatus(int32_t persistentId, bool isFocused) + return static_cast(wmsProxy->RequestFocusStatus(persistentId, isFocused)); + } + +-WMError WindowAdapter::RaiseWindowToTop(int32_t persistentId) +-{ +- INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); +- +- auto wmsProxy = GetWindowManagerServiceProxy(); +- CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); +- return static_cast(wmsProxy->RaiseWindowToTop(persistentId)); +-} +- +-WMError WindowAdapter::NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) +-{ +- INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); +- +- auto wmsProxy = GetWindowManagerServiceProxy(); +- CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); +- return static_cast(wmsProxy->NotifyWindowExtensionVisibilityChange(pid, uid, visible)); +-} +- +-WMError WindowAdapter::UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener) +-{ +- INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); +- +- auto wmsProxy = GetWindowManagerServiceProxy(); +- CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); +- WSError ret = wmsProxy->UpdateSessionWindowVisibilityListener(persistentId, haveListener); +- return static_cast(ret); +-} +- +-WMError WindowAdapter::ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) +-{ +- INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); +- +- auto wmsProxy = GetWindowManagerServiceProxy(); +- CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING); +- return static_cast( +- wmsProxy->ShiftAppWindowFocus(sourcePersistentId, targetPersistentId)); +-} +- + void WindowAdapter::AddExtensionWindowStageToSCB(const sptr& sessionStage, + const sptr& token, uint64_t surfaceNodeId) + { +diff --git a/window_window_manager-master/wm/src/window_impl.cpp b/window_window_manager-master/wm/src/window_impl.cpp +index 87f7ea2..e6cd1ce 100644 +--- a/window_window_manager-master/wm/src/window_impl.cpp ++++ b/window_window_manager-master/wm/src/window_impl.cpp +@@ -95,7 +95,6 @@ std::map> WindowImpl::dialogDeathR + std::recursive_mutex WindowImpl::globalMutex_; + int g_constructorCnt = 0; + int g_deConstructorCnt = 0; +-bool WindowImpl::enableImmersiveMode_ = true; + WindowImpl::WindowImpl(const sptr& option) + { + property_ = new (std::nothrow) WindowProperty(); +@@ -4198,5 +4197,14 @@ WMError WindowImpl::SetTextFieldAvoidInfo(double textFieldPositionY, double text + UpdateProperty(PropertyChangeAction::ACTION_UPDATE_TEXTFIELD_AVOID_INFO); + return WMError::WM_OK; + } ++ ++void WindowImpl::SetUiDvsyncSwitch(bool dvsyncSwitch) ++{ ++ std::lock_guard lock(mutex_); ++ if (!SingletonContainer::IsDestroyed() && vsyncStation_ != nullptr) { ++ vsyncStation_->SetUiDvsyncSwitch(dvsyncSwitch); ++ } ++} ++ +// } // namespace Rosen } // namespace OHOS