1 /* 2 * Copyright (c) 2021-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_H 17 #define OHOS_ROSEN_WINDOW_H 18 19 #include <refbase.h> 20 #include <parcel.h> 21 #include <iremote_object.h> 22 23 #include "dm_common.h" 24 #include "wm_common.h" 25 #include "window_option.h" 26 #include "occupied_area_change_info.h" 27 #include "data_handler_interface.h" 28 #include "floating_ball_template_base_info.h" 29 30 typedef struct napi_env__* napi_env; 31 typedef struct napi_value__* napi_value; 32 typedef class __ani_object* ani_object; 33 #ifdef __cplusplus 34 typedef struct __ani_env ani_env; 35 #else 36 typedef const struct __ani_interaction_api *ani_env; 37 #endif 38 39 namespace OHOS::MMI { 40 class PointerEvent; 41 class KeyEvent; 42 class AxisEvent; 43 } 44 namespace OHOS::AppExecFwk { 45 class Configuration; 46 class Ability; 47 class ElementName; 48 enum class SupportWindowMode; 49 } 50 51 namespace OHOS::Global::Resource { 52 class ResourceManager; 53 } // namespace OHOS::Global::Resource 54 55 namespace OHOS::AbilityRuntime { 56 class AbilityContext; 57 class Context; 58 } 59 60 namespace OHOS::AAFwk { 61 class Want; 62 class WantParams; 63 } 64 65 namespace OHOS::Ace { 66 class UIContent; 67 class ViewportConfig; 68 } 69 70 namespace OHOS::Media { 71 class PixelMap; 72 } 73 74 namespace OHOS::Accessibility { 75 class AccessibilityEventInfo; 76 } 77 namespace OHOS { 78 namespace Rosen { 79 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>; 80 using NotifyTransferComponentDataFunc = std::function<void(const AAFwk::WantParams& wantParams)>; 81 using NotifyTransferComponentDataForResultFunc = std::function<AAFwk::WantParams(const AAFwk::WantParams& wantParams)>; 82 using KeyEventFilterFunc = std::function<bool(const MMI::KeyEvent&)>; 83 using MouseEventFilterFunc = std::function<bool(const MMI::PointerEvent&)>; 84 using TouchEventFilterFunc = std::function<bool(const MMI::PointerEvent&)>; 85 class RSSurfaceNode; 86 class RSTransaction; 87 class RSUIContext; 88 class RSUIDirector; 89 class ISession; 90 class Window; 91 enum class ImageFit; 92 93 /** 94 * @class IWindowLifeCycle 95 * 96 * @brief IWindowLifeCycle is a listener used to notify caller that lifecycle of window. 97 */ 98 class IWindowLifeCycle : virtual public RefBase { 99 public: 100 /** 101 * @brief Notify caller that window is on the forground. 102 */ AfterForeground()103 virtual void AfterForeground() {} 104 105 /** 106 * @brief Notify caller that window is on the background. 107 */ AfterBackground()108 virtual void AfterBackground() {} 109 110 /** 111 * @brief Notify caller that window is focused. 112 */ AfterFocused()113 virtual void AfterFocused() {} 114 115 /** 116 * @brief Notify caller that window is unfocused. 117 */ AfterUnfocused()118 virtual void AfterUnfocused() {} 119 120 /** 121 * @brief Notify caller the error code when window go forground failed. 122 * 123 * @param ret Error code when window go forground failed. 124 */ ForegroundFailed(int32_t ret)125 virtual void ForegroundFailed(int32_t ret) {} 126 127 /** 128 * @brief Notify caller the error code when window go background failed. 129 * 130 * @param ret Error code when window go background failed. 131 */ BackgroundFailed(int32_t ret)132 virtual void BackgroundFailed(int32_t ret) {} 133 134 /** 135 * @brief Notify caller that window is active. 136 */ AfterActive()137 virtual void AfterActive() {} 138 139 /** 140 * @brief Notify caller that window is inactive. 141 */ AfterInactive()142 virtual void AfterInactive() {} 143 144 /** 145 * @brief Notify caller that window is resumed. 146 */ AfterResumed()147 virtual void AfterResumed() {} 148 149 /** 150 * @brief Notify caller that window is paused. 151 */ AfterPaused()152 virtual void AfterPaused() {} 153 154 /** 155 * @brief Notify caller that window is destroyed. 156 */ AfterDestroyed()157 virtual void AfterDestroyed() {} 158 159 /** 160 * @brief Notify caller that window is already foreground. 161 */ AfterDidForeground()162 virtual void AfterDidForeground() {} 163 164 /** 165 * @brief Notify caller that window is already background. 166 */ AfterDidBackground()167 virtual void AfterDidBackground() {} 168 }; 169 170 /** 171 * @class IWindowStageLifeCycle 172 * 173 * @brief IWindowStageLifeCycle is a listener used to notify caller that lifecycle of window. 174 */ 175 class IWindowStageLifeCycle : virtual public RefBase { 176 public: 177 /** 178 * @brief Notify caller that window is on the forground. 179 */ AfterLifecycleForeground()180 virtual void AfterLifecycleForeground() {} 181 182 /** 183 * @brief Notify caller that window is on the background. 184 */ AfterLifecycleBackground()185 virtual void AfterLifecycleBackground() {} 186 187 /** 188 * @brief Notify caller that window is resumed. 189 */ AfterLifecycleResumed()190 virtual void AfterLifecycleResumed() {} 191 192 /** 193 * @brief Notify caller that window is paused. 194 */ AfterLifecyclePaused()195 virtual void AfterLifecyclePaused() {} 196 }; 197 198 /** 199 * @class IWindowAttachStateChangeListner 200 * 201 * @brief IWindowAttachStateChangeListner is used to observe the window attach or detach state changed. 202 */ 203 class IWindowAttachStateChangeListner : virtual public RefBase { 204 public: AfterAttached()205 virtual void AfterAttached() {} AfterDetached()206 virtual void AfterDetached() {} 207 }; 208 209 /** 210 * @class IWindowChangeListener 211 * 212 * @brief IWindowChangeListener is used to observe the window size or window mode when window changed. 213 */ 214 class IWindowChangeListener : virtual public RefBase { 215 public: 216 /** 217 * @brief Notify caller when window size changed. 218 * 219 * @param Rect Rect of the current window. 220 * @param reason Reason for window change. 221 * @param rsTransaction Synchronization transaction for animation 222 */ 223 virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason, 224 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 225 226 /** 227 * @brief Notify caller when window mode changed. 228 * 229 * @param mode Mode of the current window. 230 * @param hasDeco Window has decoration or not. 231 */ 232 virtual void OnModeChange(WindowMode mode, bool hasDeco = true) {} 233 }; 234 235 class IWindowCrossAxisListener : virtual public RefBase { 236 public: 237 /** 238 * @brief Notify caller when window cross screen axis state changed. 239 * 240 * @param state is window across screen axis. 241 */ OnCrossAxisChange(CrossAxisState state)242 virtual void OnCrossAxisChange(CrossAxisState state) {} 243 }; 244 245 /** 246 * @class IWindowStatusChangeListener 247 * 248 * @brief IWindowStatusChangeListener is used to observe the window status when window status changed. 249 */ 250 class IWindowStatusChangeListener : virtual public RefBase { 251 public: 252 /** 253 * @brief Notify caller when window status changed. 254 * 255 * @param status Mode of the current window. 256 */ OnWindowStatusChange(WindowStatus status)257 virtual void OnWindowStatusChange(WindowStatus status) {} 258 }; 259 260 /** 261 * @class IWindowStatusDidChangeListener 262 * 263 * @brief IWindowStatusDidChangeListener is used to observe the window status when window status changed 264 * and layout finished. 265 */ 266 class IWindowStatusDidChangeListener : virtual public RefBase { 267 public: 268 /** 269 * @brief Notify caller when window status changed. 270 * 271 * @param status Mode of the current window. 272 */ OnWindowStatusDidChange(WindowStatus status)273 virtual void OnWindowStatusDidChange(WindowStatus status) {} 274 }; 275 276 /** 277 * @class IAvoidAreaChangedListener 278 * 279 * @brief IAvoidAreaChangedListener is used to observe the avoid area when avoid area size changed. 280 */ 281 class IAvoidAreaChangedListener : virtual public RefBase { 282 public: 283 /** 284 * @brief Notify caller when avoid area size changed. 285 * 286 * @param avoidArea Area needed to be avoided. 287 * @param type Type of avoid area. 288 * @param info Keyboard occupied area information. 289 */ 290 virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type, 291 const sptr<OccupiedAreaChangeInfo>& info = nullptr) {} 292 }; 293 294 /** 295 * @class IWindowDragListener 296 * 297 * @brief IWindowDragListener is used to observe the drag status when drag window. 298 */ 299 class IWindowDragListener : virtual public RefBase { 300 public: 301 /** 302 * @brief Notify caller when drag window. 303 * 304 * @param x X-axis when drag window. 305 * @param y Y-axis when drag window. 306 * @param event Drag type. 307 */ OnDrag(int32_t x,int32_t y,DragEvent event)308 virtual void OnDrag(int32_t x, int32_t y, DragEvent event) {} 309 }; 310 311 /** 312 * @class IDisplayMoveListener 313 * 314 * @brief IDisplayMoveListener is used to observe display move status when display move. 315 */ 316 class IDisplayMoveListener : virtual public RefBase { 317 public: 318 /** 319 * @brief Notify caller when display move. 320 * 321 * @param from Display id before display start move. 322 * @param to Display id after display move end. 323 */ OnDisplayMove(DisplayId from,DisplayId to)324 virtual void OnDisplayMove(DisplayId from, DisplayId to) {} 325 }; 326 327 /** 328 * @class IDispatchInputEventListener 329 * 330 * @brief IDispatchInputEventListener is used to dispatch input event. 331 */ 332 class IDispatchInputEventListener : virtual public RefBase { 333 public: 334 /** 335 * @brief Dispatch PointerEvent. 336 * 337 * @param inputEvent Means PointerEvent. 338 */ OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent> & inputEvent)339 virtual void OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 340 341 /** 342 * @brief Dispatch KeyEvent. 343 * 344 * @param inputEvent Means KeyEvent. 345 */ OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> & keyEvent)346 virtual void OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent) {} 347 }; 348 349 /** 350 * @class IOccupiedAreaChangeListener 351 * 352 * @brief IOccupiedAreaChangeListener is used to observe OccupiedArea change. 353 */ 354 class IOccupiedAreaChangeListener : virtual public RefBase { 355 public: 356 /** 357 * @brief Notify caller when OccupiedArea size change. 358 * 359 * @param info Occupied area info when occupied changed. 360 * @param rsTransaction Animation transaction. 361 */ 362 virtual void OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info, 363 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 364 }; 365 366 /** 367 * @class IAceAbilityHandler 368 * 369 * @brief IAceAbilityHandler is used to control Ace Ability. 370 */ 371 class IAceAbilityHandler : virtual public RefBase { 372 public: 373 /** 374 * @brief Set BackgroundColor 375 * 376 * @param color Color of Background. 377 */ SetBackgroundColor(uint32_t color)378 virtual void SetBackgroundColor(uint32_t color) {} 379 380 /** 381 * @brief Get BackgroundColor. 382 * 383 * @return Value of BackgroundColor and default color is white. 384 */ GetBackgroundColor()385 virtual uint32_t GetBackgroundColor() { return 0xffffffff; } 386 }; 387 388 /** 389 * @class IInputEventConsumer 390 * 391 * @brief IInputEventConsumer is a Listener to observe InputEvent consumed or not. 392 */ 393 class IInputEventConsumer { 394 public: 395 /** 396 * @brief Default construct func of IInputEventConsumer. 397 */ 398 IInputEventConsumer() = default; 399 400 /** 401 * @brief Default Destructor func of IInputEventConsumer. 402 */ 403 virtual ~IInputEventConsumer() = default; 404 405 /** 406 * @brief Observe KeyEvent of Multi-Model Input. 407 * 408 * @param keyEvent KeyEvent of Multi-Model Input. 409 */ OnInputEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)410 virtual bool OnInputEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const { return false; } 411 412 /** 413 * @brief Observe PointerEvent of Multi-Model Input. 414 * 415 * @param pointerEvent PointerEvent of Multi-Model Input. 416 */ OnInputEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)417 virtual bool OnInputEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) const { return false; } 418 419 /** 420 * @brief Observe axisEvent of Multi-Model Input. 421 * 422 * @param axisEvent AxisEvent of Multi-Model Input. 423 */ OnInputEvent(const std::shared_ptr<MMI::AxisEvent> & axisEvent)424 virtual bool OnInputEvent(const std::shared_ptr<MMI::AxisEvent>& axisEvent) const { return false; } 425 }; 426 427 /** 428 * @class ITouchOutsideListener 429 * 430 * @brief ITouchOutsideListener is a Listener to observe event when touch outside the window. 431 */ 432 class ITouchOutsideListener : virtual public RefBase { 433 public: 434 /** 435 * @brief Observe the event when touch outside the window. 436 */ OnTouchOutside()437 virtual void OnTouchOutside() const {} 438 }; 439 440 /** 441 * @class IAnimationTransitionController 442 * 443 * @brief IAnimationTransitionController is a Listener to observe event about animation. 444 */ 445 class IAnimationTransitionController : virtual public RefBase { 446 public: 447 /** 448 * @brief Observe the event when animation show. 449 */ AnimationForShown()450 virtual void AnimationForShown() {} 451 452 /** 453 * @brief Observe the event when animation hide. 454 */ AnimationForHidden()455 virtual void AnimationForHidden() {} 456 }; 457 458 /** 459 * @class IScreenshotListener 460 * 461 * @brief IScreenshotListener is a Listener to observe event when screenshot happened. 462 */ 463 class IScreenshotListener : virtual public RefBase { 464 public: 465 /** 466 * @brief Observe event when screenshot happened. 467 */ OnScreenshot()468 virtual void OnScreenshot() {} 469 }; 470 471 /** 472 * @class IScreenshotAppEventListener 473 * 474 * @brief IScreenshotAppEventListener is a Listener to observe event when screenshot happened. 475 */ 476 class IScreenshotAppEventListener : virtual public RefBase { 477 public: 478 /** 479 * @brief Observe event when screenshot happened. 480 */ OnScreenshotAppEvent(ScreenshotEventType type)481 virtual void OnScreenshotAppEvent(ScreenshotEventType type) {} 482 }; 483 using IScreenshotAppEventListenerSptr = sptr<IScreenshotAppEventListener>; 484 485 /** 486 * @class IDialogTargetTouchListener 487 * 488 * @brief IDialogTargetTouchListener is a Listener to observe event when touch dialog window. 489 */ 490 class IDialogTargetTouchListener : virtual public RefBase { 491 public: 492 /** 493 * @brief Observe event when touch dialog window. 494 */ OnDialogTargetTouch()495 virtual void OnDialogTargetTouch() const {} 496 }; 497 498 /** 499 * @class IDialogDeathRecipientListener 500 * 501 * @brief IDialogDeathRecipientListener is a Listener to observe event when mainwindow(bind to dialog) destroyed. 502 */ 503 class IDialogDeathRecipientListener : virtual public RefBase { 504 public: 505 /** 506 * @brief Observe event when mainwindow(bind to dialog) destroyed. 507 */ OnDialogDeathRecipient()508 virtual void OnDialogDeathRecipient() const {} 509 }; 510 511 /** 512 * @class IWindowVisibilityChangedListener 513 * 514 * @brief Listener to observe one window visibility changed. 515 */ 516 class IWindowVisibilityChangedListener : virtual public RefBase { 517 public: OnWindowVisibilityChangedCallback(const bool isVisible)518 virtual void OnWindowVisibilityChangedCallback(const bool isVisible) {}; 519 }; 520 using IWindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>; 521 522 /** 523 * @class IDisplayIdChangeListener 524 * 525 * @brief Listener to observe one window displayId changed. 526 */ 527 class IDisplayIdChangeListener : virtual public RefBase { 528 public: 529 /** 530 * @brief Notify caller when window displayId changed. 531 */ OnDisplayIdChanged(DisplayId displayId)532 virtual void OnDisplayIdChanged(DisplayId displayId) {} 533 }; 534 using IDisplayIdChangeListenerSptr = sptr<IDisplayIdChangeListener>; 535 536 /** 537 * @class ISystemDensityChangeListener 538 * 539 * @brief Listener to observe system density associated with the window changed. 540 */ 541 class ISystemDensityChangeListener : virtual public RefBase { 542 public: 543 /** 544 * @brief Notify caller when system density changed. 545 */ OnSystemDensityChanged(float density)546 virtual void OnSystemDensityChanged(float density) {} 547 }; 548 using ISystemDensityChangeListenerSptr = sptr<ISystemDensityChangeListener>; 549 550 class IAcrossDisplaysChangeListener : virtual public RefBase { 551 public: 552 /** 553 * @brief Notify caller when system density changed. 554 */ OnAcrossDisplaysChanged(bool isAcrossDisplays)555 virtual void OnAcrossDisplaysChanged(bool isAcrossDisplays) {} 556 }; 557 using IAcrossDisplaysChangeListenerSptr = sptr<IAcrossDisplaysChangeListener>; 558 559 /** 560 * @class IWindowNoInteractionListenerSptr 561 * 562 * @brief Listener to observe no interaction event for a long time of window. 563 */ 564 class IWindowNoInteractionListener : virtual public RefBase { 565 public: 566 /** 567 * @brief Observe event when no interaction for a long time. 568 */ OnWindowNoInteractionCallback()569 virtual void OnWindowNoInteractionCallback() {}; 570 571 /** 572 * @brief Set timeout of the listener. 573 * 574 * @param timeout. 575 */ SetTimeout(int64_t timeout)576 virtual void SetTimeout(int64_t timeout) {}; 577 578 /** 579 * @brief get timeout of the listener. 580 * 581 * @return timeout. 582 */ GetTimeout()583 virtual int64_t GetTimeout() const { return 0;}; 584 }; 585 using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>; 586 587 /** 588 * @class IWindowTitleButtonRectChangedListener 589 * 590 * @brief Listener to observe event when window size or the height of title bar changed. 591 */ 592 class IWindowTitleButtonRectChangedListener : virtual public RefBase { 593 public: 594 /** 595 * @brief Notify caller when window size or the height of title bar changed. 596 * @param titleButtonRect An area of title buttons relative to the upper right corner of the window. 597 */ OnWindowTitleButtonRectChanged(const TitleButtonRect & titleButtonRect)598 virtual void OnWindowTitleButtonRectChanged(const TitleButtonRect& titleButtonRect) {} 599 }; 600 601 /** 602 * @class IWindowRectChangeListener 603 * 604 * @brief IWindowRectChangeListener is used to observe the window rect and its changing reason when window changed. 605 */ 606 class IWindowRectChangeListener : virtual public RefBase { 607 public: 608 /** 609 * @brief Notify caller when window rect changed. 610 * 611 * @param Rect Rect of the current window. 612 * @param reason Reason for window size change. 613 */ OnRectChange(Rect rect,WindowSizeChangeReason reason)614 virtual void OnRectChange(Rect rect, WindowSizeChangeReason reason) {} 615 }; 616 617 /** 618 * @class IRectChangeInGlobalDisplayListener 619 * 620 * @brief Interface for observing window rectangle changes in global coordinates. 621 */ 622 class IRectChangeInGlobalDisplayListener : virtual public RefBase { 623 public: 624 /** 625 * @brief Called when the window rectangle changes in global coordinates. 626 * 627 * @param rect The updated rectangle of the window in global coordinates. 628 * @param reason The reason for the window size or position change. 629 */ OnRectChangeInGlobalDisplay(const Rect & rect,WindowSizeChangeReason reason)630 virtual void OnRectChangeInGlobalDisplay(const Rect& rect, WindowSizeChangeReason reason) {} 631 }; 632 633 /** 634 * @class IExtensionSecureLimitChangeListener 635 * 636 * @brief IExtensionSecureLimitChangeListener is used to observe the window secure limit and 637 * its change when limit changed. 638 */ 639 class IExtensionSecureLimitChangeListener : virtual public RefBase { 640 public: 641 /** 642 * @brief Notify caller when window nonsecure limit changed. 643 * 644 * @param isLimite Whether nonsecure windows is Limite. 645 */ OnSecureLimitChange(bool isLimit)646 virtual void OnSecureLimitChange(bool isLimit) {} 647 }; 648 649 /** 650 * @class ISubWindowCloseListener 651 * 652 * @brief ISubWindowCloseListener is used to observe the window rect and its changing reason when window changed. 653 */ 654 class ISubWindowCloseListener : virtual public RefBase { 655 public: 656 /** 657 * @brief Notify caller when subwindow closed. 658 * 659 * @param terminateCloseProcess Whather need to terminate the subwindow close process. 660 */ OnSubWindowClose(bool & terminateCloseProcess)661 virtual void OnSubWindowClose(bool& terminateCloseProcess) {} 662 }; 663 664 /** 665 * @class IMainWindowCloseListener 666 * 667 * @brief IMainWindowCloseListener is used for preprocessing when the main window exits. 668 */ 669 class IMainWindowCloseListener : virtual public RefBase { 670 public: 671 /** 672 * @brief Notify caller when main window closed. 673 * 674 * @param terminateCloseProcess Whether need to terminate the main window close process. 675 */ OnMainWindowClose(bool & terminateCloseProcess)676 virtual void OnMainWindowClose(bool& terminateCloseProcess) {} 677 }; 678 679 /** 680 * @class IWindowWillCloseListener 681 * 682 * @brief IWindowWillCloseListener is used for async preprocessing when the window exits. 683 */ 684 class IWindowWillCloseListener : virtual public RefBase { 685 public: 686 /** 687 * @brief Notify caller when window closed. 688 * 689 * @param terminateCloseProcess Whether need to terminate the window close process. 690 */ OnWindowWillClose(sptr<Window> window)691 virtual void OnWindowWillClose(sptr<Window> window) {} 692 }; 693 /** 694 * @class IWindowHighlightChangeListener 695 * 696 * @brief IWindowHighlightChangeListener is a listener to observe event when highlight change of window. 697 */ 698 class IWindowHighlightChangeListener : virtual public RefBase { 699 public: 700 /** 701 * @brief Notify caller when highlight status changes. 702 * 703 * @param isHighlight Whether the window is highlighted. 704 */ OnWindowHighlightChange(bool isHighlight)705 virtual void OnWindowHighlightChange(bool isHighlight) {} 706 }; 707 708 /** 709 * @class ISwitchFreeMultiWindowListener 710 * 711 * @brief ISwitchFreeMultiWindowListener is used to observe the free multi window state when it changed. 712 */ 713 class ISwitchFreeMultiWindowListener : virtual public RefBase { 714 public: 715 /** 716 * @brief Notify caller when free multi window state changed. 717 * 718 * @param enable Whether free multi window state enabled. 719 */ OnSwitchFreeMultiWindow(bool enable)720 virtual void OnSwitchFreeMultiWindow(bool enable) {} 721 }; 722 723 /** 724 * @class IKeyboardPanelInfoChangeListener 725 * 726 * @brief IKeyboardPanelInfoChangeListener is used to observe the keyboard panel info. 727 */ 728 class IKeyboardPanelInfoChangeListener : virtual public RefBase { 729 public: 730 /** 731 * @brief Notify caller when keyboard info changed. 732 * 733 * @param KeyboardPanelInfo keyboardPanelInfo of the keyboard panel; 734 */ OnKeyboardPanelInfoChanged(const KeyboardPanelInfo & keyboardPanelInfo)735 virtual void OnKeyboardPanelInfoChanged(const KeyboardPanelInfo& keyboardPanelInfo) {} 736 }; 737 738 /** 739 * @class IKeyboardWillShowListener 740 * 741 * @brief IKeyboardWillShowListener is used to observe keyboard show animation begins. 742 */ 743 class IKeyboardWillShowListener : virtual public RefBase { 744 public: 745 /** 746 * @brief Notify the caller when keyboard show animation begins. 747 */ OnKeyboardWillShow(const KeyboardAnimationInfo & keyboardAnimationInfo,const KeyboardAnimationCurve & curve)748 virtual void OnKeyboardWillShow(const KeyboardAnimationInfo& keyboardAnimationInfo, 749 const KeyboardAnimationCurve& curve) {} 750 }; 751 752 /** 753 * @class IKeyboardWillHideListener 754 * 755 * @brief IKeyboardWillHideListener is used to observe keyboard hide animation begins. 756 */ 757 class IKeyboardWillHideListener : virtual public RefBase { 758 public: 759 /** 760 * @brief Notify the caller when keyboard hide animation begins. 761 */ OnKeyboardWillHide(const KeyboardAnimationInfo & keyboardAnimationInfo,const KeyboardAnimationCurve & curve)762 virtual void OnKeyboardWillHide(const KeyboardAnimationInfo& keyboardAnimationInfo, 763 const KeyboardAnimationCurve& curve) {} 764 }; 765 766 /** 767 * @class IKeyboardDidShowListener 768 * 769 * @brief IKeyboardDidShowListener is used to observe keyboard show animation completion. 770 */ 771 class IKeyboardDidShowListener : virtual public RefBase { 772 public: 773 /** 774 * @brief Notify the caller when keyboard show animation is completed. 775 */ OnKeyboardDidShow(const KeyboardPanelInfo & keyboardPanelInfo)776 virtual void OnKeyboardDidShow(const KeyboardPanelInfo& keyboardPanelInfo) {} 777 }; 778 779 /** 780 * @class IKeyboardDidHideListener 781 * 782 * @brief IKeyboardDidHideListener is used to observe keyboard hide animation completion. 783 */ 784 class IKeyboardDidHideListener : virtual public RefBase { 785 public: 786 /** 787 * @brief Notify the caller when keyboard hide animation is completed. 788 */ OnKeyboardDidHide(const KeyboardPanelInfo & keyboardPanelInfo)789 virtual void OnKeyboardDidHide(const KeyboardPanelInfo& keyboardPanelInfo) {} 790 }; 791 792 /** 793 * @class IWaterfallModeChangeListener 794 * 795 * @brief IWaterfallModeChangeListener is used to observe the waterfall mode. 796 */ 797 class IWaterfallModeChangeListener : virtual public RefBase { 798 public: 799 /** 800 * @brief Notify caller when waterfall mode changed. 801 * 802 * @param isWaterfallMode new waterfall mode. 803 */ OnWaterfallModeChange(bool isWaterfallMode)804 virtual void OnWaterfallModeChange(bool isWaterfallMode) {} 805 }; 806 807 /** 808 * @class IPreferredOrientationChangeListener 809 * 810 * @brief listener of preferred orientation change which set by developer. 811 */ 812 class IPreferredOrientationChangeListener : virtual public RefBase { 813 public: 814 /** 815 * @brief Notify caller when orientation set by developer. 816 * 817 * @param ori the orientation set by developer. 818 */ OnPreferredOrientationChange(Orientation orientation)819 virtual void OnPreferredOrientationChange(Orientation orientation) {} 820 }; 821 822 /** 823 * @class IWindowOrientationChangeListener 824 * 825 * @brief IWindowOrientationChangeListener is used to notify while window rotate. 826 */ 827 class IWindowOrientationChangeListener : virtual public RefBase { 828 public: 829 /** 830 * @brief Innerapi, notify caller while window rotate. 831 */ OnOrientationChange()832 virtual void OnOrientationChange() {} 833 }; 834 835 /** 836 * @class ISystemBarPropertyListener 837 * 838 * @brief ISystemBarPropertyListener is used to notify while developer set SystemBarProperty. 839 */ 840 class ISystemBarPropertyListener : virtual public RefBase { 841 public: 842 /** 843 * @brief Innerapi, notify caller when developer set SystemBarProperty. 844 */ OnSystemBarPropertyUpdate(WindowType type,const SystemBarProperty & property)845 virtual void OnSystemBarPropertyUpdate(WindowType type, const SystemBarProperty& property) {} 846 }; 847 848 /* 849 * @class IWindowRotationChangeListener 850 * 851 * @brief IWindowRotationChangeListener is used to observe the window rotation change. 852 */ 853 class IWindowRotationChangeListener : virtual public RefBase { 854 public: 855 /** 856 * @brief Notify caller when window rotate 857 * 858 * @param rotationChangeInfo information of rotation 859 * @param rotationChangeResult result of rotation 860 * 861 */ OnRotationChange(const RotationChangeInfo & rotationChangeInfo,RotationChangeResult & rotationChangeResult)862 virtual void OnRotationChange(const RotationChangeInfo& rotationChangeInfo, 863 RotationChangeResult& rotationChangeResult) {} 864 }; 865 866 static WMError DefaultCreateErrCode = WMError::WM_OK; 867 class Window : virtual public RefBase { 868 public: 869 /** 870 * @brief create window, include main_window/sub_window/system_window 871 * 872 * @param windowName window name, identify window instance 873 * @param option window propertion 874 * @param context ability context 875 * @return sptr<Window> If create window success,return window instance;Otherwise, return nullptr 876 */ 877 static sptr<Window> Create(const std::string& windowName, 878 sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr, 879 WMError& errCode = DefaultCreateErrCode); 880 881 /** 882 * @brief create main/uiextension window with session 883 * 884 * @param option window propertion 885 * @param context ability context 886 * @param iSession session token of window session 887 * @param errCode error code of create window 888 * @param identityToken identity token of sceneSession 889 * @return sptr<Window> If create window success, return window instance; Otherwise, return nullptr 890 */ 891 static sptr<Window> Create(sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context, 892 const sptr<IRemoteObject>& iSession, WMError& errCode = DefaultCreateErrCode, 893 const std::string& identityToken = "", bool isModuleAbilityHookEnd = false); 894 895 /** 896 * @brief get and verify windowType, include sub_window/system_window 897 * 898 * @param parentId parent window id 899 * @param windowName current window name 900 * @param parentWindowType parent window type 901 * @param windowType current window type 902 * @return WMError::WM_OK means check success, otherwise failed. 903 */ 904 static WMError GetAndVerifyWindowTypeForArkUI(uint32_t parentId, const std::string& windowName, 905 WindowType parentWindowType, WindowType& windowType); 906 907 /** 908 * @brief create pip window with session 909 * 910 * @param option window propertion 911 * @param pipTemplateInfo pipTemplateInfo 912 * @param context ability context 913 * @param errCode error code of create pip window 914 * @return sptr<Window> If create pip window success, return window instance; Otherwise, return nullptr 915 */ 916 static sptr<Window> CreatePiP(sptr<WindowOption>& option, const PiPTemplateInfo& pipTemplateInfo, 917 const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, WMError& errCode = DefaultCreateErrCode); 918 919 /** 920 * @brief create fb window with session 921 * 922 * @param option window propertion 923 * @param fbTemplateBaseInfo baseInfo of fb window 924 * @param icon icon of fb window 925 * @param context ability context 926 * @param errCode error code of create fb window 927 * @return sptr<Window> If create fb window success, return window instance; Otherwise, return nullptr 928 */ 929 static sptr<Window> CreateFb(sptr<WindowOption>& option, const FloatingBallTemplateBaseInfo& fbTemplateBaseInfo, 930 const std::shared_ptr<Media::PixelMap>& icon, const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, 931 WMError& errCode); 932 933 /** 934 * @brief find window by windowName 935 * 936 * @param windowName 937 * @return sptr<Window> Return the window instance founded 938 */ 939 static sptr<Window> Find(const std::string& windowName); 940 941 /** 942 * @brief Get parent main windowId, which is used for mainWindow,subWindow or dialog 943 * 944 * @param windowId window id that need to get parent main window 945 * @return uint32_t Return the parent main window id 946 */ 947 static uint32_t GetParentMainWindowId(uint32_t windowId); 948 949 /** 950 * @brief Get the final show window by context. Its implemented in api8 951 * 952 * @param context Indicates the context on which the window depends 953 * @return sptr<Window> 954 */ 955 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 956 957 /** 958 * @brief Get the final show window by id. Its implemented in api8 959 * 960 * @param mainWinId main window id? 961 * @return sptr<Window> 962 */ 963 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 964 965 /** 966 * @brief Get the main window by context. 967 * 968 * @param context Indicates the context on which the window depends 969 * @return sptr<Window> 970 */ 971 static sptr<Window> GetMainWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 972 973 /** 974 * @brief Get the all sub windows by parent 975 * 976 * @param parentId parent window id 977 * @return std::vector<sptr<Window>> 978 */ 979 static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId); 980 981 /** 982 * @brief Update configuration for all windows 983 * 984 * @param configuration configuration for app 985 * @param ignoreWindowContexts context of window which will be ignored 986 */ 987 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 988 const std::vector<std::shared_ptr<AbilityRuntime::Context>>& ignoreWindowContexts = {}); 989 990 /** 991 * @brief Update theme configuration for all windows 992 * @param configuration configuration for app 993 */ 994 static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 995 996 /** 997 * @brief Get surface node from RS 998 * 999 * @return Surface node from RS 1000 */ GetSurfaceNode()1001 virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const { return nullptr; } 1002 1003 /** 1004 * @brief Get the associated RSUIDirector instance 1005 * 1006 * @return std::shared_ptr<RSUIDirector> Shared pointer to the RSUIDirector instance, 1007 * or nullptr if RS client multi-instance is disabled. 1008 */ GetRSUIDirector()1009 virtual std::shared_ptr<RSUIDirector> GetRSUIDirector() const { return nullptr; } 1010 1011 /** 1012 * @brief Get the associated RSUIContext instance 1013 * 1014 * @return std::shared_ptr<RSUIContext> Shared pointer to the RSUIContext instance, 1015 * or nullptr if RS client multi-instance is disabled. 1016 */ GetRSUIContext()1017 virtual std::shared_ptr<RSUIContext> GetRSUIContext() const { return nullptr; } 1018 1019 /** 1020 * @brief Get ability context 1021 * 1022 * @return Ability context from AbilityRuntime 1023 */ GetContext()1024 virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const { return nullptr; } 1025 1026 /** 1027 * @brief Get the window show rect 1028 * 1029 * @return Rect of window 1030 */ GetRect()1031 virtual Rect GetRect() const { return {}; } 1032 1033 /** 1034 * @brief Get window default rect from window property. 1035 * 1036 * @return Rect of window. 1037 */ GetRequestRect()1038 virtual Rect GetRequestRect() const { return {}; } 1039 1040 /** 1041 * @brief Get the window rectangle in global coordinates. 1042 * 1043 * @return The rectangle (position and size) of the window in global coordinates. 1044 */ GetGlobalDisplayRect()1045 virtual Rect GetGlobalDisplayRect() const { return { 0, 0, 0, 0 }; } 1046 1047 /** 1048 * @brief Convert a position from client (window-relative) coordinates to global coordinates. 1049 * 1050 * @param inPosition The position relative to the window. 1051 * @param outPosition [out] The corresponding position in global coordinates. 1052 * @return WMError::WM_OK on success, or appropriate error code on failure. 1053 */ ClientToGlobalDisplay(const Position & inPosition,Position & outPosition)1054 virtual WMError ClientToGlobalDisplay(const Position& inPosition, Position& outPosition) const 1055 { 1056 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1057 } 1058 1059 /** 1060 * @brief Convert a position from global coordinates to client (window-relative) coordinates. 1061 * 1062 * @param inPosition The position in global coordinates. 1063 * @param outPosition [out] The corresponding position relative to the window. 1064 * @return WMError::WM_OK on success, or appropriate error code on failure. 1065 */ GlobalDisplayToClient(const Position & inPosition,Position & outPosition)1066 virtual WMError GlobalDisplayToClient(const Position& inPosition, Position& outPosition) const 1067 { 1068 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1069 } 1070 1071 /** 1072 * @brief Get the window type 1073 * 1074 * @return Type of window 1075 */ GetType()1076 virtual WindowType GetType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 1077 1078 /** 1079 * @brief Get the window mode. 1080 * 1081 * @return Mode of window. 1082 */ GetWindowMode()1083 virtual WindowMode GetWindowMode() const { return WindowMode::WINDOW_MODE_UNDEFINED; } 1084 1085 /** 1086 * @brief Get alpha of window. 1087 * 1088 * @return Alpha of window. 1089 */ GetAlpha()1090 virtual float GetAlpha() const { return 0.0f; } 1091 1092 /** 1093 * @brief Get the name of window. 1094 * 1095 * @return Name of window. 1096 */ GetWindowName()1097 virtual const std::string& GetWindowName() const 1098 { 1099 static const std::string name; 1100 return name; 1101 } 1102 1103 /** 1104 * @brief Get id of window. 1105 * 1106 * @return ID of window. 1107 */ GetWindowId()1108 virtual uint32_t GetWindowId() const { return INVALID_WINDOW_ID; } 1109 1110 /** 1111 * @brief Get displayId of window. 1112 * 1113 * @return displayId of window. 1114 */ GetDisplayId()1115 virtual uint64_t GetDisplayId() const { return DISPLAY_ID_INVALID; } 1116 1117 /** 1118 * @brief Get flag of window. 1119 * 1120 * @return Flag of window. 1121 */ GetWindowFlags()1122 virtual uint32_t GetWindowFlags() const { return 0; } 1123 1124 /** 1125 * @brief Get state of window. 1126 * 1127 * @return Current state of window. 1128 */ GetWindowState()1129 virtual WindowState GetWindowState() const { return WindowState::STATE_INITIAL; } 1130 1131 /** 1132 * @brief Set focusable property of window. 1133 * 1134 * @param isFocusable Window can be focused or not. 1135 * @return Errorcode of window. 1136 */ SetFocusable(bool isFocusable)1137 virtual WMError SetFocusable(bool isFocusable) { return WMError::WM_OK; } 1138 1139 /** 1140 * @brief Get focusable property of window. 1141 * 1142 * @return True means window can be focused, false means window cannot be focused. 1143 */ GetFocusable()1144 virtual bool GetFocusable() const { return false; } 1145 1146 /** 1147 * @brief Set touchable property of window. 1148 * 1149 * @param isTouchable Window can be touched or not. 1150 * @return Errorcode of window. 1151 */ SetTouchable(bool isTouchable)1152 virtual WMError SetTouchable(bool isTouchable) { return WMError::WM_OK; } 1153 1154 /** 1155 * @brief Get touchable property of window. 1156 * 1157 * @return True means window can be touched, false means window cannot be touched. 1158 */ GetTouchable()1159 virtual bool GetTouchable() const { return false; } 1160 1161 /** 1162 * @brief Set follow screen change property of window. 1163 * 1164 * @param isFollowScreenChange Window follow screen change. 1165 * @return WMError. 1166 */ SetFollowScreenChange(bool isFollowScreenChange)1167 virtual WMError SetFollowScreenChange(bool isFollowScreenChange) { return WMError::WM_OK; } 1168 1169 /** 1170 * @brief Get SystemBarProperty By WindowType. 1171 * 1172 * @param type Type of window. 1173 * @return Property of system bar. 1174 */ GetSystemBarPropertyByType(WindowType type)1175 virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const { return {}; } 1176 1177 /** 1178 * @brief judge this window is full screen. 1179 * 1180 * @return true If SetFullScreen(true) is called , return true. 1181 * @return false default return false 1182 */ IsFullScreen()1183 virtual bool IsFullScreen() const { return false; } 1184 1185 /** 1186 * @brief judge window layout is full screen 1187 * 1188 * @return true this window layout is full screen 1189 * @return false this window layout is not full screen 1190 */ IsLayoutFullScreen()1191 virtual bool IsLayoutFullScreen() const { return false; } 1192 1193 /** 1194 * @brief Set the Window Type 1195 * 1196 * @param type window type 1197 * @return WMError 1198 */ SetWindowType(WindowType type)1199 virtual WMError SetWindowType(WindowType type) { return WMError::WM_OK; } 1200 1201 /** 1202 * @brief Set the Window Mode 1203 * 1204 * @param mode window mode 1205 * @return WMError 1206 */ SetWindowMode(WindowMode mode)1207 virtual WMError SetWindowMode(WindowMode mode) { return WMError::WM_OK; } 1208 1209 /** 1210 * @brief Set whether the window is topmost 1211 * 1212 * @param topmost whether window is topmost 1213 * @return WMError 1214 */ SetTopmost(bool topmost)1215 virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; } 1216 1217 /** 1218 * @brief Get whether window is topmost 1219 * 1220 * @return True means window is topmost 1221 */ IsTopmost()1222 virtual bool IsTopmost() const { return false; } 1223 1224 /** 1225 * @brief Set whether the main window is topmost 1226 * 1227 * @param isTopmost whether main window is topmost 1228 * @return WMError 1229 */ SetMainWindowTopmost(bool isTopmost)1230 virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1231 1232 /** 1233 * @brief Set static Image resource for recent. 1234 * 1235 * @param imgResourceId resourceId of static image. 1236 * @param imageFit imageFit of static image. 1237 * @return WM_OK means set success, others means failed. 1238 */ SetImageForRecent(uint32_t imgResourceId,ImageFit imageFit)1239 virtual WMError SetImageForRecent(uint32_t imgResourceId, ImageFit imageFit) 1240 { 1241 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1242 } 1243 1244 /** 1245 * @brief Get whether main window is topmost 1246 * 1247 * @return True means main window is topmost 1248 */ IsMainWindowTopmost()1249 virtual bool IsMainWindowTopmost() const { return false; } 1250 1251 /** 1252 * @brief Set sub window zLevel 1253 * 1254 * @param zLevel zLevel of sub window to specify the hierarchical relationship among sub windows 1255 * @return WM_OK means success, others mean set failed 1256 */ SetSubWindowZLevel(int32_t zLevel)1257 virtual WMError SetSubWindowZLevel(int32_t zLevel) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1258 1259 /** 1260 * @brief Get sub window zLevel 1261 * 1262 * @param zLevel sub window zLevel 1263 * @return WM_OK means success, others mean get failed 1264 */ GetSubWindowZLevel(int32_t & zLevel)1265 virtual WMError GetSubWindowZLevel(int32_t& zLevel) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1266 1267 /** 1268 * @brief Set alpha of window. 1269 * 1270 * @param alpha Alpha of window. 1271 * @return WM_OK means success, others means set failed. 1272 */ SetAlpha(float alpha)1273 virtual WMError SetAlpha(float alpha) { return WMError::WM_OK; } 1274 1275 /** 1276 * @brief Set transform of window property. 1277 * 1278 * @param trans Window Transform. 1279 * @return WMError 1280 */ SetTransform(const Transform & trans)1281 virtual WMError SetTransform(const Transform& trans) { return WMError::WM_OK; } 1282 1283 /** 1284 * @brief Get transform of window property. 1285 * 1286 * @return Property of transform. 1287 */ GetTransform()1288 virtual const Transform& GetTransform() const 1289 { 1290 static const Transform trans; 1291 return trans; 1292 } 1293 1294 /** 1295 * @brief Add window flag. 1296 * 1297 * @param flag Flag of window. 1298 * @return WM_OK means add success, others means failed. 1299 */ AddWindowFlag(WindowFlag flag)1300 virtual WMError AddWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 1301 1302 /** 1303 * @brief Remove window flag. 1304 * 1305 * @param flag Flag of window 1306 * @return WM_OK means remove success, others means failed. 1307 */ RemoveWindowFlag(WindowFlag flag)1308 virtual WMError RemoveWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 1309 1310 /** 1311 * @brief Set window flag. 1312 * 1313 * @param flags Flag of window 1314 * @return WM_OK means set success, others means failed. 1315 */ SetWindowFlags(uint32_t flags)1316 virtual WMError SetWindowFlags(uint32_t flags) { return WMError::WM_OK; } 1317 1318 /** 1319 * @brief Set the System Bar(include status bar and nav bar) Property 1320 * 1321 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 1322 * @param property system bar prop,include content color, background color 1323 * @return WMError 1324 */ SetSystemBarProperty(WindowType type,const SystemBarProperty & property)1325 virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return WMError::WM_OK; } 1326 1327 /** 1328 * @brief Get the Avoid Area By Type object 1329 * 1330 * @param type avoid area type.@see reference 1331 * @param avoidArea 1332 * @param rect 1333 * @return WMError 1334 */ 1335 virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea, 1336 const Rect& rect = Rect::EMPTY_RECT, int32_t apiVersion = API_VERSION_INVALID) { return WMError::WM_OK; } 1337 1338 /** 1339 * @brief Set whether the system or app sub window can obtain area 1340 * 1341 * @param avoidAreaOption from low to high, the first bit means system window, the second bit means app sub window 1342 * @return WMError 1343 */ SetAvoidAreaOption(uint32_t avoidAreaOption)1344 virtual WMError SetAvoidAreaOption(uint32_t avoidAreaOption) { return WMError::WM_OK; } 1345 1346 /** 1347 * @brief Get the Avoid Area of system or app sub window Enabled object 1348 * 1349 * @param avoidAreaOption from low to high, the first bit means system window, the second bit means app sub window 1350 * @return WMError 1351 */ GetAvoidAreaOption(uint32_t & avoidAreaOption)1352 virtual WMError GetAvoidAreaOption(uint32_t& avoidAreaOption) { return WMError::WM_OK; } 1353 1354 /** 1355 * @brief Is system window or not 1356 * 1357 * @return True means the window is system window, false means the window is not system window 1358 */ IsSystemWindow()1359 virtual bool IsSystemWindow() const { return false; } 1360 1361 /** 1362 * @brief Is app window or not 1363 * 1364 * @return True means the window is app window, false means the window is not app window 1365 */ IsAppWindow()1366 virtual bool IsAppWindow() const { return false; } 1367 1368 /** 1369 * @brief Set this window layout full screen, with hide status bar and nav bar above on this window 1370 * 1371 * @param status 1372 * @return WMError 1373 */ SetLayoutFullScreen(bool status)1374 virtual WMError SetLayoutFullScreen(bool status) { return WMError::WM_OK; } 1375 1376 /** 1377 * @brief Set the immersive layout properties 1378 * 1379 * @param isIgnoreSafeArea 1380 * @return WMError 1381 */ SetIgnoreSafeArea(bool isIgnoreSafeArea)1382 virtual WMError SetIgnoreSafeArea(bool isIgnoreSafeArea) { return WMError::WM_OK; } 1383 1384 /** 1385 * @brief Set whether the title bar and dock bar will show, when the mouse hovers over hot area. 1386 * 1387 * @param isTitleHoverShown 1388 * @param isDockHoverShown 1389 * @return WMError 1390 */ 1391 virtual WMError SetTitleAndDockHoverShown(bool isTitleHoverShown = true, 1392 bool isDockHoverShown = true) 1393 { 1394 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1395 } 1396 1397 /** 1398 * @brief Set this window full screen, with hide status bar and nav bar 1399 * 1400 * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar 1401 * @return WMError 1402 */ SetFullScreen(bool status)1403 virtual WMError SetFullScreen(bool status) { return WMError::WM_OK; } 1404 1405 /** 1406 * @brief destroy window 1407 * 1408 * @return WMError 1409 */ 1410 virtual WMError Destroy(uint32_t reason = 0) { return WMError::WM_OK; } 1411 1412 /** 1413 * @brief Set a flag to distinguish whether the window is shown with options. 1414 * 1415 * @param showWithOptions Options that define the behavior of a window while it is showing. 1416 */ SetShowWithOptions(bool showWithOptions)1417 virtual void SetShowWithOptions(bool showWithOptions) {} 1418 1419 /** 1420 * @brief Get showWithOptions value. 1421 * 1422 * @return True means the window is shown with options, false means the opposite. 1423 */ IsShowWithOptions()1424 virtual bool IsShowWithOptions() const { return false; } 1425 1426 /** 1427 * @brief Show window 1428 * 1429 * @param reason Reason for window state change. 1430 * @param withAnimation True means window show with animation, false means window show without animation. 1431 * @param withFocus True means window can get focus when it shows to foreground, false means the opposite; 1432 * @return WM_OK means window show success, others means failed. 1433 */ 1434 virtual WMError Show(uint32_t reason = 0, bool withAnimation = false, 1435 bool withFocus = true) { return WMError::WM_OK; } 1436 1437 /** 1438 * @brief Show window 1439 * 1440 * @param reason Reason for window state change. 1441 * @param withAnimation True means window show with animation, false means window show without animation. 1442 * @param withFocus True means window can get focus when it shows to foreground, false means the opposite; 1443 * @param waitAttach True means window need waiting for attach when it, false means the opposite; 1444 * @return WM_OK means window show success, others means failed. 1445 */ Show(uint32_t reason,bool withAnimation,bool withFocus,bool waitAttach)1446 virtual WMError Show(uint32_t reason, bool withAnimation, 1447 bool withFocus, bool waitAttach) { return WMError::WM_OK; } 1448 1449 /** 1450 * @brief Resume window 1451 */ Resume()1452 virtual void Resume() {} 1453 1454 /** 1455 * @brief Pause window 1456 */ Pause()1457 virtual void Pause() {} 1458 1459 /** 1460 * @brief Hide window 1461 * 1462 * @param reason Reason for window state change. 1463 * @param withAnimation True means window show with animation, false means window show without animation. 1464 * @param isFromInnerkits True means remove command is from inner kits. 1465 * @return WM_OK means window hide success, others means failed. 1466 */ 1467 virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) 1468 { 1469 return WMError::WM_OK; 1470 } 1471 1472 /** 1473 * @brief Hide window 1474 * 1475 * @param reason Reason for window state change. 1476 * @param withAnimation True means window show with animation, false means window show without animation. 1477 * @param isFromInnerkits True means remove command is from inner kits. 1478 * @param waitDetach True means window need waiting for detach, false means the opposite; 1479 * @return WM_OK means window hide success, others means failed. 1480 */ Hide(uint32_t reason,bool withAnimation,bool isFromInnerkits,bool waitDetach)1481 virtual WMError Hide(uint32_t reason, bool withAnimation, 1482 bool isFromInnerkits, bool waitDetach) 1483 { 1484 return WMError::WM_OK; 1485 } 1486 1487 /** 1488 * @brief notify window first frame drawing completed. 1489 * 1490 * @return WMError 1491 */ NotifyDrawingCompleted()1492 virtual WMError NotifyDrawingCompleted() { return WMError::WM_OK; } 1493 1494 /** 1495 * @brief notify window remove starting window. 1496 * 1497 * @return WMError 1498 */ NotifyRemoveStartingWindow()1499 virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1500 1501 /** 1502 * @brief move the window to (x, y) 1503 * 1504 * @param x 1505 * @param y 1506 * @param isMoveToGlobal Indicates move global flag 1507 * @param moveConfiguration Indicates the optional move configuration 1508 * @return WMError 1509 */ 1510 virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false, 1511 MoveConfiguration moveConfiguration = {}) { return WMError::WM_OK; } 1512 1513 /** 1514 * @brief move the window to (x, y) 1515 * 1516 * @param x 1517 * @param y 1518 * @param moveConfiguration Indicates the optional move configuration 1519 * @return WMError 1520 */ 1521 virtual WMError MoveToAsync(int32_t x, int32_t y, 1522 MoveConfiguration moveConfiguration = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1523 1524 /** 1525 * @brief move the window to global (x, y) 1526 * 1527 * @param x 1528 * @param y 1529 * @param moveConfiguration Indicates the optional move configuration 1530 * @return WMError 1531 */ MoveWindowToGlobal(int32_t x,int32_t y,MoveConfiguration moveConfiguration)1532 virtual WMError MoveWindowToGlobal(int32_t x, int32_t y, 1533 MoveConfiguration moveConfiguration) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1534 1535 /** 1536 * @brief Move the window to the specified position in global coordinates. 1537 * 1538 * @param x The target X-coordinate in global coordinates. 1539 * @param y The target Y-coordinate in global coordinates. 1540 * @param moveConfiguration Optional move configuration parameters. 1541 * @return WMError WM_OK if the move operation succeeds; otherwise, an error code is returned. 1542 */ 1543 virtual WMError MoveWindowToGlobalDisplay(int32_t x, int32_t y, MoveConfiguration moveConfiguration = {}) 1544 { 1545 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1546 } 1547 1548 /** 1549 * @brief Get window global scaled rect. 1550 * 1551 * @param Rect 1552 * @return WMError 1553 */ GetGlobalScaledRect(Rect & globalScaledRect)1554 virtual WMError GetGlobalScaledRect(Rect& globalScaledRect) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1555 1556 /** 1557 * @brief resize the window instance (w,h) 1558 * 1559 * @param width 1560 * @param height 1561 * @return WMError 1562 */ 1563 virtual WMError Resize(uint32_t width, uint32_t height, 1564 const RectAnimationConfig& rectAnimationConfig = {}) { return WMError::WM_OK; } 1565 1566 /** 1567 * @brief resize the window instance (w,h) 1568 * 1569 * @param width 1570 * @param height 1571 * @return WMError 1572 */ 1573 virtual WMError ResizeAsync(uint32_t width, uint32_t height, 1574 const RectAnimationConfig& rectAnimationConfig = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1575 1576 /** 1577 * @brief set the window gravity 1578 * 1579 * @param gravity 1580 * @param percent 1581 * @return WMError 1582 */ SetWindowGravity(WindowGravity gravity,uint32_t percent)1583 virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) { return WMError::WM_OK; } 1584 1585 /** 1586 * @brief Set the screen always on 1587 * 1588 * @param keepScreenOn 1589 * @return WMError 1590 */ SetKeepScreenOn(bool keepScreenOn)1591 virtual WMError SetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 1592 1593 /** 1594 * @brief Extension told host to set the screen always on, only for NAPI call. 1595 * 1596 * @param keepScreenOn 1597 * @return WMError 1598 */ ExtensionSetKeepScreenOn(bool keepScreenOn)1599 virtual WMError ExtensionSetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 1600 1601 /** 1602 * @brief Get the screen is always on or not. 1603 * 1604 * @return True means screen is always on, false means the opposite. 1605 */ IsKeepScreenOn()1606 virtual bool IsKeepScreenOn() const { return false; } 1607 1608 /** 1609 * @brief Set the view screen always on or not. 1610 * 1611 * @param keepScreenOn 1612 * @return WMError 1613 */ SetViewKeepScreenOn(bool keepScreenOn)1614 virtual WMError SetViewKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 1615 1616 /** 1617 * @brief Get the view screen is always on or not. 1618 * 1619 * @return True means view screen is always on, false means the opposite. 1620 */ IsViewKeepScreenOn()1621 virtual bool IsViewKeepScreenOn() const { return false; } 1622 1623 /** 1624 * @brief Set the screen on 1625 * 1626 * @param turnScreenOn True means turn screen on, false means the opposite. 1627 * @return WM_OK means set success, others means set failed. 1628 */ SetTurnScreenOn(bool turnScreenOn)1629 virtual WMError SetTurnScreenOn(bool turnScreenOn) { return WMError::WM_OK; } 1630 1631 /** 1632 * @brief Get the screen is on or not. 1633 * 1634 * @return True means screen is on, false means screen is off. 1635 */ IsTurnScreenOn()1636 virtual bool IsTurnScreenOn() const { return false; } 1637 1638 /** 1639 * @brief Set Background color. 1640 * 1641 * @param color Background color. 1642 * @return WM_OK means set success, others means set failed. 1643 */ SetBackgroundColor(const std::string & color)1644 virtual WMError SetBackgroundColor(const std::string& color) { return WMError::WM_OK; } 1645 1646 /** 1647 * @brief Set transparent status. 1648 * 1649 * @param isTransparent True means set window transparent, false means the opposite. 1650 * @return WM_OK means set success, others means set failed. 1651 */ SetTransparent(bool isTransparent)1652 virtual WMError SetTransparent(bool isTransparent) { return WMError::WM_OK; } 1653 1654 /** 1655 * @brief Get transparent status. 1656 * 1657 * @return True means window is transparent, false means the opposite. 1658 */ IsTransparent()1659 virtual bool IsTransparent() const { return false; } 1660 1661 /** 1662 * @brief Set brightness value of window. 1663 * 1664 * @param brightness Brightness of window. 1665 * @return WM_OK means set success, others means set failed. 1666 */ SetBrightness(float brightness)1667 virtual WMError SetBrightness(float brightness) { return WMError::WM_OK; } 1668 1669 /** 1670 * @brief Extension told host to set brightness value of window, only for NAPI call. 1671 * 1672 * @param brightness Brightness of window. 1673 * @return WM_OK means set success, others means set failed. 1674 */ ExtensionSetBrightness(float brightness)1675 virtual WMError ExtensionSetBrightness(float brightness) { return WMError::WM_OK; } 1676 1677 /** 1678 * @brief Get brightness value of window. 1679 * 1680 * @return Brightness value of window. 1681 */ GetBrightness()1682 virtual float GetBrightness() const { return 0.0f; } 1683 1684 /** 1685 * @brief Set calling window. 1686 * 1687 * @param windowId Window id. 1688 * @return WM_OK means set success, others means set failed. 1689 */ SetCallingWindow(uint32_t windowId)1690 virtual WMError SetCallingWindow(uint32_t windowId) { return WMError::WM_OK; } 1691 1692 /** 1693 * @brief Set privacy mode of window. 1694 * 1695 * @param isPrivacyMode True means set window private, false means not set window private. 1696 * @return WM_OK means set success, others means set failed. 1697 */ SetPrivacyMode(bool isPrivacyMode)1698 virtual WMError SetPrivacyMode(bool isPrivacyMode) { return WMError::WM_OK; } 1699 1700 /** 1701 * @brief Get privacy property of window. 1702 * 1703 * @return True means window is private and cannot be screenshot or recorded. 1704 */ IsPrivacyMode()1705 virtual bool IsPrivacyMode() const { return false; } 1706 1707 /** 1708 * @brief Set privacy mode by system. 1709 * 1710 * @param isSystemPrivacyMode True means set window private, false means not set window private. 1711 */ SetSystemPrivacyMode(bool isSystemPrivacyMode)1712 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) {} 1713 1714 /** 1715 * @brief Bind Dialog window to target token. 1716 * 1717 * @param targetToken Window token of target. 1718 * @return WM_OK means set success, others means set failed. 1719 */ BindDialogTarget(sptr<IRemoteObject> targetToken)1720 virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) { return WMError::WM_OK; } 1721 1722 /** 1723 * @brief Set whether the dialog window responds to back gesture. 1724 * 1725 * @param isEnabled Responds to back gesture if true, or ignore back gesture if false. 1726 * @return WM_OK means set success, others means set failed. 1727 */ SetDialogBackGestureEnabled(bool isEnabled)1728 virtual WMError SetDialogBackGestureEnabled(bool isEnabled) 1729 { 1730 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1731 } 1732 1733 /** 1734 * @brief Raise zorder of window to the top of APP Mainwindow. 1735 * 1736 * @return WM_OK means raise success, others means raise failed. 1737 */ RaiseToAppTop()1738 virtual WMError RaiseToAppTop() { return WMError::WM_OK; } 1739 1740 /** 1741 * @brief Set skip flag of snapshot. 1742 * 1743 * @param isSkip True means skip the snapshot, false means the opposite. 1744 * @return WM_OK means set success, others means set failed. 1745 */ SetSnapshotSkip(bool isSkip)1746 virtual WMError SetSnapshotSkip(bool isSkip) { return WMError::WM_OK; } 1747 1748 // window effect 1749 /** 1750 * @brief Set corner radius of window. 1751 * 1752 * @param cornerRadius Corner radius of window 1753 * @return WM_OK means set success, others means set failed. 1754 */ SetCornerRadius(float cornerRadius)1755 virtual WMError SetCornerRadius(float cornerRadius) { return WMError::WM_OK; } 1756 1757 /** 1758 * @brief Sets corner radius of window. 1759 * 1760 * @param cornerRadius Corner radius of window. 1761 * @return WM_OK means set success, others means set failed. 1762 */ SetWindowCornerRadius(float cornerRadius)1763 virtual WMError SetWindowCornerRadius(float cornerRadius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1764 1765 /** 1766 * @brief Get corner radius of window. 1767 * 1768 * @param cornerRadius Corner radius of window. 1769 * @return WM_OK means set success, others means set failed. 1770 */ GetWindowCornerRadius(float & cornerRadius)1771 virtual WMError GetWindowCornerRadius(float& cornerRadius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1772 1773 /** 1774 * @brief Set shadow radius of window. 1775 * 1776 * @param radius Shadow radius of window 1777 * @return WM_OK means set success, others means set failed. 1778 */ SetShadowRadius(float radius)1779 virtual WMError SetShadowRadius(float radius) { return WMError::WM_OK; } 1780 1781 /** 1782 * @brief Sync shadows to component. 1783 * 1784 * @param radius Shadows of window 1785 * @return WM_OK means set success, others means set failed. 1786 */ SyncShadowsToComponent(const ShadowsInfo & shadowsInfo)1787 virtual WMError SyncShadowsToComponent(const ShadowsInfo& shadowsInfo) 1788 { 1789 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1790 } 1791 1792 /** 1793 * @brief Set shadow radius of window. 1794 * 1795 * @param radius Shadow radius of window. 1796 * @return WM_OK means set success, others means set failed. 1797 */ SetWindowShadowRadius(float radius)1798 virtual WMError SetWindowShadowRadius(float radius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1799 1800 /** 1801 * @brief Set shadow color of window. 1802 * 1803 * @param color Shadow color of window. 1804 * @return WM_OK means set success, others means set failed. 1805 */ SetShadowColor(std::string color)1806 virtual WMError SetShadowColor(std::string color) { return WMError::WM_OK; } 1807 1808 /** 1809 * @brief Set shadow X offset. 1810 * 1811 * @param offsetX Shadow x-axis offset. 1812 * @return WM_OK means set success, others means set failed. 1813 */ SetShadowOffsetX(float offsetX)1814 virtual WMError SetShadowOffsetX(float offsetX) { return WMError::WM_OK; } 1815 1816 /** 1817 * @brief Set shadow Y offset. 1818 * 1819 * @param offsetY Shadow y-axis offset. 1820 * @return WM_OK means set success, others means set failed. 1821 */ SetShadowOffsetY(float offsetY)1822 virtual WMError SetShadowOffsetY(float offsetY) { return WMError::WM_OK; } 1823 1824 /** 1825 * @brief Set blur property. 1826 * 1827 * @param radius Blur value. 1828 * @return WM_OK means set success, others means set failed. 1829 */ SetBlur(float radius)1830 virtual WMError SetBlur(float radius) { return WMError::WM_OK; } 1831 1832 /** 1833 * @brief Set Backdrop blur property. 1834 * 1835 * @param radius Backdrop blur value. 1836 * @return WM_OK means set success, others means set failed. 1837 */ SetBackdropBlur(float radius)1838 virtual WMError SetBackdropBlur(float radius) { return WMError::WM_OK; } 1839 1840 /** 1841 * @brief Set Backdrop blur style. 1842 * 1843 * @param blurStyle Backdrop blur value. 1844 * @return WM_OK means set success, others means set failed. 1845 */ SetBackdropBlurStyle(WindowBlurStyle blurStyle)1846 virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) { return WMError::WM_OK; } 1847 1848 /** 1849 * @brief Request to get focus. 1850 * 1851 * @return WM_OK means request success, others means request failed. 1852 */ RequestFocus()1853 virtual WMError RequestFocus() const { return WMError::WM_OK; } 1854 1855 /** 1856 * @brief Request to get focus or lose focus. 1857 * 1858 * @return WM_OK means request success, others means request failed. 1859 */ RequestFocusByClient(bool isFocused)1860 virtual WMError RequestFocusByClient(bool isFocused) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1861 1862 /** 1863 * @brief Check current focus status. 1864 * 1865 * @return True means window is focused, false means window is unfocused. 1866 */ IsFocused()1867 virtual bool IsFocused() const { return false; } 1868 1869 /** 1870 * @brief Check current UIExtensionComponent focus status. 1871 * 1872 * @return True means UIExtensionComponent is focused, false means UIExtensionComponent is unfocused. 1873 */ IsComponentFocused()1874 virtual bool IsComponentFocused() const { return false; } 1875 1876 /** 1877 * @brief Update surfaceNode after customAnimation. 1878 * 1879 * @param isAdd True means add custom animation, false means the opposite. 1880 * @return WM_OK means update success, others means update failed. 1881 */ UpdateSurfaceNodeAfterCustomAnimation(bool isAdd)1882 virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { return WMError::WM_OK; } 1883 1884 /** 1885 * @brief Set InputEvent Consumer. 1886 * 1887 * @param inputEventConsumer Consume input event object. 1888 * @return WM_OK means set success, others means set failed. 1889 */ SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer> & inputEventConsumer)1890 virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) {} 1891 1892 /** 1893 * @brief Consume KeyEvent from MMI. 1894 * 1895 * @param inputEvent Keyboard input event. 1896 */ ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> & inputEvent)1897 virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) {} 1898 1899 /** 1900 * @brief Consume BackEvent by keyEvent with keyCode_back. 1901 */ ConsumeBackEvent()1902 virtual void ConsumeBackEvent() {} 1903 1904 /** 1905 * @brief Determine whether the dialog session back gesture is enabled. 1906 */ IsDialogSessionBackGestureEnabled()1907 virtual bool IsDialogSessionBackGestureEnabled() 1908 { 1909 return false; 1910 } 1911 1912 /** 1913 * @brief Notify KeyEvent to arkui. 1914 * 1915 * @param inputEvent Keyboard input event 1916 */ PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)1917 virtual bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) {return false;} 1918 1919 /** 1920 * @brief Consume PointerEvent from MMI. 1921 * 1922 * @param inputEvent Pointer input event 1923 */ ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent> & inputEvent)1924 virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 1925 1926 /** 1927 * @brief Request Vsync. 1928 * 1929 * @param vsyncCallback Callback of vsync. 1930 */ RequestVsync(const std::shared_ptr<VsyncCallback> & vsyncCallback)1931 virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) {} 1932 1933 /** 1934 * @brief get vsync period. 1935 * 1936 * @return vsync period. 1937 */ GetVSyncPeriod()1938 virtual int64_t GetVSyncPeriod() { return 0; } 1939 1940 /** 1941 * @brief flush frame rate of linker. 1942 * 1943 * @param rate frame rate. 1944 * @param animatorExpectedFrameRate animator expected frame rate. 1945 * @param rateType frame rate type. 1946 */ FlushFrameRate(uint32_t rate,int32_t animatorExpectedFrameRate,uint32_t rateType)1947 virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {} 1948 1949 /** 1950 * @brief Update Configuration. 1951 * 1952 * @param configuration Window configuration. 1953 */ UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1954 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1955 1956 /** 1957 * @brief Update configuration for specified window. 1958 * 1959 * @param configuration Window configuration. 1960 * @param resourceManager The resource manager 1961 */ UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration> & configuration,const std::shared_ptr<Global::Resource::ResourceManager> & resourceManager)1962 virtual void UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 1963 const std::shared_ptr<Global::Resource::ResourceManager>& resourceManager) {} 1964 1965 /** 1966 * @brief Update theme configuration. 1967 * @param configuration Window configuration. 1968 */ UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1969 virtual void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1970 1971 /** 1972 * @brief Register window lifecycle listener. 1973 * 1974 * @param listener WindowLifeCycle listener. 1975 * @return WM_OK means register success, others means register failed. 1976 */ RegisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1977 virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1978 1979 /** 1980 * @brief Unregister window lifecycle listener. 1981 * 1982 * @param listener WindowLifeCycle listener. 1983 * @return WM_OK means unregister success, others means unregister failed. 1984 */ UnregisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1985 virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1986 1987 /** 1988 * @brief Register window lifecycle listener. 1989 * 1990 * @param listener WindowLifeCycle listener. 1991 * @return WM_OK means register success, others means register failed. 1992 */ RegisterWindowStageLifeCycleListener(const sptr<IWindowStageLifeCycle> & listener)1993 virtual WMError RegisterWindowStageLifeCycleListener(const sptr<IWindowStageLifeCycle>& listener) 1994 { 1995 return WMError::WM_OK; 1996 } 1997 1998 /** 1999 * @brief Unregister window lifecycle listener. 2000 * 2001 * @param listener WindowLifeCycle listener. 2002 * @return WM_OK means unregister success, others means unregister failed. 2003 */ UnregisterWindowStageLifeCycleListener(const sptr<IWindowStageLifeCycle> & listener)2004 virtual WMError UnregisterWindowStageLifeCycleListener(const sptr<IWindowStageLifeCycle>& listener) 2005 { 2006 return WMError::WM_OK; 2007 } 2008 2009 /** 2010 * @brief Register window change listener. 2011 * 2012 * @param listener IWindowChangeListener. 2013 * @return WM_OK means register success, others means register failed. 2014 */ RegisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)2015 virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 2016 { 2017 return WMError::WM_OK; 2018 } 2019 2020 /** 2021 * @brief Unregister window change listener. 2022 * 2023 * @param listener IWindowChangeListener. 2024 * @return WM_OK means unregister success, others means unregister failed. 2025 */ UnregisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)2026 virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 2027 { 2028 return WMError::WM_OK; 2029 } 2030 2031 /** 2032 * @brief Register avoid area change listener. 2033 * 2034 * @param listener IAvoidAreaChangedListener. 2035 * @return WM_OK means register success, others means register failed. 2036 */ RegisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener> & listener)2037 virtual WMError RegisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) 2038 { 2039 return WMError::WM_OK; 2040 } 2041 2042 /** 2043 * @brief Unregister avoid area change listener. 2044 * 2045 * @param listener IAvoidAreaChangedListener. 2046 * @return WM_OK means unregister success, others means unregister failed. 2047 */ UnregisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener> & listener)2048 virtual WMError UnregisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) 2049 { 2050 return WMError::WM_OK; 2051 } 2052 2053 /** 2054 * @brief Register window drag listener. 2055 * 2056 * @param listener IWindowDragListener. 2057 * @return WM_OK means register success, others means register failed. 2058 */ RegisterDragListener(const sptr<IWindowDragListener> & listener)2059 virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 2060 2061 /** 2062 * @brief Unregister window drag listener. 2063 * 2064 * @param listener IWindowDragListener. 2065 * @return WM_OK means unregister success, others means unregister failed. 2066 */ UnregisterDragListener(const sptr<IWindowDragListener> & listener)2067 virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 2068 2069 /** 2070 * @brief Register display move listener. 2071 * 2072 * @param listener IDisplayMoveListener. 2073 * @return WM_OK means register success, others means register failed. 2074 */ RegisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)2075 virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 2076 2077 /** 2078 * @brief Unregister display move listener. 2079 * 2080 * @param listener IDisplayMoveListener. 2081 * @return WM_OK means unregister success, others means unregister failed. 2082 */ UnregisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)2083 virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 2084 2085 /** 2086 * @brief Register window destroyed listener. 2087 * 2088 * @param func Function to notify window destroyed. 2089 */ RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc & func)2090 virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) {} 2091 2092 /** 2093 * @brief Unregister window destroyed listener. 2094 * 2095 */ UnregisterWindowDestroyedListener()2096 virtual void UnregisterWindowDestroyedListener() {} 2097 2098 /** 2099 * @brief Register Occupied Area Change listener. 2100 * 2101 * @param listener IOccupiedAreaChangeListener. 2102 * @return WM_OK means register success, others means register failed. 2103 */ RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)2104 virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 2105 { 2106 return WMError::WM_OK; 2107 } 2108 2109 /** 2110 * @brief Unregister occupied area change listener. 2111 * 2112 * @param listener IOccupiedAreaChangeListener. 2113 * @return WM_OK means unregister success, others means unregister failed. 2114 */ UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)2115 virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 2116 { 2117 return WMError::WM_OK; 2118 } 2119 2120 /** 2121 * @brief Register touch outside listener. 2122 * 2123 * @param listener ITouchOutsideListener. 2124 * @return WM_OK means register success, others means register failed. 2125 */ RegisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)2126 virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) { return WMError::WM_OK; } 2127 2128 /** 2129 * @brief Unregister touch outside listener. 2130 * 2131 * @param listener ITouchOutsideListener. 2132 * @return WM_OK means unregister success, others means unregister failed. 2133 */ UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)2134 virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) 2135 { 2136 return WMError::WM_OK; 2137 } 2138 2139 /** 2140 * @brief Register Animation Transition Controller listener. 2141 * 2142 * @param listener IAnimationTransitionController. 2143 * @return WM_OK means register success, others means register failed. 2144 */ RegisterAnimationTransitionController(const sptr<IAnimationTransitionController> & listener)2145 virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) 2146 { 2147 return WMError::WM_OK; 2148 } 2149 2150 /** 2151 * @brief Register screen shot listener. 2152 * 2153 * @param listener IScreenshotListener. 2154 * @return WM_OK means register success, others means register failed. 2155 */ RegisterScreenshotListener(const sptr<IScreenshotListener> & listener)2156 virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 2157 2158 /** 2159 * @brief Unregister screen shot listener. 2160 * 2161 * @param listener IScreenshotListener. 2162 * @return WM_OK means unregister success, others means unregister failed. 2163 */ UnregisterScreenshotListener(const sptr<IScreenshotListener> & listener)2164 virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 2165 2166 /** 2167 * @brief Register screen shot app event listener. 2168 * 2169 * @param listener IScreenshotAppEventListener. 2170 * @return WM_OK means register success, others means register failed. 2171 */ RegisterScreenshotAppEventListener(const IScreenshotAppEventListenerSptr & listener)2172 virtual WMError RegisterScreenshotAppEventListener( 2173 const IScreenshotAppEventListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2174 2175 /** 2176 * @brief Unregister screen shot app event listener. 2177 * 2178 * @param listener IScreenshotAppEventListener. 2179 * @return WM_OK means unregister success, others means unregister failed. 2180 */ UnregisterScreenshotAppEventListener(const IScreenshotAppEventListenerSptr & listener)2181 virtual WMError UnregisterScreenshotAppEventListener( 2182 const IScreenshotAppEventListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2183 2184 /** 2185 * @brief Register dialog target touch listener. 2186 * 2187 * @param listener IDialogTargetTouchListener. 2188 * @return WM_OK means register success, others means register failed. 2189 */ RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)2190 virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 2191 { 2192 return WMError::WM_OK; 2193 } 2194 2195 /** 2196 * @brief Unregister dialog target touch listener. 2197 * 2198 * @param listener IDialogTargetTouchListener. 2199 * @return WM_OK means unregister success, others means unregister failed. 2200 */ UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)2201 virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 2202 { 2203 return WMError::WM_OK; 2204 } 2205 2206 /** 2207 * @brief Register dialog death Recipient listener. 2208 * 2209 * @param listener IDialogDeathRecipientListener. 2210 */ RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)2211 virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 2212 2213 /** 2214 * @brief Unregister window death recipient listener. 2215 * 2216 * @param listener IDialogDeathRecipientListener. 2217 */ UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)2218 virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 2219 2220 /** 2221 * @brief Notify touch dialog target. 2222 */ 2223 virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) {} 2224 2225 /** 2226 * @brief Set ace ability handler. 2227 * 2228 * @param handler Ace ability handler. 2229 */ SetAceAbilityHandler(const sptr<IAceAbilityHandler> & handler)2230 virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) {} 2231 2232 /** 2233 * @brief set window ui content 2234 * 2235 * @param contentInfo content info path 2236 * @param env 2237 * @param storage 2238 * @param isDistributed 2239 * @param ability 2240 * @return WMError 2241 */ 2242 virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 2243 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 2244 AppExecFwk::Ability* ability = nullptr) 2245 { 2246 return WMError::WM_OK; 2247 } 2248 virtual WMError NapiSetUIContent(const std::string& contentInfo, ani_env* env, ani_object storage, 2249 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 2250 AppExecFwk::Ability* ability = nullptr) 2251 { 2252 return WMError::WM_OK; 2253 } 2254 2255 /** 2256 * @brief set window ui content 2257 * 2258 * @param contentName content info path 2259 * @param env Napi environment 2260 * @param storage Napi storage 2261 * @param type restore type 2262 * @param token parent token 2263 * @param ability Ability instance 2264 * @return WMError 2265 */ 2266 virtual WMError NapiSetUIContentByName(const std::string& contentName, napi_env env, napi_value storage, 2267 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 2268 AppExecFwk::Ability* ability = nullptr) { return WMError::WM_OK; } 2269 2270 /** 2271 * @brief set window ui content 2272 * 2273 * @param contentInfo content info path 2274 * @param engine 2275 * @param storage 2276 * @param isDistributed 2277 * @param ability 2278 * @return WMError 2279 */ 2280 virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, 2281 AppExecFwk::Ability* ability = nullptr) 2282 { 2283 return WMError::WM_OK; 2284 } 2285 2286 /** 2287 * @brief set window ui content by abc 2288 * 2289 * @param abcPath abc path 2290 * @param env 2291 * @param storage 2292 * @param ability 2293 * @return WMError 2294 */ 2295 virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, 2296 AppExecFwk::Ability* ability = nullptr) 2297 { 2298 return WMError::WM_OK; 2299 } 2300 2301 /** 2302 * @brief Get ui content info. 2303 * 2304 * @return UI content info. 2305 */ 2306 virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) 2307 { 2308 return {}; 2309 } 2310 2311 /** 2312 * @brief Set uiability restored router stack. 2313 * 2314 * @return WMError. 2315 */ SetRestoredRouterStack(const std::string & routerStack)2316 virtual WMError SetRestoredRouterStack(const std::string& routerStack) 2317 { 2318 return WMError::WM_OK; 2319 } 2320 2321 /** 2322 * @brief Get ui content object. 2323 * 2324 * @return UIContent object of ACE. 2325 */ GetUIContent()2326 virtual Ace::UIContent* GetUIContent() const { return nullptr; } 2327 2328 /** 2329 * @brief Get ui content object. 2330 * 2331 * @param winId window id. 2332 * @return UIContent object of ACE. 2333 */ GetUIContentWithId(uint32_t winId)2334 virtual Ace::UIContent* GetUIContentWithId(uint32_t winId) const { return nullptr; } 2335 2336 /** 2337 * @brief Window handle new want. 2338 * 2339 * @param want Want object of AAFwk. 2340 */ OnNewWant(const AAFwk::Want & want)2341 virtual void OnNewWant(const AAFwk::Want& want) {} 2342 2343 /** 2344 * @brief Set requested orientation. 2345 * 2346 * @param Orientation Screen orientation. 2347 * @param animation true means window rotation needs animation. Otherwise not needed. 2348 */ 2349 virtual void SetRequestedOrientation(Orientation orientation, bool needAnimation = true) {} 2350 2351 /** 2352 * @brief Get the Target Orientation ConfigInfo. 2353 * 2354 * @param targetOrientation target Orientation. 2355 * @param properties systemBar properties 2356 * @param config Viewport config. 2357 * @param avoidAreas avoidArea information 2358 * @return WMError 2359 */ GetTargetOrientationConfigInfo(Orientation targetOrientation,const std::map<WindowType,SystemBarProperty> & properties,Ace::ViewportConfig & config,std::map<AvoidAreaType,AvoidArea> & avoidAreas)2360 virtual WMError GetTargetOrientationConfigInfo(Orientation targetOrientation, 2361 const std::map<WindowType, SystemBarProperty>& properties, Ace::ViewportConfig& config, 2362 std::map<AvoidAreaType, AvoidArea>& avoidAreas) 2363 { 2364 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2365 } 2366 2367 /** 2368 * @brief Register window orientation set by developer 2369 * 2370 * @param listener IPreferredOrientationChangeListener. 2371 * @return WM_OK means register success, others means register failed 2372 */ RegisterPreferredOrientationChangeListener(const sptr<IPreferredOrientationChangeListener> & listener)2373 virtual WMError RegisterPreferredOrientationChangeListener( 2374 const sptr<IPreferredOrientationChangeListener>& listener) 2375 { 2376 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2377 } 2378 2379 /** 2380 * @brief Unregister window orientation set by developer 2381 * 2382 * @param listener IPreferredOrientationChangeListener. 2383 * @return WM_OK means register success, others means unregister failed 2384 */ UnregisterPreferredOrientationChangeListener(const sptr<IPreferredOrientationChangeListener> & listener)2385 virtual WMError UnregisterPreferredOrientationChangeListener( 2386 const sptr<IPreferredOrientationChangeListener>& listener) 2387 { 2388 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2389 } 2390 2391 /** 2392 * @brief Register window orientation change listener 2393 * 2394 * @param listener IWindowOrientationChangeListener. 2395 * @return WM_OK means register success, others means register failed 2396 */ RegisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener> & listener)2397 virtual WMError RegisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) 2398 { 2399 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2400 } 2401 2402 /** 2403 * @brief Unregister window orientation change listener 2404 * 2405 * @param listener IWindowOrientationChangeListener. 2406 * @return WM_OK means unregister success, others means unregister failed 2407 */ UnregisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener> & listener)2408 virtual WMError UnregisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) 2409 { 2410 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2411 } 2412 2413 /** 2414 * @brief Notify caller window orientation set by developer 2415 * 2416 * @param orientation Orientation set by developer 2417 */ NotifyPreferredOrientationChange(Orientation orientation)2418 virtual void NotifyPreferredOrientationChange(Orientation orientation) {} 2419 2420 /** 2421 * @brief Set developer requested orientation. 2422 * 2423 * @param orientation Orientation set by developer 2424 */ SetUserRequestedOrientation(Orientation orientation)2425 virtual void SetUserRequestedOrientation(Orientation orientation) {} 2426 2427 /** 2428 * @brief Is needed forcibly set orientation. 2429 * 2430 * @param orientation Requested orientation. 2431 */ isNeededForciblySetOrientation(Orientation orientation)2432 virtual bool isNeededForciblySetOrientation(Orientation orientation) { return false; } 2433 2434 /** 2435 * @brief Register SystemBarProperty listener. 2436 * 2437 * @param listener ISystemBarPropertyListener. 2438 * @return WM_OK means register success, others means register failed. 2439 */ RegisterSystemBarPropertyListener(const sptr<ISystemBarPropertyListener> & listener)2440 virtual WMError RegisterSystemBarPropertyListener(const sptr<ISystemBarPropertyListener>& listener) 2441 { 2442 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2443 } 2444 2445 /** 2446 * @brief Unregister SystemBarProperty listener. 2447 * 2448 * @param listener ISystemBarPropertyListener. 2449 * @return WM_OK means unregister success, others means unregister failed. 2450 */ UnregisterSystemBarPropertyListener(const sptr<ISystemBarPropertyListener> & listener)2451 virtual WMError UnregisterSystemBarPropertyListener(const sptr<ISystemBarPropertyListener>& listener) 2452 { 2453 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2454 } 2455 2456 /** 2457 * @brief Notify SystemBarProperty listener. 2458 * 2459 * @param type The WindowType. 2460 * @param property new property value setted by developer. 2461 */ NotifySystemBarPropertyUpdate(WindowType type,const SystemBarProperty & property)2462 virtual void NotifySystemBarPropertyUpdate(WindowType type, const SystemBarProperty& property) {} 2463 2464 /** 2465 * @brief Get requested orientation. 2466 * 2467 * @return Orientation screen orientation. 2468 */ GetRequestedOrientation()2469 virtual Orientation GetRequestedOrientation() { return Orientation::UNSPECIFIED; } 2470 2471 /** 2472 * @brief Set requested mode support info. 2473 * 2474 * @param windowModeSupportType Mode of window supported. 2475 */ SetRequestWindowModeSupportType(uint32_t windowModeSupportType)2476 virtual void SetRequestWindowModeSupportType(uint32_t windowModeSupportType) {} 2477 /** 2478 * @brief Get requested mode support info. 2479 * 2480 * @return Enumeration values under WindowModeSupport. 2481 */ GetRequestWindowModeSupportType()2482 virtual uint32_t GetRequestWindowModeSupportType() const { return 0; } 2483 /** 2484 * @brief Set touch hot areas. 2485 * 2486 * @param rects Hot areas of touching. 2487 * @return WM_OK means set success, others means set failed. 2488 */ SetTouchHotAreas(const std::vector<Rect> & rects)2489 virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) { return WMError::WM_OK; } 2490 2491 /** 2492 * @brief Set keyboard touch hot areas. 2493 * 2494 * @param hotAreas keyboard hot areas of touching. 2495 * @return WM_OK means set success, others means set failed. 2496 */ SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas & hotAreas)2497 virtual WMError SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas& hotAreas) { return WMError::WM_OK; } 2498 2499 /** 2500 * @brief Get requested touch hot areas. 2501 * 2502 * @param rects Hot areas of touching. 2503 */ GetRequestedTouchHotAreas(std::vector<Rect> & rects)2504 virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const {} 2505 2506 /** 2507 * @brief Main handler available or not. 2508 * 2509 * @return True means main handler is available, false means the opposite. 2510 */ IsMainHandlerAvailable()2511 virtual bool IsMainHandlerAvailable() const { return false; } 2512 2513 /** 2514 * @brief Set window label name. 2515 * 2516 * @param label Window label name. 2517 * @return WM_OK means set success, others means set failed. 2518 */ SetAPPWindowLabel(const std::string & label)2519 virtual WMError SetAPPWindowLabel(const std::string& label) { return WMError::WM_OK; } 2520 2521 /** 2522 * @brief Set window icon. 2523 * 2524 * @param icon Window icon. 2525 * @return WM_OK means set success, others means set failed. 2526 */ SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap> & icon)2527 virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) { return WMError::WM_OK; } 2528 2529 /** 2530 * @brief disable main window decoration. It must be callled before loadContent. 2531 * 2532 */ DisableAppWindowDecor()2533 virtual WMError DisableAppWindowDecor() { return WMError::WM_OK; } 2534 2535 /** 2536 * @brief return window decoration is enabled. It is called by ACE 2537 * 2538 * @return true means window decoration is enabled. Otherwise disabled 2539 */ IsDecorEnable()2540 virtual bool IsDecorEnable() const { return false; } 2541 2542 /** 2543 * @brief maximize the main window. It is called by ACE when maximize button is clicked. 2544 * 2545 * @return WMError 2546 */ Maximize()2547 virtual WMError Maximize() { return WMError::WM_OK; } 2548 2549 /** 2550 * @brief maximize window with presentation enum. 2551 * 2552 * @param presentation the value means use presentation enum to layout when maximize window 2553 * @return WM_OK means maximize window ok, others means failed. 2554 */ Maximize(MaximizePresentation presentation)2555 virtual WMError Maximize(MaximizePresentation presentation) 2556 { 2557 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2558 } 2559 2560 /** 2561 * @brief maximize the main window according to MaximizeMode. called by ACE when maximize button is clicked. 2562 * 2563 * @return WMError 2564 */ MaximizeFloating()2565 virtual WMError MaximizeFloating() {return WMError::WM_OK;} 2566 2567 /** 2568 * @brief minimize the main window. It is called by ACE when minimize button is clicked. 2569 * 2570 * @return WMError 2571 */ Minimize()2572 virtual WMError Minimize() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2573 2574 /** 2575 * @brief recovery the main window. It is called by ACE when recovery button is clicked. 2576 * 2577 * @return WMError 2578 */ Recover()2579 virtual WMError Recover() { return WMError::WM_OK; } 2580 2581 /** 2582 * @brief After the app main window is minimized, if the Ability is not in the backgroud state, 2583 * you can restore app main window. 2584 * 2585 * @return WMError 2586 */ Restore()2587 virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2588 2589 /** 2590 * @brief close the window. It is called by ACE when close button is clicked. 2591 * 2592 * @return WMError 2593 */ Close()2594 virtual WMError Close() { return WMError::WM_OK; } 2595 2596 /** 2597 * @brief close the window. There is no pre-close process. 2598 * 2599 * @return WMError 2600 */ CloseDirectly()2601 virtual WMError CloseDirectly() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2602 2603 /** 2604 * @brief notify rotation change result. 2605 */ NotifyRotationChangeResult(RotationChangeResult rotationChangeResult)2606 virtual void NotifyRotationChangeResult(RotationChangeResult rotationChangeResult) {} 2607 2608 /** 2609 * @brief start move main window. It is called by ACE when title is moved. 2610 * 2611 */ StartMove()2612 virtual void StartMove() {} 2613 2614 /** 2615 * @brief get main window move flag. 2616 * 2617 * @return true means main window is moving. Otherwise is not moving. 2618 */ IsStartMoving()2619 virtual bool IsStartMoving() { return false; } 2620 2621 /** 2622 * @brief Start moving window. It is called by application. 2623 * 2624 * @return Errorcode of window. 2625 */ StartMoveWindow()2626 virtual WmErrorCode StartMoveWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2627 2628 /** 2629 * @brief Start moving window. It is called by application. 2630 * 2631 * @param offsetX expected pointer position x-axis offset in window when start moving. 2632 * @param offsetY expected pointer position y-axis offset in window when start moving. 2633 * @return Error code of window. 2634 */ StartMoveWindowWithCoordinate(int32_t offsetX,int32_t offsetY)2635 virtual WmErrorCode StartMoveWindowWithCoordinate(int32_t offsetX, 2636 int32_t offsetY) { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2637 2638 /** 2639 * @brief Stop moving window. It is called by application. Support pc window and pad free multi-window. 2640 * 2641 * @return Error code of window. 2642 */ StopMoveWindow()2643 virtual WmErrorCode StopMoveWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2644 2645 /** 2646 * @brief Set flag that need remove window input channel. 2647 * 2648 * @param needRemoveWindowInputChannel True means remove input channel, false means not remove. 2649 */ SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel)2650 virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) {} 2651 2652 /** 2653 * @brief set global window maximize mode. It is called by ACE when maximize mode changed. 2654 * 2655 * @param mode MODE_AVOID_SYSTEM_BAR - avoid statusbar and dockbar; MODE_FULL_FILL - fullfill the screen 2656 * 2657 * @return WMError 2658 */ SetGlobalMaximizeMode(MaximizeMode mode)2659 virtual WMError SetGlobalMaximizeMode(MaximizeMode mode) {return WMError::WM_OK;} 2660 2661 /** 2662 * @brief get global window maximize mode. 2663 * 2664 * @return MaximizeMode 2665 */ GetGlobalMaximizeMode()2666 virtual MaximizeMode GetGlobalMaximizeMode() const {return MaximizeMode::MODE_FULL_FILL;} 2667 2668 // colorspace, gamut 2669 /** 2670 * @brief Is support wide gamut or not. 2671 * 2672 * @return True means support wide gamut, false means not support. 2673 */ IsSupportWideGamut()2674 virtual bool IsSupportWideGamut() { return false; } 2675 2676 /** 2677 * @brief Set color space. 2678 * 2679 * @param colorSpace ColorSpace object. 2680 */ SetColorSpace(ColorSpace colorSpace)2681 virtual void SetColorSpace(ColorSpace colorSpace) {} 2682 2683 /** 2684 * @brief Get color space object. 2685 * 2686 * @return ColorSpace object. 2687 */ GetColorSpace()2688 virtual ColorSpace GetColorSpace() { return ColorSpace::COLOR_SPACE_DEFAULT; } 2689 DumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)2690 virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) {} 2691 2692 /** 2693 * @brief window snapshot 2694 * 2695 * @return std::shared_ptr<Media::PixelMap> snapshot pixel 2696 */ Snapshot()2697 virtual std::shared_ptr<Media::PixelMap> Snapshot() { return nullptr; } 2698 2699 /** 2700 * @brief window snapshot 2701 * 2702 * @param pixelMap pixel map 2703 * @return the error code of this operation 2704 */ Snapshot(std::shared_ptr<Media::PixelMap> & pixelMap)2705 virtual WMError Snapshot( 2706 std::shared_ptr<Media::PixelMap>& pixelMap) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2707 2708 /** 2709 * @brief window SnapshotIgnorePrivacy 2710 * 2711 * @param pixelMap pixel map 2712 * @return the error code of this operation 2713 */ SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap> & pixelMap)2714 virtual WMError SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap>& pixelMap) { return WMError::WM_OK; } 2715 2716 /** 2717 * @brief Handle and notify memory level. 2718 * 2719 * @param level memory level 2720 * @return the error code of window 2721 */ NotifyMemoryLevel(int32_t level)2722 virtual WMError NotifyMemoryLevel(int32_t level) { return WMError::WM_OK; } 2723 2724 /** 2725 * @brief Update configuration for all windows 2726 * 2727 * @param configuration configuration for app 2728 */ IsAllowHaveSystemSubWindow()2729 virtual bool IsAllowHaveSystemSubWindow() { return false; } 2730 2731 /** 2732 * @brief Set aspect ratio of this window 2733 * 2734 * @param ratio the aspect ratio of window except decoration 2735 * @return WMError 2736 */ SetAspectRatio(float ratio)2737 virtual WMError SetAspectRatio(float ratio) { return WMError::WM_OK; } 2738 2739 /** 2740 * @brief Unset aspect ratio 2741 * @return WMError 2742 */ ResetAspectRatio()2743 virtual WMError ResetAspectRatio() { return WMError::WM_OK; } 2744 2745 /** 2746 * @brief Get keyboard animation config 2747 * @return KeyboardAnimationConfig 2748 */ GetKeyboardAnimationConfig()2749 virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() { return {}; } 2750 2751 /** 2752 * @brief Set need default animation for window show and hide. 2753 * 2754 * @param needDefaultAnimation True means need default animation, false means not need. 2755 */ SetNeedDefaultAnimation(bool needDefaultAnimation)2756 virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) {} 2757 2758 /** 2759 * @brief Transfer Ability Result. 2760 * @return WMError 2761 */ TransferAbilityResult(uint32_t resultCode,const AAFwk::Want & want)2762 virtual WMError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { return WMError::WM_OK; } 2763 2764 /** 2765 * @brief Transfer UIExtension data to Extension Component. 2766 * @return WMError 2767 */ TransferExtensionData(const AAFwk::WantParams & wantParams)2768 virtual WMError TransferExtensionData(const AAFwk::WantParams& wantParams) { return WMError::WM_OK; } 2769 2770 /** 2771 * @brief Register transfer component data callback. 2772 * 2773 * @param func Function to notify transfer component data. 2774 */ RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc & func)2775 virtual void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) {} 2776 2777 /** 2778 * @brief Trigger BindUIExtensionModal callback. 2779 * It needs to be called when the UIExtension frame node is set to asynchronously bind to the modal window. 2780 */ TriggerBindModalUIExtension()2781 virtual void TriggerBindModalUIExtension() {} 2782 2783 /** 2784 * @brief Perform back event. 2785 * 2786 */ PerformBack()2787 virtual void PerformBack() {} 2788 2789 /** 2790 * @brief Set the drag enabled flag of a window. 2791 * 2792 * @param dragEnabled true means the window can be resized by dragging, otherwise means the opposite. 2793 * @return Errorcode of window. 2794 */ SetResizeByDragEnabled(bool dragEnabled)2795 virtual WMError SetResizeByDragEnabled(bool dragEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2796 2797 /** 2798 * @brief Set the raise enabled flag of a window. 2799 * 2800 * @param raiseEnabled true means the window can be raised by click, otherwise means the opposite. 2801 * @return Errorcode of window. 2802 */ SetRaiseByClickEnabled(bool raiseEnabled)2803 virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2804 2805 /** 2806 * @brief Raise one app sub window above another. 2807 * 2808 * @return WM_OK means raise success, others means raise failed. 2809 */ RaiseAboveTarget(int32_t subWindowId)2810 virtual WMError RaiseAboveTarget(int32_t subWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2811 2812 /** 2813 * @brief Raise main window above another. 2814 * 2815 * @param targetId Indicates the id of the target main window. 2816 * @return WM_OK means raise success, others means raise failed. 2817 */ RaiseMainWindowAboveTarget(int32_t targetId)2818 virtual WMError RaiseMainWindowAboveTarget(int32_t targetId) 2819 { 2820 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2821 } 2822 2823 /** 2824 * @brief Hide non-system floating windows. 2825 * 2826 * @param shouldHide true means the non-system windows should be hidden, otherwise means the opposite. 2827 * @return Errorcode of window. 2828 */ HideNonSystemFloatingWindows(bool shouldHide)2829 virtual WMError HideNonSystemFloatingWindows(bool shouldHide) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2830 2831 /** 2832 * @brief Is floating window of app type or not. 2833 * 2834 * @return True means floating window of app type, false means the opposite. 2835 */ IsFloatingWindowAppType()2836 virtual bool IsFloatingWindowAppType() const { return false; } 2837 2838 /** 2839 * @brief Is pc window or not. 2840 * 2841 * @return True means pc window, false means the opposite. 2842 */ IsPcWindow()2843 virtual bool IsPcWindow() const { return false; } 2844 2845 /** 2846 * @brief Is pad window or not. 2847 * 2848 * @return True means pad window, false means the opposite. 2849 */ IsPadWindow()2850 virtual bool IsPadWindow() const { return false; } 2851 2852 /** 2853 * @brief Is pc window or free multi window capility enabled or not. 2854 * 2855 * @return True means pc window or free multi window capility enabled, false means the opposite. 2856 */ IsPcOrFreeMultiWindowCapabilityEnabled()2857 virtual bool IsPcOrFreeMultiWindowCapabilityEnabled() const { return false; } 2858 2859 /** 2860 * @brief Is pc window or pad free multi-window. 2861 * 2862 * @return True means pc window or pad free multi-window, false means the opposite. 2863 */ IsPcOrPadFreeMultiWindowMode()2864 virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; } 2865 2866 /** 2867 * @brief Is pcAppInpad and pad window. 2868 * 2869 * @return True means pcAppInpad and pad window., false means the opposite. 2870 */ IsPadAndNotFreeMutiWindowCompatibleMode()2871 virtual bool IsPadAndNotFreeMutiWindowCompatibleMode() const { return false; } 2872 2873 /** 2874 * @brief Judge whether SceneBoard is enabled. 2875 * 2876 * @return True means SceneBoard is enabled, false means the opposite. 2877 */ IsSceneBoardEnabled()2878 virtual bool IsSceneBoardEnabled() const { return false; } 2879 2880 /** 2881 * @brief get compatible mode in pc. 2882 * @deprecated use IsAdaptToImmersive instead 2883 * 2884 * @return True means window is compatible mode in pc, false means the opposite. 2885 */ GetCompatibleModeInPc()2886 virtual bool GetCompatibleModeInPc() const { return false; } 2887 2888 /** 2889 * @brief Register transfer component data callback. 2890 * 2891 * @param func Function to notify transfer component data. 2892 */ RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc & func)2893 virtual void RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc& func) {} 2894 2895 /** 2896 * @brief Set Text Field Avoid Info. 2897 * 2898 * @return Errorcode of window. 2899 */ SetTextFieldAvoidInfo(double textFieldPositionY,double textFieldHeight)2900 virtual WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) { return WMError::WM_OK; } 2901 2902 /** 2903 * @brief Transfer accessibility event data 2904 * 2905 * @param func Function to notify transfer component data. 2906 */ TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo & info,int64_t uiExtensionIdLevel)2907 virtual WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 2908 int64_t uiExtensionIdLevel) { return WMError::WM_OK; }; 2909 2910 /** 2911 * @brief Notify prepare to close window 2912 * 2913 * @return Errorcode of window. 2914 */ NotifyPrepareClosePiPWindow()2915 virtual WMError NotifyPrepareClosePiPWindow() { return WMError::WM_OK; } 2916 2917 /** 2918 * @brief update the pip window instance (w,h,r). 2919 * 2920 * @param width width of pip window. 2921 * @param height width of pip window. 2922 * @param reason reason of update. 2923 */ UpdatePiPRect(const Rect & rect,WindowSizeChangeReason reason)2924 virtual void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) {} 2925 2926 /** 2927 * @brief update the pip control status. 2928 * 2929 * @param controlType pip control type. 2930 * @param status pip control status. 2931 */ UpdatePiPControlStatus(PiPControlType controlType,PiPControlStatus status)2932 virtual void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) {} 2933 2934 /** 2935 * @brief set auto start status for window. 2936 * 2937 * @param isAutoStart true means auto start pip window when background, otherwise means the opposite. 2938 * @param priority 1 means height priority, 0 means low priority. 2939 * @param width width means width of the video content. 2940 * @param height height means height of the video content. 2941 */ SetAutoStartPiP(bool isAutoStart,uint32_t priority,uint32_t width,uint32_t height)2942 virtual void SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) {} 2943 2944 /** 2945 * @brief When get focused, keep the keyboard created by other windows, support system window and app subwindow. 2946 * 2947 * @param keepKeyboardFlag true means the keyboard should be preserved, otherwise means the opposite. 2948 * @return WM_OK means set keep keyboard flag success, others means failed. 2949 */ KeepKeyboardOnFocus(bool keepKeyboardFlag)2950 virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) 2951 { 2952 return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; 2953 } 2954 2955 /** 2956 * @brief Register window visibility change listener. 2957 * 2958 * @param listener IWindowVisibilityChangedListener. 2959 * @return WM_OK means register success, others means register failed. 2960 */ RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)2961 virtual WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 2962 { 2963 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2964 } 2965 2966 /** 2967 * @brief Unregister window visibility change listener. 2968 * 2969 * @param listener IWindowVisibilityChangedListener. 2970 * @return WM_OK means unregister success, others means unregister failed. 2971 */ UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)2972 virtual WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 2973 { 2974 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2975 } 2976 2977 /** 2978 * @brief Register window displayId change listener. 2979 * 2980 * @param listener IDisplayIdChangedListener. 2981 * @return WM_OK means register success, others means register failed. 2982 */ RegisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)2983 virtual WMError RegisterDisplayIdChangeListener( 2984 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2985 2986 /** 2987 * @brief Unregister window displayId change listener. 2988 * 2989 * @param listener IDisplayIdChangedListener. 2990 * @return WM_OK means unregister success, others means unregister failed. 2991 */ UnregisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)2992 virtual WMError UnregisterDisplayIdChangeListener( 2993 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2994 2995 /** 2996 * @brief Register system density change listener. 2997 * 2998 * @param listener ISystemDensityChangedListener. 2999 * @return WM_OK means register success, others means register failed. 3000 */ RegisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr & listener)3001 virtual WMError RegisterSystemDensityChangeListener( 3002 const ISystemDensityChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3003 3004 /** 3005 * @brief Unregister system density change listener. 3006 * 3007 * @param listener ISystemDensityChangedListener. 3008 * @return WM_OK means unregister success, others means unregister failed. 3009 */ UnregisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr & listener)3010 virtual WMError UnregisterSystemDensityChangeListener( 3011 const ISystemDensityChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3012 3013 /** 3014 * @brief Register main window full screen across multi display change listener. 3015 * 3016 * @param listener IAcrossDisplaysChangeListener. 3017 * @return WM_OK means register success, others means register failed. 3018 */ RegisterAcrossDisplaysChangeListener(const IAcrossDisplaysChangeListenerSptr & listener)3019 virtual WMError RegisterAcrossDisplaysChangeListener( 3020 const IAcrossDisplaysChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3021 3022 /** 3023 * @brief Unregister main window full screen across multi display change listener. 3024 * 3025 * @param listener IAcrossDisplaysChangeListener. 3026 * @return WM_OK means unregister success, others means unregister failed. 3027 */ UnRegisterAcrossDisplaysChangeListener(const IAcrossDisplaysChangeListenerSptr & listener)3028 virtual WMError UnRegisterAcrossDisplaysChangeListener( 3029 const IAcrossDisplaysChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3030 3031 /** 3032 * @brief Get the window limits of current window. 3033 * 3034 * @param windowLimits. 3035 * @return WMError. 3036 */ GetWindowLimits(WindowLimits & windowLimits)3037 virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3038 3039 /** 3040 * @brief Set the window limits of current window. 3041 * 3042 * @param windowLimits. 3043 * @return WMError. 3044 */ 3045 virtual WMError SetWindowLimits(WindowLimits& windowLimits, bool isForcible = false) 3046 { 3047 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3048 } 3049 3050 /** 3051 * @brief Register listener, if timeout(seconds) pass with no interaction, the listener will be executed. 3052 * 3053 * @param listener IWindowNoInteractionListenerSptr. 3054 * @return WM_OK means unregister success, others means unregister failed. 3055 */ RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)3056 virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 3057 { 3058 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3059 } 3060 3061 /** 3062 * @brief Unregister window no interaction listener. 3063 * 3064 * @param listener IWindowNoInteractionListenerSptr. 3065 * @return WM_OK means unregister success, others means unregister failed. 3066 */ UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)3067 virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 3068 { 3069 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3070 } 3071 3072 /** 3073 * @brief Register window status change listener. 3074 * 3075 * @param listener IWindowStatusChangeListener. 3076 * @return WM_OK means register success, others means register failed. 3077 */ RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)3078 virtual WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 3079 { 3080 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3081 } 3082 3083 /** 3084 * @brief Unregister window status change listener. 3085 * 3086 * @param listener IWindowStatusChangeListener. 3087 * @return WM_OK means unregister success, others means unregister failed. 3088 */ UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)3089 virtual WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 3090 { 3091 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3092 } 3093 3094 /** 3095 * @brief Register window status change listener. 3096 * 3097 * @param listener IWindowStatusDidChangeListener. 3098 * @return WM_OK means register success, others means register failed. 3099 */ RegisterWindowStatusDidChangeListener(const sptr<IWindowStatusDidChangeListener> & listener)3100 virtual WMError RegisterWindowStatusDidChangeListener(const sptr<IWindowStatusDidChangeListener>& listener) 3101 { 3102 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3103 } 3104 3105 /** 3106 * @brief Unregister window status change listener. 3107 * 3108 * @param listener IWindowStatusDidChangeListener. 3109 * @return WM_OK means unregister success, others means unregister failed. 3110 */ UnregisterWindowStatusDidChangeListener(const sptr<IWindowStatusDidChangeListener> & listener)3111 virtual WMError UnregisterWindowStatusDidChangeListener(const sptr<IWindowStatusDidChangeListener>& listener) 3112 { 3113 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3114 } 3115 3116 /** 3117 * @brief Set Specific System Bar(include status bar and nav bar) Enable and Animation Properties 3118 * 3119 * @param systemBarEnable is system bar enabled 3120 * @param systemBarEnableAnimation is animation enabled 3121 * @param SystemBarProperty WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 3122 */ UpdateSpecificSystemBarEnabled(bool systemBarEnable,bool systemBarEnableAnimation,SystemBarProperty & property)3123 virtual void UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool systemBarEnableAnimation, 3124 SystemBarProperty& property) {} 3125 3126 /** 3127 * @brief Set Specific System Bar(include status bar and nav bar) Enable and Animation Properties 3128 * 3129 * @param name type of system bar 3130 * @param enable is system bar enabled 3131 * @param enableAnimation is animation enabled 3132 */ UpdateHostSpecificSystemBarEnabled(const std::string & name,bool enable,bool enableAnimation)3133 virtual WMError UpdateHostSpecificSystemBarEnabled(const std::string& name, bool enable, bool enableAnimation) 3134 { 3135 return WMError::WM_OK; 3136 } 3137 3138 /* 3139 * @brief Set System Bar Property for page 3140 * 3141 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_INDICATOR 3142 * @param property System Bar Property 3143 * @return WMError 3144 */ SetSystemBarPropertyForPage(WindowType type,std::optional<SystemBarProperty> property)3145 virtual WMError SetSystemBarPropertyForPage(WindowType type, std::optional<SystemBarProperty> property) 3146 { 3147 return WMError::WM_OK; 3148 } 3149 3150 /** 3151 * @brief Set Specific System Bar(include status bar and nav bar) Property 3152 * 3153 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 3154 * @param property system bar prop,include content color, background color 3155 * @return WMError 3156 */ SetSpecificBarProperty(WindowType type,const SystemBarProperty & property)3157 virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) 3158 { 3159 return WMError::WM_OK; 3160 } 3161 3162 /** 3163 * @brief Set System Bar(include status bar and nav bar) Properties 3164 * 3165 * @param properties system bar properties 3166 * @param propertyFlags flags of system bar property 3167 * @return WMError 3168 */ SetSystemBarProperties(const std::map<WindowType,SystemBarProperty> & properties,const std::map<WindowType,SystemBarPropertyFlag> & propertyFlags)3169 virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties, 3170 const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) 3171 { 3172 return WMError::WM_OK; 3173 } 3174 3175 /** 3176 * @brief Get System Bar(include status bar and nav bar) Properties 3177 * 3178 * @param properties system bar properties got 3179 * @return WMError 3180 */ GetSystemBarProperties(std::map<WindowType,SystemBarProperty> & properties)3181 virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) 3182 { 3183 return WMError::WM_OK; 3184 } 3185 3186 /** 3187 * @brief Update System Bar (include status bar and nav bar) Properties by Flags 3188 * 3189 * @param systemBarProperties map of status bar and nav bar properties 3190 * @param systemBarPropertyFlags map of status bar and nav bar properties to be changed 3191 * @return WMError 3192 */ UpdateSystemBarProperties(const std::unordered_map<WindowType,SystemBarProperty> & systemBarProperties,const std::unordered_map<WindowType,SystemBarPropertyFlag> & systemBarPropertyFlags)3193 virtual WMError UpdateSystemBarProperties( 3194 const std::unordered_map<WindowType, SystemBarProperty>& systemBarProperties, 3195 const std::unordered_map<WindowType, SystemBarPropertyFlag>& systemBarPropertyFlags) 3196 { 3197 return WMError::WM_OK; 3198 } 3199 3200 /** 3201 * @brief Set the single frame composer enabled flag of a window. 3202 * 3203 * @param enable true means the single frame composer is enabled, otherwise means the opposite. 3204 * @return Errorcode of window. 3205 */ SetSingleFrameComposerEnabled(bool enable)3206 virtual WMError SetSingleFrameComposerEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3207 3208 /** 3209 * @brief Set the visibility of window decor. 3210 * 3211 * @param isVisible whether the window decor is visible. 3212 * @return Errorcode of window. 3213 */ SetDecorVisible(bool isVisible)3214 virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3215 3216 /** 3217 * @brief Get the visibility of window decor. 3218 * 3219 * @param isVisible whether the window decor is visible. 3220 * @return Errorcode of window. 3221 */ GetDecorVisible(bool & isVisible)3222 virtual WMError GetDecorVisible(bool& isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3223 3224 /** 3225 * @brief Enable or disable move window by title bar. 3226 * 3227 * @param enable The value true means to enable window moving, and false means the opposite. 3228 * @return Errorcode of window. 3229 */ SetWindowTitleMoveEnabled(bool enable)3230 virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3231 3232 /** 3233 * @brief Set window container color. 3234 * 3235 * @param activeColor Background active color. 3236 * @param inactiveColor Background active color. 3237 * @return Errorcode of window. 3238 */ SetWindowContainerColor(const std::string & activeColor,const std::string & inactiveColor)3239 virtual WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor) 3240 { 3241 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3242 } 3243 3244 /** 3245 * @brief Set main window container color. 3246 * 3247 * @param activeColor Background active color. 3248 * @param inactiveColor Background active color. 3249 * @return Errorcode of window. 3250 */ SetWindowContainerModalColor(const std::string & activeColor,const std::string & inactiveColor)3251 virtual WMError SetWindowContainerModalColor(const std::string& activeColor, const std::string& inactiveColor) 3252 { 3253 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3254 } 3255 3256 /** 3257 * @brief Enable drag window. 3258 * 3259 * @param enableDrag The value true means to enable window dragging, and false means the opposite. 3260 * @return Errorcode of window. 3261 */ EnableDrag(bool enableDrag)3262 virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3263 3264 /** 3265 * @brief Set whether to display the maximize, minimize, split buttons of main window. 3266 * 3267 * @param isMaximizeVisible Display maximize button if true, or hide maximize button if false. 3268 * @param isMinimizeVisible Display minimize button if true, or hide minimize button if false. 3269 * @param isSplitVisible Display split button if true, or hide split button if false. 3270 * @param isCloseVisible Display close button if true, or hide close button if false. 3271 * @return Errorcode of window. 3272 */ SetTitleButtonVisible(bool isMaximizeVisible,bool isMinimizeVisible,bool isSplitVisible,bool isCloseVisible)3273 virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, 3274 bool isCloseVisible) 3275 { 3276 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3277 } 3278 3279 /** 3280 * @brief Set Window new title 3281 * 3282 * @param title Window new title 3283 * @return Errorcode of window. 3284 */ SetWindowTitle(const std::string & title)3285 virtual WMError SetWindowTitle(const std::string& title) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3286 3287 /** 3288 * @brief Set decor height of window. 3289 * 3290 * @param decorHeight Decor height of window 3291 * @return WM_OK means set success, others means set failed. 3292 */ SetDecorHeight(int32_t decorHeight)3293 virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3294 3295 /** 3296 * @brief Get decor height of window. 3297 * 3298 * @return Decor height of window. 3299 */ GetDecorHeight(int32_t & height)3300 virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3301 3302 /** 3303 * @brief Set decor button style of window. 3304 * 3305 * @param style Decor style of the window 3306 * @return WM_OK means set success, others means set failed. 3307 */ SetDecorButtonStyle(const DecorButtonStyle & style)3308 virtual WMError SetDecorButtonStyle(const DecorButtonStyle& style) 3309 { 3310 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3311 } 3312 3313 /** 3314 * @brief Get decor button style of window. 3315 * 3316 * @param style Decor style of the window 3317 * @return WM_OK means set success, others means set failed. 3318 */ GetDecorButtonStyle(DecorButtonStyle & style)3319 virtual WMError GetDecorButtonStyle(DecorButtonStyle& style) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3320 3321 /** 3322 * @brief Get the title buttons area of window. 3323 * 3324 * @param titleButtonRect. 3325 * @return WMError. 3326 */ GetTitleButtonArea(TitleButtonRect & titleButtonRect)3327 virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) 3328 { 3329 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3330 } 3331 3332 /** 3333 * @brief Register window title buttons change listener. 3334 * 3335 * @param listener IWindowTitleButtonRectChangedListener. 3336 * @return WM_OK means register success, others means register failed. 3337 */ RegisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)3338 virtual WMError RegisterWindowTitleButtonRectChangeListener( 3339 const sptr<IWindowTitleButtonRectChangedListener>& listener) 3340 { 3341 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3342 } 3343 3344 /** 3345 * @brief Unregister window title buttons change listener. 3346 * 3347 * @param listener IWindowTitleButtonRectChangedListener. 3348 * @return WM_OK means unregister success, others means unregister failed. 3349 */ UnregisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)3350 virtual WMError UnregisterWindowTitleButtonRectChangeListener( 3351 const sptr<IWindowTitleButtonRectChangedListener>& listener) 3352 { 3353 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3354 } 3355 3356 /** 3357 * @brief Set whether to use default density. 3358 * 3359 * @param enabled bool. 3360 * @return WM_OK means set success, others means failed. 3361 */ SetDefaultDensityEnabled(bool enabled)3362 virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3363 3364 /** 3365 * @brief Get whether to use default density. 3366 * 3367 * @return True means use default density, window's layout not follow to system change, false means the opposite. 3368 */ GetDefaultDensityEnabled()3369 virtual bool GetDefaultDensityEnabled() { return false; } 3370 3371 /** 3372 * @brief Set custom density of window. 3373 * 3374 * @param density the custom density of window. 3375 * @return WM_OK means set success, others means failed. 3376 */ SetCustomDensity(float density,bool applyToSubWindow)3377 virtual WMError SetCustomDensity( 3378 float density, bool applyToSubWindow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3379 3380 /** 3381 * @brief Get custom density of window. 3382 * 3383 * @return custom density. 3384 */ GetCustomDensity()3385 virtual float GetCustomDensity() const { return UNDEFINED_DENSITY; } 3386 3387 /** 3388 * @brief Get the window density of current window. 3389 * 3390 * @param densityInfo the struct representing system density, default density and custom density. 3391 * @return WMError. 3392 */ GetWindowDensityInfo(WindowDensityInfo & densityInfo)3393 virtual WMError GetWindowDensityInfo(WindowDensityInfo& densityInfo) { return WMError::WM_OK; } 3394 3395 /** 3396 * @brief Set whether the current window follows the default density of its screen. 3397 * 3398 * @param enabled bool. 3399 * @return WM_OK means set success, others means failed. 3400 */ SetWindowDefaultDensityEnabled(bool enabled)3401 virtual WMError SetWindowDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3402 3403 /** 3404 * @brief Get virtual pixel ratio. 3405 * 3406 * @return Value of PixelRatio obtained from displayInfo. 3407 */ GetVirtualPixelRatio()3408 virtual float GetVirtualPixelRatio() { return 1.0f; } 3409 3410 /** 3411 * @brief Hide None Secure Windows. 3412 * 3413 * @param shouldHide bool. 3414 * @return WMError 3415 */ HideNonSecureWindows(bool shouldHide)3416 virtual WMError HideNonSecureWindows(bool shouldHide) 3417 { 3418 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3419 } 3420 3421 /** 3422 * @brief Set water mark flag. 3423 * 3424 * @param isEnable bool. 3425 * @return WMError 3426 */ SetWaterMarkFlag(bool isEnable)3427 virtual WMError SetWaterMarkFlag(bool isEnable) 3428 { 3429 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3430 } 3431 3432 /** 3433 * @brief Hide the display content when snapshot. 3434 * 3435 * @param needHide bool. 3436 * @return WMError 3437 */ HidePrivacyContentForHost(bool needHide)3438 virtual WMError HidePrivacyContentForHost(bool needHide) 3439 { 3440 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3441 } 3442 3443 /** 3444 * @brief Set the application modality of main window. 3445 * 3446 * @param isModal bool. 3447 * @return WMError 3448 */ SetWindowModal(bool isModal)3449 virtual WMError SetWindowModal(bool isModal) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3450 3451 /** 3452 * @brief Set the modality of sub window. 3453 * 3454 * @param isModal bool. 3455 * @param modalityType ModalityType. 3456 * @return WMError 3457 */ 3458 virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) 3459 { 3460 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3461 } 3462 3463 /** 3464 * @brief recovery the main window by function overloading. It is called by JsWindow. 3465 * 3466 * @param reason reason of update. 3467 * @return WMError 3468 */ Recover(uint32_t reason)3469 virtual WMError Recover(uint32_t reason) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3470 3471 /** 3472 * @brief Set to automatically save the window rect. 3473 * 3474 * @param enabled Enable the window rect auto-save if true, otherwise means the opposite. 3475 * @return WM_OK means set success, others means failed. 3476 */ 3477 virtual WMError SetWindowRectAutoSave(bool enabled, 3478 bool isSaveBySpecifiedFlag = false) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3479 3480 /** 3481 * @brief Get whether the auto-save the window rect is enabled or not. 3482 * 3483 * @param enabled True means the window rect auto-save is enabled, otherwise means the opposite. 3484 * @return WM_OK means set success, others means failed. 3485 */ IsWindowRectAutoSave(bool & enabled)3486 virtual WMError IsWindowRectAutoSave(bool& enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3487 3488 /** 3489 * @brief Sets the supported window modes. 3490 * 3491 * @param supportedWindowModes Supported window modes of the window. 3492 * @param grayOutMaximizeButton Whether to gray out the window maximize button. 3493 The value true means to gray out the button, and false means the opposite. 3494 * @return WM_OK means set success, others means failed. 3495 */ 3496 virtual WMError SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes, 3497 bool grayOutMaximizeButton = false) 3498 { 3499 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3500 } 3501 3502 /** 3503 * @brief Set whether the sub window supports simultaneous display on multiple screens 3504 * when the parent window is dragged to move or dragged to zoom. 3505 * 3506 * @param enabled The value true means sub window supports simultaneous display on multiple screens 3507 * when the parent window is dragged to move or dragged to zoom, and false means the opposite. 3508 * @return WM_OK means set success, others means failed. 3509 */ SetFollowParentMultiScreenPolicy(bool enabled)3510 virtual WMError SetFollowParentMultiScreenPolicy(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;} 3511 3512 /** 3513 * @brief Get the rect of host window. 3514 * 3515 * @param hostWindowId window Id of the host window. 3516 * @return Rect of window. 3517 */ GetHostWindowRect(int32_t hostWindowId)3518 virtual Rect GetHostWindowRect(int32_t hostWindowId) { return {}; } 3519 3520 /** 3521 * @brief Make multi-window become landscape or not. 3522 * 3523 * @param isLandscapeMultiWindow means whether multi-window's scale is landscape. 3524 * @return WMError WM_OK means set success, others means failed. 3525 */ SetLandscapeMultiWindow(bool isLandscapeMultiWindow)3526 virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) { return WMError::WM_OK; } 3527 3528 /** 3529 * @brief Register subwindow close listener. 3530 * 3531 * @param listener ISubWindowCloseListener. 3532 * @return WM_OK means register success, others means register failed. 3533 */ RegisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)3534 virtual WMError RegisterSubWindowCloseListeners( 3535 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3536 3537 /** 3538 * @brief Unregister subwindow close listener. 3539 * 3540 * @param listener ISubWindowCloseListeners. 3541 * @return WM_OK means unregister success, others means unregister failed. 3542 */ UnregisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)3543 virtual WMError UnregisterSubWindowCloseListeners( 3544 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3545 3546 /** 3547 * @brief Register main window close listener. 3548 * 3549 * @param listener IMainWindowCloseListener. 3550 * @return WM_OK means register success, others means register failed. 3551 */ RegisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)3552 virtual WMError RegisterMainWindowCloseListeners( 3553 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3554 3555 /** 3556 * @brief Unregister main window close listener. 3557 * 3558 * @param listener IMainWindowCloseListener. 3559 * @return WM_OK means unregister success, others means unregister failed. 3560 */ UnregisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)3561 virtual WMError UnregisterMainWindowCloseListeners( 3562 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3563 3564 /** 3565 * @brief Register window close async process listener. 3566 * 3567 * @param listener IWindowWillCloseListener. 3568 * @return WM_OK means register success, others means register failed. 3569 */ RegisterWindowWillCloseListeners(const sptr<IWindowWillCloseListener> & listener)3570 virtual WMError RegisterWindowWillCloseListeners( 3571 const sptr<IWindowWillCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3572 3573 /** 3574 * @brief Unregister window close async process listener. 3575 * 3576 * @param listener IWindowWillCloseListener. 3577 * @return WM_OK means unregister success, others means unregister failed. 3578 */ UnRegisterWindowWillCloseListeners(const sptr<IWindowWillCloseListener> & listener)3579 virtual WMError UnRegisterWindowWillCloseListeners( 3580 const sptr<IWindowWillCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3581 3582 /** 3583 * @brief Register switch free multi-window listener. 3584 * 3585 * @param listener ISwitchFreeMultiWindowListener. 3586 * @return WM_OK means register success, others means register failed. 3587 */ RegisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)3588 virtual WMError RegisterSwitchFreeMultiWindowListener( 3589 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3590 3591 /** 3592 * @brief Unregister switch free multi-window listener. 3593 * 3594 * @param listener ISwitchFreeMultiWindowListener. 3595 * @return WM_OK means unregister success, others means unregister failed. 3596 */ UnregisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)3597 virtual WMError UnregisterSwitchFreeMultiWindowListener( 3598 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3599 3600 /** 3601 * @brief Set Shaped Window Mask. 3602 * 3603 * @param windowMask Mask of the shaped window. 3604 * @return WM_OK means set success, others means failed. 3605 */ SetWindowMask(const std::vector<std::vector<uint32_t>> & windowMask)3606 virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) 3607 { 3608 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3609 } 3610 3611 /** 3612 * @brief Register keyboard panel info change listener. 3613 * 3614 * @param listener IKeyboardPanelInfoChangeListener. 3615 * @return WM_OK means register success, others means register failed. 3616 */ RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)3617 virtual WMError RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 3618 { 3619 return WMError::WM_OK; 3620 } 3621 3622 /** 3623 * @brief Unregister keyboard panel info change listener. 3624 * 3625 * @param listener IKeyboardPanelInfoChangeListener. 3626 * @return WM_OK means unregister success, others means unregister failed. 3627 */ UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)3628 virtual WMError UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 3629 { 3630 return WMError::WM_OK; 3631 } 3632 3633 /** 3634 * @brief Get window by id 3635 * 3636 * @param windId window id 3637 * @return sptr<Window> 3638 */ 3639 static sptr<Window> GetWindowWithId(uint32_t windId); 3640 3641 /** 3642 * @brief register keyEvent filter. 3643 * 3644 * @param KeyEventFilterFunc callback func when window recieve keyEvent 3645 * @return WMError 3646 */ SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc)3647 virtual WMError SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc) 3648 { 3649 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3650 } 3651 3652 /** 3653 * @brief clear keyEvent filter. 3654 * 3655 * @return WMError 3656 */ ClearKeyEventFilter()3657 virtual WMError ClearKeyEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;} 3658 3659 /** 3660 * @brief register mouseEvent filter. 3661 * 3662 * @param mouseEventFilterFunc callback func when window receive mouseEvent 3663 * @return WMError 3664 */ SetMouseEventFilter(MouseEventFilterFunc mouseEventFilterFunc)3665 virtual WMError SetMouseEventFilter(MouseEventFilterFunc mouseEventFilterFunc) 3666 { 3667 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3668 } 3669 3670 /** 3671 * @brief clear mouseEvent filter. 3672 * 3673 * @return WMError 3674 */ ClearMouseEventFilter()3675 virtual WMError ClearMouseEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3676 3677 /** 3678 * @brief register touchEvent filter. 3679 * 3680 * @param touchEventFilterFunc callback func when window receive touchEvent 3681 * @return WMError 3682 */ SetTouchEventFilter(TouchEventFilterFunc touchEventFilterFunc)3683 virtual WMError SetTouchEventFilter(TouchEventFilterFunc touchEventFilterFunc) 3684 { 3685 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3686 } 3687 3688 /** 3689 * @brief clear touchEvent filter. 3690 * 3691 * @return WMError 3692 */ ClearTouchEventFilter()3693 virtual WMError ClearTouchEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3694 3695 /** 3696 * @brief Register window rect change listener. 3697 * 3698 * @param listener IWindowRectChangeListener. 3699 * @return WM_OK means register success, others means register failed. 3700 */ RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3701 virtual WMError RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3702 { 3703 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3704 } 3705 3706 /** 3707 * @brief Unregister window rect change listener. 3708 * 3709 * @param listener IWindowRectChangeListener. 3710 * @return WM_OK means unregister success, others means unregister failed. 3711 */ UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3712 virtual WMError UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3713 { 3714 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3715 } 3716 3717 /** 3718 * @brief Register a listener to observe window rectangle changes in global coordinates. 3719 * 3720 * @param listener The listener to receive rectangle change notifications. 3721 * @return WMError WM_OK if registration succeeds; otherwise, an error code is returned. 3722 */ RegisterRectChangeInGlobalDisplayListener(const sptr<IRectChangeInGlobalDisplayListener> & listener)3723 virtual WMError RegisterRectChangeInGlobalDisplayListener(const sptr<IRectChangeInGlobalDisplayListener>& listener) 3724 { 3725 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3726 } 3727 3728 /** 3729 * @brief Unregister a previously registered rectangle change listener in global coordinates. 3730 * 3731 * @param listener The listener to be unregistered. 3732 * @return WMError WM_OK if unregistration succeeds; otherwise, an error code is returned. 3733 */ UnregisterRectChangeInGlobalDisplayListener(const sptr<IRectChangeInGlobalDisplayListener> & listener)3734 virtual WMError UnregisterRectChangeInGlobalDisplayListener( 3735 const sptr<IRectChangeInGlobalDisplayListener>& listener) 3736 { 3737 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3738 } 3739 3740 /** 3741 * @brief UIExtension register host window rect change listener. 3742 * 3743 * @param listener IWindowRectChangeListener. 3744 * @return WM_OK means register success, others means register failed. 3745 */ RegisterHostWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3746 virtual WMError RegisterHostWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3747 { 3748 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3749 } 3750 3751 /** 3752 * @brief UIExtension unregister host window rect change listener. 3753 * 3754 * @param listener IWindowRectChangeListener. 3755 * @return WM_OK means unregister success, others means unregister failed. 3756 */ UnregisterHostWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3757 virtual WMError UnregisterHostWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3758 { 3759 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3760 } 3761 3762 /** 3763 * @brief Register window nonsecure limit change listener. 3764 * 3765 * @param listener IExtensionSecureLimitChangeListener. 3766 * @return WM_OK means register success, others means register failed. 3767 */ RegisterExtensionSecureLimitChangeListener(const sptr<IExtensionSecureLimitChangeListener> & listener)3768 virtual WMError RegisterExtensionSecureLimitChangeListener( 3769 const sptr<IExtensionSecureLimitChangeListener>& listener) 3770 { 3771 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3772 } 3773 3774 /** 3775 * @brief Unregister window nonsecure limit change listener. 3776 * 3777 * @param listener IExtensionSecureLimitChangeListener. 3778 * @return WM_OK means unregister success, others means unregister failed. 3779 */ UnregisterExtensionSecureLimitChangeListener(const sptr<IExtensionSecureLimitChangeListener> & listener)3780 virtual WMError UnregisterExtensionSecureLimitChangeListener( 3781 const sptr<IExtensionSecureLimitChangeListener>& listener) 3782 { 3783 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3784 } 3785 3786 /** 3787 * @brief Flush layout size. 3788 * 3789 * @param width The width after layout 3790 * @param height The height after layout 3791 */ FlushLayoutSize(int32_t width,int32_t height)3792 virtual void FlushLayoutSize(int32_t width, int32_t height) {} 3793 3794 /** 3795 * @brief Notify window manager to update snapshot. 3796 */ NotifySnapshotUpdate()3797 virtual WMError NotifySnapshotUpdate() { return WMError::WM_OK; } 3798 3799 /** 3800 * @brief get callingWindow windowStatus. 3801 * @param windowStatus 3802 * @return WM_OK means set success, others means set Failed. 3803 */ GetCallingWindowWindowStatus(WindowStatus & windowStatus)3804 virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const 3805 { 3806 return WMError::WM_OK; 3807 } 3808 3809 /** 3810 * @brief get callingWindow windowStatus 3811 * @param rect. 3812 * @return WM_OK means set success, others means set failed 3813 */ GetCallingWindowRect(Rect & rect)3814 virtual WMError GetCallingWindowRect(Rect& rect) const 3815 { 3816 return WMError::WM_OK; 3817 } 3818 3819 /** 3820 * @brief Set gray scale of window 3821 * @param grayScale gray scale of window. 3822 * @return WM_OK means set success, others means set failed. 3823 */ SetGrayScale(float grayScale)3824 virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3825 3826 /** 3827 * @brief adjust keyboard layout 3828 * @param params 3829 * @return WM_OK means set success, others means set failed 3830 */ AdjustKeyboardLayout(const KeyboardLayoutParams params)3831 virtual WMError AdjustKeyboardLayout(const KeyboardLayoutParams params) { return WMError::WM_OK; } 3832 3833 /** 3834 * @brief Set the Dvsync Switch 3835 * 3836 * @param dvsyncSwitch bool. 3837 * @return * void 3838 */ SetUiDvsyncSwitch(bool dvsyncSwitch)3839 virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {} 3840 3841 /** 3842 * @brief Set touch event 3843 * 3844 * @param touchType int32_t. 3845 */ SetTouchEvent(int32_t touchType)3846 virtual void SetTouchEvent(int32_t touchType) {} 3847 3848 /** 3849 * @brief Set whether to enable immersive mode. 3850 * @param enable the value true means to enable immersive mode, and false means the opposite. 3851 * @return WM_OK means set success, others means set failed. 3852 */ SetImmersiveModeEnabledState(bool enable)3853 virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; } 3854 3855 /** 3856 * @brief Get whether the immersive mode is enabled or not. 3857 * 3858 * @return true means the immersive mode is enabled, and false means the opposite. 3859 */ GetImmersiveModeEnabledState()3860 virtual bool GetImmersiveModeEnabledState() const { return true; } 3861 3862 /** 3863 * @brief Get whether the window is in immersive layout or not. 3864 * 3865 * @return true means the window is in immersive layout, and false means the opposite. 3866 */ IsImmersiveLayout(bool & isImmersiveLayout)3867 virtual WMError IsImmersiveLayout(bool& isImmersiveLayout) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3868 3869 /** 3870 * @brief Get the height of status bar. 3871 * 3872 * @return the height of status bar. 3873 */ GetStatusBarHeight()3874 virtual uint32_t GetStatusBarHeight() const { return 0; } 3875 3876 /** 3877 * @brief Get whether the free multi-window mode is enabled or not. 3878 * 3879 * @return true means the free multi-window mode is enabled, and false means the opposite. 3880 */ GetFreeMultiWindowModeEnabledState()3881 virtual bool GetFreeMultiWindowModeEnabledState() { return false; } 3882 3883 /** 3884 * @brief Get the window status of current window. 3885 * 3886 * @param windowStatus 3887 * @return WMError. 3888 */ GetWindowStatus(WindowStatus & windowStatus)3889 virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3890 3891 /** 3892 * @brief Set the ContinueState of window. 3893 * 3894 * @param continueState of the window. 3895 * @return Errorcode of window. 3896 */ SetContinueState(int32_t continueState)3897 virtual WMError SetContinueState(int32_t continueState) { return WMError::WM_DO_NOTHING; } 3898 3899 /** 3900 * @brief Notify host that UIExtension timeout 3901 * 3902 * @param errorCode error code when UIExtension timeout 3903 */ NotifyExtensionTimeout(int32_t errorCode)3904 virtual void NotifyExtensionTimeout(int32_t errorCode) {} 3905 3906 /** 3907 * @brief Get Data Handler of UIExtension 3908 */ GetExtensionDataHandler()3909 virtual std::shared_ptr<IDataHandler> GetExtensionDataHandler() const { return nullptr; } 3910 3911 /** 3912 * @brief Get the real parent id of UIExtension 3913 * 3914 * @return Real parent id of UIExtension 3915 */ GetRealParentId()3916 virtual int32_t GetRealParentId() const { return static_cast<int32_t>(INVALID_WINDOW_ID); } 3917 3918 /** 3919 * @brief Get the parent window type of UIExtension 3920 * 3921 * @return Parent window type of UIExtension 3922 */ GetParentWindowType()3923 virtual WindowType GetParentWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 3924 3925 /** 3926 * @brief Get the root host window type of UIExtension. 3927 * 3928 * @return WindowType of the root host window. 3929 */ GetRootHostWindowType()3930 virtual WindowType GetRootHostWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 3931 3932 /** 3933 * @brief Set the root host window type of UIExtension. 3934 * 3935 * @param WindowType of the root host window. 3936 */ SetRootHostWindowType(WindowType & rootHostWindowType)3937 virtual void SetRootHostWindowType(WindowType& rootHostWindowType) {} 3938 3939 /** 3940 * @brief Notify modal UIExtension it may be covered 3941 * 3942 * @param byLoadContent True when called by loading content, false when called by creating non topmost subwindow 3943 */ NotifyModalUIExtensionMayBeCovered(bool byLoadContent)3944 virtual void NotifyModalUIExtensionMayBeCovered(bool byLoadContent) {} 3945 3946 /** 3947 * @brief Notify extension asynchronously 3948 * 3949 * @param notifyEvent event type 3950 * @return void 3951 */ NotifyExtensionEventAsync(uint32_t notifyEvent)3952 virtual void NotifyExtensionEventAsync(uint32_t notifyEvent) {} 3953 3954 /** 3955 * @brief Get whether this window is the first level sub window of UIExtension. 3956 * 3957 * @return true - is the first sub window of UIExtension, false - is not the first sub window of UIExtension 3958 */ GetIsUIExtFirstSubWindow()3959 virtual bool GetIsUIExtFirstSubWindow() const { return false; } 3960 3961 /** 3962 * @brief Get whether this window is a sub window of any level of UIExtension. 3963 * 3964 * @return true - is UIExtension sub window, false - is not UIExtension sub window. 3965 */ GetIsUIExtAnySubWindow()3966 virtual bool GetIsUIExtAnySubWindow() const { return false; } 3967 3968 /** 3969 * @brief Set whether to enable gesture back. 3970 * @param enable the value true means to enable gesture back, and false means the opposite. 3971 * @return WM_OK means set success, others means set failed. 3972 */ SetGestureBackEnabled(bool enable)3973 virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; } 3974 3975 /** 3976 * @brief Get whether to enable gesture back. 3977 * @param enable the value true means to enable gesture back, and false means the opposite. 3978 * @return WM_OK means get success, others means get failed. 3979 */ GetGestureBackEnabled(bool & enable)3980 virtual WMError GetGestureBackEnabled(bool& enable) const { return WMError::WM_OK; } 3981 3982 /** 3983 * @brief this interface is invoked by the ACE to the native host. 3984 * @param eventName invoking event name, which is used to distinguish different invoking types. 3985 * @param value used to transfer parameters. 3986 * @return WM_OK means get success, others means get failed. 3987 */ OnContainerModalEvent(const std::string & eventName,const std::string & value)3988 virtual WMError OnContainerModalEvent(const std::string& eventName, 3989 const std::string& value) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3990 3991 /** 3992 * @brief Determine whether the window spans multiple screens and displays in full screen mode. 3993 * 3994 * @param isAcrossDisplays the value true means to span multiple screens, and false means the opposite. 3995 * @return WM_OK means success, others means failed. 3996 */ IsMainWindowFullScreenAcrossDisplays(bool & isAcrossDisplays)3997 virtual WMError IsMainWindowFullScreenAcrossDisplays( 3998 bool& isAcrossDisplays) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3999 4000 /** 4001 * @brief Get the type of window. 4002 * 4003 * @return The string corresponding to the window. 4004 */ GetClassType()4005 virtual std::string GetClassType() const { return "Window"; } 4006 4007 /** 4008 * @brief Enable or disable window delay raise 4009 * 4010 * @param isEnabled Enable or disable window delay raise 4011 */ SetWindowDelayRaiseEnabled(bool isEnabled)4012 virtual WMError SetWindowDelayRaiseEnabled(bool isEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4013 4014 /** 4015 * @brief Get whether window delay raise is enabled 4016 * 4017 * @return True means window delay raise is enabled 4018 */ IsWindowDelayRaiseEnabled()4019 virtual bool IsWindowDelayRaiseEnabled() const { return false; } 4020 4021 /** 4022 * @brief Get whether is mid scene. 4023 * 4024 * @return True - is mid scene, false - is not mid scene. 4025 */ GetIsMidScene(bool & isMidScene)4026 virtual WMError GetIsMidScene(bool& isMidScene) { return WMError::WM_OK; } 4027 4028 /** 4029 * @brief Get layoutTransform of window uiContent. 4030 * 4031 * @return UiContent of layoutTransform. 4032 */ GetLayoutTransform()4033 virtual Transform GetLayoutTransform() const 4034 { 4035 static Transform trans; 4036 return trans; 4037 } 4038 4039 /** 4040 * @brief Show keyboard window 4041 * 4042 * @param effectOption Keyboard will show with special effect option. 4043 * @return WM_OK means window show success, others means failed. 4044 */ ShowKeyboard(KeyboardEffectOption effectOption)4045 virtual WMError ShowKeyboard(KeyboardEffectOption effectOption) 4046 { 4047 return WMError::WM_OK; 4048 } 4049 4050 /** 4051 * @brief Change keyboard effect with option 4052 * 4053 * @param effectOption Keyboard will update to the special effect option. 4054 * @return WM_OK means effect update success, others means failed. 4055 */ ChangeKeyboardEffectOption(KeyboardEffectOption effectOption)4056 virtual WMError ChangeKeyboardEffectOption(KeyboardEffectOption effectOption) 4057 { 4058 return WMError::WM_OK; 4059 } 4060 4061 /** 4062 * @brief Register window highlight change listener. 4063 * 4064 * @param listener IWindowHighlightChangeListener. 4065 * @return WM_OK means register success, others means register failed. 4066 */ RegisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener> & listener)4067 virtual WMError RegisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener>& listener) 4068 { 4069 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4070 } 4071 4072 /** 4073 * @brief Unregister window highlight change listener. 4074 * 4075 * @param listener IWindowHighlightChangeListener. 4076 * @return WM_OK means unregister success, others means unregister failed. 4077 */ UnregisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener> & listener)4078 virtual WMError UnregisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener>& listener) 4079 { 4080 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4081 } 4082 4083 /** 4084 * @brief Check whether current window has specified device feature. 4085 * 4086 * @param feature specified device feature 4087 * @return true means current window has specified device feature, false means not. 4088 */ IsDeviceFeatureCapableFor(const std::string & feature)4089 virtual bool IsDeviceFeatureCapableFor(const std::string& feature) const { return false; } 4090 4091 /** 4092 * @brief Check whether current window has free-multi-window device feature. 4093 * 4094 * @return true means current window has free-multi-window feature, false means not. 4095 */ IsDeviceFeatureCapableForFreeMultiWindow()4096 virtual bool IsDeviceFeatureCapableForFreeMultiWindow() const { return false; } 4097 4098 /** 4099 * @brief Set whether to enable exclusively highlight. 4100 * 4101 * @param isExclusivelyHighlighted the value true means to exclusively highlight, and false means the opposite. 4102 * @return WM_OK means set success, others means set failed. 4103 */ SetExclusivelyHighlighted(bool isExclusivelyHighlighted)4104 virtual WMError SetExclusivelyHighlighted(bool isExclusivelyHighlighted) 4105 { 4106 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4107 } 4108 4109 /** 4110 * @brief Get highlight property of window. 4111 * 4112 * @param highlighted True means the window is highlighted, and false means the opposite. 4113 * @return WM_OK means get success, others means get failed. 4114 */ IsWindowHighlighted(bool & highlighted)4115 virtual WMError IsWindowHighlighted(bool& highlighted) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4116 4117 /** 4118 * @brief Get cross screen axis state. 4119 * 4120 * @return The cross screen axis state of the Window. 4121 */ GetCrossAxisState()4122 virtual CrossAxisState GetCrossAxisState() { return CrossAxisState::STATE_INVALID; } 4123 4124 /** 4125 * @brief Register window screen axis state change listener. 4126 * 4127 * @param listener IWindowCrossAxisChangeListener. 4128 * @return WM_OK means register success, others means register failed. 4129 */ RegisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener> & listener)4130 virtual WMError RegisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener>& listener) 4131 { 4132 return WMError::WM_OK; 4133 } 4134 4135 /** 4136 * @brief Unregister window screen axis state change listener. 4137 * 4138 * @param listener IWindowCrossAxisChangeListener. 4139 * @return WM_OK means unregister success, others means unregister failed. 4140 */ UnregisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener> & listener)4141 virtual WMError UnregisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener>& listener) 4142 { 4143 return WMError::WM_OK; 4144 } 4145 4146 /** 4147 * @brief Get custom extension param. 4148 * 4149 * @param want the want to store param. 4150 */ GetExtensionConfig(AAFwk::WantParams & want)4151 virtual void GetExtensionConfig(AAFwk::WantParams& want) const {} 4152 4153 /** 4154 * @brief Update custom extension param. 4155 * 4156 * @param want the want to update param. 4157 */ UpdateExtensionConfig(const std::shared_ptr<AAFwk::Want> & want)4158 virtual void UpdateExtensionConfig(const std::shared_ptr<AAFwk::Want>& want) {} 4159 4160 /** 4161 * @brief Receive async IPC message from UIExtensionComponent. 4162 * 4163 * @param code the message code. 4164 * @param persistentId the persistent id of UIExtension. 4165 * @param data the data transfered from UIExtensionComponent. 4166 */ OnExtensionMessage(uint32_t code,int32_t persistentId,const AAFwk::Want & data)4167 virtual WMError OnExtensionMessage(uint32_t code, int32_t persistentId, const AAFwk::Want& data) 4168 { 4169 return WMError::WM_OK; 4170 } 4171 4172 /** 4173 * @brief Query whether the waterfall mode is enabled or not. 4174 * 4175 * @return true means the waterfall mode is enabled, and false means the opposite. 4176 */ IsWaterfallModeEnabled()4177 virtual bool IsWaterfallModeEnabled() { return false; } 4178 4179 /** 4180 * @brief Register waterfall mode change listener. 4181 * 4182 * @param listener IWaterfallModeChangeListener. 4183 * @return WM_OK means register success, others means register failed. 4184 */ RegisterWaterfallModeChangeListener(const sptr<IWaterfallModeChangeListener> & listener)4185 virtual WMError RegisterWaterfallModeChangeListener(const sptr<IWaterfallModeChangeListener>& listener) 4186 { 4187 return WMError::WM_OK; 4188 } 4189 4190 /** 4191 * @brief Unregister waterfall mode change listener. 4192 * 4193 * @param listener IWaterfallModeChangeListener. 4194 * @return WM_OK means unregister success, others means unregister failed. 4195 */ UnregisterWaterfallModeChangeListener(const sptr<IWaterfallModeChangeListener> & listener)4196 virtual WMError UnregisterWaterfallModeChangeListener(const sptr<IWaterfallModeChangeListener>& listener) 4197 { 4198 return WMError::WM_OK; 4199 } 4200 4201 /** 4202 * @brief Register window scene attach or detach framenode listener. 4203 * 4204 * @param listener IWindowAttachStateChangeListner. 4205 * @return WM_OK means register success, others means register failed. 4206 */ RegisterWindowAttachStateChangeListener(const sptr<IWindowAttachStateChangeListner> & listener)4207 virtual WMError RegisterWindowAttachStateChangeListener(const sptr<IWindowAttachStateChangeListner>& listener) 4208 { 4209 return WMError::WM_OK; 4210 } 4211 4212 /** 4213 * @brief Unregister window scene attach or detach framenode listener. 4214 * 4215 * @return WM_OK means unregister success 4216 */ UnregisterWindowAttachStateChangeListener()4217 virtual WMError UnregisterWindowAttachStateChangeListener() 4218 { 4219 return WMError::WM_OK; 4220 } 4221 4222 /** 4223 * @brief Register window rotation change listener. 4224 * 4225 * @param listener IWindowRotationChangeListener. 4226 * @return WM_OK means register success, others means register failed. 4227 */ RegisterWindowRotationChangeListener(const sptr<IWindowRotationChangeListener> & listener)4228 virtual WMError RegisterWindowRotationChangeListener(const sptr<IWindowRotationChangeListener>& listener) 4229 { 4230 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4231 } 4232 4233 /** 4234 * @brief Unregister window rotation change listener. 4235 * 4236 * @param listener IWindowRotationChangeListener. 4237 * @return WM_OK means unregister success, others means unregister failed. 4238 */ UnregisterWindowRotationChangeListener(const sptr<IWindowRotationChangeListener> & listener)4239 virtual WMError UnregisterWindowRotationChangeListener(const sptr<IWindowRotationChangeListener>& listener) 4240 { 4241 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4242 } 4243 4244 /** 4245 * @brief Set the parent window of a sub window. 4246 * 4247 * @param newParentWindowId new parent window id. 4248 * @return WM_OK means set parent window success, others means failed. 4249 */ SetParentWindow(int32_t newParentWindowId)4250 virtual WMError SetParentWindow(int32_t newParentWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4251 4252 /** 4253 * @brief Get the parent window of a sub window. 4254 * 4255 * @param parentWindow parent window. 4256 * @return WM_OK means get parent window success, others means failed. 4257 */ GetParentWindow(sptr<Window> & parentWindow)4258 virtual WMError GetParentWindow(sptr<Window>& parentWindow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4259 4260 /** 4261 * @brief Set window anchor info. 4262 * 4263 * @param windowAnchorInfo the windowAnchorInfo of subWindow. 4264 * @return WM_OK means set success. 4265 */ SetWindowAnchorInfo(const WindowAnchorInfo & windowAnchorInfo)4266 virtual WMError SetWindowAnchorInfo(const WindowAnchorInfo& windowAnchorInfo) 4267 { 4268 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4269 } 4270 4271 /** 4272 * @brief Set the feature of subwindow follow the layout of the parent window. 4273 * 4274 * @param isFollow true - follow, false - not follow. 4275 * @return WM_OK means set success. 4276 */ SetFollowParentWindowLayoutEnabled(bool isFollow)4277 virtual WMError SetFollowParentWindowLayoutEnabled(bool isFollow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4278 4279 /** 4280 * @brief Enable or disable window shadow. 4281 * 4282 * @param isEnabled Enable or disable window shadow. 4283 * @return WM_OK means set success. 4284 */ SetWindowShadowEnabled(bool isEnabled)4285 virtual WMError SetWindowShadowEnabled(bool isEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4286 4287 /** 4288 * @brief Get whether window shadow is enabled. 4289 * 4290 * @return True means window shadow is enabled. 4291 */ GetWindowShadowEnabled()4292 virtual bool GetWindowShadowEnabled() const { return true; } 4293 4294 /** 4295 * @brief Set the transition animation. 4296 * 4297 * @param transitionType window transition type. 4298 * @param animation window transition animation. 4299 * @return WM_OK means set window transition animation success, others means failed. 4300 */ SetWindowTransitionAnimation(WindowTransitionType transitionType,const TransitionAnimation & animation)4301 virtual WMError SetWindowTransitionAnimation(WindowTransitionType transitionType, 4302 const TransitionAnimation& animation) 4303 { 4304 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4305 } 4306 4307 /** 4308 * @brief Get the transition animation. 4309 * 4310 * @param transitionType window transition type. 4311 * @return nullptr means get failed. 4312 */ GetWindowTransitionAnimation(WindowTransitionType transitionType)4313 virtual std::shared_ptr<TransitionAnimation> GetWindowTransitionAnimation(WindowTransitionType transitionType) 4314 { 4315 return nullptr; 4316 } 4317 4318 /** 4319 * @brief Get is subwindow support maximize. 4320 * 4321 * @return true means subwindow support maximize, others means do not support. 4322 */ IsSubWindowMaximizeSupported()4323 virtual bool IsSubWindowMaximizeSupported() const { return false; } 4324 4325 /** 4326 * @brief Update the pipTemplateInfo. 4327 * 4328 * @param pipTemplateInfo the pipTemplateInfo of pip window 4329 */ UpdatePiPTemplateInfo(PiPTemplateInfo & pipTemplateInfo)4330 virtual void UpdatePiPTemplateInfo(PiPTemplateInfo& pipTemplateInfo) {} 4331 4332 /** 4333 * @brief Register a listener for observing keyboard show animation begins. 4334 * 4335 * @param listener IKeyboardWillShowListener. 4336 * @return WM_OK means register success, others means register failed. 4337 */ RegisterKeyboardWillShowListener(const sptr<IKeyboardWillShowListener> & listener)4338 virtual WMError RegisterKeyboardWillShowListener(const sptr<IKeyboardWillShowListener>& listener) 4339 { 4340 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4341 } 4342 4343 /** 4344 * @brief Unregister keyboard show animation start listener. 4345 * 4346 * @param listener IKeyboardWillShowListener. 4347 * @return WM_OK means unregister success, others means unregister failed. 4348 */ UnregisterKeyboardWillShowListener(const sptr<IKeyboardWillShowListener> & listener)4349 virtual WMError UnregisterKeyboardWillShowListener(const sptr<IKeyboardWillShowListener>& listener) 4350 { 4351 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4352 } 4353 4354 /** 4355 * @brief Register a listener for observing keyboard hide animation begins. 4356 * 4357 * @param listener IKeyboardWillHideListener. 4358 * @return WM_OK means register success, others means register failed. 4359 */ RegisterKeyboardWillHideListener(const sptr<IKeyboardWillHideListener> & listener)4360 virtual WMError RegisterKeyboardWillHideListener(const sptr<IKeyboardWillHideListener>& listener) 4361 { 4362 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4363 } 4364 4365 /** 4366 * @brief Unregister keyboard hide animation start listener. 4367 * 4368 * @param listener IKeyboardWillHideListener. 4369 * @return WM_OK means unregister success, others means unregister failed. 4370 */ UnregisterKeyboardWillHideListener(const sptr<IKeyboardWillHideListener> & listener)4371 virtual WMError UnregisterKeyboardWillHideListener(const sptr<IKeyboardWillHideListener>& listener) 4372 { 4373 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4374 } 4375 4376 /** 4377 * @brief Register keyboard show animation completion listener. 4378 * 4379 * @param listener IKeyboardDidShowListener. 4380 * @return WM_OK means register success, others means register failed. 4381 */ RegisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener> & listener)4382 virtual WMError RegisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener>& listener) 4383 { 4384 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4385 } 4386 4387 /** 4388 * @brief Unregister keyboard show animation completion listener. 4389 * 4390 * @param listener IKeyboardDidShowListener. 4391 * @return WM_OK means unregister success, others means unregister failed. 4392 */ UnregisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener> & listener)4393 virtual WMError UnregisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener>& listener) 4394 { 4395 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4396 } 4397 4398 /** 4399 * @brief Register keyboard hide animation completion listener. 4400 * 4401 * @param listener IKeyboardDidHideListener. 4402 * @return WM_OK means register success, others means register failed. 4403 */ RegisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener> & listener)4404 virtual WMError RegisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener>& listener) 4405 { 4406 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4407 } 4408 4409 /** 4410 * @brief Unregister keyboard hide animation completion listener. 4411 * 4412 * @param listener IKeyboardDidHideListener. 4413 * @return WM_OK means unregister success, others means unregister failed. 4414 */ UnregisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener> & listener)4415 virtual WMError UnregisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener>& listener) 4416 { 4417 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4418 } 4419 4420 /** 4421 * @brief Get the window property of current window. 4422 * 4423 * @param windowPropertyInfo the window property struct. 4424 * @return WMError. 4425 */ GetWindowPropertyInfo(WindowPropertyInfo & windowPropertyInfo)4426 virtual WMError GetWindowPropertyInfo(WindowPropertyInfo& windowPropertyInfo) { return WMError::WM_OK; } 4427 4428 /** 4429 * @brief Set drag key frame policy. 4430 * effective order: 4431 * 1. resize when drag 4432 * 2. key frame 4433 * 3. default value 4434 * 4435 * @param keyFramePolicy param of key frame 4436 * @return WM_OK means get success, others means failed. 4437 */ SetDragKeyFramePolicy(const KeyFramePolicy & keyFramePolicy)4438 virtual WMError SetDragKeyFramePolicy(const KeyFramePolicy& keyFramePolicy) 4439 { 4440 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4441 } 4442 4443 /** 4444 * @brief Set the bundleName, moduleName and abilityName of the hooked window. 4445 * 4446 * @param elementName includes bundleName, moduleName and abilityName of the hooked window. 4447 * @return WM_OK means set success. 4448 */ SetHookTargetElementInfo(const AppExecFwk::ElementName & elementName)4449 virtual WMError SetHookTargetElementInfo(const AppExecFwk::ElementName& elementName) 4450 { 4451 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4452 } 4453 4454 /** 4455 * @brief notify avoid area for compatible mode app 4456 */ HookCompatibleModeAvoidAreaNotify()4457 virtual void HookCompatibleModeAvoidAreaNotify() {} 4458 4459 /** 4460 * @brief The comaptible mode app adapt to immersive or not. 4461 * 4462 * @return true comptbleMode adapt to immersive, others means not. 4463 */ IsAdaptToCompatibleImmersive()4464 virtual bool IsAdaptToCompatibleImmersive() const { return false; } 4465 4466 /** 4467 * @brief Use implict animation 4468 * 4469 * @param used used 4470 * @return Returns WMError::WM_OK if called success, otherwise failed. 4471 */ UseImplicitAnimation(bool useImplicit)4472 virtual WMError UseImplicitAnimation(bool useImplicit) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4473 4474 /** 4475 * @brief Set intent param to arkui. 4476 * 4477 * @param intentParam intent param from ams. 4478 * @param loadPageCallback load page callback after send intent. 4479 * @param isColdStart Mark as cold start or not 4480 * @return WM_OK means set intent param success. 4481 */ SetIntentParam(const std::string & intentParam,const std::function<void ()> & loadPageCallback,bool isColdStart)4482 virtual WMError SetIntentParam(const std::string& intentParam, const std::function<void()>& loadPageCallback, 4483 bool isColdStart) 4484 { 4485 return WMError::WM_OK; 4486 } 4487 4488 /** 4489 * @brief Set the source of subwindow. 4490 * 4491 * @param source 0 - defalut, 1 - arkui. 4492 * @return WM_OK means set success. 4493 */ SetSubWindowSource(SubWindowSource source)4494 virtual WMError SetSubWindowSource(SubWindowSource source) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 4495 4496 /** 4497 * @brief Set the frameRect in a partial zoom-in scene. 4498 * 4499 * @param frameRect The original rect of frameBuffer before partial zoom-in. 4500 * @return WMError::WM_OK means set success, otherwise failed. 4501 */ SetFrameRectForPartialZoomIn(const Rect & frameRect)4502 virtual WMError SetFrameRectForPartialZoomIn(const Rect& frameRect) 4503 { 4504 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 4505 } 4506 4507 /** 4508 * @brief Set the navDestinationInfo of atomicService to arkui. 4509 * 4510 * @param navDestinationInfo navDestinationInfo in atomicService hap 4511 */ SetNavDestinationInfo(const std::string & navDestinationInfo)4512 virtual void SetNavDestinationInfo(const std::string& navDestinationInfo) {} 4513 4514 /** 4515 * @brief Inject a pointerEvent to arkui. 4516 * 4517 * @param pointerEvent PointerEvent of Multi-Model Input. 4518 * @return WM_OK means set success. 4519 */ InjectTouchEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)4520 virtual WMError InjectTouchEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) 4521 { 4522 return WMError::WM_ERROR_SYSTEM_ABNORMALLY; 4523 } 4524 4525 /** 4526 * @brief update the floating ball window instance. 4527 * 4528 * @param fbTemplateInfo the template info of the floating-ball. 4529 * @param icon the icon of the floating-ball. 4530 */ UpdateFloatingBall(const FloatingBallTemplateBaseInfo & fbTemplateBaseInfo,const std::shared_ptr<Media::PixelMap> & icon)4531 virtual WMError UpdateFloatingBall(const FloatingBallTemplateBaseInfo& fbTemplateBaseInfo, 4532 const std::shared_ptr<Media::PixelMap>& icon) 4533 { 4534 return WMError::WM_OK; 4535 } 4536 4537 /** 4538 * @brief Notify prepare to close window 4539 */ NotifyPrepareCloseFloatingBall()4540 virtual void NotifyPrepareCloseFloatingBall() {} 4541 4542 /** 4543 * @brief restore floating ball ability. 4544 * 4545 * @param want the want of the ability. 4546 */ RestoreFbMainWindow(const std::shared_ptr<AAFwk::Want> & want)4547 virtual WMError RestoreFbMainWindow(const std::shared_ptr<AAFwk::Want>& want) 4548 { 4549 return WMError::WM_OK; 4550 } 4551 4552 /** 4553 * @brief get windowId of floating-ball 4554 * 4555 * @param windowId the windowId of floating-ball. 4556 */ GetFloatingBallWindowId(uint32_t & windowId)4557 virtual WMError GetFloatingBallWindowId(uint32_t& windowId) 4558 { 4559 return WMError::WM_OK; 4560 } 4561 4562 /** 4563 * @brief UIExtension get host status bar content color, only for NAPI Call. 4564 * 4565 * @return content color 4566 */ GetHostStatusBarContentColor()4567 virtual uint32_t GetHostStatusBarContentColor() const { return 0; } 4568 4569 /** 4570 * @brief Get autoStart picture-in-picture switch status of system setting. 4571 * 4572 * @param switchStatus autoStart picture-in-picture switch status. 4573 * @return WM_OK means get success. 4574 */ GetPiPSettingSwitchStatus(bool & switchStatus)4575 virtual WMError GetPiPSettingSwitchStatus(bool& switchStatus) const { return WMError::WM_OK; } 4576 4577 /** 4578 * @brief return true if current window is anco, otherwise return false 4579 */ IsAnco()4580 virtual bool IsAnco() const 4581 { 4582 return false; 4583 } 4584 4585 /** 4586 * @brief special process on point down event 4587 */ OnPointDown(int32_t eventId,int32_t posX,int32_t posY)4588 virtual bool OnPointDown(int32_t eventId, int32_t posX, int32_t posY) 4589 { 4590 return false; 4591 } 4592 }; 4593 } 4594 } 4595 #endif // OHOS_ROSEN_WINDOW_H 4596