/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_WINDOW_ADAPTER_H #define OHOS_WINDOW_ADAPTER_H #include #include #include "window.h" #include "zidl/window_interface.h" #include "singleton_delegator.h" #include "window_property.h" #include "wm_single_instance.h" #include "zidl/window_manager_interface.h" namespace OHOS { namespace Rosen { class WMSDeathRecipient : public IRemoteObject::DeathRecipient { public: virtual void OnRemoteDied(const wptr& wptrDeath) override; }; class WindowAdapter { WM_DECLARE_SINGLE_INSTANCE(WindowAdapter); public: virtual WMError CreateWindow(sptr& window, sptr& windowProperty, std::shared_ptr surfaceNode, uint32_t& windowId, const sptr& token); virtual WMError AddWindow(sptr& windowProperty); virtual WMError RemoveWindow(uint32_t windowId); virtual WMError DestroyWindow(uint32_t windowId); virtual WMError RequestFocus(uint32_t windowId); virtual WMError GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type, AvoidArea& avoidRect); virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); virtual void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr& windowProperty, sptr& moveDragProperty); virtual void ProcessPointDown(uint32_t windowId, bool isPointDown = true); virtual void ProcessPointUp(uint32_t windowId); virtual void MinimizeAllAppWindows(DisplayId displayId); virtual WMError ToggleShownStateForAllAppWindows(); virtual WMError SetWindowLayoutMode(WindowLayoutMode mode); virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action); virtual WMError GetSystemConfig(SystemConfig& systemConfig); virtual WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones); virtual WMError UpdateRsTree(uint32_t windowId, bool isAdd); virtual WMError BindDialogTarget(uint32_t& windowId, sptr targetToken); virtual bool RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); virtual bool UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); virtual WMError SetWindowAnimationController(const sptr& controller); virtual WMError NotifyWindowTransition(sptr from, sptr to); virtual WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener); virtual void ClearWindowAdapter(); virtual WMError GetAccessibilityWindowInfo(std::vector>& infos); virtual WMError GetVisibilityWindowInfo(std::vector>& infos); virtual void MinimizeWindowsByLauncher(std::vector windowIds, bool isAnimated, sptr& finishCallback); virtual void SetAnchorAndScale(int32_t x, int32_t y, float scale); virtual void SetAnchorOffset(int32_t deltaX, int32_t deltaY); virtual void OffWindowZoom(); virtual std::shared_ptr GetSnapshot(int32_t windowId); virtual void NotifyDumpInfoResult(const std::vector& info); private: static inline SingletonDelegator delegator; bool InitWMSProxy(); std::recursive_mutex mutex_; sptr windowManagerServiceProxy_ = nullptr; sptr wmsDeath_ = nullptr; bool isProxyValid_ { false }; }; } // namespace Rosen } // namespace OHOS #endif // OHOS_WINDOW_ADAPTER_H