1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H
18 
19 #include "session/host/include/session.h"
20 #include "session/host/include/move_drag_controller.h"
21 #include "wm_common.h"
22 
23 namespace OHOS::PowerMgr {
24 class RunningLock;
25 }
26 
27 namespace OHOS::Rosen {
28 namespace PARAM_KEY {
29 const std::string PARAM_MISSION_AFFINITY_KEY = "ohos.anco.param.missionAffinity";
30 const std::string PARAM_DMS_CONTINUE_SESSION_ID_KEY = "ohos.dms.continueSessionId";
31 const std::string PARAM_DMS_PERSISTENT_ID_KEY = "ohos.dms.persistentId";
32 }
33 namespace {
34 constexpr int32_t MIN_DECOR_HEIGHT = 37;
35 constexpr int32_t MAX_DECOR_HEIGHT = 112;
36 }
37 class SceneSession;
38 
39 using SpecificSessionCreateCallback =
40   std::function<sptr<SceneSession>(const SessionInfo& info, sptr<WindowSessionProperty> property)>;
41 using SpecificSessionDestroyCallback = std::function<WSError(const int32_t& persistentId)>;
42 using CameraFloatSessionChangeCallback = std::function<void(uint32_t accessTokenId, bool isShowing)>;
43 using GetSceneSessionVectorByTypeCallback = std::function<std::vector<sptr<SceneSession>>(
44     WindowType type, uint64_t displayId)>;
45 using UpdateAvoidAreaCallback = std::function<void(int32_t persistentId)>;
46 using UpdateAvoidAreaByTypeCallback = std::function<void(int32_t persistentId, AvoidAreaType type)>;
47 using UpdateOccupiedAreaIfNeedCallback = std::function<void(const int32_t& persistentId)>;
48 using NotifyWindowInfoUpdateCallback = std::function<void(int32_t persistentId, WindowUpdateType type)>;
49 using NotifyWindowPidChangeCallback = std::function<void(int32_t windowId, bool startMoving)>;
50 using NotifySessionTouchOutsideCallback = std::function<void(int32_t persistentId)>;
51 using GetAINavigationBarArea = std::function<WSRect(uint64_t displayId)>;
52 using RecoveryCallback = std::function<void(int32_t persistentId, Rect rect)>;
53 using NotifyBindDialogSessionFunc = std::function<void(const sptr<SceneSession>& session)>;
54 using NotifySessionPiPControlStatusChangeFunc = std::function<void(WsPiPControlType controlType,
55     WsPiPControlStatus status)>;
56 using NotifyAutoStartPiPStatusChangeFunc = std::function<void(bool isAutoStart, uint32_t priority)>;
57 using NotifySessionEventFunc = std::function<void(int32_t eventId, SessionEventParam param)>;
58 using NotifySessionTopmostChangeFunc = std::function<void(const bool topmost)>;
59 using NotifySubModalTypeChangeFunc = std::function<void(SubWindowModalType subWindowModalType)>;
60 using NotifyMainModalTypeChangeFunc = std::function<void(bool isModal)>;
61 using NotifyRaiseToTopFunc = std::function<void()>;
62 using SetWindowPatternOpacityFunc = std::function<void(float opacity)>;
63 using NotifyIsCustomAnimationPlayingCallback = std::function<void(bool isFinish)>;
64 using NotifyWindowAnimationFlagChangeFunc = std::function<void(const bool flag)>;
65 using NotifySystemBarPropertyChangeFunc = std::function<void(
66     const std::unordered_map<WindowType, SystemBarProperty>& propertyMap)>;
67 using NotifyNeedAvoidFunc = std::function<void(bool status)>;
68 using NotifyShowWhenLockedFunc = std::function<void(bool showWhenLocked)>;
69 using NotifyReqOrientationChangeFunc = std::function<void(uint32_t orientation)>;
70 using NotifyRaiseAboveTargetFunc = std::function<void(int32_t subWindowId)>;
71 using NotifyForceHideChangeFunc = std::function<void(bool hide)>;
72 using NotifyTouchOutsideFunc = std::function<void()>;
73 using ClearCallbackMapFunc = std::function<void(bool needRemove, int32_t persistentId)>;
74 using NotifyPrepareClosePiPSessionFunc = std::function<void()>;
75 using OnOutsideDownEvent = std::function<void(int32_t x, int32_t y)>;
76 using HandleSecureSessionShouldHideCallback = std::function<WSError(const sptr<SceneSession>& sceneSession)>;
77 using SystemSessionBufferAvailableCallback = std::function<void()>;
78 using ClearDisplayStatusBarTemporarilyFlags = std::function<void()>;
79 using CameraSessionChangeCallback = std::function<void(uint32_t accessTokenId, bool isShowing)>;
80 using NotifyLandscapeMultiWindowSessionFunc = std::function<void(bool isLandscapeMultiWindow)>;
81 using NotifyKeyboardGravityChangeFunc = std::function<void(SessionGravity gravity)>;
82 using SessionChangeByActionNotifyManagerFunc = std::function<void(const sptr<SceneSession>& sceneSession,
83     const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action)>;
84 using NotifyKeyboardLayoutAdjustFunc = std::function<void(const KeyboardLayoutParams& params)>;
85 using NotifyLayoutFullScreenChangeFunc = std::function<void(bool isLayoutFullScreen)>;
86 using NotifyDefaultDensityEnabledFunc = std::function<void(bool isDefaultDensityEnabled)>;
87 using NotifyTitleAndDockHoverShowChangeFunc = std::function<void(bool isTitleHoverShown,
88     bool isDockHoverShown)>;
89 using NotifyRestoreMainWindowFunc = std::function<void()>;
90 using SetSkipSelfWhenShowOnVirtualScreenCallback = std::function<void(uint64_t surfaceNodeId, bool isSkip)>;
91 using NotifyForceSplitFunc = std::function<AppForceLandscapeConfig(const std::string& bundleName)>;
92 using UpdatePrivateStateAndNotifyFunc = std::function<void(int32_t persistentId)>;
93 using NotifyVisibleChangeFunc = std::function<void(int32_t persistentId)>;
94 using PiPStateChangeCallback = std::function<void(const std::string& bundleName, bool isForeground)>;
95 using NotifyMainWindowTopmostChangeFunc = std::function<void(bool isTopmost)>;
96 using UpdateGestureBackEnabledCallback = std::function<void(int32_t persistentId)>;
97 using IsLastFrameLayoutFinishedFunc = std::function<WSError(bool& isLayoutFinished)>;
98 using GetStatusBarDefaultVisibilityByDisplayIdFunc = std::function<bool(DisplayId displayId)>;
99 using UpdateAppUseControlFunc = std::function<void(ControlAppType type, bool isNeedControl)>;
100 using NotifySetWindowRectAutoSaveFunc = std::function<void(bool enabled)>;
101 
102 struct UIExtensionTokenInfo {
103     bool canShowOnLockScreen { false };
104     uint32_t callingTokenId { 0 };
105     sptr<IRemoteObject> abilityToken;
106 };
107 
108 class SceneSession : public Session {
109 public:
110     // callback for notify SceneSessionManager
111     struct SpecificSessionCallback : public RefBase {
112         SpecificSessionCreateCallback onCreate_;
113         SpecificSessionDestroyCallback onDestroy_;
114         ClearDisplayStatusBarTemporarilyFlags onClearDisplayStatusBarTemporarilyFlags_;
115         CameraFloatSessionChangeCallback onCameraFloatSessionChange_;
116         GetSceneSessionVectorByTypeCallback onGetSceneSessionVectorByType_;
117         UpdateAvoidAreaCallback onUpdateAvoidArea_;
118         UpdateAvoidAreaByTypeCallback onUpdateAvoidAreaByType_;
119         GetStatusBarDefaultVisibilityByDisplayIdFunc onGetStatusBarDefaultVisibilityByDisplayId_;
120         UpdateOccupiedAreaIfNeedCallback onUpdateOccupiedAreaIfNeed_;
121         NotifyWindowInfoUpdateCallback onWindowInfoUpdate_;
122         NotifyWindowPidChangeCallback onWindowInputPidChangeCallback_;
123         NotifySessionTouchOutsideCallback onSessionTouchOutside_;
124         GetAINavigationBarArea onGetAINavigationBarArea_;
125         OnOutsideDownEvent onOutsideDownEvent_;
126         HandleSecureSessionShouldHideCallback onHandleSecureSessionShouldHide_;
127         CameraSessionChangeCallback onCameraSessionChange_;
128         SetSkipSelfWhenShowOnVirtualScreenCallback onSetSkipSelfWhenShowOnVirtualScreen_;
129         PiPStateChangeCallback onPiPStateChange_;
130         UpdateGestureBackEnabledCallback onUpdateGestureBackEnabled_;
131     };
132 
133     // callback for notify SceneBoard
134     struct SessionChangeCallback : public RefBase {
135         NotifyBindDialogSessionFunc onBindDialogTarget_;
136         NotifySessionTopmostChangeFunc onSessionTopmostChange_;
137         NotifyRaiseToTopFunc onRaiseToTop_;
138         NotifySessionEventFunc OnSessionEvent_;
139         NotifyRaiseAboveTargetFunc onRaiseAboveTarget_;
140         NotifyLandscapeMultiWindowSessionFunc onSetLandscapeMultiWindowFunc_;
141         NotifyLayoutFullScreenChangeFunc onLayoutFullScreenChangeFunc_;
142     };
143 
144     // func for change window scene pattern property
145     struct SetWindowScenePatternFunc : public RefBase {
146         SetWindowPatternOpacityFunc setOpacityFunc_;
147     };
148 
149     SceneSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback);
150     virtual ~SceneSession();
151 
152     WSError Connect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
153         const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig,
154         sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr,
155         const std::string& identityToken = "") override;
156     WSError ConnectInner(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
157         const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig,
158         sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr,
159         int32_t pid = -1, int32_t uid = -1, const std::string& identityToken = "") override;
160     virtual WSError Reconnect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
161         const std::shared_ptr<RSSurfaceNode>& surfaceNode, sptr<WindowSessionProperty> property = nullptr,
162         sptr<IRemoteObject> token = nullptr, int32_t pid = -1, int32_t uid = -1);
163     WSError ReconnectInner(sptr<WindowSessionProperty> property);
164     WSError Foreground(sptr<WindowSessionProperty> property, bool isFromClient = false,
165         const std::string& identityToken = "") override;
166     WSError Background(bool isFromClient = false, const std::string& identityToken = "") override;
RegisterBufferAvailableCallback(const SystemSessionBufferAvailableCallback & func)167     virtual void RegisterBufferAvailableCallback(const SystemSessionBufferAvailableCallback& func) {};
168     WSError BackgroundTask(const bool isSaveSnapshot = true);
169     WSError Disconnect(bool isFromClient = false, const std::string& identityToken = "") override;
170     WSError DisconnectTask(bool isFromClient = false, bool isSaveSnapshot = true);
171     void SetClientIdentityToken(const std::string& clientIdentityToken);
BindKeyboardPanelSession(sptr<SceneSession> panelSession)172     virtual void BindKeyboardPanelSession(sptr<SceneSession> panelSession) {};
GetKeyboardPanelSession()173     virtual sptr<SceneSession> GetKeyboardPanelSession() const { return nullptr; };
BindKeyboardSession(sptr<SceneSession> session)174     virtual void BindKeyboardSession(sptr<SceneSession> session) {};
GetKeyboardSession()175     virtual sptr<SceneSession> GetKeyboardSession() const { return nullptr; };
GetKeyboardGravity()176     virtual SessionGravity GetKeyboardGravity() const { return SessionGravity::SESSION_GRAVITY_DEFAULT; };
OnKeyboardPanelUpdated()177     virtual void OnKeyboardPanelUpdated() {};
OnCallingSessionUpdated()178     virtual void OnCallingSessionUpdated() {};
GetCallingSessionId()179     virtual uint32_t GetCallingSessionId() { return INVALID_SESSION_ID; };
180     bool GetScreenWidthAndHeightFromServer(const sptr<WindowSessionProperty>& sessionProperty,
181         uint32_t& screenWidth, uint32_t& screenHeight);
182     bool GetScreenWidthAndHeightFromClient(const sptr<WindowSessionProperty>& sessionProperty,
183         uint32_t& screenWidth, uint32_t& screenHeight);
184     void NotifyTargetScreenWidthAndHeight(bool isScreenAngleMismatch, uint32_t screenWidth,
185         uint32_t screenHeight);
186 
187     WSError UpdateActiveStatus(bool isActive) override;
188     WSError OnSessionEvent(SessionEvent event) override;
189     WSError SyncSessionEvent(SessionEvent event) override;
190     WSError OnLayoutFullScreenChange(bool isLayoutFullScreen) override;
191     WSError RaiseToAppTop() override;
192 
193     /*
194      * Window Layout
195      */
196     WSError UpdateSizeChangeReason(SizeChangeReason reason) override;
SyncScenePanelGlobalPosition(bool needSync)197     virtual void SyncScenePanelGlobalPosition(bool needSync) {}
198     void SetNeedSyncSessionRect(bool needSync);
199     WSError UpdateRect(const WSRect& rect, SizeChangeReason reason,
200         const std::string& updateReason, const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
201     WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason,
202         bool isGlobal = false, bool isFromMoveToGlobal = false) override;
203     WSError UpdateClientRect(const WSRect& rect) override;
204 
OpenKeyboardSyncTransaction()205     virtual void OpenKeyboardSyncTransaction() {}
CloseKeyboardSyncTransaction(const WSRect & keyboardPanelRect,bool isKeyboardShow,bool isRotating)206     virtual void CloseKeyboardSyncTransaction(const WSRect& keyboardPanelRect,
207         bool isKeyboardShow, bool isRotating) {}
208     WSError ChangeSessionVisibilityWithStatusBar(const sptr<AAFwk::SessionInfo> info, bool visible) override;
209     WSError PendingSessionActivation(const sptr<AAFwk::SessionInfo> info) override;
210     WSError TerminateSession(const sptr<AAFwk::SessionInfo> info) override;
211     WSError NotifySessionException(
212         const sptr<AAFwk::SessionInfo> info, bool needRemoveSession = false) override;
213     WSError NotifySessionExceptionInner(
214         const sptr<AAFwk::SessionInfo> info, bool needRemoveSession = false,
215         bool isFromClient = false, bool startFail = false);
216     WSError NotifyClientToUpdateRect(const std::string& updateReason,
217         std::shared_ptr<RSTransaction> rsTransaction) override;
218 
219     WSError TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
220         bool needNotifyClient = true) override;
221     WSError RequestSessionBack(bool needMoveToBackground) override;
222     WSError SetAspectRatio(float ratio) override;
223     WSError SetGlobalMaximizeMode(MaximizeMode mode) override;
224     WSError GetGlobalMaximizeMode(MaximizeMode& mode) override;
225     WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override;
226     WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override;
227     void SetZOrder(uint32_t zOrder) override;
228     std::vector<Rect> GetTouchHotAreas() const override;
229     void NotifyUILostFocus() override;
230     void SetScale(float scaleX, float scaleY, float pivotX, float pivotY) override;
231     void SetFloatingScale(float floatingScale) override;
232     WSError RaiseAboveTarget(int32_t subWindowId) override;
233 
234     /*
235      * PiP Window
236      */
237     PiPTemplateInfo GetPiPTemplateInfo() const;
238     void SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo);
239     WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override;
240     WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override;
241     WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority) override;
242     void NotifyPiPWindowPrepareClose() override;
243     void SetSessionPiPControlStatusChangeCallback(const NotifySessionPiPControlStatusChangeFunc& func);
244     void SetAutoStartPiPStatusChangeCallback(const NotifyAutoStartPiPStatusChangeFunc& func);
245     WSError SetPipActionEvent(const std::string& action, int32_t status);
246     WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status);
247     void RegisterProcessPrepareClosePiPCallback(NotifyPrepareClosePiPSessionFunc&& callback);
248 
249     void RequestHideKeyboard(bool isAppColdStart = false);
250     WSError ProcessPointDownSession(int32_t posX, int32_t posY) override;
251     WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
252     void NotifyOutsideDownEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
253     WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override;
254     void SetForegroundInteractiveStatus(bool interactive) override;
255     WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override;
256 
257     /*
258      * Window Layout
259      */
260     WMError SetSystemWindowEnableDrag(bool enableDrag) override;
261     WMError SetWindowEnableDragBySystem(bool enableDrag);
262     WSError OnDefaultDensityEnabled(bool isDefaultDensityEnabled) override;
263     void RegisterDefaultDensityEnabledCallback(NotifyDefaultDensityEnabledFunc&& callback);
264 
265     WSError SetKeepScreenOn(bool keepScreenOn);
266     void SetParentPersistentId(int32_t parentId);
267     WSError SetTurnScreenOn(bool turnScreenOn);
268     void SetPrivacyMode(bool isPrivacy);
269     void SetSnapshotSkip(bool isSkip);
270     void SetSystemSceneOcclusionAlpha(double alpha);
271     void SetSystemSceneForceUIFirst(bool forceUIFirst);
272     void MarkSystemSceneUIFirst(bool isForced, bool isUIFirstEnabled);
273     void SetRequestedOrientation(Orientation orientation);
274     WSError SetDefaultRequestedOrientation(Orientation orientation);
275     void SetWindowAnimationFlag(bool needDefaultAnimationFlag);
276     void SetCollaboratorType(int32_t collaboratorType);
277     void SetLastSafeRect(WSRect rect);
278     void SetOriPosYBeforeRaisedByKeyboard(int32_t posY);
279 
280     /*
281      * Window Hierarchy
282      */
SetTopmost(bool topmost)283     virtual WSError SetTopmost(bool topmost) { return WSError::WS_ERROR_INVALID_CALLING; }
IsTopmost()284     virtual bool IsTopmost() const { return false; }
SetMainWindowTopmost(bool isTopmost)285     virtual WSError SetMainWindowTopmost(bool isTopmost) { return WSError::WS_ERROR_INVALID_CALLING; }
IsMainWindowTopmost()286     virtual bool IsMainWindowTopmost() const { return false; }
287     void SetMainWindowTopmostChangeCallback(NotifyMainWindowTopmostChangeFunc&& func);
288 
289     /**
290      * PC Window
291      */
292     void SetRestoreMainWindowCallback(NotifyRestoreMainWindowFunc&& func);
293     void SetWindowRectAutoSaveCallback(NotifySetWindowRectAutoSaveFunc&& func);
IsModal()294     virtual bool IsModal() const { return false; }
IsApplicationModal()295     virtual bool IsApplicationModal() const { return false; }
296     bool IsDialogWindow() const;
297     WSError NotifySubModalTypeChange(SubWindowModalType subWindowModalType) override;
298     void RegisterSubModalTypeChangeCallback(NotifySubModalTypeChangeFunc&& func);
299     void RegisterMainModalTypeChangeCallback(NotifyMainModalTypeChangeFunc&& func);
300 
301     /*
302      * PC Window Layout
303      */
304     void SetIsLayoutFullScreen(bool isLayoutFullScreen);
305     bool IsLayoutFullScreen() const;
306 
307     /**
308      * Window Immersive
309      */
310     WSError OnNeedAvoid(bool status) override;
311     AvoidArea GetAvoidAreaByTypeInner(AvoidAreaType type);
312     AvoidArea GetAvoidAreaByType(AvoidAreaType type) override;
313     WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override;
314     WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty);
315     void SetIsStatusBarVisible(bool isVisible);
316     WSError SetIsStatusBarVisibleInner(bool isVisible);
317     WSError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) override;
318     void UpdateRotationAvoidArea();
319     bool CheckGetAvoidAreaAvailable(AvoidAreaType type) override;
320     bool GetIsDisplayStatusBarTemporarily() const;
321     void SetIsDisplayStatusBarTemporarily(bool isTemporary);
322     void SetIsLastFrameLayoutFinishedFunc(IsLastFrameLayoutFinishedFunc&& func);
323     void RetrieveStatusBarDefaultVisibility();
324     void RegisterNeedAvoidCallback(NotifyNeedAvoidFunc&& callback);
325     void RegisterSystemBarPropertyChangeCallback(NotifySystemBarPropertyChangeFunc&& callback);
326     void MarkAvoidAreaAsDirty();
327 
328     void SetAbilitySessionInfo(std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo);
329     void SetWindowDragHotAreaListener(const NotifyWindowDragHotAreaFunc& func);
330     void SetSessionEventParam(SessionEventParam param);
331     void SetSessionRectChangeCallback(const NotifySessionRectChangeFunc& func);
332     void SetKeyboardGravityChangeCallback(const NotifyKeyboardGravityChangeFunc& func);
333     void SetAdjustKeyboardLayoutCallback(const NotifyKeyboardLayoutAdjustFunc& func);
334     void SetSkipDraw(bool skip);
335     virtual void SetSkipSelfWhenShowOnVirtualScreen(bool isSkip);
336     WMError SetUniqueDensityDpi(bool useUnique, float dpi);
337 
338     bool IsAnco() const override;
339     void SetBlankFlag(bool isAddBlank) override;
340     bool GetBlankFlag() const override;
341     void SetBufferAvailableCallbackEnable(bool enable);
342     bool GetBufferAvailableCallbackEnable() const override;
343     int32_t GetCollaboratorType() const;
344     WSRect GetLastSafeRect() const;
345     WSRect GetSessionTargetRect() const;
346     std::string GetUpdatedIconPath() const;
347     std::string GetSessionSnapshotFilePath() const;
348     int32_t GetParentPersistentId() const;
349     int32_t GetMainSessionId();
GetMissionId()350     virtual int32_t GetMissionId() const { return persistentId_; };
351     Orientation GetRequestedOrientation() const;
352     std::vector<sptr<SceneSession>> GetSubSession() const;
353     std::vector<sptr<SceneSession>> GetToastSession() const;
354     std::shared_ptr<AppExecFwk::AbilityInfo> GetAbilityInfo() const;
355     std::string GetWindowNameAllType() const;
356     SubWindowModalType GetSubWindowModalType() const;
357     int32_t GetOriPosYBeforeRaisedByKeyboard() const;
358     std::string GetClientIdentityToken() const;
359 
360     // Session recover
IsRecovered()361     bool IsRecovered() const { return isRecovered_; }
SetRecovered(bool isRecovered)362     void SetRecovered(bool isRecovered) { isRecovered_ = isRecovered; }
363 
364     bool IsVisible() const;
365     bool IsDecorEnable() const;
366     bool IsAppSession() const;
367     bool IsAppOrLowerSystemSession() const;
368     bool IsSystemSessionAboveApp() const;
369     bool IsTurnScreenOn() const;
370     bool IsKeepScreenOn() const;
371     bool IsShowWhenLocked() const;
372     bool GetShowWhenLockedFlagValue() const;
373     bool IsFloatingWindowAppType() const;
374     bool IsNeedDefaultAnimation() const;
375     bool IsDirtyWindow();
376     void SetSystemTouchable(bool touchable) override;
377     bool IsVisibleForAccessibility() const;
378     bool IsDeviceWakeupByApplication() const;
379     void SetStartingWindowExitAnimationFlag(bool enable);
380     bool NeedStartingWindowExitAnimation() const override;
381 
382     void NotifyWindowVisibility();
383     WSError OnShowWhenLocked(bool showWhenLocked);
384     void SaveUpdatedIcon(const std::shared_ptr<Media::PixelMap>& icon);
385     void NotifyTouchOutside();
386     bool CheckTouchOutsideCallbackRegistered();
387     void UpdateNativeVisibility(bool visible);
388     void DumpSessionElementInfo(const std::vector<std::string>& params);
389     void NotifyForceHideChange(bool hide);
390     WSError BindDialogSessionTarget(const sptr<SceneSession>& sceneSession);
391     void DumpSessionInfo(std::vector<std::string>& info) const;
392     bool AddSubSession(const sptr<SceneSession>& subSession);
393     bool RemoveSubSession(int32_t persistentId);
394     bool AddToastSession(const sptr<SceneSession>& toastSession);
395     bool RemoveToastSession(int32_t persistentId);
396     void NotifySessionForeground(uint32_t reason, bool withAnimation);
397     void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits);
398     void RegisterSessionChangeCallback(const sptr<SceneSession::SessionChangeCallback>& sessionChangeCallback);
399     void RegisterForceSplitListener(const NotifyForceSplitFunc& func);
400     void SetUpdatePrivateStateAndNotifyFunc(const UpdatePrivateStateAndNotifyFunc& func);
401 
402     /*
403      * Window Input Event
404      */
405     void RegisterTouchOutsideCallback(NotifyTouchOutsideFunc&& callback);
406 
407     /*
408      * Window Rotation
409      */
410     void RegisterRequestedOrientationChangeCallback(NotifyReqOrientationChangeFunc&& callback);
411 
412     /**
413      * Window Animation
414      */
415     void RegisterIsCustomAnimationPlayingCallback(NotifyIsCustomAnimationPlayingCallback&& callback);
416     void RegisterDefaultAnimationFlagChangeCallback(NotifyWindowAnimationFlagChangeFunc&& callback);
417 
418     /*
419      * Window Visibility
420      */
421     void SetNotifyVisibleChangeFunc(const NotifyVisibleChangeFunc& func);
422 
423     /*
424      * Window Lifecycle
425      */
426     void RegisterUpdateAppUseControlCallback(UpdateAppUseControlFunc&& callback);
427     void NotifyUpdateAppUseControl(ControlAppType type, bool isNeedControl);
428 
429     void ClearSpecificSessionCbMap();
430     void RegisterShowWhenLockedCallback(NotifyShowWhenLockedFunc&& callback);
431     void RegisterForceHideChangeCallback(NotifyForceHideChangeFunc&& callback);
432     void RegisterClearCallbackMapCallback(ClearCallbackMapFunc&& callback);
HideSync()433     virtual WSError HideSync() { return WSError::WS_DO_NOTHING; }
434 
435     void SendPointerEventToUI(std::shared_ptr<MMI::PointerEvent> pointerEvent);
436     bool SendKeyEventToUI(std::shared_ptr<MMI::KeyEvent> keyEvent, bool isPreImeEvent = false);
437     bool IsStartMoving() override;
438     void SetIsStartMoving(bool startMoving);
439     bool IsSystemSpecificSession() const;
440     void SetIsSystemSpecificSession(bool isSystemSpecificSession);
441     void SetShouldHideNonSecureWindows(bool shouldHide);
442     void UpdateExtWindowFlags(int32_t extPersistentId, const ExtensionWindowFlags& extWindowFlags,
443         const ExtensionWindowFlags& extWindowActions);
444     ExtensionWindowFlags GetCombinedExtWindowFlags();
445     void RemoveExtWindowFlags(int32_t extPersistentId);
446     void ClearExtWindowFlags();
447     void NotifyDisplayMove(DisplayId from, DisplayId to);
448     void NotifySessionFullScreen(bool fullScreen);
449     void SetDefaultDisplayIdIfNeed();
450 
451     void SetSessionState(SessionState state) override;
452     void UpdateSessionState(SessionState state) override;
453     void SetForceHideState(ForceHideState forceHideState);
454     ForceHideState GetForceHideState() const;
455     bool IsTemporarilyShowWhenLocked() const;
456     void SetTemporarilyShowWhenLocked(bool isTemporarilyShowWhenLocked);
457 
458     std::shared_ptr<PowerMgr::RunningLock> keepScreenLock_;
459 
460     static const wptr<SceneSession> GetEnterWindow();
461     static void ClearEnterWindow();
462     static MaximizeMode maximizeMode_;
463     static uint32_t GetWindowDragHotAreaType(uint32_t type, int32_t pointerX, int32_t pointerY);
464     static void AddOrUpdateWindowDragHotArea(uint32_t type, const WSRect& area);
465     WSError UpdateRectChangeListenerRegistered(bool isRegister) override;
GetCustomDecorHeight()466     int32_t GetCustomDecorHeight() override
467     {
468         return customDecorHeight_;
469     }
470 
SetCustomDecorHeight(int32_t height)471     void SetCustomDecorHeight(int32_t height) override
472     {
473         if (height < MIN_DECOR_HEIGHT || height > MAX_DECOR_HEIGHT) {
474             return;
475         }
476         customDecorHeight_ = height;
477     }
478     WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property,
479         WSPropertyChangeAction action) override;
480     void SetSessionChangeByActionNotifyManagerListener(const SessionChangeByActionNotifyManagerFunc& func);
481 
482     /*
483      * UIExtension
484      */
485     bool IsShowOnLockScreen(uint32_t lockScreenZOrder);
486     void AddExtensionTokenInfo(const UIExtensionTokenInfo& tokenInfo);
487     void RemoveExtensionTokenInfo(const sptr<IRemoteObject>& abilityToken);
488     void CheckExtensionOnLockScreenToClose();
489     void CloseExtensionSync(const UIExtensionTokenInfo& tokenInfo);
490     void OnNotifyAboveLockScreen();
491     void AddModalUIExtension(const ExtensionWindowEventInfo& extensionInfo);
492     void RemoveModalUIExtension(int32_t persistentId);
493     void UpdateModalUIExtension(const ExtensionWindowEventInfo& extensionInfo);
494     std::optional<ExtensionWindowEventInfo> GetLastModalUIExtensionEventInfo();
495     Vector2f GetSessionGlobalPosition(bool useUIExtension);
496     void AddUIExtSurfaceNodeId(uint64_t surfaceNodeId, int32_t persistentId);
497     void RemoveUIExtSurfaceNodeId(int32_t persistentId);
498     int32_t GetUIExtPersistentIdBySurfaceNodeId(uint64_t surfaceNodeId) const;
IsFreeMultiWindowMode()499     bool IsFreeMultiWindowMode() const
500     {
501         return systemConfig_.IsFreeMultiWindowMode();
502     }
503     WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override;
504     bool IsPcOrPadEnableActivation() const;
505     void UnregisterSessionChangeListeners() override;
506 
507     // WMSPipeline-related: only accessed on SSM thread
508     uint32_t UpdateUIParam(const SessionUIParam& uiParam);   // update visible session, return dirty flags
509     uint32_t UpdateUIParam();   // update invisible session, return dirty flags
510     void SetPostProcessFocusState(PostProcessFocusState state);
511     PostProcessFocusState GetPostProcessFocusState() const;
512     void ResetPostProcessFocusState();
513     void SetPostProcessProperty(bool state);
514     bool GetPostProcessProperty() const;
515     void PostProcessNotifyAvoidArea();
516     bool IsImmersiveType() const;
517     bool SetFrameGravity(Gravity gravity);
518 
519     /*
520      * Gesture Back
521      */
522     bool GetGestureBackEnabled();
523     bool GetEnableGestureBackHadSet();
524 
525     /*
526      * Move Drag
527      */
SetAppDragResizeType(DragResizeType dragResizeType)528     void SetAppDragResizeType(DragResizeType dragResizeType) { appDragResizeType_ = dragResizeType; }
GetAppDragResizeType()529     DragResizeType GetAppDragResizeType() const { return appDragResizeType_; }
530 
531     /*
532      * Window Layout
533      */
534     void ResetSizeChangeReasonIfDirty();
535 
536     /*
537      * PC Window
538      */
539     void SetTitleAndDockHoverShowChangeCallback(NotifyTitleAndDockHoverShowChangeFunc&& func);
540 
541 protected:
542     void NotifySessionRectChange(const WSRect& rect, const SizeChangeReason& reason = SizeChangeReason::UNDEFINED);
543     void NotifyIsCustomAnimationPlaying(bool isPlaying);
544     void SetMoveDragCallback();
545     std::string GetRatioPreferenceKey();
546     WSError NotifyClientToUpdateRectTask(const std::string& updateReason, std::shared_ptr<RSTransaction> rsTransaction);
547     bool CheckPermissionWithPropertyAnimation(const sptr<WindowSessionProperty>& property) const;
548 
GetRectInfo(const WSRect & rect)549     std::string GetRectInfo(const WSRect& rect)
550     {
551         using std::to_string;
552         return "[" + to_string(rect.width_) + ", " + to_string(rect.height_) + "; "
553         + to_string(rect.posX_) + ", " + to_string(rect.posY_) + "]";
554     }
555 
556     /*
557      * Window Pipeline
558      */
559     bool UpdateVisibilityInner(bool visibility);
560     bool UpdateInteractiveInner(bool interactive);
NotifyClientToUpdateInteractive(bool interactive)561     virtual void NotifyClientToUpdateInteractive(bool interactive) {}
562     bool PipelineNeedNotifyClientToUpdateRect() const;
563     bool UpdateRectInner(const SessionUIParam& uiParam, SizeChangeReason reason);
564     bool NotifyServerToUpdateRect(const SessionUIParam& uiParam, SizeChangeReason reason);
565     bool IsTransformNeedChange(float scaleX, float scaleY, float pivotX, float pivotY);
566     bool UpdateScaleInner(float scaleX, float scaleY, float pivotX, float pivotY);
567     bool UpdateZOrderInner(uint32_t zOrder);
568 
569     /**
570      * Window Immersive
571      */
572     virtual void NotifyClientToUpdateAvoidArea();
573     bool PipelineNeedNotifyClientToUpdateAvoidArea(uint32_t dirty) const;
574 
575     /*
576      * Gesture Back
577      */
578     void UpdateGestureBackEnabled() override;
579 
580     sptr<SpecificSessionCallback> specificCallback_ = nullptr;
581     sptr<SessionChangeCallback> sessionChangeCallback_ = nullptr;
582     sptr<MoveDragController> moveDragController_ = nullptr;
583     sptr<SceneSession> keyboardPanelSession_ = nullptr;
584     sptr<SceneSession> keyboardSession_ = nullptr;
585     NotifyKeyboardGravityChangeFunc keyboardGravityChangeFunc_;
586     NotifyKeyboardLayoutAdjustFunc adjustKeyboardLayoutFunc_;
587 
588     /*
589      * Window Hierarchy
590      */
591     NotifyMainWindowTopmostChangeFunc mainWindowTopmostChangeFunc_;
592 
593     /*
594      * Window Immersive
595      */
596     NotifyNeedAvoidFunc onNeedAvoid_;
597     NotifySystemBarPropertyChangeFunc onSystemBarPropertyChange_;
598 
599     /**
600      * PC Window
601      */
602     NotifyRestoreMainWindowFunc onRestoreMainWindowFunc_;
603     NotifySetWindowRectAutoSaveFunc onSetWindowRectAutoSaveFunc_;
604     NotifySubModalTypeChangeFunc onSubModalTypeChange_;
605     NotifyMainModalTypeChangeFunc onMainModalTypeChange_;
606 
607     /*
608      * PiP Window
609      */
610     NotifyPrepareClosePiPSessionFunc onPrepareClosePiPSession_;
611 
612     /*
613      * Window Layout
614      */
615     NotifyDefaultDensityEnabledFunc onDefaultDensityEnabledFunc_;
616 
617     /*
618      * Window Lifecycle
619      */
620     NotifyShowWhenLockedFunc onShowWhenLockedFunc_;
621     NotifyForceHideChangeFunc onForceHideChangeFunc_;
622     ClearCallbackMapFunc clearCallbackMapFunc_;
623     UpdateAppUseControlFunc onUpdateAppUseControlFunc_;
624     std::unordered_map<ControlAppType, bool> appUseControlMap_;
625 
626     /*
627      * PC Window
628      */
629     NotifyTitleAndDockHoverShowChangeFunc onTitleAndDockHoverShowChangeFunc_;
630 
631 private:
632     void NotifyAccessibilityVisibilityChange();
633     void CalculateCombinedExtWindowFlags();
634     void HandleStyleEvent(MMI::WindowArea area) override;
635     WSError HandleEnterWinwdowArea(int32_t windowX, int32_t windowY);
636 
637     /**
638      * Window Immersive
639      */
640     void CalculateAvoidAreaRect(WSRect& rect, WSRect& avoidRect, AvoidArea& avoidArea) const;
641     void GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea);
642     void GetCutoutAvoidArea(WSRect& rect, AvoidArea& avoidArea);
643     void GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea);
644     void GetAINavigationBarArea(WSRect rect, AvoidArea& avoidArea) const;
645 
646     /*
647      * Window Lifecycle
648      */
649     bool CheckIdentityTokenIfMatched(const std::string& identityToken);
650     bool CheckPidIfMatched();
651 
652     // session lifecycle funcs
653     WSError ForegroundTask(const sptr<WindowSessionProperty>& property);
654 
655     /*
656      * Move Drag
657      */
658     bool IsDragResizeWhenEnd(SizeChangeReason reason);
SetDragResizeTypeDuringDrag(DragResizeType dragResizeType)659     void SetDragResizeTypeDuringDrag(DragResizeType dragResizeType) { dragResizeTypeDuringDrag_ = dragResizeType; }
GetDragResizeTypeDuringDrag()660     DragResizeType GetDragResizeTypeDuringDrag() const { return dragResizeTypeDuringDrag_; }
661     void HandleSessionDragEvent(SessionEvent event);
662 
663     /*
664      * Gesture Back
665      */
666     WMError SetGestureBackEnabled(bool isEnabled) override;
667 
668     /*
669      * UIExtension
670      */
671     void UpdateAllModalUIExtensions(const WSRect& globalRect);
672 
673 #ifdef DEVICE_STATUS_ENABLE
674     void RotateDragWindow(std::shared_ptr<RSTransaction> rsTransaction);
675 #endif // DEVICE_STATUS_ENABLE
676     void OnMoveDragCallback(const SizeChangeReason& reason);
677     void HandleCompatibleModeMoveDrag(WSRect& rect, const SizeChangeReason& reason,
678         bool isSupportDragInPcCompatibleMode);
679     void FixRectByLimits(WindowLimits limits, WSRect& rect, float ratio, bool isDecor, float vpr);
680     bool FixRectByAspectRatio(WSRect& rect);
681     bool SaveAspectRatio(float ratio);
682     void NotifyPropertyWhenConnect();
683     WSError RaiseAppMainWindowToTop() override;
684     void SetSurfaceBounds(const WSRect& rect);
685     void UpdateWinRectForSystemBar(WSRect& rect);
686     bool IsKeyboardNeedLeftOffset(bool isPhone, const sptr<WindowSessionProperty>& sessionProperty);
687     bool UpdateInputMethodSessionRect(const WSRect& rect, WSRect& newWinRect, WSRect& newRequestRect);
688     bool IsMovableWindowType();
689     bool IsFullScreenMovable();
690     void HandleCastScreenConnection(SessionInfo& info, sptr<SceneSession> session);
691     void UpdateSessionRectInner(const WSRect& rect, const SizeChangeReason& reason);
692     void FixKeyboardPositionByKeyboardPanel(sptr<SceneSession> panelSession, sptr<SceneSession> keyboardSession);
693     WMError HandleUpdatePropertyByAction(const sptr<WindowSessionProperty>& property,
694         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
695     WMError HandleActionUpdateTurnScreenOn(const sptr<WindowSessionProperty>& property,
696         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
697     WMError HandleActionUpdateKeepScreenOn(const sptr<WindowSessionProperty>& property,
698         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
699     WMError HandleActionUpdateFocusable(const sptr<WindowSessionProperty>& property,
700         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
701     WMError HandleActionUpdateTouchable(const sptr<WindowSessionProperty>& property,
702         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
703     WMError HandleActionUpdateSetBrightness(const sptr<WindowSessionProperty>& property,
704         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
705     WMError HandleActionUpdateOrientation(const sptr<WindowSessionProperty>& property,
706         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
707     WMError HandleActionUpdatePrivacyMode(const sptr<WindowSessionProperty>& property,
708         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
709     WMError HandleActionUpdateSnapshotSkip(const sptr<WindowSessionProperty>& property,
710         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
711     WMError HandleActionUpdateMaximizeState(const sptr<WindowSessionProperty>& property,
712         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
713     WMError HandleActionUpdateOtherProps(const sptr<WindowSessionProperty>& property,
714         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
715     WMError HandleActionUpdateStatusProps(const sptr<WindowSessionProperty>& property,
716         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
717     WMError HandleActionUpdateNavigationProps(const sptr<WindowSessionProperty>& property,
718         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
719     WMError HandleActionUpdateNavigationIndicatorProps(const sptr<WindowSessionProperty>& property,
720         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
721     WMError HandleActionUpdateFlags(const sptr<WindowSessionProperty>& property,
722         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
723     WMError HandleActionUpdateMode(const sptr<WindowSessionProperty>& property,
724         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
725     WMError HandleActionUpdateAnimationFlag(const sptr<WindowSessionProperty>& property,
726         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
727     WMError HandleActionUpdateTouchHotArea(const sptr<WindowSessionProperty>& property,
728         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
729     WMError HandleActionUpdateDecorEnable(const sptr<WindowSessionProperty>& property,
730         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
731     WMError HandleActionUpdateWindowLimits(const sptr<WindowSessionProperty>& property,
732         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
733     WMError HandleActionUpdateDragenabled(const sptr<WindowSessionProperty>& property,
734         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
735     WMError HandleActionUpdateRaiseenabled(const sptr<WindowSessionProperty>& property,
736         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
737     WMError HandleActionUpdateHideNonSystemFloatingWindows(const sptr<WindowSessionProperty>& property,
738         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
739     WMError HandleActionUpdateTextfieldAvoidInfo(const sptr<WindowSessionProperty>& property,
740         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
741     WMError HandleActionUpdateWindowMask(const sptr<WindowSessionProperty>& property,
742         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
743     WMError HandleActionUpdateTopmost(const sptr<WindowSessionProperty>& property,
744         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
745     WMError HandleActionUpdateMainWindowTopmost(const sptr<WindowSessionProperty>& property,
746         WSPropertyChangeAction action);
747     WMError HandleActionUpdateWindowModeSupportType(const sptr<WindowSessionProperty>& property,
748         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
749     WMError ProcessUpdatePropertyByAction(const sptr<WindowSessionProperty>& property,
750         const sptr<SceneSession>& sceneSession, WSPropertyChangeAction action);
751     void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property,
752         const sptr<SceneSession>& sceneSession);
753     void SetWindowFlags(const sptr<SceneSession>& sceneSession,
754         const sptr<WindowSessionProperty>& property);
755     void NotifySessionChangeByActionNotifyManager(const sptr<SceneSession>& sceneSession,
756         const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action);
757 
758     /*
759      * PiP Window
760      */
761     NotifySessionPiPControlStatusChangeFunc sessionPiPControlStatusChangeFunc_;
762     NotifyAutoStartPiPStatusChangeFunc autoStartPiPStatusChangeFunc_;
763     PiPTemplateInfo pipTemplateInfo_ = {0, 0, {}};
764 
765     NotifyForceSplitFunc forceSplitFunc_;
766     UpdatePrivateStateAndNotifyFunc updatePrivateStateAndNotifyFunc_;
767     static wptr<SceneSession> enterSession_;
768     static std::mutex enterSessionMutex_;
769     int32_t collaboratorType_ = CollaboratorType::DEFAULT_TYPE;
770     mutable std::mutex sessionChangeCbMutex_;
771     WSRect lastSafeRect = { 0, 0, 0, 0 };
772     std::vector<sptr<SceneSession>> subSession_;
773     std::vector<sptr<SceneSession>> toastSession_;
774     std::atomic_bool isDeviceWakeupByApplication_ { false };
775     std::atomic_bool needStartingWindowExitAnimation_ { true };
776     bool needDefaultAnimationFlag_ = true;
777     SessionEventParam sessionEventParam_ = { 0, 0, 0, 0, 0 };
778     std::atomic_bool isStartMoving_ { false };
779     std::atomic_bool isVisibleForAccessibility_ { true };
780     bool isSystemSpecificSession_ { false };
781 
782     /*
783      * UIExtension
784      */
785     std::atomic_bool shouldHideNonSecureWindows_ { false };
786     std::shared_mutex combinedExtWindowFlagsMutex_;
787     ExtensionWindowFlags combinedExtWindowFlags_ { 0 };
788     std::map<int32_t, ExtensionWindowFlags> extWindowFlagsMap_;
789     std::vector<UIExtensionTokenInfo> extensionTokenInfos_;
790 
791     int32_t customDecorHeight_ = 0;
792     ForceHideState forceHideState_ { ForceHideState::NOT_HIDDEN };
793     static std::shared_mutex windowDragHotAreaMutex_;
794     static std::map<uint32_t, WSRect> windowDragHotAreaMap_;
795     int32_t oriPosYBeforeRaisedByKeyboard_ = 0;
796     std::atomic_bool isTemporarilyShowWhenLocked_ { false };
797     std::shared_mutex modalUIExtensionInfoListMutex_;
798     std::vector<ExtensionWindowEventInfo> modalUIExtensionInfoList_;
799     mutable std::shared_mutex uiExtNodeIdToPersistentIdMapMutex_;
800     std::map<uint64_t, int32_t> uiExtNodeIdToPersistentIdMap_;
801     std::string clientIdentityToken_ = { "" };
802     SessionChangeByActionNotifyManagerFunc sessionChangeByActionNotifyManagerFunc_;
803     bool isAddBlank_ = false;
804     bool bufferAvailableCallbackEnable_ = false;
805     bool isScreenAngleMismatch_ = false;
806     uint32_t targetScreenWidth_ = 0;
807     uint32_t targetScreenHeight_ = 0;
808 
809     // Session recover
810     bool isRecovered_ = false;
811 
812     // WMSPipeline-related: only accessed on SSM thread
813     PostProcessFocusState postProcessFocusState_;
814     bool postProcessProperty_ { false };
815 
816     /*
817      * Move Drag
818      */
819     DragResizeType appDragResizeType_ = DragResizeType::RESIZE_TYPE_UNDEFINED;
820     DragResizeType dragResizeTypeDuringDrag_ = DragResizeType::RESIZE_TYPE_UNDEFINED;
821 
822     /**
823      * Gesture Back
824      */
825     bool isEnableGestureBack_ { true };
826     bool isEnableGestureBackHadSet_ { false };
827 
828     /**
829      * Window Visibility
830      */
831     NotifyVisibleChangeFunc notifyVisibleChangeFunc_;
832 
833     /*
834      * Window Input Event
835      */
836     NotifyTouchOutsideFunc onTouchOutside_;
837 
838     /**
839      * Window Immersive
840      */
841     std::atomic_bool isDisplayStatusBarTemporarily_ { false };
842     bool isStatusBarVisible_ = true;
843     IsLastFrameLayoutFinishedFunc isLastFrameLayoutFinishedFunc_;
844 
845     /*
846      * Window Rotation
847      */
848     NotifyReqOrientationChangeFunc onRequestedOrientationChange_;
849 
850     /**
851      * Window Animation
852      */
853     NotifyIsCustomAnimationPlayingCallback onIsCustomAnimationPlaying_;
854     NotifyWindowAnimationFlagChangeFunc onWindowAnimationFlagChange_;
855 
856     /*
857      * PC Window Layout
858      */
859     bool isLayoutFullScreen_ { false };
860 };
861 } // namespace OHOS::Rosen
862 #endif // OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H
863