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