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_SESSION_IMPL_H 17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_IMPL_H 18 19 #include "window_session_impl.h" 20 #include "window_manager.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 using NotifyWindowRecoverStateChangeFunc = std::function<void(bool isSpecificSession, 25 const WindowRecoverState& state)>; 26 27 class WindowSceneSessionImpl : public WindowSessionImpl { 28 public: 29 explicit WindowSceneSessionImpl(const sptr<WindowOption>& option); 30 ~WindowSceneSessionImpl(); 31 WMError Create(const std::shared_ptr<AbilityRuntime::Context>& context, 32 const sptr<Rosen::ISession>& iSession, const std::string& identityToken = "", 33 bool isModuleAbilityHookEnd = false) override; 34 WMError Show(uint32_t reason = 0, bool withAnimation = false, bool withFocus = true) override; 35 WMError Show(uint32_t reason, bool withAnimation, bool withFocus, bool waitAttach) override; 36 WMError ShowKeyboard(KeyboardEffectOption effectOption) override; 37 WMError Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits) override; 38 WMError Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits, bool waitDetach) override; 39 WMError Destroy(bool needNotifyServer, bool needClearListener = true, uint32_t reason = 0) override; 40 WMError DestroyHookWindow(); 41 WMError NotifyDrawingCompleted() override; 42 WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) override; 43 void PreProcessCreate(); 44 void SetDefaultProperty(); 45 WMError Minimize() override; 46 void StartMove() override; 47 bool IsStartMoving() override; 48 WindowMode GetWindowMode() const override; 49 WMError SetHookTargetElementInfo(const AppExecFwk::ElementName& elementName) override; 50 51 /* 52 * Window Layout 53 */ 54 WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false, 55 MoveConfiguration moveConfiguration = {}) override; 56 WMError MoveToAsync(int32_t x, int32_t y, MoveConfiguration moveConfiguration = {}) override; 57 WMError MoveWindowToGlobal(int32_t x, int32_t y, MoveConfiguration moveConfiguration = {}) override; 58 WMError MoveWindowToGlobalDisplay(int32_t x, int32_t y, MoveConfiguration moveConfiguration = {}) override; 59 WMError GetGlobalScaledRect(Rect& globalScaledRect) override; 60 WMError Resize(uint32_t width, uint32_t height, 61 const RectAnimationConfig& rectAnimationConfig = {}) override; 62 WMError ResizeAsync(uint32_t width, uint32_t height, 63 const RectAnimationConfig& rectAnimationConfig = {}) override; 64 WMError SetWindowAnchorInfo(const WindowAnchorInfo& windowAnchorInfo) override; 65 WMError SetFollowParentWindowLayoutEnabled(bool isFollow) override; 66 WSError NotifyLayoutFinishAfterWindowModeChange(WindowMode mode) override; 67 WMError SetFrameRectForPartialZoomIn(const Rect& frameRect) override; 68 WMError UpdateWindowModeForUITest(int32_t updateMode) override; 69 WSError NotifyAppHookWindowInfoUpdated() override; 70 71 /* 72 * Window Hierarchy 73 */ 74 WMError RaiseToAppTop() override; 75 WMError RaiseAboveTarget(int32_t subWindowId) override; 76 WMError SetSubWindowZLevel(int32_t zLevel) override; 77 WMError GetSubWindowZLevel(int32_t& zLevel) override; 78 WMError RaiseMainWindowAboveTarget(int32_t targetId) override; 79 80 void PerformBack() override; 81 WMError SetAspectRatio(float ratio) override; 82 WMError ResetAspectRatio() override; 83 WMError SetGlobalMaximizeMode(MaximizeMode mode) override; 84 MaximizeMode GetGlobalMaximizeMode() const override; 85 86 WMError BindDialogTarget(sptr<IRemoteObject> targetToken) override; 87 WMError SetDialogBackGestureEnabled(bool isEnabled) override; 88 WMError GetWindowLimits(WindowLimits& windowLimits) override; 89 WMError SetWindowLimits(WindowLimits& windowLimits, bool isForce) override; 90 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 91 const std::vector<std::shared_ptr<AbilityRuntime::Context>>& ignoreWindowContexts = {}); 92 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 93 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 94 static sptr<Window> GetMainWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 95 static sptr<WindowSessionImpl> GetMainWindowWithId(uint32_t mainWinId); 96 // only main window, sub window, dialog window can use 97 static int32_t GetParentMainWindowId(int32_t windowId); 98 static WMError GetAndVerifyWindowTypeForArkUI(uint32_t parentId, const std::string& windowName, 99 WindowType parentWindowType, WindowType& windowType); 100 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) override; 101 void UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 102 const std::shared_ptr<Global::Resource::ResourceManager>& resourceManager) override; 103 WMError NotifyMemoryLevel(int32_t level) override; 104 105 virtual WMError AddWindowFlag(WindowFlag flag) override; 106 virtual WMError RemoveWindowFlag(WindowFlag flag) override; 107 virtual WMError SetWindowFlags(uint32_t flags) override; 108 virtual uint32_t GetWindowFlags() const override; 109 110 virtual WMError SetTransparent(bool isTransparent) override; 111 virtual WMError SetTurnScreenOn(bool turnScreenOn) override; 112 virtual WMError SetKeepScreenOn(bool keepScreenOn) override; 113 virtual WMError SetViewKeepScreenOn(bool keepScreenOn) override; 114 virtual WMError SetWindowShadowEnabled(bool isEnabled) override; 115 virtual WMError SetPrivacyMode(bool isPrivacyMode) override; 116 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) override; 117 virtual WMError SetSnapshotSkip(bool isSkip) override; 118 virtual std::shared_ptr<Media::PixelMap> Snapshot() override; 119 WMError Snapshot(std::shared_ptr<Media::PixelMap>& pixelMap) override; 120 WMError SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap>& pixelMap) override; 121 WMError SetTouchHotAreas(const std::vector<Rect>& rects) override; 122 WMError SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas& hotAreas) override; 123 virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) override; 124 virtual WMError SetCallingWindow(uint32_t callingSessionId) override; 125 WMError ChangeKeyboardEffectOption(KeyboardEffectOption effectOption) override; 126 127 virtual bool IsTransparent() const override; 128 virtual bool IsTurnScreenOn() const override; 129 virtual bool IsKeepScreenOn() const override; 130 virtual bool IsViewKeepScreenOn() const override; 131 virtual bool GetWindowShadowEnabled() const override; 132 virtual bool IsPrivacyMode() const override; 133 virtual bool IsLayoutFullScreen() const override; 134 virtual bool IsFullScreen() const override; 135 WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) override; 136 void SetNeedDefaultAnimation(bool needDefaultAnimation) override; 137 WMError SetTransform(const Transform& trans) override; 138 const Transform& GetTransform() const override; 139 WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) override; 140 WMError SetAlpha(float alpha) override; 141 void DumpSessionElementInfo(const std::vector<std::string>& params) override; 142 WSError UpdateWindowMode(WindowMode mode) override; 143 WSError GetTopNavDestinationName(std::string& topNavDestName) override; 144 WSError UpdateTitleInTargetPos(bool isShow, int32_t height) override; 145 void NotifySessionForeground(uint32_t reason, bool withAnimation) override; 146 void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) override; 147 WMError NotifyPrepareClosePiPWindow() override; 148 void UpdateSubWindowState(const WindowType& type, bool waitDetach = false); 149 WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties, 150 const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) override; 151 WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) override; 152 WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override; 153 WMError SetSystemBarPropertyForPage(WindowType type, std::optional<SystemBarProperty> property) override; 154 void GetSystemBarPropertyForPage(const std::map<WindowType, SystemBarProperty>& properties, 155 std::map<WindowType, SystemBarProperty>& pageProperties); 156 void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override; 157 bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override; 158 WSError NotifyDialogStateChange(bool isForeground) override; 159 WMError SetDefaultDensityEnabled(bool enabled) override; 160 bool GetDefaultDensityEnabled() override; 161 WMError HideNonSecureWindows(bool shouldHide) override; 162 void UpdateDensity() override; 163 WSError UpdateOrientation() override; 164 WMError GetTargetOrientationConfigInfo(Orientation targetOrientation, 165 const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties, Ace::ViewportConfig& config, 166 std::map<AvoidAreaType, AvoidArea>& avoidAreas) override; 167 WSError NotifyTargetRotationInfo(OrientationInfo& info) override; 168 WSError UpdateDisplayId(uint64_t displayId) override; 169 WMError AdjustKeyboardLayout(const KeyboardLayoutParams params) override; 170 WMError CheckAndModifyWindowRect(uint32_t& width, uint32_t& height) override; 171 WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override; 172 WSError NotifyAppForceLandscapeConfigUpdated() override; 173 174 /* 175 * Sub Window 176 */ 177 WMError SetParentWindow(int32_t newParentWindowId) override; 178 WMError GetParentWindow(sptr<Window>& parentWindow) override; 179 180 /* 181 * PC Window 182 */ 183 WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) override; 184 WMError SetFollowParentMultiScreenPolicy(bool enabled) override; 185 WMError UseImplicitAnimation(bool useImplicit) override; 186 187 /* 188 * PC Window Layout 189 */ 190 WMError Restore() override; 191 WMError SetTitleAndDockHoverShown(bool isTitleHoverShown = true, 192 bool isDockHoverShown = true) override; 193 WMError SetWindowRectAutoSave(bool enabled, bool isSaveBySpecifiedFlag = false) override; 194 WMError IsWindowRectAutoSave(bool& enabled) override; 195 WMError MaximizeFloating() override; 196 WMError MaximizeForCompatibleMode(); 197 WMError RecoverForCompatibleMode(); 198 WMError Maximize() override; 199 WMError Maximize(MaximizePresentation presentation) override; 200 WMError Recover() override; 201 WMError Recover(uint32_t reason) override; 202 WSError UpdateMaximizeMode(MaximizeMode mode) override; 203 WMError SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes, 204 bool grayOutMaximizeButton = false) override; 205 WmErrorCode StartMoveWindow() override; 206 WmErrorCode StartMoveWindowWithCoordinate(int32_t offsetX, int32_t offsetY) override; 207 WmErrorCode StopMoveWindow() override; 208 WMError SetSupportedWindowModesInner(const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes); 209 void UpdateWindowModeWhenSupportTypeChange(uint32_t windowModeSupportType); 210 bool haveSetSupportedWindowModes_ = false; 211 uint32_t pendingWindowModeSupportType_ { WindowModeSupport::WINDOW_MODE_SUPPORT_ALL }; 212 213 /* 214 * Compatible Mode 215 */ 216 WSError NotifyCompatibleModePropertyChange(const sptr<CompatibleModeProperty> property) override; 217 void HookDecorButtonStyleInCompatibleMode(uint32_t contentColor); 218 WSError PcAppInPadNormalClose() override; 219 void HandleWindowLimitsInCompatibleMode(WindowSizeLimits& windowSizeLimits); 220 221 /* 222 * Free Multi Window 223 */ 224 WSError SwitchFreeMultiWindow(bool enable) override; 225 virtual bool GetFreeMultiWindowModeEnabledState() override; 226 void UpdateImmersiveBySwitchMode(bool freeMultiWindowEnable); 227 228 void NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo& keyboardPanelInfo) override; 229 virtual WMError SetImmersiveModeEnabledState(bool enable) override; 230 virtual bool GetImmersiveModeEnabledState() const override; 231 WMError IsImmersiveLayout(bool& isImmersiveLayout) const override; 232 void NotifySessionFullScreen(bool fullScreen) override; 233 WMError GetWindowStatus(WindowStatus& windowStatus) override; 234 bool GetIsUIExtFirstSubWindow() const override; 235 bool GetIsUIExtAnySubWindow() const override; 236 237 /* 238 * Gesture Back 239 */ 240 WMError SetGestureBackEnabled(bool enable) override; 241 WMError GetGestureBackEnabled(bool& enable) const override; 242 243 /* 244 * PC Fold Screen 245 */ 246 WSError SetFullScreenWaterfallMode(bool isWaterfallMode) override; 247 WSError SetSupportEnterWaterfallMode(bool isSupportEnter) override; 248 WMError OnContainerModalEvent(const std::string& eventName, const std::string& value) override; 249 250 /* 251 * Window Property 252 */ 253 WMError SetCornerRadius(float cornerRadius) override; 254 WMError SetWindowCornerRadius(float cornerRadius) override; 255 WMError GetWindowCornerRadius(float& cornerRadius) override; 256 WMError SetShadowRadius(float radius) override; 257 WMError SyncShadowsToComponent(const ShadowsInfo& shadowsInfo) override; 258 WMError SetShadowColor(std::string color) override; 259 WMError SetShadowOffsetX(float offsetX) override; 260 WMError SetShadowOffsetY(float offsetY) override; 261 WMError SetBlur(float radius) override; 262 WMError SetBackdropBlur(float radius) override; 263 WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) override; 264 WMError SetWindowMode(WindowMode mode) override; 265 WMError SetGrayScale(float grayScale) override; 266 WMError SetWindowShadowRadius(float radius) override; 267 static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 268 void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) override; 269 float GetCustomDensity() const override; 270 WMError SetCustomDensity(float density, bool applyToSubWindow) override; 271 WMError GetWindowDensityInfo(WindowDensityInfo& densityInfo) override; 272 WMError IsMainWindowFullScreenAcrossDisplays(bool& isAcrossDisplays) override; 273 WMError GetWindowPropertyInfo(WindowPropertyInfo& windowPropertyInfo) override; 274 275 /* 276 * Window Decor 277 */ 278 WMError SetWindowTitle(const std::string& title) override; 279 WMError DisableAppWindowDecor() override; 280 bool IsDecorEnable() const override; 281 WMError Close() override; 282 WMError CloseDirectly() override; 283 284 /* 285 * Starting Window 286 */ 287 WMError NotifyRemoveStartingWindow() override; 288 289 /* 290 * Window Scene 291 */ 292 WMError RegisterWindowAttachStateChangeListener( 293 const sptr<IWindowAttachStateChangeListner>& listener) override; 294 WMError UnregisterWindowAttachStateChangeListener() override; 295 296 /* 297 * Window Immersive 298 */ 299 WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea, const Rect& rect = Rect::EMPTY_RECT, 300 int32_t apiVersion = API_VERSION_INVALID) override; 301 SystemBarProperty GetSystemBarPropertyByType(WindowType type) const override; 302 WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) override; 303 WMError SetLayoutFullScreen(bool status) override; 304 WMError SetIgnoreSafeArea(bool isIgnoreSafeArea) override; 305 WMError SetFullScreen(bool status) override; 306 WMError UpdateSystemBarProperties(const std::unordered_map<WindowType, SystemBarProperty>& systemBarProperties, 307 const std::unordered_map<WindowType, SystemBarPropertyFlag>& systemBarPropertyFlags) override; 308 /* 309 * Window Pattern 310 */ 311 WMError SetImageForRecent(uint32_t imgResourceId, ImageFit imageFit) override; 312 /** 313 * Window Transition Animation For PC 314 */ 315 WMError SetWindowTransitionAnimation(WindowTransitionType transitionType, 316 const TransitionAnimation& animation) override; 317 std::shared_ptr<TransitionAnimation> GetWindowTransitionAnimation(WindowTransitionType transitionType) override; 318 319 /* 320 * Window LifeCycle 321 */ 322 void Resume() override; 323 void Pause() override; 324 325 WSError CloseSpecificScene() override; 326 WMError SetSubWindowSource(SubWindowSource source) override; 327 328 protected: 329 WMError CreateAndConnectSpecificSession(); 330 WMError CreateSystemWindow(WindowType type); 331 sptr<WindowSessionImpl> FindParentSessionByParentId(uint32_t parentId); 332 bool IsSessionMainWindow(uint32_t parentId); 333 void LimitWindowSize(uint32_t& width, uint32_t& height); 334 void LimitCameraFloatWindowMininumSize(uint32_t& width, uint32_t& height, float& vpr); 335 void UpdateFloatingWindowSizeBySizeLimits(uint32_t& width, uint32_t& height) const; 336 WMError NotifyWindowSessionProperty(); 337 WMError NotifyWindowNeedAvoid(bool status = false); 338 WMError SetLayoutFullScreenByApiVersion(bool status) override; 339 void UpdateWindowSizeLimits(); 340 WindowLimits GetSystemSizeLimits(uint32_t displayWidth, uint32_t displayHeight, float vpr); 341 void GetConfigurationFromAbilityInfo(); 342 std::vector<AppExecFwk::SupportWindowMode> ExtractSupportWindowModeFromMetaData( 343 const std::shared_ptr<AppExecFwk::AbilityInfo>& abilityInfo); 344 std::vector<AppExecFwk::SupportWindowMode> ParseWindowModeFromMetaData( 345 const std::string& supportModesInFreeMultiWindow); 346 float GetVirtualPixelRatio(const sptr<DisplayInfo>& displayInfo) override; 347 WMError NotifySpecificWindowSessionProperty(WindowType type, const SystemBarProperty& property); 348 using SessionMap = std::map<std::string, std::pair<int32_t, sptr<WindowSessionImpl>>>; 349 sptr<WindowSessionImpl> FindParentMainSession(uint32_t parentId, const SessionMap& sessionMap); 350 351 /* 352 * Window Recover 353 */ 354 WMError RecoverAndConnectSpecificSession(); 355 WMError RecoverAndReconnectSceneSession(); 356 void RegisterWindowRecoverStateChangeListener(); 357 358 private: 359 WMError DestroyInner(bool needNotifyServer); 360 WMError MainWindowCloseInner(); 361 WMError SyncDestroyAndDisconnectSpecificSession(int32_t persistentId); 362 bool IsValidSystemWindowType(const WindowType& type); 363 WMError CheckParmAndPermission(); 364 void TransformSurfaceNode(const Transform& trans); 365 void AdjustWindowAnimationFlag(bool withAnimation = false); 366 WMError UpdateAnimationFlagProperty(bool withAnimation); 367 WMError UpdateWindowModeImmediately(WindowMode mode); 368 uint32_t UpdateConfigVal(uint32_t minVal, uint32_t maxVal, uint32_t configVal, uint32_t defaultVal, float vpr); 369 void UpdateWindowState(); 370 void UpdateNewSize(); 371 void fillWindowLimits(WindowLimits& windowLimits); 372 void UpdateSupportWindowModesWhenSwitchFreeMultiWindow(); 373 void PendingUpdateSupportWindowModesWhenSwitchMultiWindow(); 374 void ConsumePointerEventInner(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 375 MMI::PointerEvent::PointerItem& pointerItem, bool isHitTargetDraggable = false); 376 void HandleEventForCompatibleMode(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 377 MMI::PointerEvent::PointerItem& pointerItem); 378 void HandleDownForCompatibleMode(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 379 MMI::PointerEvent::PointerItem& pointerItem); 380 void HandleMoveForCompatibleMode(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 381 MMI::PointerEvent::PointerItem& pointerItem); 382 void HandleUpForCompatibleMode(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 383 MMI::PointerEvent::PointerItem& pointerItem); 384 void ConvertPointForCompatibleMode(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 385 MMI::PointerEvent::PointerItem& pointerItem, int32_t transferX); 386 bool IsInMappingRegionForCompatibleMode(int32_t displayX, int32_t displayY); 387 bool CheckTouchSlop(int32_t pointerId, int32_t x, int32_t y, int32_t threshold); 388 void IgnoreClickEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 389 bool HandlePointDownEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 390 const MMI::PointerEvent::PointerItem& pointerItem); 391 std::unique_ptr<Media::PixelMap> HandleWindowMask(const std::vector<std::vector<uint32_t>>& windowMask); 392 void CalculateNewLimitsByLimits( 393 WindowLimits& newLimits, WindowLimits& customizedLimits, float& virtualPixelRatio); 394 void CalculateNewLimitsByRatio(WindowLimits& newLimits, WindowLimits& customizedLimits); 395 void NotifyDisplayInfoChange(const sptr<DisplayInfo>& info = nullptr); 396 void UpdateDensityInner(const sptr<DisplayInfo>& info = nullptr); 397 sptr<DisplayInfo> GetDisplayInfo() const; 398 399 /* 400 * Window Input Event 401 */ 402 void ResetSuperFoldDisplayY(const std::shared_ptr<MMI::PointerEvent>& pointerEvent); 403 404 /* 405 * Window Recover 406 */ 407 void RegisterSessionRecoverListener(bool isSpecificSession); 408 void OnWindowRecoverStateChange(bool isSpecificSession, const WindowRecoverState& state); 409 void UpdateStartRecoverProperty(bool isSpecificSession); 410 void UpdateFinishRecoverProperty(bool isSpecificSession); 411 NotifyWindowRecoverStateChangeFunc windowRecoverStateChangeFunc_; 412 413 /* 414 * Window Layout 415 */ 416 void CheckMoveConfiguration(MoveConfiguration& moveConfiguration); 417 WMError GetAppHookWindowInfoFromServer(HookWindowInfo& hookWindowInfo) override; 418 419 /* 420 * PC Window Layout 421 */ 422 std::shared_ptr<MMI::PointerEvent> lastPointerEvent_ = nullptr; 423 bool IsFullScreenSizeWindow(uint32_t width, uint32_t height); 424 bool isResizedByLimit_ = false; 425 426 /* 427 * Window Immersive 428 */ 429 void UpdateDefaultStatusBarColor(); 430 WMError MoveAndResizeKeyboard(const KeyboardLayoutParams& params); 431 bool userLimitsSet_ = false; 432 bool forceLimits_ = false; 433 bool enableDefaultAnimation_ = true; 434 sptr<IAnimationTransitionController> animationTransitionController_; 435 uint32_t setSameSystembarPropertyCnt_ = 0; 436 std::atomic<uint32_t> getAvoidAreaCnt_ = 0; 437 std::atomic<bool> enableImmersiveMode_ = false; 438 std::atomic<bool> cacheEnableImmersiveMode_ = false; 439 bool titleHoverShowEnabled_ = true; 440 bool dockHoverShowEnabled_ = true; 441 void PreLayoutOnShow(WindowType type, const sptr<DisplayInfo>& info = nullptr); 442 443 /* 444 * Gesture Back 445 */ 446 bool gestureBackEnabled_ = true; 447 448 /* 449 * Window Property 450 */ 451 void InitSystemSessionDragEnable(); 452 bool IsSystemDensityChanged(const sptr<DisplayInfo>& displayInfo); 453 bool IsDefaultDensityEnabled(); 454 float GetMainWindowCustomDensity(); 455 float customDensity_ = UNDEFINED_DENSITY; 456 bool isEnableDefaultDensityWhenCreate_ = false; 457 std::string specifiedColorMode_; 458 WMError SetPcAppInpadSpecificSystemBarInvisible(); 459 WMError SetPcAppInpadOrientationLandscape(); 460 461 /* 462 * Sub Window 463 */ 464 void AddSubWindowMapForExtensionWindow(); 465 WMError GetParentSessionAndVerify(bool isToast, sptr<WindowSessionImpl>& parentSession); 466 static WMError VerifySubWindowLevel(bool isToast, const sptr<WindowSessionImpl>& parentSession); 467 WMError SetParentWindowInner(int32_t oldParentWindowId, const sptr<WindowSessionImpl>& newParentWindow); 468 469 WMError RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) override; 470 WMError UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) override; 471 static std::mutex keyboardPanelInfoChangeListenerMutex_; 472 sptr<IKeyboardPanelInfoChangeListener> keyboardPanelInfoChangeListeners_ = nullptr; 473 bool isOverTouchSlop_ = false; 474 bool isDown_ = false; 475 std::unordered_map<int32_t, std::vector<bool>> eventMapTriggerByDisplay_; 476 std::unordered_map<int32_t, std::vector<int32_t>> eventMapDeltaXByDisplay_; 477 std::unordered_map<int32_t, std::vector<PointInfo>> downPointerByDisplay_; 478 479 /* 480 * PC Fold Screen 481 */ 482 std::atomic_bool isWaterfallToMaximize_ { false }; 483 std::atomic<WindowMode> lastWindowModeBeforeWaterfall_ { WindowMode::WINDOW_MODE_UNDEFINED }; 484 485 /* 486 * Move Drag 487 */ 488 bool CalcWindowShouldMove(); 489 bool CheckCanMoveWindowType(); 490 bool CheckCanMoveWindowTypeByDevice(); 491 bool CheckIsPcAppInPadFullScreenOnMobileWindowMode(); 492 AreaType GetDragAreaByDownEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 493 const MMI::PointerEvent::PointerItem& pointerItem); 494 495 /* 496 * PC Window 497 */ 498 /* whether in process of delay raise during cross window drag and drop 499 * only used when delay raise is enabled and hit draggable component 500 */ 501 bool isExecuteDelayRaise_ = false; 502 bool IsFullScreenEnable() const; 503 504 /* 505 * Window Input Event 506 */ 507 int32_t superFoldOffsetY_ = -1; // calculate the total height of the display_B area and crease area. 508 509 /* 510 * Window Scene 511 */ 512 static std::mutex windowAttachStateChangeListenerMutex_; 513 sptr<IWindowAttachStateChangeListner> windowAttachStateChangeListener_; 514 WSError NotifyWindowAttachStateChange(bool isAttach) override; 515 516 /* 517 * Window Rotation 518 */ 519 Ace::ViewportConfig FillTargetOrientationConfig( 520 const OrientationInfo& info, const sptr<DisplayInfo>& displayInfo, uint64_t displayId); 521 522 /* 523 * Window Lifecycle 524 */ 525 void NotifyFreeMultiWindowModeResume(); 526 std::string TransferLifeCycleEventToString(LifeCycleEvent type) const; 527 void RecordLifeCycleExceptionEvent(LifeCycleEvent event, WMError erCode) const; 528 WindowLifeCycleInfo GetWindowLifecycleInfo() const; 529 530 /** 531 * Window Transition Animation For PC 532 */ 533 std::mutex transitionAnimationConfigMutex_; 534 535 /* 536 * Window Decor 537 */ 538 WMError GrayOutMaximizeButton(bool isGrayOut); 539 }; 540 } // namespace Rosen 541 } // namespace OHOS 542 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_IMPL_H 543