/* * 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 "wm_single_instance.h" #include "singleton_delegator.h" #include "window_property.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); virtual WMError AddWindow(sptr& windowProperty); virtual WMError RemoveWindow(uint32_t windowId); virtual WMError DestroyWindow(uint32_t windowId); virtual WMError SaveAbilityToken(const sptr& abilityToken, uint32_t windowId); virtual WMError RequestFocus(uint32_t windowId); virtual WMError GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type, std::vector& avoidRect); virtual WMError SetWindowBackgroundBlur(uint32_t windowId, WindowBlurLevel level); virtual WMError SetAlpha(uint32_t windowId, float alpha); virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId); virtual void ProcessPointDown(uint32_t windowId, bool isStartDrag = false); virtual void ProcessPointUp(uint32_t windowId); virtual void MinimizeAllAppWindows(DisplayId displayId); virtual WMError MaxmizeWindow(uint32_t windowId); virtual WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode); virtual WMError UpdateProperty(sptr& windowProperty, PropertyChangeAction action); virtual void RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); virtual void UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); virtual void ClearWindowAdapter(); 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