1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ROSEN_SESSION_MANAGER_AGENT_CONTROLLER_H 17 #define OHOS_ROSEN_SESSION_MANAGER_AGENT_CONTROLLER_H 18 #include <mutex> 19 20 #include "client_agent_container.h" 21 #include "window_manager.h" 22 #include "wm_single_instance.h" 23 #include "zidl/window_manager_agent_interface.h" 24 #include "window_visibility_info.h" 25 #include "window_drawing_content_info.h" 26 #include "window_pid_visibility_info.h" 27 28 namespace OHOS { 29 namespace Rosen { 30 class SessionManagerAgentController { 31 WM_DECLARE_SINGLE_INSTANCE_BASE(SessionManagerAgentController) 32 public: 33 WMError RegisterWindowManagerAgent(const sptr<IWindowManagerAgent>& windowManagerAgent, 34 WindowManagerAgentType type, int32_t pid); 35 WMError UnregisterWindowManagerAgent(const sptr<IWindowManagerAgent>& windowManagerAgent, 36 WindowManagerAgentType type, int32_t pid); 37 38 void UpdateCameraFloatWindowStatus(uint32_t accessTokenId, bool isShowing); 39 void UpdateFocusChangeInfo(const sptr<FocusChangeInfo>& focusChangeInfo, bool focused); 40 void UpdateWindowModeTypeInfo(WindowModeType type); 41 void NotifyAccessibilityWindowInfo(const std::vector<sptr<AccessibilityWindowInfo>>& infos, 42 WindowUpdateType type); 43 void NotifyWaterMarkFlagChangedResult(bool hasWaterMark); 44 void UpdateWindowVisibilityInfo(const std::vector<sptr<WindowVisibilityInfo>>& windowVisibilityInfos); 45 void UpdateVisibleWindowNum(const std::vector<VisibleWindowNumInfo>& visibleWindowNumInfo); 46 void UpdateWindowDrawingContentInfo(const std::vector<sptr<WindowDrawingContentInfo>>& windowDrawingContentInfos); 47 void UpdateCameraWindowStatus(uint32_t accessTokenId, bool isShowing); 48 void NotifyGestureNavigationEnabledResult(bool enable); 49 void NotifyWindowStyleChange(WindowStyleType type); 50 void NotifyCallingWindowDisplayChanged(const CallingWindowInfo& callingWindowInfo); 51 void NotifyWindowPidVisibilityChanged(const sptr<WindowPidVisibilityInfo>& info); 52 void NotifyWindowSystemBarPropertyChange(WindowType type, const SystemBarProperty& systemBarProperty); 53 void UpdatePiPWindowStateChanged(const std::string& bundleName, bool isForeground); 54 void NotifyWindowPropertyChange(uint32_t propertyDirtyFlags, 55 const std::vector<std::unordered_map<WindowInfoKey, WindowChangeInfoType>>& windowInfoList); 56 57 private: SessionManagerAgentController()58 SessionManagerAgentController() 59 { 60 smAgentContainer_.SetAgentDeathCallback(([this](const sptr<IRemoteObject>& remoteObject) { 61 DoAfterAgentDeath(remoteObject); 62 })); 63 } 64 virtual ~SessionManagerAgentController() = default; 65 void DoAfterAgentDeath(const sptr<IRemoteObject>& remoteObject); 66 67 ClientAgentContainer<IWindowManagerAgent, WindowManagerAgentType> smAgentContainer_; 68 std::map<int32_t, std::map<WindowManagerAgentType, sptr<IWindowManagerAgent>>> windowManagerPidAgentMap_; 69 std::map<sptr<IRemoteObject>, std::pair<int32_t, WindowManagerAgentType>> windowManagerAgentPairMap_; 70 std::mutex windowManagerAgentPidMapMutex_; 71 WindowManagementMode windowManagementMode_; 72 }; 73 } 74 } 75 #endif // OHOS_ROSEN_WINDOW_MANAGER_AGENT_CONTROLLER_H 76