/* * Copyright (c) 2023 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_ROSEN_WINDOW_SESSION_IMPL_H #define OHOS_ROSEN_WINDOW_SESSION_IMPL_H #include #include #include #include #include #include #include #include #include #include "display_manager.h" #include "singleton_container.h" #include "common/include/window_session_property.h" #include "display_info.h" #include "future_callback.h" #include "interfaces/include/ws_common.h" #include "interfaces/include/ws_common_inner.h" #include "session/container/include/zidl/session_stage_stub.h" #include "session/host/include/zidl/session_interface.h" #include "vsync_station.h" #include "window.h" #include "window_helper.h" #include "window_option.h" #include "wm_common.h" #include "wm_common_inner.h" #include "floating_ball_template_info.h" #include "lifecycle_future_callback.h" namespace OHOS { namespace Rosen { namespace { template using EnableIfSame = typename std::enable_if, Ret>::type; /* * DFX */ const std::string SET_UICONTENT_TIMEOUT_LISTENER_TASK_NAME = "SetUIContentTimeoutListener"; constexpr int64_t SET_UICONTENT_TIMEOUT_TIME_MS = 4000; constexpr int64_t SET_UICONTENT_TIMEOUT_TIME_AFTER_FREEZE_MS = 5000; } struct WindowTitleVisibleFlags { bool isMaximizeVisible = true; bool isMinimizeVisible = true; bool isSplitVisible = true; bool isCloseVisible = true; }; struct CursorInfo { double left = -1.0; double top = -1.0; double width = -1.0; double height = -1.0; }; using IKBWillShowListener = IKeyboardWillShowListener; using IKBWillHideListener = IKeyboardWillHideListener; class WindowSessionImpl : public Window, public virtual SessionStageStub { public: explicit WindowSessionImpl(const sptr& option); ~WindowSessionImpl(); static sptr Find(const std::string& name); static std::vector> GetSubWindow(int parentId); static sptr GetWindowWithId(uint32_t windowId); virtual WMError Create(const std::shared_ptr& context, const sptr& iSession, const std::string& identityToken = "", bool isModuleAbilityHookEnd = false) { return WMError::WM_OK; } /* * inherits from window */ WMError Show(uint32_t reason = 0, bool withAnimation = false, bool withFocus = true) override; WMError Show(uint32_t reason, bool withAnimation, bool withFocus, bool waitAttach) override; WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) override; WMError Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits, bool waitDetach) override; WMError Destroy(uint32_t reason = 0) override; virtual WMError Destroy(bool needNotifyServer, bool needClearListener = true, uint32_t reason = 0); WMError NapiSetUIContent(const std::string& contentInfo, ani_env* env, ani_object storage, BackupAndRestoreType type, sptr token, AppExecFwk::Ability* ability) override; WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, BackupAndRestoreType type, sptr token, AppExecFwk::Ability* ability) override; WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, AppExecFwk::Ability* ability) override; WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, AppExecFwk::Ability* ability) override; std::shared_ptr GetSurfaceNode() const override; const std::shared_ptr GetContext() const override; void SetContext(const std::shared_ptr& context); Rect GetRequestRect() const override; Rect GetGlobalDisplayRect() const override; WMError ClientToGlobalDisplay(const Position& inPosition, Position& outPosition) const override; WMError GlobalDisplayToClient(const Position& inPosition, Position& outPosition) const override; WSError UpdateGlobalDisplayRectFromServer(const WSRect& rect, SizeChangeReason reason) override; WindowType GetType() const override; const std::string& GetWindowName() const override; WindowState GetWindowState() const override; WindowState GetRequestWindowState() const; WMError SetFocusable(bool isFocusable) override; WMError SetTouchable(bool isTouchable) override; /* * Window Hierarchy */ WMError SetTopmost(bool topmost) override; bool IsTopmost() const override; WMError SetMainWindowTopmost(bool isTopmost) override; bool IsMainWindowTopmost() const override; void SetSubWindowZLevelToProperty(); int32_t GetSubWindowZLevelByFlags(WindowType type, uint32_t windowFlags, bool isTopmost); WMError RaiseToAppTopOnDrag(); bool IsApplicationModalSubWindowShowing(int32_t parentId); WMError SetResizeByDragEnabled(bool dragEnabled) override; WMError SetRaiseByClickEnabled(bool raiseEnabled) override; WMError HideNonSystemFloatingWindows(bool shouldHide) override; WMError SetSingleFrameComposerEnabled(bool enable) override; bool IsFloatingWindowAppType() const override; /* * PC Window */ bool IsPcWindow() const override; bool IsPadWindow() const override; bool IsPcOrFreeMultiWindowCapabilityEnabled() const override; bool IsPcOrPadFreeMultiWindowMode() const override; bool IsPadAndNotFreeMutiWindowCompatibleMode() const override; bool IsSceneBoardEnabled() const override; bool GetCompatibleModeInPc() const override; void HookCompatibleModeAvoidAreaNotify() override; bool IsAdaptToCompatibleImmersive() const override; WMError SetWindowDelayRaiseEnabled(bool isEnabled) override; bool IsWindowDelayRaiseEnabled() const override; WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, bool isCloseVisible) override; WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) override; WMError SetWindowModal(bool isModal) override; void SetTargetAPIVersion(uint32_t targetAPIVersion); uint32_t GetTargetAPIVersion() const; void NotifyClientWindowSize(); bool IsFullScreenPcAppInPadMode() const; sptr GetPropertyByContext() const; /* * Compatible Mode */ bool IsAdaptToSimulationScale() const; bool IsAdaptToProportionalScale() const; bool IsInCompatScaleMode() const; bool IsInCompatScaleStatus() const; WMError UpdateCompatScaleInfo(const Transform& transform); void SetCompatInfoInExtensionConfig(AAFwk::WantParams& want) const; bool IsAdaptToSubWindow() const; static void RegisterWindowScaleCallback(); static WMError GetWindowScaleCoordinate(uint32_t windowId, CursorInfo& cursorInfo); static sptr GetScaleWindow(uint32_t windowId); WMError SetWindowType(WindowType type) override; WMError SetBrightness(float brightness) override; virtual float GetBrightness() const override; void SetRequestedOrientation(Orientation orientation, bool needAnimation = true) override; WMError RegisterPreferredOrientationChangeListener( const sptr& listener) override; WMError UnregisterPreferredOrientationChangeListener( const sptr& listener) override; void NotifyPreferredOrientationChange(Orientation orientation) override; WMError RegisterOrientationChangeListener(const sptr& listener) override; WMError UnregisterOrientationChangeListener(const sptr& listener) override; bool GetTouchable() const override; uint32_t GetWindowId() const override; uint64_t GetDisplayId() const override; Rect GetRect() const override; bool GetFocusable() const override; std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) override; WMError SetRestoredRouterStack(const std::string& routerStack) override; Ace::UIContent* GetUIContent() const override; std::shared_ptr GetUIContentSharedPtr() const; Ace::UIContent* GetUIContentWithId(uint32_t winId) const override; void OnNewWant(const AAFwk::Want& want) override; void RequestVsync(const std::shared_ptr& vsyncCallback) override; int64_t GetVSyncPeriod() override; void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType = 0) override; void ConsumePointerEvent(const std::shared_ptr& pointerEvent) override; void ConsumeKeyEvent(std::shared_ptr& inputEvent) override; void ConsumeBackEvent() override; bool IsDialogSessionBackGestureEnabled() override; bool PreNotifyKeyEvent(const std::shared_ptr& keyEvent) override; bool OnPointDown(int32_t eventId, int32_t posX, int32_t posY) override; WMError SetIntentParam(const std::string& intentParam, const std::function& loadPageCallback, bool isColdStart) override; void SetForceSplitEnable(AppForceLandscapeConfig& config); /* * inherits from session stage */ WSError SetActive(bool active) override; WSError UpdateRect(const WSRect& rect, SizeChangeReason reason, const SceneAnimationConfig& config = { nullptr, ROTATE_ANIMATION_DURATION }, const std::map& avoidAreas = {}) override; void UpdateDensity() override; void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) override; WSError UpdateOrientation() override; WSError UpdateDisplayId(uint64_t displayId) override; WSError UpdateFocus(bool focus) override; bool IsFocused() const override; WMError RequestFocus() const override; WMError RequestFocusByClient(bool isFocused) const override; WSError UpdateWindowMode(WindowMode mode) override; WSError GetTopNavDestinationName(std::string& topNavDestName) override { return WSError::WS_OK; } WSError HandleBackEvent() override; KeyboardAnimationConfig GetKeyboardAnimationConfig() override; bool NotifyOnKeyPreImeEvent(const std::shared_ptr& keyEvent) override; void NotifyPointerEvent(const std::shared_ptr& pointerEvent) override; void NotifyKeyEvent(const std::shared_ptr& keyEvent, bool& isConsumed, bool notifyInputMethod = true) override; void NotifyOccupiedAreaChangeInfoInner(sptr info); void NotifyOccupiedAreaChangeInfo(sptr info, const std::shared_ptr& rsTransaction, const Rect& callingSessionRect, const std::map& avoidAreas) override; void NotifyKeyboardWillShow(const KeyboardAnimationInfo& keyboardAnimationInfo); void NotifyKeyboardWillHide(const KeyboardAnimationInfo& keyboardAnimationInfo); virtual void NotifyKeyboardDidShow(const KeyboardPanelInfo& keyboardPanelInfo); virtual void NotifyKeyboardDidHide(const KeyboardPanelInfo& keyboardPanelInfo); void NotifyKeyboardAnimationCompleted(const KeyboardPanelInfo& keyboardPanelInfo) override; void NotifyKeyboardAnimationWillBegin(const KeyboardAnimationInfo& keyboardAnimationInfo, const std::shared_ptr& rsTransaction) override; void NotifyForegroundInteractiveStatus(bool interactive) override; void NotifyDisplayMove(DisplayId from, DisplayId to) override; void NotifyWindowCrossAxisChange(CrossAxisState state) override; WMError RegisterLifeCycleListener(const sptr& listener) override; WMError UnregisterLifeCycleListener(const sptr& listener) override; WMError RegisterDisplayMoveListener(sptr& listener) override; WMError UnregisterDisplayMoveListener(sptr& listener) override; WMError RegisterWindowChangeListener(const sptr& listener) override; WMError UnregisterWindowChangeListener(const sptr& listener) override; WMError RegisterWindowCrossAxisListener(const sptr& listener) override; WMError UnregisterWindowCrossAxisListener(const sptr& listener) override; void RegisterDialogDeathRecipientListener(const sptr& listener) override; void UnregisterDialogDeathRecipientListener(const sptr& listener) override; WMError RegisterDialogTargetTouchListener(const sptr& listener) override; WMError UnregisterDialogTargetTouchListener(const sptr& listener) override; WMError RegisterOccupiedAreaChangeListener(const sptr& listener) override; WMError UnregisterOccupiedAreaChangeListener(const sptr& listener) override; WMError RegisterKeyboardWillShowListener(const sptr& listener) override; WMError UnregisterKeyboardWillShowListener(const sptr& listener) override; WMError RegisterKeyboardWillHideListener(const sptr& listener) override; WMError UnregisterKeyboardWillHideListener(const sptr& listener) override; WMError RegisterKeyboardDidShowListener(const sptr& listener) override; WMError UnregisterKeyboardDidShowListener(const sptr& listener) override; WMError RegisterKeyboardDidHideListener(const sptr& listener) override; WMError UnregisterKeyboardDidHideListener(const sptr& listener) override; WMError RegisterTouchOutsideListener(const sptr& listener) override; WMError UnregisterTouchOutsideListener(const sptr& listener) override; WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) override; WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) override; WMError RegisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr& listener) override; WMError UnregisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr& listener) override; WMError RegisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr& listener) override; WMError UnregisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr& listener) override; WMError RegisterAcrossDisplaysChangeListener(const IAcrossDisplaysChangeListenerSptr& listener) override; WMError UnRegisterAcrossDisplaysChangeListener(const IAcrossDisplaysChangeListenerSptr& listener) override; WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) override; WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) override; WMError RegisterWindowStageLifeCycleListener(const sptr& listener) override; WMError UnregisterWindowStageLifeCycleListener(const sptr& listener) override; WMError RegisterSystemBarPropertyListener(const sptr& listener) override; WMError UnregisterSystemBarPropertyListener(const sptr& listener) override; void NotifySystemBarPropertyUpdate(WindowType type, const SystemBarProperty& property) override; void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) override; void UnregisterWindowDestroyedListener() override { notifyNativeFunc_ = nullptr; } WMError RegisterScreenshotListener(const sptr& listener) override; WMError UnregisterScreenshotListener(const sptr& listener) override; WMError RegisterScreenshotAppEventListener(const IScreenshotAppEventListenerSptr& listener) override; WMError UnregisterScreenshotAppEventListener(const IScreenshotAppEventListenerSptr& listener) override; void SetAceAbilityHandler(const sptr& handler) override; void SetInputEventConsumer(const std::shared_ptr& inputEventConsumer) override; void GetExtensionConfig(AAFwk::WantParams& want) const override; WMError OnExtensionMessage(uint32_t code, int32_t persistentId, const AAFwk::Want& data) override; virtual WMError HandleHostWindowRaise(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleRegisterHostWindowRectChangeListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleUnregisterHostWindowRectChangeListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleUIExtRegisterKeyboardDidShowListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleUIExtUnregisterKeyboardDidShowListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleUIExtRegisterKeyboardDidHideListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); virtual WMError HandleUIExtUnregisterKeyboardDidHideListener(uint32_t code, int32_t persistentId, const AAFwk::Want& data); WMError SetBackgroundColor(const std::string& color) override; virtual Orientation GetRequestedOrientation() override; int32_t GetParentId() const; int32_t GetPersistentId() const override; sptr GetProperty() const; SystemSessionConfig GetSystemSessionConfig() const; sptr GetHostSession() const; int32_t GetFloatingWindowParentId(); void NotifyAfterForeground(bool needNotifyListeners = true, bool needNotifyUiContent = true, bool waitAttach = false); void GetAttachStateSyncResult(bool waitAttachState, bool afterForeground) const; void NotifyAfterBackground(bool needNotifyListeners = true, bool needNotifyUiContent = true, bool waitDetach = false); void NotifyAfterDidForeground(uint32_t reason = static_cast(WindowStateChangeReason::NORMAL)); void NotifyAfterDidBackground(uint32_t reason = static_cast(WindowStateChangeReason::NORMAL)); void NotifyForegroundFailed(WMError ret); void NotifyBackgroundFailed(WMError ret); WSError MarkProcessed(int32_t eventId) override; void UpdateTitleButtonVisibility(); void HideTitleButton(bool& hideSplitButton, bool& hideMaximizeButton, bool& hideMinimizeButton, bool& hideCloseButton); WSError NotifyDestroy() override; WSError NotifyTransferComponentData(const AAFwk::WantParams& wantParams) override; WSErrorCode NotifyTransferComponentDataSync(const AAFwk::WantParams& wantParams, AAFwk::WantParams& reWantParams) override; void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) override; void NotifyScreenshot() override; void DumpSessionElementInfo(const std::vector& params) override; // colorspace, gamut virtual bool IsSupportWideGamut() override; virtual void SetColorSpace(ColorSpace colorSpace) override; virtual ColorSpace GetColorSpace() override; WSError NotifyTouchOutside() override; WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override; WSError NotifyWindowVisibility(bool isVisible) override; WSError NotifyNoInteractionTimeout(const IWindowNoInteractionListenerSptr& listener); WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, int64_t uiExtensionIdLevel) override; WindowState state_ { WindowState::STATE_INITIAL }; WindowState requestState_ { WindowState::STATE_INITIAL }; WSError UpdateMaximizeMode(MaximizeMode mode) override; void NotifySessionForeground(uint32_t reason, bool withAnimation) override; void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) override; WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override; WSError NotifyDialogStateChange(bool isForeground) override; bool IsMainHandlerAvailable() const override; /* * PiP Window */ WSError NotifyCloseExistPipWindow() override; WSError SetPipActionEvent(const std::string& action, int32_t status) override; WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status) override; WSError NotifyPipWindowSizeChange(double width, double height, double scale) override; void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) override; void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) override; void SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) override; void UpdatePiPTemplateInfo(PiPTemplateInfo& pipTemplateInfo) override; WMError GetPiPSettingSwitchStatus(bool& switchStatus) const override; WMError UpdateFloatingBall(const FloatingBallTemplateBaseInfo& fbTemplateBaseInfo, const std::shared_ptr& icon) override; void NotifyPrepareCloseFloatingBall() override; WSError SendFbActionEvent(const std::string& action) override; WMError RestoreFbMainWindow(const std::shared_ptr& want) override; WMError GetFloatingBallWindowId(uint32_t& windowId) override; void SetDrawingContentState(bool drawingContentState); WMError RegisterWindowStatusChangeListener(const sptr& listener) override; WMError UnregisterWindowStatusChangeListener(const sptr& listener) override; WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override; void SetLayoutTransform(const Transform& trans); Transform GetLayoutTransform() const override; /* * Window Decor */ WMError SetDecorVisible(bool isVisible) override; WMError GetDecorVisible(bool& isVisible) override; WMError SetWindowTitleMoveEnabled(bool enable) override; WMError SetDecorHeight(int32_t decorHeight) override; WMError GetDecorHeight(int32_t& height) override; WMError SetDecorButtonStyle(const DecorButtonStyle& decorButtonStyle) override; WMError GetDecorButtonStyle(DecorButtonStyle& decorButtonStyle) override; WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) override; WMError SetAPPWindowLabel(const std::string& label) override; WMError SetAPPWindowIcon(const std::shared_ptr& icon) override; WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor) override; WMError SetWindowContainerModalColor(const std::string& activeColor, const std::string& inactiveColor) override; nlohmann::json SetContainerButtonStyle(const DecorButtonStyle& decorButtonStyle); void UpdateDecorEnable(bool needNotify = false, WindowMode mode = WindowMode::WINDOW_MODE_UNDEFINED); /* * Window Decor listener */ WMError RegisterWindowTitleButtonRectChangeListener( const sptr& listener) override; WMError UnregisterWindowTitleButtonRectChangeListener( const sptr& listener) override; void NotifyWindowTitleButtonRectChange(TitleButtonRect titleButtonRect); WMError RegisterSubWindowCloseListeners(const sptr& listener) override; WMError UnregisterSubWindowCloseListeners(const sptr& listener) override; void NotifySubWindowClose(bool& terminateCloseProcess); WMError RegisterMainWindowCloseListeners(const sptr& listener) override; WMError UnregisterMainWindowCloseListeners(const sptr& listener) override; WMError NotifyMainWindowClose(bool& terminateCloseProcess); WMError RegisterWindowWillCloseListeners(const sptr& listener) override; WMError UnRegisterWindowWillCloseListeners(const sptr& listener) override; WMError NotifyWindowWillClose(sptr window); WSError GetUIContentRemoteObj(sptr& uiContentRemoteObj) override; void RecoverSessionListener(); void SetDefaultDisplayIdIfNeed(); WMError RegisterWindowRectChangeListener(const sptr& listener) override; WMError UnregisterWindowRectChangeListener(const sptr& listener) override; WMError RegisterRectChangeInGlobalDisplayListener( const sptr& listener) override; WMError UnregisterRectChangeInGlobalDisplayListener( const sptr& listener) override; WMError RegisterExtensionSecureLimitChangeListener( const sptr& listener) override; WMError UnregisterExtensionSecureLimitChangeListener( const sptr& listener) override; virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const override; virtual WMError GetCallingWindowRect(Rect& rect) const override; virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) override; virtual void SetTouchEvent(int32_t touchType) override; WMError SetContinueState(int32_t continueState) override; virtual WMError CheckAndModifyWindowRect(uint32_t& width, uint32_t& height) { return WMError::WM_ERROR_INVALID_PARAM; } /* * Multi Window */ WSError SetSplitButtonVisible(bool isVisible) override; WMError GetIsMidScene(bool& isMidScene) override; WSError SendContainerModalEvent(const std::string& eventName, const std::string& eventValue) override; /* * Window Layout */ WMError EnableDrag(bool enableDrag) override; WSError SetDragActivated(bool dragActivated) override; WSError SetEnableDragBySystem(bool enableDrag) override; bool IsWindowDraggable(); float GetVirtualPixelRatio() override; CrossAxisState GetCrossAxisState() override; void RegisterKeyFrameCallback(); WSError LinkKeyFrameCanvasNode(std::shared_ptr& rsCanvasNode) override; WSError SetKeyFramePolicy(KeyFramePolicy& keyFramePolicy) override; WMError SetDragKeyFramePolicy(const KeyFramePolicy& keyFramePolicy) override; WMError RegisterWindowStatusDidChangeListener(const sptr& listener) override; WMError UnregisterWindowStatusDidChangeListener(const sptr& listener) override; WSError NotifyLayoutFinishAfterWindowModeChange(WindowMode mode) override { return WSError::WS_OK; } WMError UpdateWindowModeForUITest(int32_t updateMode) override { return WMError::WM_OK; } void UpdateEnableDragWhenSwitchMultiWindow(bool enable); WSError NotifyAppHookWindowInfoUpdated() override { return WSError::WS_DO_NOTHING; } void SetNotifySizeChangeFlag(bool flag); /* * Free Multi Window */ WMError RegisterSwitchFreeMultiWindowListener(const sptr& listener) override; WMError UnregisterSwitchFreeMultiWindowListener(const sptr& listener) override; void SetFreeMultiWindowMode(bool enable) { windowSystemConfig_.freeMultiWindowEnable_ = enable; } void SwitchSubWindow(bool freeMultiWindowEnable, int32_t parentId); /* * Window Immersive */ WMError RegisterAvoidAreaChangeListener(const sptr& listener) override; WMError UnregisterAvoidAreaChangeListener(const sptr& listener) override; WMError SetAvoidAreaOption(uint32_t avoidAreaOption) override; WMError GetAvoidAreaOption(uint32_t& avoidAreaOption) override; void NotifyAvoidAreaChange(const sptr& avoidArea, AvoidAreaType type); WSError UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) override; bool IsSystemWindow() const override { return WindowHelper::IsSystemWindow(GetType()); } bool IsAppWindow() const override { return WindowHelper::IsAppWindow(GetType()); } WindowType GetRootHostWindowType() const override { return rootHostWindowType_; } void SetRootHostWindowType(WindowType& rootHostWindowType) override { rootHostWindowType_ = rootHostWindowType; } WMError UpdateSystemBarProperties(const std::unordered_map& systemBarProperties, const std::unordered_map& systemBarPropertyFlags) override; void UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool systemBarEnableAnimation, SystemBarProperty& property) override; WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) override; /* * Window Property */ WMError SetWindowDefaultDensityEnabled(bool enabled) override; void SetDefaultDensityEnabledValue(bool enabled); WSError NotifyDisplayIdChange(DisplayId displayId); WSError NotifyScreenshotAppEvent(ScreenshotEventType type) override; bool IsDeviceFeatureCapableFor(const std::string& feature) const override; bool IsDeviceFeatureCapableForFreeMultiWindow() const override; bool IsAnco() const override; /* * Window Input Event */ WMError NotifyWatchGestureConsumeResult(int32_t keyCode, bool isConsumed); WMError NotifyWatchFocusActiveChange(bool isActive); WMError InjectTouchEvent(const std::shared_ptr& pointerEvent) override; void RegisterWatchFocusActiveChangeCallback(); void NotifyConsumeResultToFloatWindow(const std::shared_ptr& keyEvent, bool isConsumed); /* * HightLight Window */ bool GetExclusivelyHighlighted() const; WMError IsWindowHighlighted(bool& highlighted) const override; WMError SetExclusivelyHighlighted(bool isExclusivelyHighlighted) override; WMError RegisterWindowHighlightChangeListeners(const sptr& listener) override; WMError UnregisterWindowHighlightChangeListeners(const sptr& listener) override; WSError NotifyHighlightChange(bool isHighlight) override; /* * PC Fold Screen */ bool IsWaterfallModeEnabled() override; WMError RegisterWaterfallModeChangeListener(const sptr& listener) override; WMError UnregisterWaterfallModeChangeListener(const sptr& listener) override; /* * Window Rotation */ WMError RegisterWindowRotationChangeListener(const sptr& listener) override; WMError UnregisterWindowRotationChangeListener(const sptr& listener) override; RotationChangeResult NotifyRotationChange(const RotationChangeInfo& rotationChangeInfo) override; WMError CheckMultiWindowRect(uint32_t& width, uint32_t& height); WSError SetCurrentRotation(int32_t currentRotation) override; void UpdateCurrentWindowOrientation(DisplayOrientation displayOrientation); DisplayOrientation GetCurrentWindowOrientation() const; Orientation ConvertUserOrientationToUserPageOrientation(Orientation orientation) const; Orientation ConvertInvalidOrientation(); void SetUserRequestedOrientation(Orientation orientation) override; bool IsUserOrientation(Orientation orientation) const; bool IsUserPageOrientation(Orientation orientation) const; bool isNeededForciblySetOrientation(Orientation orientation) override; WMError SetFollowScreenChange(bool isFollowScreenChange) override; /* * UIExtension */ WSError NotifyExtensionSecureLimitChange(bool isLimit) override; /* * RS Client Multi Instance */ std::shared_ptr GetRSUIDirector() const override; std::shared_ptr GetRSUIContext() const override; /* * Window LifeCycle */ void NotifyLifecyclePausedStatus() override; void NotifyAppUseControlStatus(bool isUseControl) override; void NotifyAfterLifecycleForeground(); void NotifyAfterLifecycleBackground(); void NotifyAfterLifecycleResumed(); void NotifyAfterLifecyclePaused(); WMError GetRouterStackInfo(std::string& routerStackInfo) override; void SetNavDestinationInfo(const std::string& navDestinationInfo) override; protected: WMError Connect(); bool IsWindowSessionInvalid() const; void NotifyWindowAfterUnfocused(); void NotifyWindowAfterFocused(); void NotifyAfterActive(); void NotifyAfterInactive(); void NotifyBeforeDestroy(std::string windowName); void NotifyAfterDestroy(); template WMError RegisterListener(std::vector>& holder, const sptr& listener); template WMError UnregisterListener(std::vector>& holder, const sptr& listener); void ClearListenersById(int32_t persistentId); /* * Free Multi Window */ void ClearSwitchFreeMultiWindowListenersById(int32_t persistentId); void NotifySwitchFreeMultiWindow(bool enable); void ClearVsyncStation(); WMError WindowSessionCreateCheck(); void UpdateDecorEnableToAce(bool isDecorEnable); void NotifyModeChange(WindowMode mode, bool hasDeco = true); WMError UpdateProperty(WSPropertyChangeAction action); WMError SetBackgroundColor(uint32_t color); uint32_t GetBackgroundColor() const; virtual WMError SetLayoutFullScreenByApiVersion(bool status); virtual float GetVirtualPixelRatio(const sptr& displayInfo); void UpdateViewportConfig(const Rect& rect, WindowSizeChangeReason reason, const std::shared_ptr& rsTransaction = nullptr, const sptr& info = nullptr, const std::map& avoidAreas = {}); void NotifySizeChange(Rect rect, WindowSizeChangeReason reason); void NotifyGlobalDisplayRectChange(const Rect& rect, WindowSizeChangeReason reason); void NotifyUIExtHostWindowRectChangeListeners(const Rect rect, const WindowSizeChangeReason reason); static sptr FindWindowById(uint32_t winId); void NotifyWindowStatusChange(WindowMode mode); void NotifyTransformChange(const Transform& transForm) override; void NotifySingleHandTransformChange(const SingleHandTransform& singleHandTransform) override; bool IsKeyboardEvent(const std::shared_ptr& keyEvent) const; WMError HandleEscKeyEvent(const std::shared_ptr& keyEvent, bool& isConsumed); void DispatchKeyEventCallback(const std::shared_ptr& keyEvent, bool& isConsumed); bool IsVerticalOrientation(Orientation orientation) const; bool IsHorizontalOrientation(Orientation orientation) const; void CopyUniqueDensityParameter(sptr parentWindow); sptr FindMainWindowWithContext() const; sptr FindExtensionWindowWithContext() const; WMError RegisterExtensionAvoidAreaChangeListener(const sptr& listener); WMError UnregisterExtensionAvoidAreaChangeListener(const sptr& listener); void RefreshNoInteractionTimeoutMonitor(); WindowStatus GetWindowStatusInner(WindowMode mode); /* * PC Event Filter */ bool FilterKeyEvent(const std::shared_ptr& keyEvent); bool FilterPointerEvent(const std::shared_ptr& pointerEvent); WMError SetKeyEventFilter(KeyEventFilterFunc filter) override; WMError ClearKeyEventFilter() override; WMError SetMouseEventFilter(MouseEventFilterFunc filter) override; WMError ClearMouseEventFilter() override; WMError SetTouchEventFilter(TouchEventFilterFunc filter) override; WMError ClearTouchEventFilter() override; /* * UIExtension */ std::unordered_set rectChangeUIExtListenerIds_; std::unordered_set keyboardDidShowUIExtListenerIds_; std::unordered_set keyboardDidHideUIExtListenerIds_; std::unordered_map> keyboardDidShowUIExtListeners_; std::unordered_map> keyboardDidHideUIExtListeners_; void WriteKeyboardInfoToWant(AAFwk::Want& want, const KeyboardPanelInfo& keyboardPanelInfo) const; void ReadKeyboardInfoFromWant(const AAFwk::Want& want, KeyboardPanelInfo& keyboardPanelInfo) const; static std::set>& GetWindowExtensionSessionSet(); /* * Sub Window */ void UpdateSubWindowStateAndNotify(int32_t parentPersistentId, const WindowState newState); void DestroySubWindow(); bool IsSubWindowMaximizeSupported() const override; void UpdateSubWindowInfo(uint32_t subWindowLevel, const std::shared_ptr& context); void GetSubWindows(int32_t parentPersistentId, std::vector>& subWindows); void RemoveSubWindow(int32_t parentPersistentId); sptr windowOption_; sptr hostSession_; mutable std::mutex hostSessionMutex_; std::shared_ptr uiContent_; mutable std::shared_mutex uiContentMutex_; std::shared_ptr context_; mutable std::shared_mutex contextMutex_; std::shared_ptr surfaceNode_; sptr property_; SystemSessionConfig windowSystemConfig_; NotifyNativeWinDestroyFunc notifyNativeFunc_; std::recursive_mutex mutex_; static std::map>> windowSessionMap_; // protect windowSessionMap_ static std::shared_mutex windowSessionMutex_; // protect g_windowExtensionSessionSet_ static std::shared_mutex windowExtensionSessionMutex_; bool isSystembarPropertiesSet_ = false; bool isIgnoreSafeAreaNeedNotify_ = false; bool isIgnoreSafeArea_ = false; std::atomic_bool isFocused_ = false; std::atomic_bool isHighlighted_ = false; std::atomic_bool shouldReNotifyHighlight_ = false; std::shared_ptr handler_ = nullptr; bool shouldReNotifyFocus_ = false; std::shared_ptr vsyncStation_ = nullptr; std::shared_ptr inputEventConsumer_; bool useUniqueDensity_ { false }; float virtualPixelRatio_ { 1.0f }; bool escKeyEventTriggered_ = false; bool escKeyHasDown_ { false }; // Check whether the UIExtensionAbility process is started static bool isUIExtensionAbilityProcess_; WSError SwitchFreeMultiWindow(bool enable) override; std::string identityToken_ = { "" }; void MakeSubOrDialogWindowDragableAndMoveble(); bool IsFreeMultiWindowMode() const { return windowSystemConfig_.IsFreeMultiWindowMode(); } /* * Sub Window */ static std::recursive_mutex subWindowSessionMutex_; static std::map>> subWindowSessionMap_; /* * Compatible Mode */ float compatScaleX_ = 1.0f; float compatScaleY_ = 1.0f; /* * DFX */ void SetUIContentComplete(); void AddSetUIContentTimeoutCheck(); void NotifySetUIContentComplete(); std::atomic_bool setUIContentCompleted_ { false }; void SetUIExtensionDestroyComplete(); void SetUIExtensionDestroyCompleteInSubWindow(); void AddSetUIExtensionDestroyTimeoutCheck(); std::atomic_bool setUIExtensionDestroyCompleted_ { false }; std::atomic_bool startUIExtensionDestroyTimer_ { false }; enum TimeoutErrorCode : int32_t { SET_UICONTENT_TIMEOUT = 1000, SET_UIEXTENSION_DESTROY_TIMEOUT }; /* * Window Lifecycle */ mutable std::mutex appUseControlMutex_; bool hasFirstNotifyInteractive_ = false; bool isAppUseControl_ = false; bool interactive_ = true; bool isDidForeground_ = false; bool isInteractiveStateFlag_ = false; std::string intentParam_; std::function loadPageCallback_; bool isColdStart_ = true; bool isIntentColdStart_ = true; std::string navDestinationInfo_; sptr lifecycleCallback_ = nullptr; /* * Window Layout */ std::atomic_bool isDragTaskPostDone_ = true; void FlushLayoutSize(int32_t width, int32_t height) override; sptr layoutCallback_ = nullptr; sptr getTargetInfoCallback_ = nullptr; sptr getRotationResultFuture_ = nullptr; sptr updateRectCallback_ = nullptr; void UpdateVirtualPixelRatio(const sptr& display); WMError GetVirtualPixelRatio(float& vpr); void SetCurrentTransform(const Transform& transform); Transform GetCurrentTransform() const; void NotifyAfterUIContentReady(); void SetNeedRenotifyTransform(bool isNeedRenotify) { needRenotifyTransform_.store(isNeedRenotify); } bool IsNeedRenotifyTransform() const { return needRenotifyTransform_.load(); } mutable std::recursive_mutex transformMutex_; std::atomic crossAxisState_ = CrossAxisState::STATE_INVALID; bool IsValidCrossState(int32_t state) const; template EnableIfSame>> GetListeners(); void NotifyWindowStatusDidChange(WindowMode mode); void NotifyFirstValidLayoutUpdate(const Rect& preRect, const Rect& newRect); std::atomic_bool hasSetEnableDrag_ = false; void HookWindowSizeByHookWindowInfo(Rect& rect); void SetAppHookWindowInfo(const HookWindowInfo& hookWindowInfo); HookWindowInfo GetAppHookWindowInfo(); virtual WMError GetAppHookWindowInfoFromServer(HookWindowInfo& hookWindowInfo) { return WMError::WM_OK; } /* * Window Immersive */ std::map lastAvoidAreaMap_; uint32_t GetStatusBarHeight() const override; WindowType rootHostWindowType_ = WindowType::APP_MAIN_WINDOW_BASE; /* * PC Fold Screen */ bool supportEnterWaterfallMode_ { false }; std::atomic_bool isFullScreenWaterfallMode_ { false }; std::atomic_bool isValidWaterfallMode_ { false }; bool isAcrossDisplays_ = false; WMError NotifyAcrossDisplaysChange(bool isAcrossDisplays); void NotifyWaterfallModeChange(bool isWaterfallMode); std::vector> GetWaterfallModeChangeListeners(); /* * Window Pattern */ WMError NotifySnapshotUpdate() override; /* * Window Property */ std::unordered_set containerColorList_; float lastSystemDensity_ = UNDEFINED_DENSITY; static std::atomic defaultDensityEnabledGlobalConfig_; std::atomic isDefaultDensityEnabled_ = false; WSError NotifySystemDensityChange(float density); void RegisterWindowInspectorCallback(); uint32_t GetTargetAPIVersionByApplicationInfo() const; /* * Window Input Event */ bool GetWatchGestureConsumed() const; void SetWatchGestureConsumed(bool isWatchGestureConsumed); bool dialogSessionBackGestureEnabled_ = false; /* * Window Rotation */ int16_t rotationAnimationCount_ { 0 }; void NotifyRotationAnimationEnd(); /* * Keyboard */ sptr occupiedAreaInfo_ = nullptr; /* * Window Decor */ bool grayOutMaximizeButton_ = false; private: //Trans between colorGamut and colorSpace static ColorSpace GetColorSpaceFromSurfaceGamut(GraphicColorGamut colorGamut); static GraphicColorGamut GetSurfaceGamutFromColorSpace(ColorSpace colorSpace); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template void ClearUselessListeners(std::map& listeners, int32_t persistentId); template void ClearUselessListeners(std::unordered_map& listeners, int32_t persistentId); RSSurfaceNode::SharedPtr CreateSurfaceNode(const std::string& name, WindowType type); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); void NotifyAfterFocused(); void NotifyUIContentFocusStatus(); void NotifyAfterUnfocused(bool needNotifyUiContent = true); void NotifyAfterResumed(); void NotifyAfterPaused(); void NotifyUIContentHighlightStatus(bool isHighlighted); /* * Window Decor listener */ template EnableIfSame>> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame> GetListeners(); template EnableIfSame>> GetListeners(); std::unique_ptr UIContentCreate(AppExecFwk::Ability* ability, void* env, int isAni); Ace::UIContentErrorCode UIContentInitByName(Ace::UIContent*, const std::string&, void* storage, int isAni); template Ace::UIContentErrorCode UIContentInit(Ace::UIContent*, T contentInfo, void* storage, int isAni); Ace::UIContentErrorCode UIContentRestore(Ace::UIContent*, const std::string& contentInfo, void* storage, Ace::ContentInfoType infoType, int isAni); WMError InitUIContent(const std::string& contentInfo, void* env, void* storage, WindowSetUIContentType setUIContentType, BackupAndRestoreType restoreType, AppExecFwk::Ability* ability, OHOS::Ace::UIContentErrorCode& aceRet, int isAni = 0); void UpdateConfigWhenSetUIContent(); WMError SetUIContentInner(const std::string& contentInfo, void* env, void* storage, WindowSetUIContentType setUIContentType, BackupAndRestoreType restoreType, AppExecFwk::Ability* ability, int isAni = 0); std::shared_ptr> GetAbcContent(const std::string& abcPath); void RegisterUIContenCallback(); inline void DestroyExistUIContent(); std::string GetRestoredRouterStack(); bool CheckIfNeedCommitRsTransaction(WindowSizeChangeReason wmReason); void UpdateRectForRotation(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, const SceneAnimationConfig& config, const std::map& avoidAreas = {}); void UpdateRectForPageRotation(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, const SceneAnimationConfig& config, const std::map& avoidAreas = {}); void UpdateRectForOtherReason(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, const std::shared_ptr& rsTransaction = nullptr, const std::map& avoidAreas = {}); void UpdateRectForOtherReasonTask(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, const std::shared_ptr& rsTransaction, const std::map& avoidAreas = {}); void UpdateRectForResizeWithAnimation(const Rect& wmRect, const Rect& preRect, WindowSizeChangeReason wmReason, const RectAnimationConfig& rectAnimationConfig, const std::shared_ptr& rsTransaction = nullptr, const std::map& avoidAreas = {}); void SubmitNoInteractionMonitorTask(int32_t eventId, const IWindowNoInteractionListenerSptr& listener); virtual WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) { return WMError::WM_OK; }; WSError NotifyAppForceLandscapeConfigUpdated() override; void SetFrameLayoutCallbackEnable(bool enable); void UpdateFrameLayoutCallbackIfNeeded(WindowSizeChangeReason wmReason); bool IsNotifyInteractiveDuplicative(bool interactive); void SetUniqueVirtualPixelRatioForSub(bool useUniqueDensity, float virtualPixelRatio); bool IsWindowShouldDrag(); bool CheckCanDragWindowType(); /* * PC Window */ void GetTitleButtonVisible(bool& hideMaximizeButton, bool& hideMinimizeButton, bool& hideSplitButton, bool& hideCloseButton); /* * PC Fold Screen */ bool waterfallModeWhenEnterBackground_ { false }; static std::mutex waterfallModeChangeListenerMutex_; static std::unordered_map>> waterfallModeChangeListeners_; bool InitWaterfallMode(); static std::recursive_mutex lifeCycleListenerMutex_; static std::recursive_mutex windowStageLifeCycleListenerMutex_; static std::recursive_mutex windowChangeListenerMutex_; static std::recursive_mutex windowCrossAxisListenerMutex_; static std::recursive_mutex avoidAreaChangeListenerMutex_; static std::recursive_mutex dialogDeathRecipientListenerMutex_; static std::recursive_mutex dialogTargetTouchListenerMutex_; static std::recursive_mutex occupiedAreaChangeListenerMutex_; static std::recursive_mutex keyboardWillShowListenerMutex_; static std::recursive_mutex keyboardWillHideListenerMutex_; static std::recursive_mutex keyboardDidShowListenerMutex_; static std::recursive_mutex keyboardDidHideListenerMutex_; static std::recursive_mutex screenshotListenerMutex_; static std::recursive_mutex touchOutsideListenerMutex_; static std::recursive_mutex windowVisibilityChangeListenerMutex_; static std::recursive_mutex windowNoInteractionListenerMutex_; static std::recursive_mutex windowStatusChangeListenerMutex_; static std::recursive_mutex windowStatusDidChangeListenerMutex_; static std::mutex displayMoveListenerMutex_; static std::mutex windowRectChangeListenerMutex_; static std::mutex rectChangeInGlobalDisplayListenerMutex_; static std::mutex secureLimitChangeListenerMutex_; static std::mutex switchFreeMultiWindowListenerMutex_; static std::mutex preferredOrientationChangeListenerMutex_; static std::mutex windowOrientationChangeListenerMutex_; static std::mutex highlightChangeListenerMutex_; static std::mutex systemBarPropertyListenerMutex_; static std::mutex windowRotationChangeListenerMutex_; static std::map>> systemBarPropertyListeners_; static std::map>> lifecycleListeners_; static std::map>> windowStageLifecycleListeners_; static std::map>> displayMoveListeners_; static std::map>> windowChangeListeners_; static std::map>> windowCrossAxisListeners_; static std::map>> avoidAreaChangeListeners_; static std::map>> dialogDeathRecipientListeners_; static std::map>> dialogTargetTouchListener_; static std::map>> occupiedAreaChangeListeners_; static std::map>> keyboardWillShowListeners_; static std::map>> keyboardWillHideListeners_; static std::map>> keyboardDidShowListeners_; static std::map>> keyboardDidHideListeners_; static std::map>> screenshotListeners_; static std::recursive_mutex screenshotAppEventListenerMutex_; static std::unordered_map> screenshotAppEventListeners_; static std::map>> touchOutsideListeners_; static std::map> windowVisibilityChangeListeners_; static std::mutex displayIdChangeListenerMutex_; static std::map> displayIdChangeListeners_; static std::mutex systemDensityChangeListenerMutex_; static std::unordered_map> systemDensityChangeListeners_; static std::recursive_mutex acrossDisplaysChangeListenerMutex_; static std::unordered_map> acrossDisplaysChangeListeners_; static std::map> windowNoInteractionListeners_; static std::map>> windowStatusChangeListeners_; static std::map>> windowStatusDidChangeListeners_; static std::map>> windowRectChangeListeners_; static std::map>> rectChangeInGlobalDisplayListeners_; static std::map>> secureLimitChangeListeners_; static std::map>> switchFreeMultiWindowListeners_; static std::map> preferredOrientationChangeListener_; static std::map> windowOrientationChangeListener_; static std::map>> highlightChangeListeners_; static std::map>> windowRotationChangeListeners_; // FA only sptr aceAbilityHandler_; std::atomic lastInteractionEventId_ { 0 }; bool isMainHandlerAvailable_ = true; std::string subWindowTitle_ = { "" }; std::string dialogTitle_ = { "" }; WindowTitleVisibleFlags windowTitleVisibleFlags_; std::string restoredRouterStack_; // It was set and get in same thread, which is js thread. /* * Window Layout */ WSRect layoutRect_; std::atomic_bool windowSizeChanged_ = false; std::atomic_bool enableFrameLayoutFinishCb_ = false; std::atomic_bool dragActivated_ = true; WindowSizeChangeReason lastSizeChangeReason_ = WindowSizeChangeReason::END; bool postTaskDone_ = false; Transform layoutTransform_; SingleHandTransform singleHandTransform_; mutable std::mutex currentTransformMutex_; Transform currentTransform_; std::atomic_bool needRenotifyTransform_ = false; KeyFramePolicy keyFramePolicy_; std::atomic lastWindowStatus_ = WindowStatus::WINDOW_STATUS_UNDEFINED; std::atomic lastStatusWhenNotifyWindowStatusDidChange_ = WindowStatus::WINDOW_STATUS_UNDEFINED; std::atomic isFirstValidLayoutUpdate_ = true; SizeChangeReason globalDisplayRectSizeChangeReason_ = SizeChangeReason::END; std::shared_mutex hookWindowInfoMutex_; HookWindowInfo hookWindowInfo_; std::atomic_bool notifySizeChangeFlag_ = false; /* * Window Decor */ DecorButtonStyle decorButtonStyle_; int32_t decorHeight_ = 0; /* * Window Decor listener */ static std::recursive_mutex windowTitleButtonRectChangeListenerMutex_; static std::map>> windowTitleButtonRectChangeListeners_; static std::mutex subWindowCloseListenersMutex_; static std::map> subWindowCloseListeners_; static std::mutex mainWindowCloseListenersMutex_; static std::map> mainWindowCloseListeners_; static std::recursive_mutex windowWillCloseListenersMutex_; static std::unordered_map>> windowWillCloseListeners_; /* * Multi Window */ bool isSplitButtonVisible_ = true; /* * PC Window */ uint32_t targetAPIVersion_ = 0; /* * Window Input Event */ bool isWatchGestureConsumed_ = false; /* * PC Event Filter */ std::mutex keyEventFilterMutex_; KeyEventFilterFunc keyEventFilter_; std::mutex mouseEventFilterMutex_; MouseEventFilterFunc mouseEventFilter_; std::mutex touchEventFilterMutex_; TouchEventFilterFunc touchEventFilter_; /* * Window Scene */ WSError NotifyWindowAttachStateChange(bool isAttach) override { return WSError::WS_OK; } /* * Window Rotation */ void NotifyClientOrientationChange(); void NotifyRotationChangeResult(RotationChangeResult rotationChangeResult) override; void NotifyRotationChangeResultInner(const RotationChangeInfo& rotationChangeInfo); DisplayOrientation windowOrientation_ = DisplayOrientation::UNKNOWN; /* * RS Client Multi Instance */ std::shared_ptr rsUIDirector_; }; } // namespace Rosen } // namespace OHOS #endif // OHOS_ROSEN_WINDOW_SESSION_IMPL_H