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 <animation/rs_animation_timing_curve.h> 20 #include <animation/rs_animation_timing_protocol.h> 21 #include <animation/rs_symbol_animation.h> 22 #include <pipeline/rs_node_map.h> 23 #include <ui/rs_canvas_node.h> 24 #include <chrono> 25 26 #include "display_manager.h" 27 #include "session/host/include/session.h" 28 #include "session/host/include/move_drag_controller.h" 29 #include "session/host/include/pc_fold_screen_controller.h" 30 #include "vsync_station.h" 31 #include "wm_common.h" 32 33 namespace OHOS::PowerMgr { 34 class RunningLock; 35 } 36 37 namespace OHOS::Rosen { 38 namespace PARAM_KEY { 39 const std::string PARAM_MISSION_AFFINITY_KEY = "ohos.anco.param.missionAffinity"; 40 const std::string PARAM_DMS_CONTINUE_SESSION_ID_KEY = "ohos.dms.continueSessionId"; 41 const std::string PARAM_DMS_PERSISTENT_ID_KEY = "ohos.dms.persistentId"; 42 } 43 44 class SceneSession; 45 class ScreenSession; 46 47 using NotifySessionLockStateChangeCallback = std::function<void(bool isLockedState)>; 48 using SpecificSessionCreateCallback = 49 std::function<sptr<SceneSession>(const SessionInfo& info, sptr<WindowSessionProperty> property)>; 50 using SpecificSessionDestroyCallback = std::function<WSError(const int32_t& persistentId)>; 51 using CameraFloatSessionChangeCallback = std::function<void(uint32_t accessTokenId, bool isShowing)>; 52 using GetSceneSessionVectorByTypeAndDisplayIdCallback = std::function<std::vector<sptr<SceneSession>>( 53 WindowType type, DisplayId displayId)>; 54 using GetSceneSessionVectorByTypeCallback = std::function<std::vector<sptr<SceneSession>>(WindowType type)>; 55 using UpdateAvoidAreaCallback = std::function<void(int32_t persistentId)>; 56 using UpdateOccupiedAreaIfNeedCallback = std::function<void(int32_t persistentId)>; 57 using NotifyWindowInfoUpdateCallback = std::function<void(int32_t persistentId, WindowUpdateType type)>; 58 using NotifyWindowPidChangeCallback = std::function<void(int32_t windowId, bool startMoving)>; 59 using NotifySessionTouchOutsideCallback = std::function<void(int32_t persistentId, DisplayId displayId)>; 60 using GetAINavigationBarArea = std::function<WSRect(uint64_t displayId)>; 61 using RecoveryCallback = std::function<void(int32_t persistentId, Rect rect)>; 62 using NotifyBindDialogSessionFunc = std::function<void(const sptr<SceneSession>& session)>; 63 using NotifySessionPiPControlStatusChangeFunc = std::function<void(WsPiPControlType controlType, 64 WsPiPControlStatus status)>; 65 using NotifyAutoStartPiPStatusChangeFunc = std::function<void(bool isAutoStart, uint32_t priority, 66 uint32_t width, uint32_t height)>; 67 using NotifyUpdatePiPTemplateInfoFunc = std::function<void(PiPTemplateInfo& pipTemplateInfo)>; 68 using NotifySessionEventFunc = std::function<void(int32_t eventId, SessionEventParam param)>; 69 using NotifySessionTopmostChangeFunc = std::function<void(const bool topmost)>; 70 using NotifySubSessionZLevelChangeFunc = std::function<void(const int32_t zLevel)>; 71 using NotifySubModalTypeChangeFunc = std::function<void(SubWindowModalType subWindowModalType)>; 72 using NotifyMainModalTypeChangeFunc = std::function<void(bool isModal)>; 73 using NotifyRaiseToTopFunc = std::function<void()>; 74 using SetWindowPatternOpacityFunc = std::function<void(float opacity)>; 75 using NotifyIsCustomAnimationPlayingCallback = std::function<void(bool isFinish)>; 76 using NotifyWindowAnimationFlagChangeFunc = std::function<void(const bool flag)>; 77 using NotifySystemBarPropertyChangeFunc = std::function<void( 78 const std::unordered_map<WindowType, SystemBarProperty>& propertyMap)>; 79 using NotifyNeedAvoidFunc = std::function<void(bool status)>; 80 using NotifyShowWhenLockedFunc = std::function<void(bool showWhenLocked)>; 81 using NotifyReqOrientationChangeFunc = std::function<void(uint32_t orientation, bool needAnimation)>; 82 using NotifyRaiseAboveTargetFunc = std::function<void(int32_t subWindowId)>; 83 using NotifyForceHideChangeFunc = std::function<void(bool hide)>; 84 using NotifyTouchOutsideFunc = std::function<void()>; 85 using ClearCallbackMapFunc = std::function<void(bool needRemove)>; 86 using NotifyPrepareClosePiPSessionFunc = std::function<void()>; 87 using OnOutsideDownEvent = std::function<void(int32_t x, int32_t y)>; 88 using HandleSecureSessionShouldHideCallback = std::function<WSError(const sptr<SceneSession>& sceneSession)>; 89 using ClearDisplayStatusBarTemporarilyFlags = std::function<void()>; 90 using CameraSessionChangeCallback = std::function<void(uint32_t accessTokenId, bool isShowing)>; 91 using NotifyLandscapeMultiWindowSessionFunc = std::function<void(bool isLandscapeMultiWindow)>; 92 using NotifyKeyboardLayoutAdjustFunc = std::function<void(const KeyboardLayoutParams& params)>; 93 using NotifyKeyboarEffectOptionChangeFunc = std::function<void(const KeyboardEffectOption& effectOption)>; 94 using SessionChangeByActionNotifyManagerFunc = std::function<void(const sptr<SceneSession>& sceneSession, 95 const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action)>; 96 using NotifyLayoutFullScreenChangeFunc = std::function<void(bool isLayoutFullScreen)>; 97 using NotifyDefaultDensityEnabledFunc = std::function<void(bool isDefaultDensityEnabled)>; 98 using NotifyTitleAndDockHoverShowChangeFunc = std::function<void(bool isTitleHoverShown, 99 bool isDockHoverShown)>; 100 using NotifyRestoreMainWindowFunc = std::function<void()>; 101 using SetSkipSelfWhenShowOnVirtualScreenCallback = std::function<void(uint64_t surfaceNodeId, bool isSkip)>; 102 using SetSkipEventOnCastPlusCallback = std::function<void(int32_t persistentId, bool isSkip)>; 103 using NotifyForceSplitFunc = std::function<AppForceLandscapeConfig(const std::string& bundleName)>; 104 using GetHookWindowInfoFunc = std::function<HookWindowInfo(const std::string& bundleName)>; 105 using UpdatePrivateStateAndNotifyFunc = std::function<void(int32_t persistentId)>; 106 using UpdateScreenshotAppEventRegisteredFunc = std::function<void(int32_t persistentId, bool isRegister)>; 107 using PiPStateChangeCallback = std::function<void(const std::string& bundleName, bool isForeground)>; 108 using NotifyMainWindowTopmostChangeFunc = std::function<void(bool isTopmost)>; 109 using GetConstrainedModalExtWindowInfoFunc = 110 std::function<std::optional<ExtensionWindowEventInfo>(const sptr<SceneSession>& sceneSession)>; 111 using NotifyPrivacyModeChangeFunc = std::function<void(bool isPrivacyMode)>; 112 using UpdateGestureBackEnabledCallback = std::function<void(int32_t persistentId)>; 113 using NotifyVisibleChangeFunc = std::function<void(int32_t persistentId)>; 114 using IsLastFrameLayoutFinishedFunc = std::function<WSError(bool& isLayoutFinished)>; 115 using IsAINavigationBarAvoidAreaValidFunc = std::function<bool(const AvoidArea& avoidArea, int32_t sessionBottom)>; 116 using GetStatusBarDefaultVisibilityByDisplayIdFunc = std::function<bool(DisplayId displayId)>; 117 using NotifySetWindowRectAutoSaveFunc = std::function<void(bool enabled, bool isSaveBySpecifiedFlag)>; 118 using UpdateAppUseControlFunc = std::function<void(ControlAppType type, bool isNeedControl, bool isControlRecentOnly)>; 119 using NotifyAvoidAreaChangeCallback = std::function<void(const sptr<AvoidArea>& avoidArea, AvoidAreaType type)>; 120 using NotifySetSupportedWindowModesFunc = std::function<void( 121 std::vector<AppExecFwk::SupportWindowMode>&& supportedWindowModes)>; 122 using GetStatusBarAvoidHeightFunc = std::function<void(DisplayId displayId, WSRect& barArea)>; 123 using GetStatusBarConstantlyShowFunc = std::function<void(DisplayId displayId, bool& isVisible)>; 124 using NotifySetWindowCornerRadiusFunc = std::function<void(float cornerRadius)>; 125 using GetKeyboardOccupiedAreaWithRotationCallback = 126 std::function<void(int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas)>; 127 using GetNextAvoidAreaRectInfoFunc = std::function<WSError(DisplayId displayId, AvoidAreaType type, 128 std::pair<WSRect, WSRect>& nextSystemBarAvoidAreaRectInfo)>; 129 using NotifyFollowParentRectFunc = std::function<void(bool isFollow)>; 130 using NotifyWindowAnchorInfoChangeFunc = std::function<void(const WindowAnchorInfo& windowAnchorInfo)>; 131 using GetSceneSessionByIdCallback = std::function<sptr<SceneSession>(int32_t sessionId)>; 132 using NotifySetParentSessionFunc = std::function<void(int32_t oldParentWindowId, int32_t newParentWindowId)>; 133 using NotifyUpdateFlagFunc = std::function<void(const std::string& flag)>; 134 using GetStartWindowTypeFunc = std::function<void(const SessionInfo& info, std::string& startWindowType)>; 135 using NotifyRotationChangeFunc = std::function<void(int32_t persistentId, bool isRegister)>; 136 using NotifyHookSceneSessionActivationFunc = std::function<void(const sptr<SceneSession>& session, bool isNewWant)>; 137 using NotifySceneSessionDestructFunc = std::function<void(int32_t persistentId)>; 138 using NotifyFollowScreenChangeFunc = std::function<void(bool isFollowScreenChange)>; 139 using NotifyUseImplicitAnimationChangeFunc = std::function<void(bool useImplicit)>; 140 using NotifySetWindowShadowsFunc = std::function<void(const ShadowsInfo& shadowsInfo)>; 141 using NotifyWindowShadowEnableChangeFunc = std::function<void(bool windowShadowEnabled)>; 142 using NotifyWindowSystemBarPropertyChangeFunc = std::function<void(WindowType type, 143 const SystemBarProperty& systemBarProperty)>; 144 using NotifySetSubWindowSourceFunc = std::function<void(SubWindowSource source)>; 145 using NotifyAnimateToFunc = std::function<void(const WindowAnimationProperty& animationProperty, 146 const WindowAnimationOption& animationOption)>; 147 using GetAllAppUseControlMapFunc = 148 std::function<std::unordered_map<std::string, std::unordered_map<ControlAppType, ControlInfo>>&()>; 149 using GetFbPanelWindowIdFunc = std::function<WMError(uint32_t& windowId)>; 150 struct UIExtensionTokenInfo { 151 bool canShowOnLockScreen { false }; 152 uint32_t callingTokenId { 0 }; 153 sptr<IRemoteObject> abilityToken; 154 }; 155 156 class SceneSession : public Session { 157 public: 158 friend class HidumpController; 159 friend class PcFoldScreenController; 160 // callback for notify SceneSessionManager 161 struct SpecificSessionCallback : public RefBase { 162 SpecificSessionCreateCallback onCreate_; 163 SpecificSessionDestroyCallback onDestroy_; 164 ClearDisplayStatusBarTemporarilyFlags onClearDisplayStatusBarTemporarilyFlags_; 165 CameraFloatSessionChangeCallback onCameraFloatSessionChange_; 166 GetSceneSessionVectorByTypeAndDisplayIdCallback onGetSceneSessionVectorByTypeAndDisplayId_; 167 GetSceneSessionVectorByTypeCallback onGetSceneSessionVectorByType_; 168 UpdateAvoidAreaCallback onUpdateAvoidArea_; 169 GetStatusBarDefaultVisibilityByDisplayIdFunc onGetStatusBarDefaultVisibilityByDisplayId_; 170 UpdateOccupiedAreaIfNeedCallback onUpdateOccupiedAreaIfNeed_; 171 NotifyWindowInfoUpdateCallback onWindowInfoUpdate_; 172 NotifyWindowPidChangeCallback onWindowInputPidChangeCallback_; 173 NotifySessionTouchOutsideCallback onSessionTouchOutside_; 174 GetAINavigationBarArea onGetAINavigationBarArea_; 175 GetNextAvoidAreaRectInfoFunc onGetNextAvoidAreaRectInfo_; 176 OnOutsideDownEvent onOutsideDownEvent_; 177 HandleSecureSessionShouldHideCallback onHandleSecureSessionShouldHide_; 178 CameraSessionChangeCallback onCameraSessionChange_; 179 SetSkipSelfWhenShowOnVirtualScreenCallback onSetSkipSelfWhenShowOnVirtualScreen_; 180 SetSkipEventOnCastPlusCallback onSetSkipEventOnCastPlus_; 181 PiPStateChangeCallback onPiPStateChange_; 182 UpdateGestureBackEnabledCallback onUpdateGestureBackEnabled_; 183 NotifyAvoidAreaChangeCallback onNotifyAvoidAreaChange_; 184 NotifyWindowSystemBarPropertyChangeFunc onNotifyWindowSystemBarPropertyChangeFunc_; 185 GetKeyboardOccupiedAreaWithRotationCallback onKeyboardRotationChange_; 186 GetSceneSessionByIdCallback onGetSceneSessionByIdCallback_; 187 NotifyFollowScreenChangeFunc onUpdateFollowScreenChange_; 188 }; 189 190 // func for change window scene pattern property 191 struct SetWindowScenePatternFunc : public RefBase { 192 SetWindowPatternOpacityFunc setOpacityFunc_; 193 }; 194 195 SceneSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback); 196 virtual ~SceneSession(); 197 198 WSError Connect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel, 199 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig, 200 sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr, 201 const std::string& identityToken = "") override; 202 WSError ConnectInner(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel, 203 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig, 204 sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr, 205 int32_t pid = -1, int32_t uid = -1, const std::string& identityToken = "") override; 206 WSError Foreground(sptr<WindowSessionProperty> property, bool isFromClient = false, 207 const std::string& identityToken = "") override; 208 WSError Background(bool isFromClient = false, const std::string& identityToken = "") override; 209 WSError BackgroundTask(const bool isSaveSnapshot = true, ScreenLockReason reason = ScreenLockReason::DEFAULT); 210 WSError Disconnect(bool isFromClient = false, const std::string& identityToken = "") override; 211 WSError DisconnectTask(bool isFromClient = false, bool isSaveSnapshot = true); 212 void SetClientIdentityToken(const std::string& clientIdentityToken); BindKeyboardPanelSession(sptr<SceneSession> panelSession)213 virtual void BindKeyboardPanelSession(sptr<SceneSession> panelSession) {}; GetKeyboardPanelSession()214 virtual sptr<SceneSession> GetKeyboardPanelSession() const { return nullptr; }; BindKeyboardSession(sptr<SceneSession> session)215 virtual void BindKeyboardSession(sptr<SceneSession> session) {}; GetKeyboardSession()216 virtual sptr<SceneSession> GetKeyboardSession() const { return nullptr; }; GetKeyboardGravity()217 virtual SessionGravity GetKeyboardGravity() const { return SessionGravity::SESSION_GRAVITY_DEFAULT; }; GetCallingSessionId()218 virtual uint32_t GetCallingSessionId() { return INVALID_SESSION_ID; }; 219 bool GetScreenWidthAndHeightFromClient(const sptr<WindowSessionProperty>& sessionProperty, 220 uint32_t& screenWidth, uint32_t& screenHeight); 221 sptr<SceneSession> GetSceneSessionById(int32_t sessionId) const; 222 223 WSError UpdateActiveStatus(bool isActive) override; 224 WSError OnSessionEvent(SessionEvent event) override; 225 WSError SyncSessionEvent(SessionEvent event) override; 226 WSError OnLayoutFullScreenChange(bool isLayoutFullScreen) override; 227 WSError RaiseToAppTop() override; 228 229 /* 230 * Window Recover 231 */ 232 virtual WSError Reconnect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel, 233 const std::shared_ptr<RSSurfaceNode>& surfaceNode, sptr<WindowSessionProperty> property = nullptr, 234 sptr<IRemoteObject> token = nullptr, int32_t pid = -1, int32_t uid = -1); 235 WSError ReconnectInner(sptr<WindowSessionProperty> property) REQUIRES(SCENE_GUARD); IsRecovered()236 bool IsRecovered() const { return isRecovered_; } SetRecovered(bool isRecovered)237 void SetRecovered(bool isRecovered) { isRecovered_ = isRecovered; } 238 239 /* 240 * Window Layout 241 */ 242 WSError UpdateSizeChangeReason(SizeChangeReason reason) override; 243 virtual void NotifySessionRectChange(const WSRect& rect, 244 SizeChangeReason reason = SizeChangeReason::UNDEFINED, DisplayId displayId = DISPLAY_ID_INVALID, 245 const RectAnimationConfig& rectAnimationConfig = {}); 246 WSError UpdateRect(const WSRect& rect, SizeChangeReason reason, 247 const std::string& updateReason, const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override; 248 WSError UpdateSessionRect(const WSRect& rect, SizeChangeReason reason, bool isGlobal = false, 249 bool isFromMoveToGlobal = false, const MoveConfiguration& moveConfiguration = {}, 250 const RectAnimationConfig& rectAnimationConfig = {}) override; 251 WSError UpdateClientRect(const WSRect& rect) override; 252 WSError UpdateGlobalDisplayRectFromClient(const WSRect& rect, SizeChangeReason reason) override; 253 void NotifySingleHandTransformChange(const SingleHandTransform& singleHandTransform); 254 WSRect GetSessionGlobalRectWithSingleHandScale(); 255 void UpdateSessionState(SessionState state) override; 256 WSError NotifyClientToUpdateRect(const std::string& updateReason, 257 std::shared_ptr<RSTransaction> rsTransaction) override; 258 void SetWinRectWhenUpdateRect(const WSRect& rect); 259 void RegisterNotifySurfaceBoundsChangeFunc(int32_t sessionId, NotifySurfaceBoundsChangeFunc&& func) override; 260 void UnregisterNotifySurfaceBoundsChangeFunc(int32_t sessionId) override; SetRequestRectWhenFollowParent(const WSRect & rect)261 void SetRequestRectWhenFollowParent(const WSRect& rect) { requestRectWhenFollowParent_ = rect; } GetRequestRectWhenFollowParent()262 WSRect GetRequestRectWhenFollowParent() const { return requestRectWhenFollowParent_; } 263 void HandleCrossMoveTo(WSRect& globalRect); HandleCrossMoveToSurfaceNode(WSRect & globalRect)264 virtual void HandleCrossMoveToSurfaceNode(WSRect& globalRect) {} IsNeedCrossDisplayRendering()265 virtual bool IsNeedCrossDisplayRendering() const { return false; } HandleCrossSurfaceNodeByWindowAnchor(SizeChangeReason reason,const sptr<ScreenSession> & screenSession)266 virtual void HandleCrossSurfaceNodeByWindowAnchor(SizeChangeReason reason, 267 const sptr<ScreenSession>& screenSession) {} 268 virtual void SetSurfaceBounds(const WSRect& rect, bool isGlobal, bool needFlush = true); 269 OpenKeyboardSyncTransaction()270 virtual void OpenKeyboardSyncTransaction() {} CloseKeyboardSyncTransaction(const WSRect & keyboardPanelRect,bool isKeyboardShow,const WindowAnimationInfo & animationInfo)271 virtual void CloseKeyboardSyncTransaction(const WSRect& keyboardPanelRect, 272 bool isKeyboardShow, const WindowAnimationInfo& animationInfo) {} 273 WSError ChangeSessionVisibilityWithStatusBar(const sptr<AAFwk::SessionInfo> info, bool visible) override; 274 WSError PendingSessionActivation(const sptr<AAFwk::SessionInfo> info) override; 275 WSError BatchPendingSessionsActivation(const std::vector<sptr<AAFwk::SessionInfo>>& abilitySessionInfos) override; 276 WSError DoBatchPendingSessionsActivation( 277 const std::vector<sptr<AAFwk::SessionInfo>>& abilitySessionInfos, sptr<SceneSession>& session, 278 bool isFoundationCall); 279 bool DisallowActivationFromPendingBackground(bool isPcOrPadEnableActivation, bool isFoundationCall, 280 bool canStartAbilityFromBackground, bool isFromAncoAndToAnco); 281 WSError TerminateSession(const sptr<AAFwk::SessionInfo> info) override; 282 WSError NotifySessionException( 283 const sptr<AAFwk::SessionInfo> info, const ExceptionInfo& exceptionInfo) override; 284 WSError NotifySessionExceptionInner( 285 const sptr<AAFwk::SessionInfo> info, const ExceptionInfo& exceptionInfo, 286 bool isFromClient = false, bool startFail = false); 287 288 WSError TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 289 bool needNotifyClient = true, bool isExecuteDelayRaise = false) override; 290 WSError TransferPointerEventInner(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 291 bool needNotifyClient = true, bool isExecuteDelayRaise = false); 292 WSError RequestSessionBack(bool needMoveToBackground) override; 293 WSError SetAspectRatio(float ratio) override; 294 WSError SetGlobalMaximizeMode(MaximizeMode mode) override; 295 WSError GetGlobalMaximizeMode(MaximizeMode& mode) override; 296 WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override; 297 WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override; 298 void SetZOrder(uint32_t zOrder) override; 299 std::vector<Rect> GetTouchHotAreas() const override; 300 void NotifyUILostFocus() override; 301 void SetScale(float scaleX, float scaleY, float pivotX, float pivotY) override; 302 void SetFloatingScale(float floatingScale) override; 303 WSError RaiseAboveTarget(int32_t subWindowId) override; 304 WSError RaiseMainWindowAboveTarget(int32_t targetId) override; 305 306 /* 307 * PiP Window 308 */ 309 PiPTemplateInfo GetPiPTemplateInfo() const; 310 void SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo); 311 WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override; 312 WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override; 313 WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) override; 314 void SetUpdatePiPTemplateInfoCallback(NotifyUpdatePiPTemplateInfoFunc&& func); 315 WSError UpdatePiPTemplateInfo(PiPTemplateInfo& pipTemplateInfo) override; 316 void NotifyPiPWindowPrepareClose() override; 317 void SetSessionPiPControlStatusChangeCallback(const NotifySessionPiPControlStatusChangeFunc& func); 318 void SetAutoStartPiPStatusChangeCallback(const NotifyAutoStartPiPStatusChangeFunc& func); 319 WSError SetPipActionEvent(const std::string& action, int32_t status); 320 WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status); 321 WSError NotifyPipWindowSizeChange(double width, double height, double scale); 322 void RegisterProcessPrepareClosePiPCallback(NotifyPrepareClosePiPSessionFunc&& callback); 323 324 void RequestHideKeyboard(bool isAppColdStart = false); 325 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 326 WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 327 bool isExecuteDelayRaise = false) override; 328 WSError SendPointerEventForHover(const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 329 void NotifyOutsideDownEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 330 WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override; 331 void SetForegroundInteractiveStatus(bool interactive) override; 332 WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override; 333 334 /* 335 * Floating Ball Window 336 */ UpdateFloatingBall(const FloatingBallTemplateInfo & fbTemplateInfo)337 WMError UpdateFloatingBall(const FloatingBallTemplateInfo& fbTemplateInfo) override { return WMError::WM_OK; }; StopFloatingBall()338 WSError StopFloatingBall() override { return WSError::WS_OK; }; GetFloatingBallWindowId(uint32_t & windowId)339 WMError GetFloatingBallWindowId(uint32_t& windowId) override { return WMError::WM_OK; }; RestoreFbMainWindow(const std::shared_ptr<AAFwk::Want> & want)340 WMError RestoreFbMainWindow(const std::shared_ptr<AAFwk::Want>& want) override { return WMError::WM_OK; }; SendFbActionEvent(const std::string & action)341 virtual WSError SendFbActionEvent(const std::string& action) { return WSError::WS_OK; }; GetFbTemplateInfo()342 virtual FloatingBallTemplateInfo GetFbTemplateInfo() const { return fbTemplateInfo_; }; SetFbTemplateInfo(const FloatingBallTemplateInfo & fbTemplateInfo)343 virtual void SetFbTemplateInfo(const FloatingBallTemplateInfo& fbTemplateInfo) {}; GetFbWindowId()344 virtual uint32_t GetFbWindowId() const { return 0; }; SetFloatingBallUpdateCallback(NotifyUpdateFloatingBallFunc && func)345 virtual void SetFloatingBallUpdateCallback(NotifyUpdateFloatingBallFunc&& func) {}; SetFloatingBallStopCallback(NotifyStopFloatingBallFunc && func)346 virtual void SetFloatingBallStopCallback(NotifyStopFloatingBallFunc&& func) {}; SetFloatingBallRestoreMainWindowCallback(NotifyRestoreFloatingBallMainWindowFunc && func)347 virtual void SetFloatingBallRestoreMainWindowCallback(NotifyRestoreFloatingBallMainWindowFunc&& func) {}; RegisterGetFbPanelWindowIdFunc(GetFbPanelWindowIdFunc && func)348 virtual void RegisterGetFbPanelWindowIdFunc(GetFbPanelWindowIdFunc&& func) {}; 349 350 /* 351 * Window Layout 352 */ 353 WMError ActivateDragBySystem(bool activateDrag); 354 WMError SetSystemWindowEnableDrag(bool enableDrag) override; 355 WMError SetWindowEnableDragBySystem(bool enableDrag); 356 WSError OnDefaultDensityEnabled(bool isDefaultDensityEnabled) override; 357 WMError UpdateWindowModeForUITest(int32_t updateMode); 358 void RegisterDefaultDensityEnabledCallback(NotifyDefaultDensityEnabledFunc&& callback); 359 void SetSessionDisplayIdChangeCallback(NotifySessionDisplayIdChangeFunc&& func); 360 bool IsMovable() const; 361 bool IsDraggable() const; 362 363 WSError SetKeepScreenOn(bool keepScreenOn); 364 WSError SetViewKeepScreenOn(bool keepScreenOn); 365 WSError SetWindowShadowEnabled(bool isEnabled); 366 void SetParentPersistentId(int32_t parentId); 367 WSError SetTurnScreenOn(bool turnScreenOn); 368 void SetPrivacyMode(bool isPrivacy); 369 WMError SetSnapshotSkip(bool isSkip); 370 void SetSystemSceneOcclusionAlpha(double alpha); 371 void ResetOcclusionAlpha(); 372 void SetSystemSceneForceUIFirst(bool forceUIFirst); 373 void SetUIFirstSwitch(RSUIFirstSwitch uiFirstSwitch); 374 void MarkSystemSceneUIFirst(bool isForced, bool isUIFirstEnabled); 375 void SetRequestedOrientation(Orientation orientation, bool needAnimation = true); 376 WSError SetDefaultRequestedOrientation(Orientation orientation); 377 void SetWindowAnimationFlag(bool needDefaultAnimationFlag); 378 void SetCollaboratorType(int32_t collaboratorType); 379 void SetLastSafeRect(WSRect rect); 380 void SetMovable(bool isMovable); 381 void SetOriPosYBeforeRaisedByKeyboard(int32_t posY); 382 void SetColorSpace(ColorSpace colorSpace); 383 384 /* 385 * Window Hierarchy 386 */ SetTopmost(bool topmost)387 virtual WSError SetTopmost(bool topmost) { return WSError::WS_ERROR_INVALID_CALLING; } IsTopmost()388 virtual bool IsTopmost() const { return false; } SetMainWindowTopmost(bool isTopmost)389 virtual WSError SetMainWindowTopmost(bool isTopmost) { return WSError::WS_ERROR_INVALID_CALLING; } IsMainWindowTopmost()390 virtual bool IsMainWindowTopmost() const { return false; } SetSubWindowZLevel(int32_t zLevel)391 virtual WSError SetSubWindowZLevel(int32_t zLevel) { return WSError::WS_ERROR_INVALID_CALLING; } GetSubWindowZLevel()392 virtual int32_t GetSubWindowZLevel() const { return 0; } 393 void SetMainWindowTopmostChangeCallback(NotifyMainWindowTopmostChangeFunc&& func); 394 395 /* 396 * Compatible Mode 397 */ 398 bool IsInCompatScaleStatus() const; 399 bool IsInCompatScaleMode() const; 400 401 /* 402 * PC Window 403 */ 404 void SetTitleAndDockHoverShowChangeCallback(NotifyTitleAndDockHoverShowChangeFunc&& func); 405 void SetRestoreMainWindowCallback(NotifyRestoreMainWindowFunc&& func); 406 void SetWindowRectAutoSaveCallback(NotifySetWindowRectAutoSaveFunc&& func); IsModal()407 virtual bool IsModal() const { return false; } IsApplicationModal()408 virtual bool IsApplicationModal() const { return false; } 409 bool IsDialogWindow() const; 410 WSError NotifySubModalTypeChange(SubWindowModalType subWindowModalType) override; 411 void RegisterSubModalTypeChangeCallback(NotifySubModalTypeChangeFunc&& func); 412 void RegisterMainModalTypeChangeCallback(NotifyMainModalTypeChangeFunc&& func); 413 void RegisterSupportWindowModesCallback(NotifySetSupportedWindowModesFunc&& func); 414 void CloneWindow(NodeId surfaceNodeId, bool needOffScreen); 415 void AddSidebarBlur(); 416 void AddRSNodeModifier(bool isDark, const std::shared_ptr<RSBaseNode>& rsNode); 417 void SetSidebarBlur(bool isDefaultSidebarBlur, bool isNeedAnimation); 418 void ModifyRSAnimatableProperty(bool isDefaultSidebarBlur, bool isDark, bool isNeedAnimation); 419 void SaveLastDensity(); IsFollowParentMultiScreenPolicy()420 virtual bool IsFollowParentMultiScreenPolicy() const { return false; } 421 void NotifyUpdateFlagCallback(NotifyUpdateFlagFunc&& func); 422 void SetSidebarBlurMaximize(bool isMaximize); 423 void ModifyRSAnimatablePropertyMaximize(bool isMaximize, bool isDark); 424 void RegisterUseImplicitAnimationChangeCallback(NotifyUseImplicitAnimationChangeFunc&& func); 425 WSError UseImplicitAnimation(bool useImplicit) override; 426 427 /* 428 * PC Window Layout 429 */ 430 void SetIsLayoutFullScreen(bool isLayoutFullScreen); 431 bool IsLayoutFullScreen() const; 432 WSError StartMovingWithCoordinate(int32_t offsetX, int32_t offsetY, 433 int32_t pointerPosX, int32_t pointerPosY, DisplayId displayId) override; 434 435 /* 436 * Sub Window 437 */ SetParentSessionCallback(NotifySetParentSessionFunc && func)438 virtual void SetParentSessionCallback(NotifySetParentSessionFunc&& func) {} NotifySetParentSession(int32_t oldParentWindowId,int32_t newParentWindowId)439 virtual WMError NotifySetParentSession(int32_t oldParentWindowId, 440 int32_t newParentWindowId) { return WMError::WM_ERROR_INVALID_WINDOW; } 441 void UpdateSubWindowLevel(uint32_t subWindowLevel); 442 uint32_t GetMaxSubWindowLevel() const; 443 void SetSubWindowOutlineEnabled(bool subWindowOutlineEnabled); 444 bool IsSubWindowOutlineEnabled() const; 445 WSError CloseSpecificScene(); 446 void SetSubWindowSourceFunc(NotifySetSubWindowSourceFunc&& func); 447 WSError SetSubWindowSource(SubWindowSource source) override; 448 449 /* 450 * Window Immersive 451 */ 452 WSError OnNeedAvoid(bool status) override; 453 AvoidArea GetAvoidAreaByType(AvoidAreaType type, const WSRect& rect = WSRect::EMPTY_RECT, 454 int32_t apiVersion = API_VERSION_INVALID) override; 455 WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override; 456 WSError GetTargetOrientationConfigInfo(Orientation targetOrientation, 457 const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties) override; 458 void SetSessionGetTargetOrientationConfigInfoCallback( 459 const NotifySessionGetTargetOrientationConfigInfoFunc& func); 460 WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty); 461 void SetIsStatusBarVisible(bool isVisible); 462 WSError SetIsStatusBarVisibleInner(bool isVisible); 463 WSError HandleLayoutAvoidAreaUpdate(AvoidAreaType avoidArea = AvoidAreaType::TYPE_END); 464 WSError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) override; 465 void UpdateRotationAvoidArea(); 466 bool CheckGetAvoidAreaAvailable(AvoidAreaType type) override; 467 bool CheckGetSubWindowAvoidAreaAvailable(WindowMode winMode, AvoidAreaType type); 468 bool CheckGetMainWindowAvoidAreaAvailable(WindowMode winMode, AvoidAreaType type); 469 bool CheckGetSystemWindowAvoidAreaAvailable(); 470 bool GetIsDisplayStatusBarTemporarily() const; 471 void SetIsDisplayStatusBarTemporarily(bool isTemporary); 472 void SetIsLastFrameLayoutFinishedFunc(IsLastFrameLayoutFinishedFunc&& func); 473 void SetIsAINavigationBarAvoidAreaValidFunc(IsAINavigationBarAvoidAreaValidFunc&& func); 474 void RetrieveStatusBarDefaultVisibility(); 475 void RegisterNeedAvoidCallback(NotifyNeedAvoidFunc&& callback); 476 void RegisterSystemBarPropertyChangeCallback(NotifySystemBarPropertyChangeFunc&& callback); 477 void MarkAvoidAreaAsDirty(); RecalculatePanelRectForAvoidArea(WSRect & panelRect)478 virtual void RecalculatePanelRectForAvoidArea(WSRect& panelRect) {} 479 void RegisterGetStatusBarAvoidHeightFunc(GetStatusBarAvoidHeightFunc&& func); 480 void RegisterGetStatusBarConstantlyShowFunc(GetStatusBarConstantlyShowFunc&& func); 481 void HookAvoidAreaInCompatibleMode(const WSRect& rect, AvoidAreaType avoidAreaType, AvoidArea& avoidArea) const; 482 483 void SetAbilitySessionInfo(std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo); 484 void SetWindowDragHotAreaListener(const NotifyWindowDragHotAreaFunc& func); 485 void SetSessionEventParam(SessionEventParam param); 486 void SetSessionRectChangeCallback(const NotifySessionRectChangeFunc& func); 487 void SetAdjustKeyboardLayoutCallback(const NotifyKeyboardLayoutAdjustFunc& func); 488 void SetSkipDraw(bool skip); 489 virtual void SetSkipSelfWhenShowOnVirtualScreen(bool isSkip); 490 virtual void SetSkipEventOnCastPlus(bool isSkip); 491 WMError SetUniqueDensityDpi(bool useUnique, float dpi); 492 493 bool IsAnco() const override; 494 void SetBlank(bool isAddBlank) override; 495 bool GetBlank() const override; 496 void SetBufferAvailableCallbackEnable(bool enable); 497 bool GetBufferAvailableCallbackEnable() const override; 498 int32_t GetCollaboratorType() const; 499 WSRect GetLastSafeRect() const; 500 WSRect GetSessionTargetRectByDisplayId(DisplayId displayId) const; 501 std::string GetUpdatedIconPath() const; 502 int32_t GetParentPersistentId() const; 503 int32_t GetMainSessionId(); GetMissionId()504 virtual int32_t GetMissionId() const { return persistentId_; }; 505 Orientation GetRequestedOrientation() const; 506 std::vector<sptr<SceneSession>> GetSubSession() const; 507 std::vector<sptr<SceneSession>> GetToastSession() const; 508 std::shared_ptr<AppExecFwk::AbilityInfo> GetAbilityInfo() const; 509 std::string GetWindowNameAllType() const; 510 SubWindowModalType GetSubWindowModalType() const; 511 int32_t GetOriPosYBeforeRaisedByKeyboard() const; 512 std::string GetClientIdentityToken() const; 513 514 /* 515 * Window Watermark 516 */ 517 void SetWatermarkEnabled(const std::string& watermarkName, bool isEnabled); 518 519 bool IsDecorEnable() const; 520 bool IsAppSession() const; 521 bool IsAppOrLowerSystemSession() const; 522 bool IsSystemSessionAboveApp() const; 523 bool IsTurnScreenOn() const; 524 bool IsKeepScreenOn() const; 525 bool IsViewKeepScreenOn() const; 526 bool GetWindowShadowEnabled() const; 527 bool IsShowWhenLocked() const; 528 bool GetShowWhenLockedFlagValue() const; 529 bool IsFloatingWindowAppType() const; 530 bool IsNeedDefaultAnimation() const; 531 void SetSystemTouchable(bool touchable) override; 532 bool IsVisibleForAccessibility() const; 533 void SetStartingWindowExitAnimationFlag(bool enable); 534 bool NeedStartingWindowExitAnimation() const override; 535 536 void NotifyWindowVisibility(); 537 WSError OnShowWhenLocked(bool showWhenLocked); 538 void SaveUpdatedIcon(const std::shared_ptr<Media::PixelMap>& icon); 539 void NotifyTouchOutside(); 540 bool CheckTouchOutsideCallbackRegistered(); 541 void UpdateNativeVisibility(bool visible); 542 void DumpSessionElementInfo(const std::vector<std::string>& params); 543 void NotifyForceHideChange(bool hide); 544 WSError BindDialogSessionTarget(const sptr<SceneSession>& sceneSession); 545 void DumpSessionInfo(std::vector<std::string>& info) const; 546 bool AddSubSession(const sptr<SceneSession>& subSession); 547 bool RemoveSubSession(int32_t persistentId); 548 bool AddToastSession(const sptr<SceneSession>& toastSession); 549 bool RemoveToastSession(int32_t persistentId); 550 void NotifySessionForeground(uint32_t reason, bool withAnimation); 551 void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits); 552 void RegisterForceSplitListener(const NotifyForceSplitFunc& func); 553 554 /* 555 * Dialog Window 556 */ 557 void RegisterBindDialogSessionCallback(const NotifyBindDialogSessionFunc& callback); 558 559 void SetUpdatePrivateStateAndNotifyFunc(const UpdatePrivateStateAndNotifyFunc& func); 560 561 /* 562 * Window Input Event 563 */ 564 void RegisterTouchOutsideCallback(NotifyTouchOutsideFunc&& callback); 565 void SetMousePointerDownEventStatus(bool mousePointerDownEventStatus); 566 bool GetMousePointerDownEventStatus() const; 567 void SetFingerPointerDownStatus(int32_t fingerId); 568 void RemoveFingerPointerDownStatus(int32_t fingerId); 569 std::unordered_set<int32_t> GetFingerPointerDownStatusList() const; 570 571 /* 572 * Window Rotation 573 */ 574 void RegisterRequestedOrientationChangeCallback(NotifyReqOrientationChangeFunc&& callback); 575 WSError NotifyRotationProperty(uint32_t rotation, uint32_t width, uint32_t height); 576 void RegisterUpdateRotationChangeListener(NotifyRotationChangeFunc&& callback); 577 WSError UpdateRotationChangeRegistered(int32_t persistentId, bool isRegister) override; 578 RotationChangeResult NotifyRotationChange(const RotationChangeInfo& rotationChangeInfo, 579 bool isRestrictNotify = false); 580 bool isRotationChangeCallbackRegistered = false; 581 WSError SetCurrentRotation(int32_t currentRotation); 582 void RegisterFollowScreenChangeCallback(NotifyFollowScreenChangeFunc&& callback); 583 WSError UpdateFollowScreenChange(bool isFollowScreenChange); 584 585 /* 586 * Window Animation 587 */ 588 void RegisterIsCustomAnimationPlayingCallback(NotifyIsCustomAnimationPlayingCallback&& callback); 589 void RegisterDefaultAnimationFlagChangeCallback(NotifyWindowAnimationFlagChangeFunc&& callback); 590 void RegisterAnimateToCallback(NotifyAnimateToFunc&& callback); 591 WMError AnimateTo(const WindowAnimationProperty& animationProperty, 592 const WindowAnimationOption& animationOption); 593 WSError SetFrameRectForPartialZoomIn(const Rect& frameRect) override; 594 595 /* 596 * Window Visibility 597 */ 598 void SetNotifyVisibleChangeFunc(const NotifyVisibleChangeFunc& func); 599 600 /* 601 * Window Hierarchy 602 */ 603 void RegisterRaiseToTopCallback(NotifyRaiseToTopFunc&& callback); 604 void RegisterRaiseAboveTargetCallback(NotifyRaiseAboveTargetFunc&& callback); 605 void RegisterRaiseMainWindowAboveTargetCallback(NotifyRaiseMainWindowAboveTargetFunc&& callback); 606 void RegisterSessionTopmostChangeCallback(NotifySessionTopmostChangeFunc&& callback); 607 void RegisterSubSessionZLevelChangeCallback(NotifySubSessionZLevelChangeFunc&& callback); 608 609 /* 610 * Window Lifecycle 611 */ 612 void ClearJsSceneSessionCbMap(bool needRemove); // ONLY Accessed on OS_sceneSession thread 613 void ClearSpecificSessionCbMap(); 614 void RegisterShowWhenLockedCallback(NotifyShowWhenLockedFunc&& callback); 615 void RegisterForceHideChangeCallback(NotifyForceHideChangeFunc&& callback); 616 void RegisterClearCallbackMapCallback(ClearCallbackMapFunc&& callback); HideSync()617 virtual WSError HideSync() { return WSError::WS_DO_NOTHING; } 618 void RegisterUpdateAppUseControlCallback(UpdateAppUseControlFunc&& func); 619 void NotifyUpdateAppUseControl(ControlAppType type, const ControlInfo& controlInfo) override; 620 void UpdatePrivacyModeControlInfo(); 621 bool HasSubSessionInPrivacyMode(); 622 void SetVisibilityChangedDetectFunc(VisibilityChangedDetectFunc&& func); RegisterSessionLockStateChangeCallback(NotifySessionLockStateChangeCallback && callback)623 virtual void RegisterSessionLockStateChangeCallback(NotifySessionLockStateChangeCallback&& callback) {} NotifySessionLockStateChange(bool isLockedState)624 virtual void NotifySessionLockStateChange(bool isLockedState) {} SetUpdateSessionLabelAndIconListener(NofitySessionLabelAndIconUpdatedFunc && func)625 virtual void SetUpdateSessionLabelAndIconListener(NofitySessionLabelAndIconUpdatedFunc&& func) {} GetRouterStackInfo(std::string & routerStackInfo)626 virtual WMError GetRouterStackInfo(std::string& routerStackInfo) const { return WMError::WM_OK; } 627 bool UpdateInteractiveInner(bool interactive); 628 void HookSceneSessionActivation(NotifyHookSceneSessionActivationFunc&& func); 629 void SetSceneSessionDestructNotificationFunc(NotifySceneSessionDestructFunc&& func); 630 void SetIsUserRequestedExit(bool isUserRequestedExit); 631 void SetGetAllAppUseControlMapFunc(GetAllAppUseControlMapFunc&& callback); 632 void UpdateLifecyclePausedInner(); 633 void CalculatedStartWindowType(SessionInfo& sessionInfo, bool hideStartWindow); 634 635 void SendPointerEventToUI(std::shared_ptr<MMI::PointerEvent> pointerEvent); 636 bool SendKeyEventToUI(std::shared_ptr<MMI::KeyEvent> keyEvent, bool isPreImeEvent = false); 637 bool IsStartMoving() override; 638 void SetIsStartMoving(bool startMoving); 639 bool IsSystemSpecificSession() const; 640 void SetIsSystemSpecificSession(bool isSystemSpecificSession); 641 void SetShouldHideNonSecureWindows(bool shouldHide); 642 void UpdateExtWindowFlags(int32_t extPersistentId, const ExtensionWindowFlags& extWindowFlags, 643 const ExtensionWindowFlags& extWindowActions); 644 ExtensionWindowFlags GetCombinedExtWindowFlags(); 645 void RemoveExtWindowFlags(int32_t extPersistentId); 646 void ClearExtWindowFlags(); 647 void NotifyDisplayMove(DisplayId from, DisplayId to); 648 void NotifySessionFullScreen(bool fullScreen); 649 void SetDefaultDisplayIdIfNeed(); 650 651 void SetSessionState(SessionState state) override; 652 void SetForceHideState(ForceHideState forceHideState); 653 ForceHideState GetForceHideState() const; 654 bool IsTemporarilyShowWhenLocked() const; 655 void SetTemporarilyShowWhenLocked(bool isTemporarilyShowWhenLocked); 656 657 std::shared_ptr<PowerMgr::RunningLock> keepScreenLock_; 658 std::shared_ptr<PowerMgr::RunningLock> viewKeepScreenLock_; 659 660 static MaximizeMode maximizeMode_; 661 static uint32_t GetWindowDragHotAreaType(DisplayId displayId, uint32_t type, int32_t pointerX, int32_t pointerY); 662 static void AddOrUpdateWindowDragHotArea(DisplayId displayId, uint32_t type, const WSRect& area); 663 WSError UpdateRectChangeListenerRegistered(bool isRegister) override; 664 WMError NotifyDisableDelegatorChange() override; SetRecentSessionState(RecentSessionInfo & info,const SessionState & state)665 virtual void SetRecentSessionState(RecentSessionInfo& info, const SessionState& state) {} 666 void RegisterGetStartWindowConfigFunc(GetStartWindowTypeFunc&& func); 667 668 /* 669 * Window Decor 670 */ 671 int32_t GetCustomDecorHeight() const; 672 void SetCustomDecorHeight(int32_t height) override; 673 674 WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property, 675 WSPropertyChangeAction action) override; 676 void SetSessionChangeByActionNotifyManagerListener(const SessionChangeByActionNotifyManagerFunc& func); 677 678 /* 679 * UIExtension 680 */ 681 bool IsShowOnLockScreen(uint32_t lockScreenZOrder); 682 void AddExtensionTokenInfo(const UIExtensionTokenInfo& tokenInfo); 683 void RemoveExtensionTokenInfo(const sptr<IRemoteObject>& abilityToken); 684 void CheckExtensionOnLockScreenToClose(); 685 void CloseExtensionSync(const UIExtensionTokenInfo& tokenInfo); 686 void OnNotifyAboveLockScreen(); 687 void AddNormalModalUIExtension(const ExtensionWindowEventInfo& extensionInfo); 688 void RemoveNormalModalUIExtension(int32_t persistentId); 689 void UpdateNormalModalUIExtension(const ExtensionWindowEventInfo& extensionInfo); 690 std::optional<ExtensionWindowEventInfo> GetLastModalUIExtensionEventInfo(); 691 Vector2f GetSessionGlobalPosition(bool useUIExtension); 692 void AddUIExtSurfaceNodeId(uint64_t surfaceNodeId, int32_t persistentId); 693 void RemoveUIExtSurfaceNodeId(int32_t persistentId); 694 int32_t GetUIExtPersistentIdBySurfaceNodeId(uint64_t surfaceNodeId) const; 695 int32_t GetStatusBarHeight() override; 696 int32_t GetDockHeight(); IsFreeMultiWindowMode()697 bool IsFreeMultiWindowMode() const 698 { 699 return systemConfig_.IsFreeMultiWindowMode(); 700 } 701 WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override; 702 703 // WMSPipeline-related: only accessed on SSM thread SyncScenePanelGlobalPosition(bool needSync)704 virtual void SyncScenePanelGlobalPosition(bool needSync) {} 705 void SetNeedSyncSessionRect(bool needSync); 706 // update visible session, return dirty flags 707 uint32_t UpdateUIParam(const SessionUIParam& uiParam) REQUIRES(SCENE_GUARD); 708 // update invisible session, return dirty flags 709 uint32_t UpdateUIParam() REQUIRES(SCENE_GUARD); 710 void SetPostProcessFocusState(PostProcessFocusState state); 711 PostProcessFocusState GetPostProcessFocusState() const; 712 void ResetPostProcessFocusState(); 713 void SetPostProcessProperty(bool state); 714 bool GetPostProcessProperty() const; 715 void PostProcessNotifyAvoidArea(); 716 bool IsImmersiveType() const; 717 bool IsPcOrPadEnableActivation() const; 718 static void RegisterGetConstrainedModalExtWindowInfo(GetConstrainedModalExtWindowInfoFunc&& callback); 719 720 /* 721 * Multi User 722 */ 723 void SetMinimizedFlagByUserSwitch(bool isMinimized); 724 bool IsMinimizedByUserSwitch() const; 725 void UnregisterSessionChangeListeners() override; 726 727 /* 728 * Window ZOrder: PC 729 */ SetPcScenePanel(bool isPcScenePanel)730 void SetPcScenePanel(bool isPcScenePanel) { isPcScenePanel_ = isPcScenePanel; } 731 void UpdatePCZOrderAndMarkDirty(const uint32_t zOrder); 732 733 /* 734 * Multi Window 735 */ 736 WSError SetSplitButtonVisible(bool isVisible); 737 WSError SendContainerModalEvent(const std::string& eventName, const std::string& eventValue); 738 WSError OnContainerModalEvent(const std::string& eventName, const std::string& eventValue) override; 739 void RegisterSetLandscapeMultiWindowFunc(NotifyLandscapeMultiWindowSessionFunc&& func); 740 741 /* 742 * Move Drag 743 */ SetAppDragResizeType(DragResizeType dragResizeType)744 void SetAppDragResizeType(DragResizeType dragResizeType) { appDragResizeType_ = dragResizeType; } GetAppDragResizeType()745 DragResizeType GetAppDragResizeType() const { return appDragResizeType_; } 746 void RegisterSessionEventCallback(NotifySessionEventFunc&& callback); 747 void SetWindowMovingCallback(NotifyWindowMovingFunc&& func); 748 DMRect CalcRectForStatusBar(); 749 WSError SetMoveAvailableArea(DisplayId displayId); 750 bool IsDragMoving() const override; 751 bool IsDragZooming() const override; 752 // KeyFrame 753 WSError UpdateKeyFrameCloneNode(std::shared_ptr<RSCanvasNode>& rsCanvasNode, 754 std::shared_ptr<RSTransaction>& rsTransaction) override; 755 void SetKeyFramePolicy(const KeyFramePolicy& keyFramePolicy); 756 WSError SetDragKeyFramePolicy(const KeyFramePolicy& keyFramePolicy) override; 757 WSError KeyFrameAnimateEnd() override; 758 759 /* 760 * Window Layout 761 */ 762 bool IsDirtyWindow(); 763 bool IsDirtyDragWindow(); 764 void ResetDirtyDragFlags(); 765 void ResetSizeChangeReasonIfDirty(); 766 void SetRequestNextVsyncFunc(RequestVsyncFunc&& func); 767 void OnNextVsyncReceivedWhenDrag(const WSRect& globalRect, 768 bool isGlobal, bool needFlush, bool needSetBoundsNextVsync); 769 void RegisterLayoutFullScreenChangeCallback(NotifyLayoutFullScreenChangeFunc&& callback); 770 bool SetFrameGravity(Gravity gravity); 771 WSError GetCrossAxisState(CrossAxisState& state) override; 772 virtual void UpdateCrossAxis(); GetIsFollowParentLayout()773 bool GetIsFollowParentLayout() const { return isFollowParentLayout_; } GetMoveDragController()774 sptr<MoveDragController> GetMoveDragController() const { return moveDragController_; } 775 void NotifyUpdateGravity(); 776 void SetWindowAnchorInfoChangeFunc(NotifyWindowAnchorInfoChangeFunc&& func); 777 WSError SetWindowAnchorInfo(const WindowAnchorInfo& windowAnchorInfo) override; GetWindowAnchorInfo()778 WindowAnchorInfo GetWindowAnchorInfo() const { return windowAnchorInfo_; } 779 void CalcSubWindowRectByAnchor(const WSRect& parentRect, WSRect& subRect); 780 bool IsAnyParentSessionDragMoving() const override; 781 bool IsAnyParentSessionDragZooming() const override; 782 bool IsCompatibleModeDirtyDragScaleWindow() const; 783 void ResetCompatibleModeDragScaleFlags(); 784 void RegisterAppHookWindowInfoFunc(GetHookWindowInfoFunc&& func); 785 WMError GetAppHookWindowInfoFromServer(HookWindowInfo& hookWindowInfo) override; 786 787 /* 788 * Gesture Back 789 */ 790 bool GetGestureBackEnabled(); 791 bool GetEnableGestureBackHadSet(); 792 793 /* 794 * PC Fold Screen 795 */ 796 void UpdateFullScreenWaterfallMode(bool isWaterfallMode); 797 void RegisterFullScreenWaterfallModeChangeCallback(std::function<void(bool isWaterfallMode)>&& func); 798 void OnThrowSlipAnimationStateChange(bool isAnimating, bool isFullScreen); 799 void RegisterThrowSlipAnimationStateChangeCallback(std::function<void(bool isAnimating, bool isFullScreen)>&& func); 800 bool IsMissionHighlighted(); 801 bool IsPcFoldDevice(); 802 void MaskSupportEnterWaterfallMode(); 803 void SetSupportEnterWaterfallMode(bool isSupportEnter); 804 void ThrowSlipDirectly(ThrowSlipMode throwSlipMode, const WSRectF& velocity); 805 WSError GetWaterfallMode(bool& isWaterfallMode) override; 806 807 /* 808 * Keyboard 809 */ 810 void SetIsSystemKeyboard(bool isSystemKeyboard); 811 bool IsSystemKeyboard() const; 812 void ActivateKeyboardAvoidArea(bool active, bool recalculateAvoid); 813 bool IsKeyboardAvoidAreaActive() const; SetKeyboardEffectOptionChangeListener(const NotifyKeyboarEffectOptionChangeFunc & func)814 virtual void SetKeyboardEffectOptionChangeListener(const NotifyKeyboarEffectOptionChangeFunc& func) {}; 815 void GetKeyboardOccupiedAreaWithRotation( 816 int32_t persistentId, Rotation rotation, std::vector<std::pair<bool, WSRect>>& avoidAreas); 817 void NotifyKeyboardAnimationCompleted(bool isShowAnimation, const WSRect& beginRect, const WSRect& endRect); 818 void NotifyKeyboardAnimationWillBegin(bool isKeyboardShow, const WSRect& beginRect, const WSRect& endRect, 819 bool withAnimation, const std::shared_ptr<RSTransaction>& rsTransaction); 820 void NotifyKeyboardWillShowRegistered(bool registered) override; 821 void NotifyKeyboardWillHideRegistered(bool registered) override; 822 void NotifyKeyboardDidShowRegistered(bool registered) override; 823 void NotifyKeyboardDidHideRegistered(bool registered) override; 824 bool isSubWindowResizingOrMoving_ = false; CalculateOccupiedAreaAfterUIRefresh()825 virtual void CalculateOccupiedAreaAfterUIRefresh() {} 826 827 /* 828 * Window Focus 829 */ 830 bool IsSameMainSession(const sptr<SceneSession>& prevSession); 831 void SetHighlightChangeNotifyFunc(const NotifyHighlightChangeFunc& func); 832 void SetFollowParentRectFunc(NotifyFollowParentRectFunc&& func); 833 WSError SetFollowParentWindowLayoutEnabled(bool isFollow) override; 834 bool IsDelayFocusChange(); 835 836 /* 837 * Window Property 838 */ 839 void SetWindowCornerRadiusCallback(NotifySetWindowCornerRadiusFunc&& func); 840 WSError SetWindowCornerRadius(float cornerRadius) override; 841 void SetPrivacyModeChangeNotifyFunc(NotifyPrivacyModeChangeFunc&& func); 842 void SetIsAncoForFloatingWindow(bool isAncoForFloatingWindow); 843 bool GetIsAncoForFloatingWindow() const; 844 void SetWindowShadowsCallback(NotifySetWindowShadowsFunc&& func); 845 WSError SetWindowShadows(const ShadowsInfo& shadowsInfo) override; 846 virtual WSError GetTopNavDestinationName(std::string& topNavDestName); 847 void RegisterWindowShadowEnableChangeCallback(NotifyWindowShadowEnableChangeFunc&& callback); 848 void SetNotifyScreenshotAppEventRegisteredFunc(UpdateScreenshotAppEventRegisteredFunc&& func); 849 WMError UpdateScreenshotAppEventRegistered(int32_t persistentId, bool isRegister) override; 850 WMError UpdateAcrossDisplaysChangeRegistered(bool isRegister) override; 851 WMError IsMainWindowFullScreenAcrossDisplays(bool& isAcrossDisplays) override; GetIsRegisterAcrossMultiDisplayChanged()852 bool GetIsRegisterAcrossMultiDisplayChanged() const { return isRegisterAcrossDisplaysChanged_.load(); } 853 WMError NotifySubSessionAcrossDisplaysChange(bool isAcrossDisplays); 854 WMError NotifyFollowedParentWindowAcrossDisplaysChange(bool isAcrossDisplays); 855 void NotifySessionAcrossDisplaysChange(const sptr<SceneSession>& sceneSession, bool isAcrossDisplays); 856 857 /* 858 * Window Pattern 859 */ 860 void NotifyWindowAttachStateListenerRegistered(bool registered) override; 861 WMError NotifySnapshotUpdate() override; 862 863 /** 864 * Window Transition Animation For PC 865 */ 866 WSError SetWindowTransitionAnimation(WindowTransitionType transitionType, 867 const TransitionAnimation& animation) override; 868 void SetTransitionAnimationCallback(UpdateTransitionAnimationFunc&& func); 869 870 protected: 871 void NotifyIsCustomAnimationPlaying(bool isPlaying); 872 void SetMoveDragCallback(); 873 std::string GetRatioPreferenceKey(); 874 WSError NotifyClientToUpdateRectTask(const std::string& updateReason, std::shared_ptr<RSTransaction> rsTransaction); 875 bool CheckPermissionWithPropertyAnimation(const sptr<WindowSessionProperty>& property) const; 876 GetRectInfo(const WSRect & rect)877 std::string GetRectInfo(const WSRect& rect) 878 { 879 using std::to_string; 880 return "[" + to_string(rect.width_) + ", " + to_string(rect.height_) + "; " 881 + to_string(rect.posX_) + ", " + to_string(rect.posY_) + "]"; 882 } 883 884 /* 885 * Window Pipeline 886 */ 887 bool UpdateVisibilityInner(bool visibility) REQUIRES(SCENE_GUARD); NotifyClientToUpdateInteractive(bool interactive)888 virtual void NotifyClientToUpdateInteractive(bool interactive) {} 889 bool PipelineNeedNotifyClientToUpdateRect() const; 890 bool UpdateRectInner(const SessionUIParam& uiParam, SizeChangeReason reason); 891 bool NotifyServerToUpdateRect(const SessionUIParam& uiParam, SizeChangeReason reason); 892 bool UpdateScaleInner(float scaleX, float scaleY, float pivotX, float pivotY); 893 bool UpdateZOrderInner(uint32_t zOrder); 894 895 /* 896 * Window Immersive 897 */ 898 void CalculateAvoidAreaRect(const WSRect& rect, const WSRect& avoidRect, AvoidArea& avoidArea) const; 899 virtual void NotifyClientToUpdateAvoidArea(); 900 bool PipelineNeedNotifyClientToUpdateAvoidArea(uint32_t dirty) const; 901 NotifyNeedAvoidFunc onNeedAvoid_; 902 NotifySystemBarPropertyChangeFunc onSystemBarPropertyChange_; 903 GetStatusBarAvoidHeightFunc onGetStatusBarAvoidHeightFunc_; 904 GetStatusBarConstantlyShowFunc onGetStatusBarConstantlyShowFunc_; 905 void PrintAvoidAreaInfo(DisplayId displayId, 906 AvoidAreaType type, const WSRect& winRect, const WSRect& avoidRect) const; 907 void CalculateAvoidAreaByType(AvoidAreaType type, 908 const WSRect& winRect, const WSRect& avoidRect, AvoidArea& avoidArea); 909 910 /* 911 * Gesture Back 912 */ 913 void UpdateGestureBackEnabled() override; 914 915 sptr<SpecificSessionCallback> specificCallback_ = nullptr; 916 917 /* 918 * Dialog window 919 */ 920 NotifyBindDialogSessionFunc onBindDialogTarget_; 921 922 sptr<SceneSession> keyboardPanelSession_ = nullptr; 923 sptr<SceneSession> keyboardSession_ = nullptr; 924 NotifyKeyboardLayoutAdjustFunc adjustKeyboardLayoutFunc_; 925 926 /* 927 * Window Hierarchy 928 */ 929 NotifyMainWindowTopmostChangeFunc mainWindowTopmostChangeFunc_; 930 NotifyRaiseToTopFunc onRaiseToTop_; 931 NotifyRaiseAboveTargetFunc onRaiseAboveTarget_; 932 NotifySessionTopmostChangeFunc onSessionTopmostChange_; 933 NotifySubSessionZLevelChangeFunc onSubSessionZLevelChange_; 934 935 /* 936 * PC Window 937 */ 938 NotifyTitleAndDockHoverShowChangeFunc onTitleAndDockHoverShowChangeFunc_; 939 NotifyRestoreMainWindowFunc onRestoreMainWindowFunc_; 940 NotifySetWindowRectAutoSaveFunc onSetWindowRectAutoSaveFunc_; 941 NotifySubModalTypeChangeFunc onSubModalTypeChange_; 942 NotifyMainModalTypeChangeFunc onMainModalTypeChange_; 943 NotifySetSupportedWindowModesFunc onSetSupportedWindowModesFunc_; 944 NotifyUpdateFlagFunc onUpdateFlagFunc_; 945 NotifyUseImplicitAnimationChangeFunc useImplicitAnimationChangeFunc_; 946 947 /* 948 * PiP Window 949 */ 950 NotifyPrepareClosePiPSessionFunc onPrepareClosePiPSession_; 951 952 /* 953 * Window Layout 954 */ 955 NotifyDefaultDensityEnabledFunc onDefaultDensityEnabledFunc_; 956 sptr<MoveDragController> moveDragController_ = nullptr; 957 std::mutex displayIdSetDuringMoveToMutex_; 958 std::set<uint64_t> displayIdSetDuringMoveTo_; 959 NotifyFollowParentRectFunc followParentRectFunc_ = nullptr; 960 std::mutex registerNotifySurfaceBoundsChangeMutex_; 961 std::unordered_map<int32_t, NotifySurfaceBoundsChangeFunc> notifySurfaceBoundsChangeFuncMap_; 962 bool isFollowParentLayout_ = false; 963 NotifyWindowAnchorInfoChangeFunc onWindowAnchorInfoChangeFunc_ = nullptr; 964 WindowAnchorInfo windowAnchorInfo_; 965 int32_t cloneNodeCount_ = 0; 966 967 virtual void NotifySubSessionRectChangeByAnchor(const WSRect& parentRect, 968 SizeChangeReason reason = SizeChangeReason::UNDEFINED, DisplayId displayId = DISPLAY_ID_INVALID) {} 969 virtual void UpdateSessionRectInner(const WSRect& rect, SizeChangeReason reason, 970 const MoveConfiguration& moveConfiguration, const RectAnimationConfig& rectAnimationConfig = {}); 971 void NotifySessionDisplayIdChange(uint64_t displayId); 972 virtual void CheckAndMoveDisplayIdRecursively(uint64_t displayId); SetShouldFollowParentWhenShow(bool shouldFollow)973 void SetShouldFollowParentWhenShow(bool shouldFollow) { shouldFollowParentWhenShow_ = shouldFollow; } GetShouldFollowParentWhenShow()974 bool GetShouldFollowParentWhenShow() const { return shouldFollowParentWhenShow_; } 975 void CheckSubSessionShouldFollowParent(uint64_t displayId); 976 bool IsNeedConvertToRelativeRect(SizeChangeReason reason = SizeChangeReason::UNDEFINED) const override; SetRequestMoveConfiguration(const MoveConfiguration & config)977 void SetRequestMoveConfiguration(const MoveConfiguration& config) { requestMoveConfiguration_ = config; } GetRequestMoveConfiguration()978 MoveConfiguration GetRequestMoveConfiguration() const { return requestMoveConfiguration_; } 979 SubWindowSource subWindowSource_ = SubWindowSource::SUB_WINDOW_SOURCE_UNKNOWN; 980 NotifySetSubWindowSourceFunc subWindowSourceFunc_ = nullptr; 981 982 /* 983 * Floating Ball Window 984 */ NotifyUpdateFloatingBall(const FloatingBallTemplateInfo & fbTemplateInfo)985 virtual void NotifyUpdateFloatingBall(const FloatingBallTemplateInfo& fbTemplateInfo) {}; NotifyStopFloatingBall()986 virtual void NotifyStopFloatingBall() {}; NotifyRestoreFloatingBallMainWindow(const std::shared_ptr<AAFwk::Want> & want)987 virtual void NotifyRestoreFloatingBallMainWindow(const std::shared_ptr<AAFwk::Want>& want) {}; 988 uint64_t fbClickTime_ = 0; 989 std::mutex fbClickMutex_; 990 FloatingBallTemplateInfo fbTemplateInfo_ = {}; 991 992 /* 993 * Window Lifecycle 994 */ 995 bool isAppUseControl_ = false; 996 NotifyShowWhenLockedFunc onShowWhenLockedFunc_; 997 NotifyForceHideChangeFunc onForceHideChangeFunc_; 998 ClearCallbackMapFunc clearCallbackMapFunc_; 999 UpdateAppUseControlFunc onUpdateAppUseControlFunc_; 1000 std::unordered_map<ControlAppType, ControlInfo> appUseControlMap_; 1001 GetAllAppUseControlMapFunc onGetAllAppUseControlMapFunc_; 1002 1003 /* 1004 * PC Fold Screen 1005 */ 1006 bool IsFullScreenWaterfallMode(); 1007 void SetFullScreenWaterfallMode(bool isFullScreenWaterfallMode); 1008 void UpdateWaterfallMode(SessionEvent event); 1009 sptr<PcFoldScreenController> pcFoldScreenController_ = nullptr; 1010 std::atomic<uint32_t> throwSlipToFullScreenAnimCount_ = 0; 1011 std::function<void(bool isAnimating, bool isFullScreen)> onThrowSlipAnimationStateChangeFunc_; 1012 1013 /* 1014 * Compatible Mode 1015 */ 1016 void HookStartMoveRect(WSRect& newRect, const WSRect& sessionRect); 1017 1018 /* 1019 * UIExtension 1020 */ 1021 static GetConstrainedModalExtWindowInfoFunc onGetConstrainedModalExtWindowInfoFunc_; 1022 1023 /* 1024 * Multi Window 1025 */ 1026 NotifyLandscapeMultiWindowSessionFunc onSetLandscapeMultiWindowFunc_; 1027 1028 /* 1029 * Keyboard 1030 */ EnableCallingSessionAvoidArea()1031 virtual void EnableCallingSessionAvoidArea() {} RestoreCallingSession(uint32_t callingId,const std::shared_ptr<RSTransaction> & rsTransaction)1032 virtual void RestoreCallingSession(uint32_t callingId, const std::shared_ptr<RSTransaction>& rsTransaction) {} 1033 bool keyboardAvoidAreaActive_ = true; 1034 1035 private: 1036 void NotifyAccessibilityVisibilityChange(); 1037 void CalculateCombinedExtWindowFlags(); 1038 1039 /* 1040 * Window Immersive 1041 */ 1042 void SetSystemBarPropertyForRotation(const std::map<WindowType, SystemBarProperty>& properties); 1043 std::map<Rosen::WindowType, Rosen::SystemBarProperty>& GetSystemBarPropertyForRotation(); 1044 void GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea); 1045 void GetCutoutAvoidArea(WSRect& rect, AvoidArea& avoidArea); 1046 void GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea); 1047 void GetAINavigationBarArea(WSRect& rect, AvoidArea& avoidArea); 1048 AvoidArea GetAvoidAreaByTypeInner(AvoidAreaType type, const WSRect& rect = WSRect::EMPTY_RECT); 1049 WSError GetAvoidAreasByRotation(Rotation rotation, const WSRect& rect, 1050 const std::map<WindowType, SystemBarProperty>& properties, std::map<AvoidAreaType, AvoidArea>& avoidAreas); 1051 void GetSystemBarAvoidAreaByRotation(Rotation rotation, AvoidAreaType type, const WSRect& rect, 1052 const std::map<WindowType, SystemBarProperty>& properties, AvoidArea& avoidArea); 1053 void GetCutoutAvoidAreaByRotation(Rotation rotation, const WSRect& rect, AvoidArea& avoidArea); 1054 void GetKeyboardAvoidAreaByRotation(Rotation rotation, const WSRect& rect, AvoidArea& avoidArea); 1055 AvoidArea GetAvoidAreaByRotation(Rotation rotation, const WSRect& rect, 1056 const std::map<WindowType, SystemBarProperty>& properties, AvoidAreaType type); 1057 1058 /* 1059 * Window Lifecycle 1060 */ 1061 NotifySceneSessionDestructFunc notifySceneSessionDestructFunc_; 1062 bool CheckIdentityTokenIfMatched(const std::string& identityToken); 1063 bool CheckPidIfMatched(); 1064 GetStartWindowTypeFunc getStartWindowConfigFunc_; 1065 StartWindowType startWindowType_ = StartWindowType::DEFAULT; 1066 1067 // session lifecycle funcs 1068 WSError ForegroundTask(const sptr<WindowSessionProperty>& property); 1069 1070 /* 1071 * Move Drag 1072 */ 1073 virtual void HandleMoveDragSurfaceNode(SizeChangeReason reason); 1074 void OnMoveDragCallback(SizeChangeReason reason); 1075 bool DragResizeWhenEndFilter(SizeChangeReason reason); 1076 void HandleMoveDragEvent(SizeChangeReason reason); 1077 bool IsDragResizeScale(SizeChangeReason reason); 1078 void InitializeCrossMoveDrag(); 1079 WSError InitializeMoveInputBar(); 1080 void HandleMoveDragSurfaceBounds(WSRect& rect, WSRect& globalRect, SizeChangeReason reason); 1081 void HandleMoveDragEnd(WSRect& rect, SizeChangeReason reason); 1082 void WindowScaleTransfer(WSRect& rect, float scaleX, float scaleY); 1083 bool IsCompatibilityModeScale(float scaleX, float scaleY); 1084 void CompatibilityModeWindowScaleTransfer(WSRect& rect, bool isScale); 1085 void ThrowSlipToFullScreen(WSRect& endRect, WSRect& rect); 1086 bool MoveUnderInteriaAndNotifyRectChange(WSRect& rect, SizeChangeReason reason); 1087 void NotifyFullScreenAfterThrowSlip(const WSRect& rect); SetDragResizeTypeDuringDrag(DragResizeType dragResizeType)1088 void SetDragResizeTypeDuringDrag(DragResizeType dragResizeType) { dragResizeTypeDuringDrag_ = dragResizeType; } GetDragResizeTypeDuringDrag()1089 DragResizeType GetDragResizeTypeDuringDrag() const { return dragResizeTypeDuringDrag_; } 1090 void HandleSessionDragEvent(SessionEvent event); 1091 NotifySessionEventFunc onSessionEvent_; 1092 void ProcessWindowMoving(const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 1093 void HandleSubSessionCrossNode(SizeChangeReason reason); 1094 1095 /* 1096 * Gesture Back 1097 */ 1098 WMError SetGestureBackEnabled(bool isEnabled) override; 1099 1100 /* 1101 * UIExtension 1102 */ 1103 void UpdateAllModalUIExtensions(const WSRect& globalRect); 1104 1105 /* 1106 * Window Property 1107 */ 1108 NotifyWindowShadowEnableChangeFunc onWindowShadowEnableChangeFunc_; 1109 void NotifyPrivacyModeChange(); 1110 1111 #ifdef DEVICE_STATUS_ENABLE 1112 void RotateDragWindow(std::shared_ptr<RSTransaction> rsTransaction); 1113 #endif // DEVICE_STATUS_ENABLE 1114 void NotifyPropertyWhenConnect(); 1115 WSError RaiseAppMainWindowToTop() override; 1116 void UpdateWinRectForSystemBar(WSRect& rect); 1117 bool IsMovableWindowType() const; 1118 bool IsFullScreenMovable() const; 1119 void HandleCastScreenConnection(SessionInfo& info, sptr<SceneSession> session); 1120 WMError HandleUpdatePropertyByAction(const sptr<WindowSessionProperty>& property, 1121 WSPropertyChangeAction action); 1122 WMError HandleActionUpdateTurnScreenOn(const sptr<WindowSessionProperty>& property, 1123 WSPropertyChangeAction action); 1124 WMError HandleActionUpdateKeepScreenOn(const sptr<WindowSessionProperty>& property, 1125 WSPropertyChangeAction action); 1126 WMError HandleActionUpdateViewKeepScreenOn(const sptr<WindowSessionProperty>& property, 1127 WSPropertyChangeAction action); 1128 WMError HandleActionUpdateFocusable(const sptr<WindowSessionProperty>& property, 1129 WSPropertyChangeAction action); 1130 WMError HandleActionUpdateTouchable(const sptr<WindowSessionProperty>& property, 1131 WSPropertyChangeAction action); 1132 WMError HandleActionUpdateSetBrightness(const sptr<WindowSessionProperty>& property, 1133 WSPropertyChangeAction action); 1134 WMError HandleActionUpdateOrientation(const sptr<WindowSessionProperty>& property, 1135 WSPropertyChangeAction action); 1136 WMError HandleActionUpdatePrivacyMode(const sptr<WindowSessionProperty>& property, 1137 WSPropertyChangeAction action); 1138 WMError HandleActionUpdateSnapshotSkip(const sptr<WindowSessionProperty>& property, 1139 WSPropertyChangeAction action); 1140 WMError HandleActionUpdateMaximizeState(const sptr<WindowSessionProperty>& property, 1141 WSPropertyChangeAction action); 1142 WMError HandleActionUpdateOtherProps(const sptr<WindowSessionProperty>& property, 1143 WSPropertyChangeAction action); 1144 WMError HandleActionUpdateStatusProps(const sptr<WindowSessionProperty>& property, 1145 WSPropertyChangeAction action); 1146 WMError HandleActionUpdateNavigationProps(const sptr<WindowSessionProperty>& property, 1147 WSPropertyChangeAction action); 1148 WMError HandleActionUpdateNavigationIndicatorProps(const sptr<WindowSessionProperty>& property, 1149 WSPropertyChangeAction action); 1150 WMError HandleActionUpdateFlags(const sptr<WindowSessionProperty>& property, 1151 WSPropertyChangeAction action); 1152 WMError HandleActionUpdateMode(const sptr<WindowSessionProperty>& property, 1153 WSPropertyChangeAction action); 1154 WMError HandleActionUpdateAnimationFlag(const sptr<WindowSessionProperty>& property, 1155 WSPropertyChangeAction action); 1156 WMError HandleActionUpdateTouchHotArea(const sptr<WindowSessionProperty>& property, 1157 WSPropertyChangeAction action); 1158 WMError HandleActionUpdateKeyboardTouchHotArea(const sptr<WindowSessionProperty>& property, 1159 WSPropertyChangeAction action); 1160 WMError HandleActionUpdateDecorEnable(const sptr<WindowSessionProperty>& property, 1161 WSPropertyChangeAction action); 1162 WMError HandleActionUpdateWindowLimits(const sptr<WindowSessionProperty>& property, 1163 WSPropertyChangeAction action); 1164 WMError HandleActionUpdateDragenabled(const sptr<WindowSessionProperty>& property, 1165 WSPropertyChangeAction action); 1166 WMError HandleActionUpdateRaiseenabled(const sptr<WindowSessionProperty>& property, 1167 WSPropertyChangeAction action); 1168 WMError HandleActionUpdateHideNonSystemFloatingWindows(const sptr<WindowSessionProperty>& property, 1169 WSPropertyChangeAction action); 1170 WMError HandleActionUpdateTextfieldAvoidInfo(const sptr<WindowSessionProperty>& property, 1171 WSPropertyChangeAction action); 1172 WMError HandleActionUpdateWindowMask(const sptr<WindowSessionProperty>& property, 1173 WSPropertyChangeAction action); 1174 WMError HandleActionUpdateTopmost(const sptr<WindowSessionProperty>& property, 1175 WSPropertyChangeAction action); 1176 WMError HandleActionUpdateMainWindowTopmost(const sptr<WindowSessionProperty>& property, 1177 WSPropertyChangeAction action); 1178 WMError HandleActionUpdateSubWindowZLevel(const sptr<WindowSessionProperty>& property, 1179 WSPropertyChangeAction action); 1180 WMError HandleActionUpdateWindowModeSupportType(const sptr<WindowSessionProperty>& property, 1181 WSPropertyChangeAction action); 1182 WMError ProcessUpdatePropertyByAction(const sptr<WindowSessionProperty>& property, 1183 WSPropertyChangeAction action); 1184 WMError HandleActionUpdateAvoidAreaOption(const sptr<WindowSessionProperty>& property, 1185 WSPropertyChangeAction action); 1186 WMError HandleBackgroundAlpha(const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action); 1187 WMError HandleActionUpdateExclusivelyHighlighted(const sptr<WindowSessionProperty>& property, 1188 WSPropertyChangeAction action); 1189 WMError HandleActionUpdateFollowScreenChange(const sptr<WindowSessionProperty>& property, 1190 WSPropertyChangeAction action); 1191 WMError HandleActionUpdateWindowShadowEnabled(const sptr<WindowSessionProperty>& property, 1192 WSPropertyChangeAction action); 1193 void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property); 1194 void SetWindowFlags(const sptr<WindowSessionProperty>& property); 1195 void NotifySessionChangeByActionNotifyManager(const sptr<WindowSessionProperty>& property, 1196 WSPropertyChangeAction action); 1197 void NotifyExtensionSecureLimitChange(bool isLimit); 1198 1199 // window animation 1200 WSError SetFrameRectForPartialZoomInInner(const Rect& frameRect); 1201 1202 /* 1203 * PiP Window 1204 */ 1205 NotifySessionPiPControlStatusChangeFunc sessionPiPControlStatusChangeFunc_; 1206 NotifyAutoStartPiPStatusChangeFunc autoStartPiPStatusChangeFunc_; 1207 NotifyUpdatePiPTemplateInfoFunc updatePiPTemplateInfoCallbackFunc_; 1208 PiPTemplateInfo pipTemplateInfo_ = {}; 1209 1210 NotifyForceSplitFunc forceSplitFunc_; 1211 UpdatePrivateStateAndNotifyFunc updatePrivateStateAndNotifyFunc_; 1212 int32_t collaboratorType_ = CollaboratorType::DEFAULT_TYPE; 1213 WSRect lastSafeRect = { 0, 0, 0, 0 }; 1214 std::vector<sptr<SceneSession>> subSession_; 1215 std::vector<sptr<SceneSession>> toastSession_; 1216 std::atomic_bool needStartingWindowExitAnimation_ { true }; 1217 bool needDefaultAnimationFlag_ = true; 1218 bool isFollowScreenChange_ = false; 1219 SessionEventParam sessionEventParam_ = { 0, 0, 0, 0, 0 }; 1220 std::atomic_bool isStartMoving_ { false }; 1221 std::atomic_bool isVisibleForAccessibility_ { true }; 1222 bool isSystemSpecificSession_ { false }; 1223 1224 /* 1225 * UIExtension 1226 */ 1227 std::atomic_bool shouldHideNonSecureWindows_ { false }; 1228 ExtensionWindowFlags combinedExtWindowFlags_ { 0 }; 1229 std::map<int32_t, ExtensionWindowFlags> extWindowFlagsMap_; 1230 std::vector<UIExtensionTokenInfo> extensionTokenInfos_; 1231 1232 /* 1233 * Window Layout 1234 */ 1235 GetHookWindowInfoFunc getHookWindowInfoFunc_ = nullptr; 1236 bool SaveAspectRatio(float ratio); 1237 WSError UpdateRectForDrag(const WSRect& rect); 1238 void UpdateSessionRectPosYFromClient(SizeChangeReason reason, DisplayId& configDisplayId, WSRect& rect); 1239 void HandleSubSessionSurfaceNode(bool isAdd, DisplayId draggingOrMovingParentDisplayId); HandleSubSessionSurfaceNodeByWindowAnchor(SizeChangeReason reason,const sptr<ScreenSession> & screenSession)1240 virtual void HandleSubSessionSurfaceNodeByWindowAnchor(SizeChangeReason reason, 1241 const sptr<ScreenSession>& screenSession) {} AddSurfaceNodeToScreen(DisplayId draggingOrMovingParentDisplayId)1242 virtual void AddSurfaceNodeToScreen(DisplayId draggingOrMovingParentDisplayId) {} RemoveSurfaceNodeFromScreen()1243 virtual void RemoveSurfaceNodeFromScreen() {} 1244 void SetParentRect(); 1245 WSRect GetGlobalOrWinRect(); 1246 1247 /* 1248 * Window Decor 1249 */ 1250 mutable std::mutex customDecorHeightMutex_; 1251 int32_t customDecorHeight_ = 0; 1252 1253 ForceHideState forceHideState_ { ForceHideState::NOT_HIDDEN }; 1254 int32_t oriPosYBeforeRaisedByKeyboard_ = 0; 1255 std::atomic_bool isTemporarilyShowWhenLocked_ { false }; 1256 std::shared_mutex modalUIExtensionInfoListMutex_; 1257 std::vector<ExtensionWindowEventInfo> modalUIExtensionInfoList_; 1258 mutable std::shared_mutex uiExtNodeIdToPersistentIdMapMutex_; 1259 std::map<uint64_t, int32_t> uiExtNodeIdToPersistentIdMap_; 1260 std::string clientIdentityToken_ = { "" }; 1261 SessionChangeByActionNotifyManagerFunc sessionChangeByActionNotifyManagerFunc_; 1262 1263 bool isAddBlank_ = false; 1264 bool bufferAvailableCallbackEnable_ = false; 1265 1266 // WMSPipeline-related: only accessed on SSM thread 1267 PostProcessFocusState postProcessFocusState_; 1268 bool postProcessProperty_ { false }; 1269 1270 /* 1271 * Window Recover 1272 */ 1273 bool isRecovered_ = false; 1274 1275 /* 1276 * Multi User 1277 */ 1278 bool isMinimizedByUserSwitch_ { false }; 1279 1280 /* 1281 * Window ZOrder: PC 1282 */ 1283 bool isPcScenePanel_ { false }; 1284 1285 /* 1286 * Move Drag 1287 */ 1288 static std::shared_mutex windowDragHotAreaMutex_; 1289 static std::map<uint64_t, std::map<uint32_t, WSRect>> windowDragHotAreaMap_; 1290 DragResizeType appDragResizeType_ = DragResizeType::RESIZE_TYPE_UNDEFINED; 1291 DragResizeType dragResizeTypeDuringDrag_ = DragResizeType::RESIZE_TYPE_UNDEFINED; 1292 NotifyWindowMovingFunc notifyWindowMovingFunc_; 1293 // KeyFrame 1294 void UpdateKeyFrameState(SizeChangeReason reason, const WSRect& rect); 1295 void InitKeyFrameState(const WSRect& rect); 1296 void RequestKeyFrameNextVsync(uint64_t requestStamp, uint64_t count); 1297 void OnKeyFrameNextVsync(uint64_t count); 1298 bool KeyFrameNotifyFilter(const WSRect& rect, SizeChangeReason reason); 1299 bool KeyFrameRectAlmostSame(const WSRect& rect1, const WSRect& rect2); 1300 KeyFramePolicy keyFramePolicy_; 1301 std::shared_ptr<RSCanvasNode> keyFrameCloneNode_ = nullptr; 1302 bool keyFrameAnimating_ = false; 1303 uint64_t lastKeyFrameStamp_ = 0; 1304 WSRect lastKeyFrameRect_; 1305 uint64_t keyFrameVsyncRequestStamp_ = 0; 1306 uint64_t lastKeyFrameDragStamp_ = 0; 1307 WSRect lastKeyFrameDragRect_; 1308 bool keyFrameDragPauseNoticed_ = false; 1309 1310 /* 1311 * Gesture Back 1312 */ 1313 bool isEnableGestureBack_ { true }; 1314 bool isEnableGestureBackHadSet_ { false }; 1315 1316 /* 1317 * Window Visibility 1318 */ 1319 NotifyVisibleChangeFunc notifyVisibleChangeFunc_; 1320 1321 /* 1322 * Window Input Event 1323 */ 1324 NotifyTouchOutsideFunc onTouchOutside_; 1325 bool isMousePointerDownEventStatus_ { false }; 1326 std::unordered_set<int32_t> fingerPointerDownStatusList_; 1327 1328 /* 1329 * Window Rotation 1330 */ 1331 NotifyReqOrientationChangeFunc onRequestedOrientationChange_; 1332 NotifyRotationChangeFunc onUpdateRotationChangeFunc_; 1333 bool GetFollowScreenChange() const; 1334 void SetFollowScreenChange(bool isFollowScreenChange); 1335 1336 /* 1337 * Window Animation 1338 */ 1339 NotifyIsCustomAnimationPlayingCallback onIsCustomAnimationPlaying_; 1340 NotifyWindowAnimationFlagChangeFunc onWindowAnimationFlagChange_; 1341 NotifyAnimateToFunc onAnimateTo_; 1342 bool isUIFirstEnabled_ = false; 1343 1344 /* 1345 * Window Layout 1346 */ 1347 void SetSurfaceBoundsWithAnimation( 1348 const std::pair<RSAnimationTimingProtocol, RSAnimationTimingCurve>& animationParam, 1349 const WSRect& rect, const std::function<void()>& finishCallback = nullptr, bool isGlobal = false); 1350 virtual void UpdateCrossAxisOfLayout(const WSRect& rect); 1351 NotifyLayoutFullScreenChangeFunc onLayoutFullScreenChangeFunc_; 1352 WSRect requestRectWhenFollowParent_; 1353 MoveConfiguration requestMoveConfiguration_; NotifySubAndDialogFollowRectChange(const WSRect & rect,bool isGlobal,bool needFlush)1354 virtual void NotifySubAndDialogFollowRectChange(const WSRect& rect, bool isGlobal, bool needFlush) {}; SetSubWindowBoundsDuringCross(const WSRect & parentRect,bool isGlobal,bool needFlush)1355 virtual void SetSubWindowBoundsDuringCross(const WSRect& parentRect, bool isGlobal, bool needFlush) {} 1356 std::atomic<bool> shouldFollowParentWhenShow_ = true; 1357 bool isDragging_ = false; 1358 std::atomic<bool> isCrossAxisOfLayout_ = false; 1359 std::atomic<uint32_t> crossAxisState_ = 0; 1360 1361 /* 1362 * Window Immersive 1363 */ 1364 std::map<Rosen::WindowType, Rosen::SystemBarProperty> targetSystemBarProperty_; 1365 std::atomic_bool isDisplayStatusBarTemporarily_ { false }; 1366 bool isStatusBarVisible_ = true; 1367 IsLastFrameLayoutFinishedFunc isLastFrameLayoutFinishedFunc_; 1368 IsAINavigationBarAvoidAreaValidFunc isAINavigationBarAvoidAreaValid_; 1369 std::unordered_map<AvoidAreaType, std::tuple<DisplayId, WSRect, WSRect>> lastAvoidAreaInputParamtersMap_; 1370 1371 /* 1372 * PC Window Layout 1373 */ 1374 bool isLayoutFullScreen_ { false }; 1375 bool isDefaultDensityEnabled_ = false; 1376 1377 /** 1378 * Window pattern 1379 */ 1380 void NotifyAddOrRemoveSnapshotWindow(bool interactive); 1381 1382 /* 1383 * Window Property 1384 */ 1385 std::unordered_set<std::string> containerColorList_; 1386 NotifySetWindowCornerRadiusFunc onSetWindowCornerRadiusFunc_; 1387 NotifyPrivacyModeChangeFunc privacyModeChangeNotifyFunc_; 1388 // Set true if either sessionProperty privacyMode or combinedExtWindowFlags_ privacyModeFlag is true. 1389 bool isPrivacyMode_ { false }; 1390 bool isAncoForFloatingWindow_ = false; 1391 bool subWindowOutlineEnabled_ = false; 1392 std::atomic_bool isRegisterAcrossDisplaysChanged_ = false; 1393 NotifySetWindowShadowsFunc onSetWindowShadowsFunc_; 1394 UpdateScreenshotAppEventRegisteredFunc updateScreenshotAppEventRegisteredFunc_; 1395 1396 /* 1397 * PC Window Sidebar Blur 1398 */ 1399 std::shared_ptr<Rosen::RSAnimatableProperty<float>> blurRadiusValue_; 1400 std::shared_ptr<Rosen::RSAnimatableProperty<float>> blurSaturationValue_; 1401 std::shared_ptr<Rosen::RSAnimatableProperty<float>> blurBrightnessValue_; 1402 std::shared_ptr<Rosen::RSAnimatableProperty<Rosen::RSColor>> blurMaskColorValue_; 1403 1404 /* 1405 * Window Lifecycle 1406 */ 1407 NotifyHookSceneSessionActivationFunc hookSceneSessionActivationFunc_; 1408 bool isUserRequestedExit_ = false; 1409 1410 /** 1411 * Window Transition Animation For PC 1412 */ 1413 UpdateTransitionAnimationFunc updateTransitionAnimationFunc_; 1414 }; 1415 } // namespace OHOS::Rosen 1416 #endif // OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H 1417