1e0dac50fSopenharmony_ci/* 2e0dac50fSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3e0dac50fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e0dac50fSopenharmony_ci * you may not use this file except in compliance with the License. 5e0dac50fSopenharmony_ci * You may obtain a copy of the License at 6e0dac50fSopenharmony_ci * 7e0dac50fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e0dac50fSopenharmony_ci * 9e0dac50fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e0dac50fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e0dac50fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e0dac50fSopenharmony_ci * See the License for the specific language governing permissions and 13e0dac50fSopenharmony_ci * limitations under the License. 14e0dac50fSopenharmony_ci */ 15e0dac50fSopenharmony_ci 16e0dac50fSopenharmony_ci#ifndef OHOS_ROSEN_WINDOW_SESSION_IMPL_H 17e0dac50fSopenharmony_ci#define OHOS_ROSEN_WINDOW_SESSION_IMPL_H 18e0dac50fSopenharmony_ci 19e0dac50fSopenharmony_ci#include <atomic> 20e0dac50fSopenharmony_ci 21e0dac50fSopenharmony_ci#include <shared_mutex> 22e0dac50fSopenharmony_ci#include <ability_context.h> 23e0dac50fSopenharmony_ci#include <event_handler.h> 24e0dac50fSopenharmony_ci#include <i_input_event_consumer.h> 25e0dac50fSopenharmony_ci#include <ui_content.h> 26e0dac50fSopenharmony_ci#include <ui/rs_surface_node.h> 27e0dac50fSopenharmony_ci#include "display_manager.h" 28e0dac50fSopenharmony_ci#include "singleton_container.h" 29e0dac50fSopenharmony_ci 30e0dac50fSopenharmony_ci#include "common/include/window_session_property.h" 31e0dac50fSopenharmony_ci#include "display_info.h" 32e0dac50fSopenharmony_ci#include "future_callback.h" 33e0dac50fSopenharmony_ci#include "interfaces/include/ws_common.h" 34e0dac50fSopenharmony_ci#include "interfaces/include/ws_common_inner.h" 35e0dac50fSopenharmony_ci#include "session/container/include/zidl/session_stage_stub.h" 36e0dac50fSopenharmony_ci#include "session/host/include/zidl/session_interface.h" 37e0dac50fSopenharmony_ci#include "vsync_station.h" 38e0dac50fSopenharmony_ci#include "window.h" 39e0dac50fSopenharmony_ci#include "window_option.h" 40e0dac50fSopenharmony_ci#include "wm_common.h" 41e0dac50fSopenharmony_ci 42e0dac50fSopenharmony_cinamespace OHOS { 43e0dac50fSopenharmony_cinamespace Rosen { 44e0dac50fSopenharmony_cinamespace { 45e0dac50fSopenharmony_citemplate<typename T1, typename T2, typename Ret> 46e0dac50fSopenharmony_ciusing EnableIfSame = typename std::enable_if<std::is_same_v<T1, T2>, Ret>::type; 47e0dac50fSopenharmony_ci 48e0dac50fSopenharmony_ci/* 49e0dac50fSopenharmony_ci * DFX 50e0dac50fSopenharmony_ci */ 51e0dac50fSopenharmony_ciconst std::string SET_UICONTENT_TIMEOUT_LISTENER_TASK_NAME = "SetUIContentTimeoutListener"; 52e0dac50fSopenharmony_ciconstexpr int64_t SET_UICONTENT_TIMEOUT_TIME_MS = 4000; 53e0dac50fSopenharmony_ci} 54e0dac50fSopenharmony_ci 55e0dac50fSopenharmony_cistruct WindowTitleVisibleFlags { 56e0dac50fSopenharmony_ci bool isMaximizeVisible = true; 57e0dac50fSopenharmony_ci bool isMinimizeVisible = true; 58e0dac50fSopenharmony_ci bool isSplitVisible = true; 59e0dac50fSopenharmony_ci bool isCloseVisible = true; 60e0dac50fSopenharmony_ci}; 61e0dac50fSopenharmony_ci 62e0dac50fSopenharmony_ciclass WindowSessionImpl : public Window, public virtual SessionStageStub { 63e0dac50fSopenharmony_cipublic: 64e0dac50fSopenharmony_ci explicit WindowSessionImpl(const sptr<WindowOption>& option); 65e0dac50fSopenharmony_ci ~WindowSessionImpl(); 66e0dac50fSopenharmony_ci 67e0dac50fSopenharmony_ci static sptr<Window> Find(const std::string& name); 68e0dac50fSopenharmony_ci static std::vector<sptr<Window>> GetSubWindow(int parentId); 69e0dac50fSopenharmony_ci 70e0dac50fSopenharmony_ci virtual WMError Create(const std::shared_ptr<AbilityRuntime::Context>& context, 71e0dac50fSopenharmony_ci const sptr<Rosen::ISession>& iSession, 72e0dac50fSopenharmony_ci const std::string& identityToken = "") { return WMError::WM_OK; } 73e0dac50fSopenharmony_ci 74e0dac50fSopenharmony_ci /* 75e0dac50fSopenharmony_ci * inherits from window 76e0dac50fSopenharmony_ci */ 77e0dac50fSopenharmony_ci WMError Show(uint32_t reason = 0, bool withAnimation = false, bool withFocus = true) override; 78e0dac50fSopenharmony_ci WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) override; 79e0dac50fSopenharmony_ci WMError Destroy() override; 80e0dac50fSopenharmony_ci virtual WMError Destroy(bool needNotifyServer, bool needClearListener = true); 81e0dac50fSopenharmony_ci WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 82e0dac50fSopenharmony_ci BackupAndRestoreType type, sptr<IRemoteObject> token, AppExecFwk::Ability* ability) override; 83e0dac50fSopenharmony_ci WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, 84e0dac50fSopenharmony_ci AppExecFwk::Ability* ability) override; 85e0dac50fSopenharmony_ci WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, 86e0dac50fSopenharmony_ci AppExecFwk::Ability* ability) override; 87e0dac50fSopenharmony_ci std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const override; 88e0dac50fSopenharmony_ci const std::shared_ptr<AbilityRuntime::Context> GetContext() const override; 89e0dac50fSopenharmony_ci Rect GetRequestRect() const override; 90e0dac50fSopenharmony_ci WindowType GetType() const override; 91e0dac50fSopenharmony_ci const std::string& GetWindowName() const override; 92e0dac50fSopenharmony_ci WindowState GetWindowState() const override; 93e0dac50fSopenharmony_ci WindowState GetRequestWindowState() const; 94e0dac50fSopenharmony_ci WMError SetFocusable(bool isFocusable) override; 95e0dac50fSopenharmony_ci WMError SetTouchable(bool isTouchable) override; 96e0dac50fSopenharmony_ci 97e0dac50fSopenharmony_ci /* 98e0dac50fSopenharmony_ci * Window Hierarchy 99e0dac50fSopenharmony_ci */ 100e0dac50fSopenharmony_ci WMError SetTopmost(bool topmost) override; 101e0dac50fSopenharmony_ci bool IsTopmost() const override; 102e0dac50fSopenharmony_ci WMError SetMainWindowTopmost(bool isTopmost) override; 103e0dac50fSopenharmony_ci bool IsMainWindowTopmost() const override; 104e0dac50fSopenharmony_ci 105e0dac50fSopenharmony_ci WMError SetResizeByDragEnabled(bool dragEnabled) override; 106e0dac50fSopenharmony_ci WMError SetRaiseByClickEnabled(bool raiseEnabled) override; 107e0dac50fSopenharmony_ci WMError HideNonSystemFloatingWindows(bool shouldHide) override; 108e0dac50fSopenharmony_ci WMError SetSingleFrameComposerEnabled(bool enable) override; 109e0dac50fSopenharmony_ci bool IsFloatingWindowAppType() const override; 110e0dac50fSopenharmony_ci 111e0dac50fSopenharmony_ci /* 112e0dac50fSopenharmony_ci * PC Window 113e0dac50fSopenharmony_ci */ 114e0dac50fSopenharmony_ci bool IsPcOrPadCapabilityEnabled() const override; 115e0dac50fSopenharmony_ci bool IsPcOrPadFreeMultiWindowMode() const override; 116e0dac50fSopenharmony_ci 117e0dac50fSopenharmony_ci WMError SetWindowType(WindowType type) override; 118e0dac50fSopenharmony_ci WMError SetBrightness(float brightness) override; 119e0dac50fSopenharmony_ci virtual float GetBrightness() const override; 120e0dac50fSopenharmony_ci void SetRequestedOrientation(Orientation orientation) override; 121e0dac50fSopenharmony_ci bool GetTouchable() const override; 122e0dac50fSopenharmony_ci uint32_t GetWindowId() const override; 123e0dac50fSopenharmony_ci uint64_t GetDisplayId() const override; 124e0dac50fSopenharmony_ci Rect GetRect() const override; 125e0dac50fSopenharmony_ci bool GetFocusable() const override; 126e0dac50fSopenharmony_ci std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) override; 127e0dac50fSopenharmony_ci WMError SetRestoredRouterStack(const std::string& routerStack) override; 128e0dac50fSopenharmony_ci Ace::UIContent* GetUIContent() const override; 129e0dac50fSopenharmony_ci std::shared_ptr<Ace::UIContent> GetUIContentSharedPtr() const; 130e0dac50fSopenharmony_ci Ace::UIContent* GetUIContentWithId(uint32_t winId) const override; 131e0dac50fSopenharmony_ci void OnNewWant(const AAFwk::Want& want) override; 132e0dac50fSopenharmony_ci WMError SetAPPWindowLabel(const std::string& label) override; 133e0dac50fSopenharmony_ci WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) override; 134e0dac50fSopenharmony_ci void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) override; 135e0dac50fSopenharmony_ci int64_t GetVSyncPeriod() override; 136e0dac50fSopenharmony_ci void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType = 0) override; 137e0dac50fSopenharmony_ci void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override; 138e0dac50fSopenharmony_ci void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) override; 139e0dac50fSopenharmony_ci bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override; 140e0dac50fSopenharmony_ci 141e0dac50fSopenharmony_ci /* 142e0dac50fSopenharmony_ci * inherits from session stage 143e0dac50fSopenharmony_ci */ 144e0dac50fSopenharmony_ci WSError SetActive(bool active) override; 145e0dac50fSopenharmony_ci WSError UpdateRect(const WSRect& rect, SizeChangeReason reason, 146e0dac50fSopenharmony_ci const SceneAnimationConfig& config = { nullptr, ROTATE_ANIMATION_DURATION }) override; 147e0dac50fSopenharmony_ci void UpdateDensity() override; 148e0dac50fSopenharmony_ci void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) override; 149e0dac50fSopenharmony_ci WSError UpdateOrientation() override; 150e0dac50fSopenharmony_ci WSError UpdateDisplayId(uint64_t displayId) override; 151e0dac50fSopenharmony_ci WSError UpdateFocus(bool focus) override; 152e0dac50fSopenharmony_ci bool IsFocused() const override; 153e0dac50fSopenharmony_ci WMError RequestFocus() const override; 154e0dac50fSopenharmony_ci WMError RequestFocusByClient(bool isFocused) const override; 155e0dac50fSopenharmony_ci WSError UpdateWindowMode(WindowMode mode) override; 156e0dac50fSopenharmony_ci WSError HandleBackEvent() override; 157e0dac50fSopenharmony_ci WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) override; 158e0dac50fSopenharmony_ci WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) override; 159e0dac50fSopenharmony_ci KeyboardAnimationConfig GetKeyboardAnimationConfig() override; 160e0dac50fSopenharmony_ci bool NotifyOnKeyPreImeEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override; 161e0dac50fSopenharmony_ci void NotifyPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override; 162e0dac50fSopenharmony_ci void NotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed, 163e0dac50fSopenharmony_ci bool notifyInputMethod = true) override; 164e0dac50fSopenharmony_ci void NotifyOccupiedAreaChangeInfoInner(sptr<OccupiedAreaChangeInfo> info); 165e0dac50fSopenharmony_ci void NotifyOccupiedAreaChangeInfo(sptr<OccupiedAreaChangeInfo> info, 166e0dac50fSopenharmony_ci const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override; 167e0dac50fSopenharmony_ci void NotifyForegroundInteractiveStatus(bool interactive) override; 168e0dac50fSopenharmony_ci void NotifyDisplayMove(DisplayId from, DisplayId to) override; 169e0dac50fSopenharmony_ci 170e0dac50fSopenharmony_ci WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) override; 171e0dac50fSopenharmony_ci WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) override; 172e0dac50fSopenharmony_ci WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) override; 173e0dac50fSopenharmony_ci WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) override; 174e0dac50fSopenharmony_ci WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) override; 175e0dac50fSopenharmony_ci WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) override; 176e0dac50fSopenharmony_ci WMError RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) override; 177e0dac50fSopenharmony_ci WMError UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener) override; 178e0dac50fSopenharmony_ci void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) override; 179e0dac50fSopenharmony_ci void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) override; 180e0dac50fSopenharmony_ci WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) override; 181e0dac50fSopenharmony_ci WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) override; 182e0dac50fSopenharmony_ci WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) override; 183e0dac50fSopenharmony_ci WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) override; 184e0dac50fSopenharmony_ci WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) override; 185e0dac50fSopenharmony_ci WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) override; 186e0dac50fSopenharmony_ci WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) override; 187e0dac50fSopenharmony_ci WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) override; 188e0dac50fSopenharmony_ci WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) override; 189e0dac50fSopenharmony_ci WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) override; 190e0dac50fSopenharmony_ci void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) override; 191e0dac50fSopenharmony_ci void UnregisterWindowDestroyedListener() override { notifyNativeFunc_ = nullptr; } 192e0dac50fSopenharmony_ci WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) override; 193e0dac50fSopenharmony_ci WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) override; 194e0dac50fSopenharmony_ci void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) override; 195e0dac50fSopenharmony_ci void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) override; 196e0dac50fSopenharmony_ci WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, 197e0dac50fSopenharmony_ci bool isCloseVisible) override; 198e0dac50fSopenharmony_ci 199e0dac50fSopenharmony_ci WMError SetBackgroundColor(const std::string& color) override; 200e0dac50fSopenharmony_ci WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor) override; 201e0dac50fSopenharmony_ci virtual Orientation GetRequestedOrientation() override; 202e0dac50fSopenharmony_ci 203e0dac50fSopenharmony_ci int32_t GetParentId() const; 204e0dac50fSopenharmony_ci int32_t GetPersistentId() const override; 205e0dac50fSopenharmony_ci sptr<WindowSessionProperty> GetProperty() const; 206e0dac50fSopenharmony_ci SystemSessionConfig GetSystemSessionConfig() const; 207e0dac50fSopenharmony_ci sptr<ISession> GetHostSession() const; 208e0dac50fSopenharmony_ci int32_t GetFloatingWindowParentId(); 209e0dac50fSopenharmony_ci void NotifyAfterForeground(bool needNotifyListeners = true, bool needNotifyUiContent = true); 210e0dac50fSopenharmony_ci void NotifyAfterBackground(bool needNotifyListeners = true, bool needNotifyUiContent = true); 211e0dac50fSopenharmony_ci void NotifyForegroundFailed(WMError ret); 212e0dac50fSopenharmony_ci void NotifyBackgroundFailed(WMError ret); 213e0dac50fSopenharmony_ci WSError MarkProcessed(int32_t eventId) override; 214e0dac50fSopenharmony_ci void UpdateTitleButtonVisibility(); 215e0dac50fSopenharmony_ci WSError NotifyDestroy() override; 216e0dac50fSopenharmony_ci WSError NotifyTransferComponentData(const AAFwk::WantParams& wantParams) override; 217e0dac50fSopenharmony_ci WSErrorCode NotifyTransferComponentDataSync(const AAFwk::WantParams& wantParams, 218e0dac50fSopenharmony_ci AAFwk::WantParams& reWantParams) override; 219e0dac50fSopenharmony_ci void NotifyAvoidAreaChange(const sptr<AvoidArea>& avoidArea, AvoidAreaType type); 220e0dac50fSopenharmony_ci WSError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) override; 221e0dac50fSopenharmony_ci void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) override; 222e0dac50fSopenharmony_ci void NotifyScreenshot() override; 223e0dac50fSopenharmony_ci void DumpSessionElementInfo(const std::vector<std::string>& params) override; 224e0dac50fSopenharmony_ci // colorspace, gamut 225e0dac50fSopenharmony_ci virtual bool IsSupportWideGamut() override; 226e0dac50fSopenharmony_ci virtual void SetColorSpace(ColorSpace colorSpace) override; 227e0dac50fSopenharmony_ci virtual ColorSpace GetColorSpace() override; 228e0dac50fSopenharmony_ci WSError NotifyTouchOutside() override; 229e0dac50fSopenharmony_ci WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override; 230e0dac50fSopenharmony_ci WSError NotifyWindowVisibility(bool isVisible) override; 231e0dac50fSopenharmony_ci WSError NotifyNoInteractionTimeout(const IWindowNoInteractionListenerSptr& listener); 232e0dac50fSopenharmony_ci WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 233e0dac50fSopenharmony_ci int64_t uiExtensionIdLevel) override; 234e0dac50fSopenharmony_ci WindowState state_ { WindowState::STATE_INITIAL }; 235e0dac50fSopenharmony_ci WindowState requestState_ { WindowState::STATE_INITIAL }; 236e0dac50fSopenharmony_ci WSError UpdateMaximizeMode(MaximizeMode mode) override; 237e0dac50fSopenharmony_ci void NotifySessionForeground(uint32_t reason, bool withAnimation) override; 238e0dac50fSopenharmony_ci void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) override; 239e0dac50fSopenharmony_ci WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override; 240e0dac50fSopenharmony_ci WSError NotifyDialogStateChange(bool isForeground) override; 241e0dac50fSopenharmony_ci bool IsMainHandlerAvailable() const override; 242e0dac50fSopenharmony_ci 243e0dac50fSopenharmony_ci /* 244e0dac50fSopenharmony_ci * PiP Window 245e0dac50fSopenharmony_ci */ 246e0dac50fSopenharmony_ci WSError NotifyCloseExistPipWindow() override; 247e0dac50fSopenharmony_ci WSError SetPipActionEvent(const std::string& action, int32_t status) override; 248e0dac50fSopenharmony_ci WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status) override; 249e0dac50fSopenharmony_ci void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) override; 250e0dac50fSopenharmony_ci void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) override; 251e0dac50fSopenharmony_ci void SetAutoStartPiP(bool isAutoStart) override; 252e0dac50fSopenharmony_ci 253e0dac50fSopenharmony_ci void SetDrawingContentState(bool drawingContentState); 254e0dac50fSopenharmony_ci WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) override; 255e0dac50fSopenharmony_ci WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) override; 256e0dac50fSopenharmony_ci WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override; 257e0dac50fSopenharmony_ci virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) override; 258e0dac50fSopenharmony_ci virtual WMError SetDecorVisible(bool isVisible) override; 259e0dac50fSopenharmony_ci virtual WMError SetDecorHeight(int32_t decorHeight) override; 260e0dac50fSopenharmony_ci virtual WMError GetDecorHeight(int32_t& height) override; 261e0dac50fSopenharmony_ci virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) override; 262e0dac50fSopenharmony_ci WSError GetUIContentRemoteObj(sptr<IRemoteObject>& uiContentRemoteObj) override; 263e0dac50fSopenharmony_ci virtual WMError RegisterWindowTitleButtonRectChangeListener( 264e0dac50fSopenharmony_ci const sptr<IWindowTitleButtonRectChangedListener>& listener) override; 265e0dac50fSopenharmony_ci virtual WMError UnregisterWindowTitleButtonRectChangeListener( 266e0dac50fSopenharmony_ci const sptr<IWindowTitleButtonRectChangedListener>& listener) override; 267e0dac50fSopenharmony_ci void NotifyWindowTitleButtonRectChange(TitleButtonRect titleButtonRect); 268e0dac50fSopenharmony_ci void RecoverSessionListener(); 269e0dac50fSopenharmony_ci void SetDefaultDisplayIdIfNeed(); 270e0dac50fSopenharmony_ci WMError RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) override; 271e0dac50fSopenharmony_ci WMError UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) override; 272e0dac50fSopenharmony_ci WMError RegisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener>& listener) override; 273e0dac50fSopenharmony_ci WMError UnregisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener>& listener) override; 274e0dac50fSopenharmony_ci WMError RegisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener>& listener) override; 275e0dac50fSopenharmony_ci WMError UnregisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener>& listener) override; 276e0dac50fSopenharmony_ci WMError RegisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener>& listener) override; 277e0dac50fSopenharmony_ci WMError UnregisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener>& listener) override; 278e0dac50fSopenharmony_ci virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const override; 279e0dac50fSopenharmony_ci virtual WMError GetCallingWindowRect(Rect& rect) const override; 280e0dac50fSopenharmony_ci virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) override; 281e0dac50fSopenharmony_ci virtual WMError EnableDrag(bool enableDrag) override; 282e0dac50fSopenharmony_ci WMError SetContinueState(int32_t continueState) override; 283e0dac50fSopenharmony_ci 284e0dac50fSopenharmony_ci /* 285e0dac50fSopenharmony_ci * Multi Window 286e0dac50fSopenharmony_ci */ 287e0dac50fSopenharmony_ci WSError SetSplitButtonVisible(bool isVisible) override; 288e0dac50fSopenharmony_ci 289e0dac50fSopenharmony_ciprotected: 290e0dac50fSopenharmony_ci WMError Connect(); 291e0dac50fSopenharmony_ci bool IsWindowSessionInvalid() const; 292e0dac50fSopenharmony_ci void NotifyWindowAfterUnfocused(); 293e0dac50fSopenharmony_ci void NotifyWindowAfterFocused(); 294e0dac50fSopenharmony_ci void NotifyAfterActive(); 295e0dac50fSopenharmony_ci void NotifyAfterInactive(); 296e0dac50fSopenharmony_ci void NotifyBeforeDestroy(std::string windowName); 297e0dac50fSopenharmony_ci void NotifyAfterDestroy(); 298e0dac50fSopenharmony_ci void ClearListenersById(int32_t persistentId); 299e0dac50fSopenharmony_ci void ClearSwitchFreeMultiWindowListenersById(int32_t persistentId); 300e0dac50fSopenharmony_ci void ClearVsyncStation(); 301e0dac50fSopenharmony_ci WMError WindowSessionCreateCheck(); 302e0dac50fSopenharmony_ci void UpdateDecorEnableToAce(bool isDecorEnable); 303e0dac50fSopenharmony_ci void UpdateDecorEnable(bool needNotify = false, WindowMode mode = WindowMode::WINDOW_MODE_UNDEFINED); 304e0dac50fSopenharmony_ci void NotifyModeChange(WindowMode mode, bool hasDeco = true); 305e0dac50fSopenharmony_ci WMError UpdateProperty(WSPropertyChangeAction action); 306e0dac50fSopenharmony_ci WMError SetBackgroundColor(uint32_t color); 307e0dac50fSopenharmony_ci uint32_t GetBackgroundColor() const; 308e0dac50fSopenharmony_ci virtual WMError SetLayoutFullScreenByApiVersion(bool status); 309e0dac50fSopenharmony_ci float GetVirtualPixelRatio() override; 310e0dac50fSopenharmony_ci virtual float GetVirtualPixelRatio(sptr<DisplayInfo> displayInfo); 311e0dac50fSopenharmony_ci void UpdateViewportConfig(const Rect& rect, WindowSizeChangeReason reason, 312e0dac50fSopenharmony_ci const std::shared_ptr<RSTransaction>& rsTransaction = nullptr, 313e0dac50fSopenharmony_ci const sptr<DisplayInfo>& info = nullptr, 314e0dac50fSopenharmony_ci const std::map<AvoidAreaType, AvoidArea>& avoidAreas = {}); 315e0dac50fSopenharmony_ci void NotifySizeChange(Rect rect, WindowSizeChangeReason reason); 316e0dac50fSopenharmony_ci void NotifySubWindowClose(bool& terminateCloseProcess); 317e0dac50fSopenharmony_ci WMError NotifyMainWindowClose(bool& terminateCloseProcess); 318e0dac50fSopenharmony_ci void NotifySwitchFreeMultiWindow(bool enable); 319e0dac50fSopenharmony_ci static sptr<Window> FindWindowById(uint32_t winId); 320e0dac50fSopenharmony_ci void NotifyWindowStatusChange(WindowMode mode); 321e0dac50fSopenharmony_ci void NotifyTransformChange(const Transform& transForm) override; 322e0dac50fSopenharmony_ci bool IsKeyboardEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const; 323e0dac50fSopenharmony_ci void DispatchKeyEventCallback(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed); 324e0dac50fSopenharmony_ci bool FilterKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent); 325e0dac50fSopenharmony_ci void RegisterFrameLayoutCallback(); 326e0dac50fSopenharmony_ci bool IsVerticalOrientation(Orientation orientation) const; 327e0dac50fSopenharmony_ci void CopyUniqueDensityParameter(sptr<WindowSessionImpl> parentWindow); 328e0dac50fSopenharmony_ci sptr<WindowSessionImpl> FindMainWindowWithContext(); 329e0dac50fSopenharmony_ci sptr<WindowSessionImpl> FindExtensionWindowWithContext(); 330e0dac50fSopenharmony_ci 331e0dac50fSopenharmony_ci WMError RegisterExtensionAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener); 332e0dac50fSopenharmony_ci WMError UnregisterExtensionAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener); 333e0dac50fSopenharmony_ci 334e0dac50fSopenharmony_ci void RefreshNoInteractionTimeoutMonitor(); 335e0dac50fSopenharmony_ci WindowStatus GetWindowStatusInner(WindowMode mode); 336e0dac50fSopenharmony_ci 337e0dac50fSopenharmony_ci /** 338e0dac50fSopenharmony_ci * Sub Window 339e0dac50fSopenharmony_ci */ 340e0dac50fSopenharmony_ci void UpdateSubWindowStateAndNotify(int32_t parentPersistentId, const WindowState newState); 341e0dac50fSopenharmony_ci void DestroySubWindow(); 342e0dac50fSopenharmony_ci 343e0dac50fSopenharmony_ci sptr<ISession> hostSession_; 344e0dac50fSopenharmony_ci mutable std::mutex hostSessionMutex_; 345e0dac50fSopenharmony_ci std::shared_ptr<Ace::UIContent> uiContent_; 346e0dac50fSopenharmony_ci mutable std::shared_mutex uiContentMutex_; 347e0dac50fSopenharmony_ci std::shared_ptr<AbilityRuntime::Context> context_; 348e0dac50fSopenharmony_ci std::shared_ptr<RSSurfaceNode> surfaceNode_; 349e0dac50fSopenharmony_ci 350e0dac50fSopenharmony_ci sptr<WindowSessionProperty> property_; 351e0dac50fSopenharmony_ci SystemSessionConfig windowSystemConfig_; 352e0dac50fSopenharmony_ci NotifyNativeWinDestroyFunc notifyNativeFunc_; 353e0dac50fSopenharmony_ci 354e0dac50fSopenharmony_ci std::recursive_mutex mutex_; 355e0dac50fSopenharmony_ci static std::map<std::string, std::pair<int32_t, sptr<WindowSessionImpl>>> windowSessionMap_; 356e0dac50fSopenharmony_ci // protect windowSessionMap_ 357e0dac50fSopenharmony_ci static std::shared_mutex windowSessionMutex_; 358e0dac50fSopenharmony_ci static std::set<sptr<WindowSessionImpl>> windowExtensionSessionSet_; 359e0dac50fSopenharmony_ci // protect windowExtensionSessionSet_ 360e0dac50fSopenharmony_ci static std::shared_mutex windowExtensionSessionMutex_; 361e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<WindowSessionImpl>>> subWindowSessionMap_; 362e0dac50fSopenharmony_ci bool isSystembarPropertiesSet_ = false; 363e0dac50fSopenharmony_ci bool isIgnoreSafeAreaNeedNotify_ = false; 364e0dac50fSopenharmony_ci bool isIgnoreSafeArea_ = false; 365e0dac50fSopenharmony_ci std::atomic_bool isFocused_ = false; 366e0dac50fSopenharmony_ci std::shared_ptr<AppExecFwk::EventHandler> handler_ = nullptr; 367e0dac50fSopenharmony_ci bool shouldReNotifyFocus_ = false; 368e0dac50fSopenharmony_ci std::shared_ptr<VsyncStation> vsyncStation_ = nullptr; 369e0dac50fSopenharmony_ci std::shared_ptr<IInputEventConsumer> inputEventConsumer_; 370e0dac50fSopenharmony_ci bool useUniqueDensity_ { false }; 371e0dac50fSopenharmony_ci float virtualPixelRatio_ { 1.0f }; 372e0dac50fSopenharmony_ci bool escKeyEventTriggered_ = false; 373e0dac50fSopenharmony_ci // Check whether the UIExtensionAbility process is started 374e0dac50fSopenharmony_ci static bool isUIExtensionAbilityProcess_; 375e0dac50fSopenharmony_ci virtual WMError SetKeyEventFilter(KeyEventFilterFunc filter) override; 376e0dac50fSopenharmony_ci virtual WMError ClearKeyEventFilter() override; 377e0dac50fSopenharmony_ci WSError SwitchFreeMultiWindow(bool enable) override; 378e0dac50fSopenharmony_ci std::string identityToken_ = { "" }; 379e0dac50fSopenharmony_ci void MakeSubOrDialogWindowDragableAndMoveble(); 380e0dac50fSopenharmony_ci bool IsFreeMultiWindowMode() const 381e0dac50fSopenharmony_ci { 382e0dac50fSopenharmony_ci return windowSystemConfig_.IsFreeMultiWindowMode(); 383e0dac50fSopenharmony_ci } 384e0dac50fSopenharmony_ci 385e0dac50fSopenharmony_ci /* 386e0dac50fSopenharmony_ci * DFX 387e0dac50fSopenharmony_ci */ 388e0dac50fSopenharmony_ci void SetUIContentComplete(); 389e0dac50fSopenharmony_ci void AddSetUIContentTimeoutCheck(); 390e0dac50fSopenharmony_ci void NotifySetUIContentComplete(); 391e0dac50fSopenharmony_ci std::atomic_bool setUIContentCompleted_ { false }; 392e0dac50fSopenharmony_ci enum TimeoutErrorCode : int32_t { 393e0dac50fSopenharmony_ci SET_UICONTENT_TIMEOUT = 1000 394e0dac50fSopenharmony_ci }; 395e0dac50fSopenharmony_ci 396e0dac50fSopenharmony_ci /* 397e0dac50fSopenharmony_ci * Window Lifecycle 398e0dac50fSopenharmony_ci */ 399e0dac50fSopenharmony_ci bool hasFirstNotifyInteractive_ = false; 400e0dac50fSopenharmony_ci bool interactive_ = true; 401e0dac50fSopenharmony_ci 402e0dac50fSopenharmony_ci /* 403e0dac50fSopenharmony_ci * Window Layout 404e0dac50fSopenharmony_ci */ 405e0dac50fSopenharmony_ci sptr<FutureCallback> layoutCallback_ = nullptr; 406e0dac50fSopenharmony_ci 407e0dac50fSopenharmony_ciprivate: 408e0dac50fSopenharmony_ci //Trans between colorGamut and colorSpace 409e0dac50fSopenharmony_ci static ColorSpace GetColorSpaceFromSurfaceGamut(GraphicColorGamut colorGamut); 410e0dac50fSopenharmony_ci static GraphicColorGamut GetSurfaceGamutFromColorSpace(ColorSpace colorSpace); 411e0dac50fSopenharmony_ci 412e0dac50fSopenharmony_ci template<typename T> WMError RegisterListener(std::vector<sptr<T>>& holder, const sptr<T>& listener); 413e0dac50fSopenharmony_ci template<typename T> WMError UnregisterListener(std::vector<sptr<T>>& holder, const sptr<T>& listener); 414e0dac50fSopenharmony_ci template<typename T> EnableIfSame<T, IWindowLifeCycle, std::vector<sptr<IWindowLifeCycle>>> GetListeners(); 415e0dac50fSopenharmony_ci template<typename T> EnableIfSame<T, IDisplayMoveListener, std::vector<sptr<IDisplayMoveListener>>> GetListeners(); 416e0dac50fSopenharmony_ci template<typename T> 417e0dac50fSopenharmony_ci EnableIfSame<T, IWindowChangeListener, std::vector<sptr<IWindowChangeListener>>> GetListeners(); 418e0dac50fSopenharmony_ci template<typename T> 419e0dac50fSopenharmony_ci EnableIfSame<T, IAvoidAreaChangedListener, std::vector<sptr<IAvoidAreaChangedListener>>> GetListeners(); 420e0dac50fSopenharmony_ci template<typename T> 421e0dac50fSopenharmony_ci EnableIfSame<T, IDialogDeathRecipientListener, std::vector<sptr<IDialogDeathRecipientListener>>> GetListeners(); 422e0dac50fSopenharmony_ci template<typename T> 423e0dac50fSopenharmony_ci EnableIfSame<T, IDialogTargetTouchListener, std::vector<sptr<IDialogTargetTouchListener>>> GetListeners(); 424e0dac50fSopenharmony_ci template<typename T> 425e0dac50fSopenharmony_ci EnableIfSame<T, IOccupiedAreaChangeListener, std::vector<sptr<IOccupiedAreaChangeListener>>> GetListeners(); 426e0dac50fSopenharmony_ci template<typename T> 427e0dac50fSopenharmony_ci EnableIfSame<T, IScreenshotListener, std::vector<sptr<IScreenshotListener>>> GetListeners(); 428e0dac50fSopenharmony_ci template<typename T> 429e0dac50fSopenharmony_ci EnableIfSame<T, ITouchOutsideListener, std::vector<sptr<ITouchOutsideListener>>> GetListeners(); 430e0dac50fSopenharmony_ci template<typename T> 431e0dac50fSopenharmony_ci EnableIfSame<T, IWindowVisibilityChangedListener, std::vector<IWindowVisibilityListenerSptr>> GetListeners(); 432e0dac50fSopenharmony_ci template<typename T> 433e0dac50fSopenharmony_ci EnableIfSame<T, IWindowNoInteractionListener, std::vector<IWindowNoInteractionListenerSptr>> GetListeners(); 434e0dac50fSopenharmony_ci template<typename T> 435e0dac50fSopenharmony_ci EnableIfSame<T, IWindowTitleButtonRectChangedListener, 436e0dac50fSopenharmony_ci std::vector<sptr<IWindowTitleButtonRectChangedListener>>> GetListeners(); 437e0dac50fSopenharmony_ci template<typename T> void ClearUselessListeners(std::map<int32_t, T>& listeners, int32_t persistentId); 438e0dac50fSopenharmony_ci RSSurfaceNode::SharedPtr CreateSurfaceNode(const std::string& name, WindowType type); 439e0dac50fSopenharmony_ci template<typename T> 440e0dac50fSopenharmony_ci EnableIfSame<T, IWindowStatusChangeListener, std::vector<sptr<IWindowStatusChangeListener>>> GetListeners(); 441e0dac50fSopenharmony_ci template<typename T> 442e0dac50fSopenharmony_ci EnableIfSame<T, IWindowRectChangeListener, std::vector<sptr<IWindowRectChangeListener>>> GetListeners(); 443e0dac50fSopenharmony_ci template<typename T> 444e0dac50fSopenharmony_ci EnableIfSame<T, ISubWindowCloseListener, sptr<ISubWindowCloseListener>> GetListeners(); 445e0dac50fSopenharmony_ci template<typename T> 446e0dac50fSopenharmony_ci EnableIfSame<T, IMainWindowCloseListener, sptr<IMainWindowCloseListener>> GetListeners(); 447e0dac50fSopenharmony_ci template<typename T> 448e0dac50fSopenharmony_ci EnableIfSame<T, ISwitchFreeMultiWindowListener, std::vector<sptr<ISwitchFreeMultiWindowListener>>> GetListeners(); 449e0dac50fSopenharmony_ci void NotifyAfterFocused(); 450e0dac50fSopenharmony_ci void NotifyUIContentFocusStatus(); 451e0dac50fSopenharmony_ci void NotifyAfterUnfocused(bool needNotifyUiContent = true); 452e0dac50fSopenharmony_ci void NotifyAfterResumed(); 453e0dac50fSopenharmony_ci void NotifyAfterPaused(); 454e0dac50fSopenharmony_ci 455e0dac50fSopenharmony_ci WMError InitUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 456e0dac50fSopenharmony_ci WindowSetUIContentType setUIContentType, BackupAndRestoreType restoreType, AppExecFwk::Ability* ability, 457e0dac50fSopenharmony_ci OHOS::Ace::UIContentErrorCode& aceRet); 458e0dac50fSopenharmony_ci WMError SetUIContentInner(const std::string& contentInfo, napi_env env, napi_value storage, 459e0dac50fSopenharmony_ci WindowSetUIContentType setUIContentType, BackupAndRestoreType restoreType, AppExecFwk::Ability* ability); 460e0dac50fSopenharmony_ci std::shared_ptr<std::vector<uint8_t>> GetAbcContent(const std::string& abcPath); 461e0dac50fSopenharmony_ci inline void DestroyExistUIContent(); 462e0dac50fSopenharmony_ci std::string GetRestoredRouterStack(); 463e0dac50fSopenharmony_ci 464e0dac50fSopenharmony_ci bool CheckIfNeedCommitRsTransaction(WindowSizeChangeReason wmReason); 465e0dac50fSopenharmony_ci void UpdateRectForRotation(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, 466e0dac50fSopenharmony_ci const SceneAnimationConfig& config); 467e0dac50fSopenharmony_ci void UpdateRectForOtherReason(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, 468e0dac50fSopenharmony_ci const std::shared_ptr<RSTransaction>& rsTransaction = nullptr); 469e0dac50fSopenharmony_ci void NotifyRotationAnimationEnd(); 470e0dac50fSopenharmony_ci void SubmitNoInteractionMonitorTask(int32_t eventId, const IWindowNoInteractionListenerSptr& listener); 471e0dac50fSopenharmony_ci bool IsUserOrientation(Orientation orientation) const; 472e0dac50fSopenharmony_ci void GetTitleButtonVisible(bool isPC, bool& hideMaximizeButton, bool& hideMinimizeButton, bool& hideSplitButton, 473e0dac50fSopenharmony_ci bool& hideCloseButton); 474e0dac50fSopenharmony_ci WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config); 475e0dac50fSopenharmony_ci void SetForceSplitEnable(bool isForceSplit, const std::string& homePage = ""); 476e0dac50fSopenharmony_ci void SetFrameLayoutCallbackEnable(bool enable); 477e0dac50fSopenharmony_ci void UpdateFrameLayoutCallbackIfNeeded(WindowSizeChangeReason wmReason); 478e0dac50fSopenharmony_ci bool IsNotifyInteractiveDuplicative(bool interactive); 479e0dac50fSopenharmony_ci void SetUniqueVirtualPixelRatioForSub(bool useUniqueDensity, float virtualPixelRatio); 480e0dac50fSopenharmony_ci 481e0dac50fSopenharmony_ci static std::recursive_mutex lifeCycleListenerMutex_; 482e0dac50fSopenharmony_ci static std::recursive_mutex windowChangeListenerMutex_; 483e0dac50fSopenharmony_ci static std::recursive_mutex avoidAreaChangeListenerMutex_; 484e0dac50fSopenharmony_ci static std::recursive_mutex dialogDeathRecipientListenerMutex_; 485e0dac50fSopenharmony_ci static std::recursive_mutex dialogTargetTouchListenerMutex_; 486e0dac50fSopenharmony_ci static std::recursive_mutex occupiedAreaChangeListenerMutex_; 487e0dac50fSopenharmony_ci static std::recursive_mutex screenshotListenerMutex_; 488e0dac50fSopenharmony_ci static std::recursive_mutex touchOutsideListenerMutex_; 489e0dac50fSopenharmony_ci static std::recursive_mutex windowVisibilityChangeListenerMutex_; 490e0dac50fSopenharmony_ci static std::recursive_mutex windowNoInteractionListenerMutex_; 491e0dac50fSopenharmony_ci static std::recursive_mutex windowStatusChangeListenerMutex_; 492e0dac50fSopenharmony_ci static std::recursive_mutex windowTitleButtonRectChangeListenerMutex_; 493e0dac50fSopenharmony_ci static std::mutex displayMoveListenerMutex_; 494e0dac50fSopenharmony_ci static std::mutex windowRectChangeListenerMutex_; 495e0dac50fSopenharmony_ci static std::mutex subWindowCloseListenersMutex_; 496e0dac50fSopenharmony_ci static std::mutex mainWindowCloseListenersMutex_; 497e0dac50fSopenharmony_ci static std::mutex switchFreeMultiWindowListenerMutex_; 498e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IWindowLifeCycle>>> lifecycleListeners_; 499e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IDisplayMoveListener>>> displayMoveListeners_; 500e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IWindowChangeListener>>> windowChangeListeners_; 501e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IAvoidAreaChangedListener>>> avoidAreaChangeListeners_; 502e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IDialogDeathRecipientListener>>> dialogDeathRecipientListeners_; 503e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IDialogTargetTouchListener>>> dialogTargetTouchListener_; 504e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IOccupiedAreaChangeListener>>> occupiedAreaChangeListeners_; 505e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IScreenshotListener>>> screenshotListeners_; 506e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<ITouchOutsideListener>>> touchOutsideListeners_; 507e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<IWindowVisibilityListenerSptr>> windowVisibilityChangeListeners_; 508e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<IWindowNoInteractionListenerSptr>> windowNoInteractionListeners_; 509e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IWindowStatusChangeListener>>> windowStatusChangeListeners_; 510e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IWindowTitleButtonRectChangedListener>>> 511e0dac50fSopenharmony_ci windowTitleButtonRectChangeListeners_; 512e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<IWindowRectChangeListener>>> windowRectChangeListeners_; 513e0dac50fSopenharmony_ci static std::map<int32_t, sptr<ISubWindowCloseListener>> subWindowCloseListeners_; 514e0dac50fSopenharmony_ci static std::map<int32_t, sptr<IMainWindowCloseListener>> mainWindowCloseListeners_; 515e0dac50fSopenharmony_ci static std::map<int32_t, std::vector<sptr<ISwitchFreeMultiWindowListener>>> switchFreeMultiWindowListeners_; 516e0dac50fSopenharmony_ci 517e0dac50fSopenharmony_ci // FA only 518e0dac50fSopenharmony_ci sptr<IAceAbilityHandler> aceAbilityHandler_; 519e0dac50fSopenharmony_ci 520e0dac50fSopenharmony_ci std::atomic<int32_t> lastInteractionEventId_ { 0 }; 521e0dac50fSopenharmony_ci 522e0dac50fSopenharmony_ci bool isMainHandlerAvailable_ = true; 523e0dac50fSopenharmony_ci 524e0dac50fSopenharmony_ci std::string subWindowTitle_ = { "" }; 525e0dac50fSopenharmony_ci std::string dialogTitle_ = { "" }; 526e0dac50fSopenharmony_ci std::shared_mutex keyEventFilterMutex_; 527e0dac50fSopenharmony_ci KeyEventFilterFunc keyEventFilter_; 528e0dac50fSopenharmony_ci WindowTitleVisibleFlags windowTitleVisibleFlags_; 529e0dac50fSopenharmony_ci sptr<WindowOption> windowOption_; 530e0dac50fSopenharmony_ci 531e0dac50fSopenharmony_ci std::string restoredRouterStack_; // It was set and get in same thread, which is js thread. 532e0dac50fSopenharmony_ci 533e0dac50fSopenharmony_ci /* 534e0dac50fSopenharmony_ci * Window Layout 535e0dac50fSopenharmony_ci */ 536e0dac50fSopenharmony_ci std::atomic_bool windowSizeChanged_ = true; 537e0dac50fSopenharmony_ci std::atomic_bool enableFrameLayoutFinishCb_ = false; 538e0dac50fSopenharmony_ci WindowSizeChangeReason lastSizeChangeReason_ = WindowSizeChangeReason::END; 539e0dac50fSopenharmony_ci bool postTaskDone_ = false; 540e0dac50fSopenharmony_ci int16_t rotationAnimationCount_ { 0 }; 541e0dac50fSopenharmony_ci 542e0dac50fSopenharmony_ci /* 543e0dac50fSopenharmony_ci * Multi Window 544e0dac50fSopenharmony_ci */ 545e0dac50fSopenharmony_ci bool isSplitButtonVisible_ = true; 546e0dac50fSopenharmony_ci}; 547e0dac50fSopenharmony_ci} // namespace Rosen 548e0dac50fSopenharmony_ci} // namespace OHOS 549e0dac50fSopenharmony_ci 550e0dac50fSopenharmony_ci#endif // OHOS_ROSEN_WINDOW_SESSION_IMPL_H 551