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 29 typedef struct napi_env__* napi_env; 30 typedef struct napi_value__* napi_value; 31 namespace OHOS::MMI { 32 class PointerEvent; 33 class KeyEvent; 34 class AxisEvent; 35 } 36 namespace OHOS::AppExecFwk { 37 class Configuration; 38 class Ability; 39 enum class SupportWindowMode; 40 } 41 42 namespace OHOS::Global::Resource { 43 class ResourceManager; 44 } // namespace OHOS::Global::Resource 45 46 namespace OHOS::AbilityRuntime { 47 class AbilityContext; 48 class Context; 49 } 50 51 namespace OHOS::AAFwk { 52 class Want; 53 class WantParams; 54 } 55 56 namespace OHOS::Ace { 57 class UIContent; 58 class ViewportConfig; 59 } 60 61 namespace OHOS::Media { 62 class PixelMap; 63 } 64 65 namespace OHOS::Accessibility { 66 class AccessibilityEventInfo; 67 } 68 namespace OHOS { 69 namespace Rosen { 70 using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>; 71 using NotifyTransferComponentDataFunc = std::function<void(const AAFwk::WantParams& wantParams)>; 72 using NotifyTransferComponentDataForResultFunc = std::function<AAFwk::WantParams(const AAFwk::WantParams& wantParams)>; 73 using KeyEventFilterFunc = std::function<bool(const MMI::KeyEvent&)>; 74 using MouseEventFilterFunc = std::function<bool(const MMI::PointerEvent&)>; 75 using TouchEventFilterFunc = std::function<bool(const MMI::PointerEvent&)>; 76 class RSSurfaceNode; 77 class RSTransaction; 78 class ISession; 79 class Window; 80 81 /** 82 * @class IWindowLifeCycle 83 * 84 * @brief IWindowLifeCycle is a listener used to notify caller that lifecycle of window. 85 */ 86 class IWindowLifeCycle : virtual public RefBase { 87 public: 88 /** 89 * @brief Notify caller that window is on the forground. 90 */ AfterForeground()91 virtual void AfterForeground() {} 92 93 /** 94 * @brief Notify caller that window is on the background. 95 */ AfterBackground()96 virtual void AfterBackground() {} 97 98 /** 99 * @brief Notify caller that window is focused. 100 */ AfterFocused()101 virtual void AfterFocused() {} 102 103 /** 104 * @brief Notify caller that window is unfocused. 105 */ AfterUnfocused()106 virtual void AfterUnfocused() {} 107 108 /** 109 * @brief Notify caller the error code when window go forground failed. 110 * 111 * @param ret Error code when window go forground failed. 112 */ ForegroundFailed(int32_t ret)113 virtual void ForegroundFailed(int32_t ret) {} 114 115 /** 116 * @brief Notify caller the error code when window go background failed. 117 * 118 * @param ret Error code when window go background failed. 119 */ BackgroundFailed(int32_t ret)120 virtual void BackgroundFailed(int32_t ret) {} 121 122 /** 123 * @brief Notify caller that window is active. 124 */ AfterActive()125 virtual void AfterActive() {} 126 127 /** 128 * @brief Notify caller that window is inactive. 129 */ AfterInactive()130 virtual void AfterInactive() {} 131 132 /** 133 * @brief Notify caller that window is resumed. 134 */ AfterResumed()135 virtual void AfterResumed() {} 136 137 /** 138 * @brief Notify caller that window is paused. 139 */ AfterPaused()140 virtual void AfterPaused() {} 141 142 /** 143 * @brief Notify caller that window is destroyed. 144 */ AfterDestroyed()145 virtual void AfterDestroyed() {} 146 147 /** 148 * @brief Notify caller that window is already foreground. 149 */ AfterDidForeground()150 virtual void AfterDidForeground() {} 151 152 /** 153 * @brief Notify caller that window is already background. 154 */ AfterDidBackground()155 virtual void AfterDidBackground() {} 156 }; 157 158 /** 159 * @class IWindowAttachStateChangeListner 160 * 161 * @brief IWindowAttachStateChangeListner is used to observe the window attach or detach state changed. 162 */ 163 class IWindowAttachStateChangeListner : virtual public RefBase { 164 public: AfterAttached()165 virtual void AfterAttached() {} AfterDetached()166 virtual void AfterDetached() {} 167 }; 168 169 /** 170 * @class IWindowChangeListener 171 * 172 * @brief IWindowChangeListener is used to observe the window size or window mode when window changed. 173 */ 174 class IWindowChangeListener : virtual public RefBase { 175 public: 176 /** 177 * @brief Notify caller when window size changed. 178 * 179 * @param Rect Rect of the current window. 180 * @param reason Reason for window change. 181 * @param rsTransaction Synchronization transaction for animation 182 */ 183 virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason, 184 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 185 186 /** 187 * @brief Notify caller when window mode changed. 188 * 189 * @param mode Mode of the current window. 190 * @param hasDeco Window has decoration or not. 191 */ 192 virtual void OnModeChange(WindowMode mode, bool hasDeco = true) {} 193 }; 194 195 class IWindowCrossAxisListener : virtual public RefBase { 196 public: 197 /** 198 * @brief Notify caller when window cross screen axis state changed. 199 * 200 * @param state is window across screen axis. 201 */ OnCrossAxisChange(CrossAxisState state)202 virtual void OnCrossAxisChange(CrossAxisState state) {} 203 }; 204 205 /** 206 * @class IWindowStatusChangeListener 207 * 208 * @brief IWindowStatusChangeListener is used to observe the window status when window status changed. 209 */ 210 class IWindowStatusChangeListener : virtual public RefBase { 211 public: 212 /** 213 * @brief Notify caller when window status changed. 214 * 215 * @param status Mode of the current window. 216 */ OnWindowStatusChange(WindowStatus status)217 virtual void OnWindowStatusChange(WindowStatus status) {} 218 }; 219 220 /** 221 * @class IAvoidAreaChangedListener 222 * 223 * @brief IAvoidAreaChangedListener is used to observe the avoid area when avoid area size changed. 224 */ 225 class IAvoidAreaChangedListener : virtual public RefBase { 226 public: 227 /** 228 * @brief Notify caller when avoid area size changed. 229 * 230 * @param avoidArea Area needed to be avoided. 231 * @param type Type of avoid area. 232 */ OnAvoidAreaChanged(const AvoidArea avoidArea,AvoidAreaType type)233 virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {} 234 }; 235 236 /** 237 * @class IWindowDragListener 238 * 239 * @brief IWindowDragListener is used to observe the drag status when drag window. 240 */ 241 class IWindowDragListener : virtual public RefBase { 242 public: 243 /** 244 * @brief Notify caller when drag window. 245 * 246 * @param x X-axis when drag window. 247 * @param y Y-axis when drag window. 248 * @param event Drag type. 249 */ OnDrag(int32_t x,int32_t y,DragEvent event)250 virtual void OnDrag(int32_t x, int32_t y, DragEvent event) {} 251 }; 252 253 /** 254 * @class IDisplayMoveListener 255 * 256 * @brief IDisplayMoveListener is used to observe display move status when display move. 257 */ 258 class IDisplayMoveListener : virtual public RefBase { 259 public: 260 /** 261 * @brief Notify caller when display move. 262 * 263 * @param from Display id before display start move. 264 * @param to Display id after display move end. 265 */ OnDisplayMove(DisplayId from,DisplayId to)266 virtual void OnDisplayMove(DisplayId from, DisplayId to) {} 267 }; 268 269 /** 270 * @class IDispatchInputEventListener 271 * 272 * @brief IDispatchInputEventListener is used to dispatch input event. 273 */ 274 class IDispatchInputEventListener : virtual public RefBase { 275 public: 276 /** 277 * @brief Dispatch PointerEvent. 278 * 279 * @param inputEvent Means PointerEvent. 280 */ OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent> & inputEvent)281 virtual void OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 282 283 /** 284 * @brief Dispatch KeyEvent. 285 * 286 * @param inputEvent Means KeyEvent. 287 */ OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> & keyEvent)288 virtual void OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent) {} 289 }; 290 291 /** 292 * @class IOccupiedAreaChangeListener 293 * 294 * @brief IOccupiedAreaChangeListener is used to observe OccupiedArea change. 295 */ 296 class IOccupiedAreaChangeListener : virtual public RefBase { 297 public: 298 /** 299 * @brief Notify caller when OccupiedArea size change. 300 * 301 * @param info Occupied area info when occupied changed. 302 * @param rsTransaction Animation transaction. 303 */ 304 virtual void OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info, 305 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {} 306 }; 307 308 /** 309 * @class IAceAbilityHandler 310 * 311 * @brief IAceAbilityHandler is used to control Ace Ability. 312 */ 313 class IAceAbilityHandler : virtual public RefBase { 314 public: 315 /** 316 * @brief Set BackgroundColor 317 * 318 * @param color Color of Background. 319 */ SetBackgroundColor(uint32_t color)320 virtual void SetBackgroundColor(uint32_t color) {} 321 322 /** 323 * @brief Get BackgroundColor. 324 * 325 * @return Value of BackgroundColor and default color is white. 326 */ GetBackgroundColor()327 virtual uint32_t GetBackgroundColor() { return 0xffffffff; } 328 }; 329 330 /** 331 * @class IInputEventConsumer 332 * 333 * @brief IInputEventConsumer is a Listener to observe InputEvent consumed or not. 334 */ 335 class IInputEventConsumer { 336 public: 337 /** 338 * @brief Default construct func of IInputEventConsumer. 339 */ 340 IInputEventConsumer() = default; 341 342 /** 343 * @brief Default Destructor func of IInputEventConsumer. 344 */ 345 virtual ~IInputEventConsumer() = default; 346 347 /** 348 * @brief Observe KeyEvent of Multi-Model Input. 349 * 350 * @param keyEvent KeyEvent of Multi-Model Input. 351 */ OnInputEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)352 virtual bool OnInputEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const { return false; } 353 354 /** 355 * @brief Observe PointerEvent of Multi-Model Input. 356 * 357 * @param pointerEvent PointerEvent of Multi-Model Input. 358 */ OnInputEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)359 virtual bool OnInputEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) const { return false; } 360 361 /** 362 * @brief Observe axisEvent of Multi-Model Input. 363 * 364 * @param axisEvent AxisEvent of Multi-Model Input. 365 */ OnInputEvent(const std::shared_ptr<MMI::AxisEvent> & axisEvent)366 virtual bool OnInputEvent(const std::shared_ptr<MMI::AxisEvent>& axisEvent) const { return false; } 367 }; 368 369 /** 370 * @class ITouchOutsideListener 371 * 372 * @brief ITouchOutsideListener is a Listener to observe event when touch outside the window. 373 */ 374 class ITouchOutsideListener : virtual public RefBase { 375 public: 376 /** 377 * @brief Observe the event when touch outside the window. 378 */ OnTouchOutside()379 virtual void OnTouchOutside() const {} 380 }; 381 382 /** 383 * @class IAnimationTransitionController 384 * 385 * @brief IAnimationTransitionController is a Listener to observe event about animation. 386 */ 387 class IAnimationTransitionController : virtual public RefBase { 388 public: 389 /** 390 * @brief Observe the event when animation show. 391 */ AnimationForShown()392 virtual void AnimationForShown() {} 393 394 /** 395 * @brief Observe the event when animation hide. 396 */ AnimationForHidden()397 virtual void AnimationForHidden() {} 398 }; 399 400 /** 401 * @class IScreenshotListener 402 * 403 * @brief IScreenshotListener is a Listener to observe event when screenshot happened. 404 */ 405 class IScreenshotListener : virtual public RefBase { 406 public: 407 /** 408 * @brief Observe event when screenshot happened. 409 */ OnScreenshot()410 virtual void OnScreenshot() {} 411 }; 412 413 /** 414 * @class IDialogTargetTouchListener 415 * 416 * @brief IDialogTargetTouchListener is a Listener to observe event when touch dialog window. 417 */ 418 class IDialogTargetTouchListener : virtual public RefBase { 419 public: 420 /** 421 * @brief Observe event when touch dialog window. 422 */ OnDialogTargetTouch()423 virtual void OnDialogTargetTouch() const {} 424 }; 425 426 /** 427 * @class IDialogDeathRecipientListener 428 * 429 * @brief IDialogDeathRecipientListener is a Listener to observe event when mainwindow(bind to dialog) destroyed. 430 */ 431 class IDialogDeathRecipientListener : virtual public RefBase { 432 public: 433 /** 434 * @brief Observe event when mainwindow(bind to dialog) destroyed. 435 */ OnDialogDeathRecipient()436 virtual void OnDialogDeathRecipient() const {} 437 }; 438 439 /** 440 * @class IWindowVisibilityChangedListener 441 * 442 * @brief Listener to observe one window visibility changed. 443 */ 444 class IWindowVisibilityChangedListener : virtual public RefBase { 445 public: OnWindowVisibilityChangedCallback(const bool isVisible)446 virtual void OnWindowVisibilityChangedCallback(const bool isVisible) {}; 447 }; 448 using IWindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>; 449 450 /** 451 * @class IDisplayIdChangeListener 452 * 453 * @brief Listener to observe one window displayId changed. 454 */ 455 class IDisplayIdChangeListener : virtual public RefBase { 456 public: 457 /** 458 * @brief Notify caller when window displayId changed. 459 */ OnDisplayIdChanged(DisplayId displayId)460 virtual void OnDisplayIdChanged(DisplayId displayId) {} 461 }; 462 using IDisplayIdChangeListenerSptr = sptr<IDisplayIdChangeListener>; 463 464 /** 465 * @class ISystemDensityChangeListener 466 * 467 * @brief Listener to observe system density associated with the window changed. 468 */ 469 class ISystemDensityChangeListener : virtual public RefBase { 470 public: 471 /** 472 * @brief Notify caller when system density changed. 473 */ OnSystemDensityChanged(float density)474 virtual void OnSystemDensityChanged(float density) {} 475 }; 476 using ISystemDensityChangeListenerSptr = sptr<ISystemDensityChangeListener>; 477 478 /** 479 * @class IWindowNoInteractionListenerSptr 480 * 481 * @brief Listener to observe no interaction event for a long time of window. 482 */ 483 class IWindowNoInteractionListener : virtual public RefBase { 484 public: 485 /** 486 * @brief Observe event when no interaction for a long time. 487 */ OnWindowNoInteractionCallback()488 virtual void OnWindowNoInteractionCallback() {}; 489 490 /** 491 * @brief Set timeout of the listener. 492 * 493 * @param timeout. 494 */ SetTimeout(int64_t timeout)495 virtual void SetTimeout(int64_t timeout) {}; 496 497 /** 498 * @brief get timeout of the listener. 499 * 500 * @return timeout. 501 */ GetTimeout()502 virtual int64_t GetTimeout() const { return 0;}; 503 }; 504 using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>; 505 506 /** 507 * @class IWindowTitleButtonRectChangedListener 508 * 509 * @brief Listener to observe event when window size or the height of title bar changed. 510 */ 511 class IWindowTitleButtonRectChangedListener : virtual public RefBase { 512 public: 513 /** 514 * @brief Notify caller when window size or the height of title bar changed. 515 * @param titleButtonRect An area of title buttons relative to the upper right corner of the window. 516 */ OnWindowTitleButtonRectChanged(const TitleButtonRect & titleButtonRect)517 virtual void OnWindowTitleButtonRectChanged(const TitleButtonRect& titleButtonRect) {} 518 }; 519 520 /** 521 * @class IWindowRectChangeListener 522 * 523 * @brief IWindowRectChangeListener is used to observe the window rect and its changing reason when window changed. 524 */ 525 class IWindowRectChangeListener : virtual public RefBase { 526 public: 527 /** 528 * @brief Notify caller when window rect changed. 529 * 530 * @param Rect Rect of the current window. 531 * @param reason Reason for window size change. 532 */ OnRectChange(Rect rect,WindowSizeChangeReason reason)533 virtual void OnRectChange(Rect rect, WindowSizeChangeReason reason) {} 534 }; 535 536 /** 537 * @class ISubWindowCloseListener 538 * 539 * @brief ISubWindowCloseListener is used to observe the window rect and its changing reason when window changed. 540 */ 541 class ISubWindowCloseListener : virtual public RefBase { 542 public: 543 /** 544 * @brief Notify caller when subwindow closed. 545 * 546 * @param terminateCloseProcess Whather need to terminate the subwindow close process. 547 */ OnSubWindowClose(bool & terminateCloseProcess)548 virtual void OnSubWindowClose(bool& terminateCloseProcess) {} 549 }; 550 551 /** 552 * @class IMainWindowCloseListener 553 * 554 * @brief IMainWindowCloseListener is used for preprocessing when the main window exits. 555 */ 556 class IMainWindowCloseListener : virtual public RefBase { 557 public: 558 /** 559 * @brief Notify caller when main window closed. 560 * 561 * @param terminateCloseProcess Whether need to terminate the main window close process. 562 */ OnMainWindowClose(bool & terminateCloseProcess)563 virtual void OnMainWindowClose(bool& terminateCloseProcess) {} 564 }; 565 566 /** 567 * @class IWindowWillCloseListener 568 * 569 * @brief IWindowWillCloseListener is used for async preprocessing when the window exits. 570 */ 571 class IWindowWillCloseListener : virtual public RefBase { 572 public: 573 /** 574 * @brief Notify caller when window closed. 575 * 576 * @param terminateCloseProcess Whether need to terminate the window close process. 577 */ OnWindowWillClose(sptr<Window> window)578 virtual void OnWindowWillClose(sptr<Window> window) {} 579 }; 580 /** 581 * @class IWindowHighlightChangeListener 582 * 583 * @brief IWindowHighlightChangeListener is a listener to observe event when highlight change of window. 584 */ 585 class IWindowHighlightChangeListener : virtual public RefBase { 586 public: 587 /** 588 * @brief Notify caller when highlight status changes. 589 * 590 * @param isHighlight Whether the window is highlighted. 591 */ OnWindowHighlightChange(bool isHighlight)592 virtual void OnWindowHighlightChange(bool isHighlight) {} 593 }; 594 595 /** 596 * @class ISwitchFreeMultiWindowListener 597 * 598 * @brief ISwitchFreeMultiWindowListener is used to observe the free multi window state when it changed. 599 */ 600 class ISwitchFreeMultiWindowListener : virtual public RefBase { 601 public: 602 /** 603 * @brief Notify caller when free multi window state changed. 604 * 605 * @param enable Whether free multi window state enabled. 606 */ OnSwitchFreeMultiWindow(bool enable)607 virtual void OnSwitchFreeMultiWindow(bool enable) {} 608 }; 609 610 /** 611 * @class IKeyboardPanelInfoChangeListener 612 * 613 * @brief IKeyboardPanelInfoChangeListener is used to observe the keyboard panel info. 614 */ 615 class IKeyboardPanelInfoChangeListener : virtual public RefBase { 616 public: 617 /** 618 * @brief Notify caller when keyboard info changed. 619 * 620 * @param KeyboardPanelInfo keyboardPanelInfo of the keyboard panel; 621 */ OnKeyboardPanelInfoChanged(const KeyboardPanelInfo & keyboardPanelInfo)622 virtual void OnKeyboardPanelInfoChanged(const KeyboardPanelInfo& keyboardPanelInfo) {} 623 }; 624 625 /** 626 * @class IKeyboardDidShowListener 627 * 628 * @brief IKeyboardDidShowListener is used to observe keyboard show animation completion. 629 */ 630 class IKeyboardDidShowListener : virtual public RefBase { 631 public: 632 /** 633 * @brief Notify the caller when keyboard show animation is completed. 634 */ OnKeyboardDidShow(const KeyboardPanelInfo & keyboardPanelInfo)635 virtual void OnKeyboardDidShow(const KeyboardPanelInfo& keyboardPanelInfo) {} 636 }; 637 638 /** 639 * @class IKeyboardDidHideListener 640 * 641 * @brief IKeyboardDidHideListener is used to observe keyboard hide animation completion. 642 */ 643 class IKeyboardDidHideListener : virtual public RefBase { 644 public: 645 /** 646 * @brief Notify the caller when keyboard hide animation is completed. 647 */ OnKeyboardDidHide(const KeyboardPanelInfo & keyboardPanelInfo)648 virtual void OnKeyboardDidHide(const KeyboardPanelInfo& keyboardPanelInfo) {} 649 }; 650 651 /** 652 * @class IPreferredOrientationChangeListener 653 * 654 * @brief listener of preferred orientation change which set by developer. 655 */ 656 class IPreferredOrientationChangeListener : virtual public RefBase { 657 public: 658 /** 659 * @brief Notify caller when orientation set by developer. 660 * 661 * @param ori the orientation set by developer. 662 */ OnPreferredOrientationChange(Orientation orientation)663 virtual void OnPreferredOrientationChange(Orientation orientation) {} 664 }; 665 666 /** 667 * @class IWindowOrientationChangeListener 668 * 669 * @brief IWindowOrientationChangeListener is used to notify while window rotate. 670 */ 671 class IWindowOrientationChangeListener : virtual public RefBase { 672 public: 673 /** 674 * @brief Innerapi, notify caller while window rotate. 675 */ OnOrientationChange()676 virtual void OnOrientationChange() {} 677 }; 678 679 static WMError DefaultCreateErrCode = WMError::WM_OK; 680 class Window : virtual public RefBase { 681 public: 682 /** 683 * @brief create window, include main_window/sub_window/system_window 684 * 685 * @param windowName window name, identify window instance 686 * @param option window propertion 687 * @param context ability context 688 * @return sptr<Window> If create window success,return window instance;Otherwise, return nullptr 689 */ 690 static sptr<Window> Create(const std::string& windowName, 691 sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr, 692 WMError& errCode = DefaultCreateErrCode); 693 694 /** 695 * @brief create main/uiextension window with session 696 * 697 * @param option window propertion 698 * @param context ability context 699 * @param iSession session token of window session 700 * @param errCode error code of create window 701 * @param identityToken identity token of sceneSession 702 * @return sptr<Window> If create window success, return window instance; Otherwise, return nullptr 703 */ 704 static sptr<Window> Create(sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context, 705 const sptr<IRemoteObject>& iSession, WMError& errCode = DefaultCreateErrCode, 706 const std::string& identityToken = ""); 707 708 /** 709 * @brief create pip window with session 710 * 711 * @param option window propertion 712 * @param pipTemplateInfo pipTemplateInfo 713 * @param context ability context 714 * @param errCode error code of create pip window 715 * @return sptr<Window> If create pip window success, return window instance; Otherwise, return nullptr 716 */ 717 static sptr<Window> CreatePiP(sptr<WindowOption>& option, const PiPTemplateInfo& pipTemplateInfo, 718 const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, WMError& errCode = DefaultCreateErrCode); 719 720 /** 721 * @brief find window by windowName 722 * 723 * @param windowName 724 * @return sptr<Window> Return the window instance founded 725 */ 726 static sptr<Window> Find(const std::string& windowName); 727 728 /** 729 * @brief Get parent main windowId, which is used for mainWindow,subWindow or dialog 730 * 731 * @param windowId window id that need to get parent main window 732 * @return uint32_t Return the parent main window id 733 */ 734 static uint32_t GetParentMainWindowId(uint32_t windowId); 735 736 /** 737 * @brief Get the final show window by context. Its implemented in api8 738 * 739 * @param context Indicates the context on which the window depends 740 * @return sptr<Window> 741 */ 742 static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 743 744 /** 745 * @brief Get the final show window by id. Its implemented in api8 746 * 747 * @param mainWinId main window id? 748 * @return sptr<Window> 749 */ 750 static sptr<Window> GetTopWindowWithId(uint32_t mainWinId); 751 752 /** 753 * @brief Get the main window by context. 754 * 755 * @param context Indicates the context on which the window depends 756 * @return sptr<Window> 757 */ 758 static sptr<Window> GetMainWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr); 759 760 /** 761 * @brief Get the all sub windows by parent 762 * 763 * @param parentId parent window id 764 * @return std::vector<sptr<Window>> 765 */ 766 static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId); 767 768 /** 769 * @brief Update configuration for all windows 770 * 771 * @param configuration configuration for app 772 * @param ignoreWindowContexts context of window which will be ignored 773 */ 774 static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 775 const std::vector<std::shared_ptr<AbilityRuntime::Context>>& ignoreWindowContexts = {}); 776 777 /** 778 * @brief Update theme configuration for all windows 779 * @param configuration configuration for app 780 */ 781 static void UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration); 782 783 /** 784 * @brief Get surface node from RS 785 * 786 * @return Surface node from RS 787 */ GetSurfaceNode()788 virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const { return nullptr; } 789 790 /** 791 * @brief Get ability context 792 * 793 * @return Ability context from AbilityRuntime 794 */ GetContext()795 virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const { return nullptr; } 796 797 /** 798 * @brief Get the window show rect 799 * 800 * @return Rect of window 801 */ GetRect()802 virtual Rect GetRect() const { return {}; } 803 804 /** 805 * @brief Get window default rect from window property. 806 * 807 * @return Rect of window. 808 */ GetRequestRect()809 virtual Rect GetRequestRect() const { return {}; } 810 811 /** 812 * @brief Get the window type 813 * 814 * @return Type of window 815 */ GetType()816 virtual WindowType GetType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 817 818 /** 819 * @brief Get the window mode. 820 * 821 * @return Mode of window. 822 */ GetWindowMode()823 virtual WindowMode GetWindowMode() const { return WindowMode::WINDOW_MODE_UNDEFINED; } 824 825 /** 826 * @brief Get alpha of window. 827 * 828 * @return Alpha of window. 829 */ GetAlpha()830 virtual float GetAlpha() const { return 0.0f; } 831 832 /** 833 * @brief Get the name of window. 834 * 835 * @return Name of window. 836 */ GetWindowName()837 virtual const std::string& GetWindowName() const 838 { 839 static const std::string name; 840 return name; 841 } 842 843 /** 844 * @brief Get id of window. 845 * 846 * @return ID of window. 847 */ GetWindowId()848 virtual uint32_t GetWindowId() const { return INVALID_WINDOW_ID; } 849 850 /** 851 * @brief Get displayId of window. 852 * 853 * @return displayId of window. 854 */ GetDisplayId()855 virtual uint64_t GetDisplayId() const { return DISPLAY_ID_INVALID; } 856 857 /** 858 * @brief Get flag of window. 859 * 860 * @return Flag of window. 861 */ GetWindowFlags()862 virtual uint32_t GetWindowFlags() const { return 0; } 863 864 /** 865 * @brief Get state of window. 866 * 867 * @return Current state of window. 868 */ GetWindowState()869 virtual WindowState GetWindowState() const { return WindowState::STATE_INITIAL; } 870 871 /** 872 * @brief Set focusable property of window. 873 * 874 * @param isFocusable Window can be focused or not. 875 * @return Errorcode of window. 876 */ SetFocusable(bool isFocusable)877 virtual WMError SetFocusable(bool isFocusable) { return WMError::WM_OK; } 878 879 /** 880 * @brief Get focusable property of window. 881 * 882 * @return True means window can be focused, false means window cannot be focused. 883 */ GetFocusable()884 virtual bool GetFocusable() const { return false; } 885 886 /** 887 * @brief Set touchable property of window. 888 * 889 * @param isTouchable Window can be touched or not. 890 * @return Errorcode of window. 891 */ SetTouchable(bool isTouchable)892 virtual WMError SetTouchable(bool isTouchable) { return WMError::WM_OK; } 893 894 /** 895 * @brief Get touchable property of window. 896 * 897 * @return True means window can be touched, false means window cannot be touched. 898 */ GetTouchable()899 virtual bool GetTouchable() const { return false; } 900 901 /** 902 * @brief Get SystemBarProperty By WindowType. 903 * 904 * @param type Type of window. 905 * @return Property of system bar. 906 */ GetSystemBarPropertyByType(WindowType type)907 virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const { return {}; } 908 909 /** 910 * @brief judge this window is full screen. 911 * 912 * @return true If SetFullScreen(true) is called , return true. 913 * @return false default return false 914 */ IsFullScreen()915 virtual bool IsFullScreen() const { return false; } 916 917 /** 918 * @brief judge window layout is full screen 919 * 920 * @return true this window layout is full screen 921 * @return false this window layout is not full screen 922 */ IsLayoutFullScreen()923 virtual bool IsLayoutFullScreen() const { return false; } 924 925 /** 926 * @brief Set the Window Type 927 * 928 * @param type window type 929 * @return WMError 930 */ SetWindowType(WindowType type)931 virtual WMError SetWindowType(WindowType type) { return WMError::WM_OK; } 932 933 /** 934 * @brief Set the Window Mode 935 * 936 * @param mode window mode 937 * @return WMError 938 */ SetWindowMode(WindowMode mode)939 virtual WMError SetWindowMode(WindowMode mode) { return WMError::WM_OK; } 940 941 /** 942 * @brief Set whether the window is topmost 943 * 944 * @param topmost whether window is topmost 945 * @return WMError 946 */ SetTopmost(bool topmost)947 virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; } 948 949 /** 950 * @brief Get whether window is topmost 951 * 952 * @return True means window is topmost 953 */ IsTopmost()954 virtual bool IsTopmost() const { return false; } 955 956 /** 957 * @brief Set whether the main window is topmost 958 * 959 * @param isTopmost whether main window is topmost 960 * @return WMError 961 */ SetMainWindowTopmost(bool isTopmost)962 virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 963 964 /** 965 * @brief Get whether main window is topmost 966 * 967 * @return True means main window is topmost 968 */ IsMainWindowTopmost()969 virtual bool IsMainWindowTopmost() const { return false; } 970 971 /** 972 * @brief Set sub window zLevel 973 * 974 * @param zLevel zLevel of sub window to specify the hierarchical relationship among sub windows 975 * @return WM_OK means success, others mean set failed 976 */ SetSubWindowZLevel(int32_t zLevel)977 virtual WMError SetSubWindowZLevel(int32_t zLevel) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 978 979 /** 980 * @brief Get sub window zLevel 981 * 982 * @param zLevel sub window zLevel 983 * @return WM_OK means success, others mean get failed 984 */ GetSubWindowZLevel(int32_t & zLevel)985 virtual WMError GetSubWindowZLevel(int32_t& zLevel) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 986 987 /** 988 * @brief Set alpha of window. 989 * 990 * @param alpha Alpha of window. 991 * @return WM_OK means success, others means set failed. 992 */ SetAlpha(float alpha)993 virtual WMError SetAlpha(float alpha) { return WMError::WM_OK; } 994 995 /** 996 * @brief Set transform of window property. 997 * 998 * @param trans Window Transform. 999 * @return WMError 1000 */ SetTransform(const Transform & trans)1001 virtual WMError SetTransform(const Transform& trans) { return WMError::WM_OK; } 1002 1003 /** 1004 * @brief Get transform of window property. 1005 * 1006 * @return Property of transform. 1007 */ GetTransform()1008 virtual const Transform& GetTransform() const 1009 { 1010 static const Transform trans; 1011 return trans; 1012 } 1013 1014 /** 1015 * @brief Add window flag. 1016 * 1017 * @param flag Flag of window. 1018 * @return WM_OK means add success, others means failed. 1019 */ AddWindowFlag(WindowFlag flag)1020 virtual WMError AddWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 1021 1022 /** 1023 * @brief Remove window flag. 1024 * 1025 * @param flag Flag of window 1026 * @return WM_OK means remove success, others means failed. 1027 */ RemoveWindowFlag(WindowFlag flag)1028 virtual WMError RemoveWindowFlag(WindowFlag flag) { return WMError::WM_OK; } 1029 1030 /** 1031 * @brief Set window flag. 1032 * 1033 * @param flags Flag of window 1034 * @return WM_OK means set success, others means failed. 1035 */ SetWindowFlags(uint32_t flags)1036 virtual WMError SetWindowFlags(uint32_t flags) { return WMError::WM_OK; } 1037 1038 /** 1039 * @brief Set the System Bar(include status bar and nav bar) Property 1040 * 1041 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 1042 * @param property system bar prop,include content color, background color 1043 * @return WMError 1044 */ SetSystemBarProperty(WindowType type,const SystemBarProperty & property)1045 virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return WMError::WM_OK; } 1046 1047 /** 1048 * @brief Get the Avoid Area By Type object 1049 * 1050 * @param type avoid area type.@see reference 1051 * @param avoidArea 1052 * @param rect 1053 * @return WMError 1054 */ 1055 virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea, 1056 const Rect& rect = Rect::EMPTY_RECT, int32_t apiVersion = API_VERSION_INVALID) { return WMError::WM_OK; } 1057 1058 /** 1059 * @brief Set whether the system or app sub window can obtain area 1060 * 1061 * @param avoidAreaOption from low to high, the first bit means system window, the second bit means app sub window 1062 * @return WMError 1063 */ SetAvoidAreaOption(uint32_t avoidAreaOption)1064 virtual WMError SetAvoidAreaOption(uint32_t avoidAreaOption) { return WMError::WM_OK; } 1065 1066 /** 1067 * @brief Get the Avoid Area of system or app sub window Enabled object 1068 * 1069 * @param avoidAreaOption from low to high, the first bit means system window, the second bit means app sub window 1070 * @return WMError 1071 */ GetAvoidAreaOption(uint32_t & avoidAreaOption)1072 virtual WMError GetAvoidAreaOption(uint32_t& avoidAreaOption) { return WMError::WM_OK; } 1073 1074 /** 1075 * @brief Is system window or not 1076 * 1077 * @return True means the window is system window, false means the window is not system window 1078 */ IsSystemWindow()1079 virtual bool IsSystemWindow() const { return false; } 1080 1081 /** 1082 * @brief Is app window or not 1083 * 1084 * @return True means the window is app window, false means the window is not app window 1085 */ IsAppWindow()1086 virtual bool IsAppWindow() const { return false; } 1087 1088 /** 1089 * @brief Set this window layout full screen, with hide status bar and nav bar above on this window 1090 * 1091 * @param status 1092 * @return WMError 1093 */ SetLayoutFullScreen(bool status)1094 virtual WMError SetLayoutFullScreen(bool status) { return WMError::WM_OK; } 1095 1096 /** 1097 * @brief Set whether the title bar and dock bar will show, when the mouse hovers over hot area. 1098 * 1099 * @param isTitleHoverShown 1100 * @param isDockHoverShown 1101 * @return WMError 1102 */ 1103 virtual WMError SetTitleAndDockHoverShown(bool isTitleHoverShown = true, 1104 bool isDockHoverShown = true) 1105 { 1106 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1107 } 1108 1109 /** 1110 * @brief Set this window full screen, with hide status bar and nav bar 1111 * 1112 * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar 1113 * @return WMError 1114 */ SetFullScreen(bool status)1115 virtual WMError SetFullScreen(bool status) { return WMError::WM_OK; } 1116 1117 /** 1118 * @brief destroy window 1119 * 1120 * @return WMError 1121 */ Destroy()1122 virtual WMError Destroy() { return WMError::WM_OK; } 1123 1124 /** 1125 * @brief Show window 1126 * 1127 * @param reason Reason for window state change. 1128 * @param withAnimation True means window show with animation, false means window show without animation. 1129 * @param withFocus True means window can get focus when it shows to foreground, false means the opposite; 1130 * @return WM_OK means window show success, others means failed. 1131 */ 1132 virtual WMError Show(uint32_t reason = 0, bool withAnimation = false, 1133 bool withFocus = true) { return WMError::WM_OK; } 1134 1135 /** 1136 * @brief resume window 1137 */ Resume()1138 virtual void Resume() {} 1139 1140 /** 1141 * @brief Hide window 1142 * 1143 * @param reason Reason for window state change. 1144 * @param withAnimation True means window show with animation, false means window show without animation. 1145 * @param isFromInnerkits True means remove command is from inner kits. 1146 * @return WM_OK means window hide success, others means failed. 1147 */ 1148 virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true) 1149 { 1150 return WMError::WM_OK; 1151 } 1152 1153 /** 1154 * @brief notify window first frame drawing completed. 1155 * 1156 * @return WMError 1157 */ NotifyDrawingCompleted()1158 virtual WMError NotifyDrawingCompleted() { return WMError::WM_OK; } 1159 1160 /** 1161 * @brief notify window remove starting window. 1162 * 1163 * @return WMError 1164 */ NotifyRemoveStartingWindow()1165 virtual WMError NotifyRemoveStartingWindow() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1166 1167 /** 1168 * @brief move the window to (x, y) 1169 * 1170 * @param x 1171 * @param y 1172 * @param isMoveToGlobal Indicates move global flag 1173 * @param moveConfiguration Indicates the optional move configuration 1174 * @return WMError 1175 */ 1176 virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false, 1177 MoveConfiguration moveConfiguration = {}) { return WMError::WM_OK; } 1178 1179 /** 1180 * @brief move the window to (x, y) 1181 * 1182 * @param x 1183 * @param y 1184 * @param moveConfiguration Indicates the optional move configuration 1185 * @return WMError 1186 */ 1187 virtual WMError MoveToAsync(int32_t x, int32_t y, 1188 MoveConfiguration moveConfiguration = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1189 1190 /** 1191 * @brief move the window to global (x, y) 1192 * 1193 * @param x 1194 * @param y 1195 * @param moveConfiguration Indicates the optional move configuration 1196 * @return WMError 1197 */ MoveWindowToGlobal(int32_t x,int32_t y,MoveConfiguration moveConfiguration)1198 virtual WMError MoveWindowToGlobal(int32_t x, int32_t y, 1199 MoveConfiguration moveConfiguration) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1200 1201 /** 1202 * @brief Get window global scaled rect. 1203 * 1204 * @param Rect 1205 * @return WMError 1206 */ GetGlobalScaledRect(Rect & globalScaledRect)1207 virtual WMError GetGlobalScaledRect(Rect& globalScaledRect) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1208 1209 /** 1210 * @brief resize the window instance (w,h) 1211 * 1212 * @param width 1213 * @param height 1214 * @return WMError 1215 */ 1216 virtual WMError Resize(uint32_t width, uint32_t height, 1217 const RectAnimationConfig& rectAnimationConfig = {}) { return WMError::WM_OK; } 1218 1219 /** 1220 * @brief resize the window instance (w,h) 1221 * 1222 * @param width 1223 * @param height 1224 * @return WMError 1225 */ 1226 virtual WMError ResizeAsync(uint32_t width, uint32_t height, 1227 const RectAnimationConfig& rectAnimationConfig = {}) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1228 1229 /** 1230 * @brief set the window gravity 1231 * 1232 * @param gravity 1233 * @param percent 1234 * @return WMError 1235 */ SetWindowGravity(WindowGravity gravity,uint32_t percent)1236 virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) { return WMError::WM_OK; } 1237 1238 /** 1239 * @brief Set the screen always on 1240 * 1241 * @param keepScreenOn 1242 * @return WMError 1243 */ SetKeepScreenOn(bool keepScreenOn)1244 virtual WMError SetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 1245 1246 /** 1247 * @brief Get the screen is always on or not. 1248 * 1249 * @return True means screen is always on, false means the opposite. 1250 */ IsKeepScreenOn()1251 virtual bool IsKeepScreenOn() const { return false; } 1252 1253 /** 1254 * @brief Set the view screen always on 1255 * 1256 * @param keepScreenOn 1257 * @return WMError 1258 */ SetViewKeepScreenOn(bool keepScreenOn)1259 virtual WMError SetViewKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; } 1260 1261 /** 1262 * @brief Get the view screen is always on or not. 1263 * 1264 * @return True means view screen is always on, false means the opposite. 1265 */ IsViewKeepScreenOn()1266 virtual bool IsViewKeepScreenOn() const { return false; } 1267 1268 /** 1269 * @brief Set the screen on 1270 * 1271 * @param turnScreenOn True means turn screen on, false means the opposite. 1272 * @return WM_OK means set success, others means set failed. 1273 */ SetTurnScreenOn(bool turnScreenOn)1274 virtual WMError SetTurnScreenOn(bool turnScreenOn) { return WMError::WM_OK; } 1275 1276 /** 1277 * @brief Get the screen is on or not. 1278 * 1279 * @return True means screen is on, false means screen is off. 1280 */ IsTurnScreenOn()1281 virtual bool IsTurnScreenOn() const { return false; } 1282 1283 /** 1284 * @brief Set Background color. 1285 * 1286 * @param color Background color. 1287 * @return WM_OK means set success, others means set failed. 1288 */ SetBackgroundColor(const std::string & color)1289 virtual WMError SetBackgroundColor(const std::string& color) { return WMError::WM_OK; } 1290 1291 /** 1292 * @brief Set transparent status. 1293 * 1294 * @param isTransparent True means set window transparent, false means the opposite. 1295 * @return WM_OK means set success, others means set failed. 1296 */ SetTransparent(bool isTransparent)1297 virtual WMError SetTransparent(bool isTransparent) { return WMError::WM_OK; } 1298 1299 /** 1300 * @brief Get transparent status. 1301 * 1302 * @return True means window is transparent, false means the opposite. 1303 */ IsTransparent()1304 virtual bool IsTransparent() const { return false; } 1305 1306 /** 1307 * @brief Set brightness value of window. 1308 * 1309 * @param brightness Brightness of window. 1310 * @return WM_OK means set success, others means set failed. 1311 */ SetBrightness(float brightness)1312 virtual WMError SetBrightness(float brightness) { return WMError::WM_OK; } 1313 1314 /** 1315 * @brief Get brightness value of window. 1316 * 1317 * @return Brightness value of window. 1318 */ GetBrightness()1319 virtual float GetBrightness() const { return 0.0f; } 1320 1321 /** 1322 * @brief Set calling window. 1323 * 1324 * @param windowId Window id. 1325 * @return WM_OK means set success, others means set failed. 1326 */ SetCallingWindow(uint32_t windowId)1327 virtual WMError SetCallingWindow(uint32_t windowId) { return WMError::WM_OK; } 1328 1329 /** 1330 * @brief Set privacy mode of window. 1331 * 1332 * @param isPrivacyMode True means set window private, false means not set window private. 1333 * @return WM_OK means set success, others means set failed. 1334 */ SetPrivacyMode(bool isPrivacyMode)1335 virtual WMError SetPrivacyMode(bool isPrivacyMode) { return WMError::WM_OK; } 1336 1337 /** 1338 * @brief Get privacy property of window. 1339 * 1340 * @return True means window is private and cannot be screenshot or recorded. 1341 */ IsPrivacyMode()1342 virtual bool IsPrivacyMode() const { return false; } 1343 1344 /** 1345 * @brief Set privacy mode by system. 1346 * 1347 * @param isSystemPrivacyMode True means set window private, false means not set window private. 1348 */ SetSystemPrivacyMode(bool isSystemPrivacyMode)1349 virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) {} 1350 1351 /** 1352 * @brief Bind Dialog window to target token. 1353 * 1354 * @param targetToken Window token of target. 1355 * @return WM_OK means set success, others means set failed. 1356 */ BindDialogTarget(sptr<IRemoteObject> targetToken)1357 virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) { return WMError::WM_OK; } 1358 1359 /** 1360 * @brief Set whether the dialog window responds to back gesture. 1361 * 1362 * @param isEnabled Responds to back gesture if true, or ignore back gesture if false. 1363 * @return WM_OK means set success, others means set failed. 1364 */ SetDialogBackGestureEnabled(bool isEnabled)1365 virtual WMError SetDialogBackGestureEnabled(bool isEnabled) 1366 { 1367 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1368 } 1369 1370 /** 1371 * @brief Raise zorder of window to the top of APP Mainwindow. 1372 * 1373 * @return WM_OK means raise success, others means raise failed. 1374 */ RaiseToAppTop()1375 virtual WMError RaiseToAppTop() { return WMError::WM_OK; } 1376 1377 /** 1378 * @brief Set skip flag of snapshot. 1379 * 1380 * @param isSkip True means skip the snapshot, false means the opposite. 1381 * @return WM_OK means set success, others means set failed. 1382 */ SetSnapshotSkip(bool isSkip)1383 virtual WMError SetSnapshotSkip(bool isSkip) { return WMError::WM_OK; } 1384 1385 // window effect 1386 /** 1387 * @brief Set corner radius of window. 1388 * 1389 * @param cornerRadius Corner radius of window 1390 * @return WM_OK means set success, others means set failed. 1391 */ SetCornerRadius(float cornerRadius)1392 virtual WMError SetCornerRadius(float cornerRadius) { return WMError::WM_OK; } 1393 1394 /** 1395 * @brief Sets corner radius of window. 1396 * 1397 * @param cornerRadius Corner radius of window. 1398 * @return WM_OK means set success, others means set failed. 1399 */ SetWindowCornerRadius(float cornerRadius)1400 virtual WMError SetWindowCornerRadius(float cornerRadius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1401 1402 /** 1403 * @brief Get corner radius of window. 1404 * 1405 * @param cornerRadius Corner radius of window. 1406 * @return WM_OK means set success, others means set failed. 1407 */ GetWindowCornerRadius(float & cornerRadius)1408 virtual WMError GetWindowCornerRadius(float& cornerRadius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1409 1410 /** 1411 * @brief Set shadow radius of window. 1412 * 1413 * @param radius Shadow radius of window 1414 * @return WM_OK means set success, others means set failed. 1415 */ SetShadowRadius(float radius)1416 virtual WMError SetShadowRadius(float radius) { return WMError::WM_OK; } 1417 1418 /** 1419 * @brief Set shadow radius of window. 1420 * 1421 * @param radius Shadow radius of window. 1422 * @return WM_OK means set success, others means set failed. 1423 */ SetWindowShadowRadius(float radius)1424 virtual WMError SetWindowShadowRadius(float radius) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1425 1426 /** 1427 * @brief Set shadow color of window. 1428 * 1429 * @param color Shadow color of window. 1430 * @return WM_OK means set success, others means set failed. 1431 */ SetShadowColor(std::string color)1432 virtual WMError SetShadowColor(std::string color) { return WMError::WM_OK; } 1433 1434 /** 1435 * @brief Set shadow X offset. 1436 * 1437 * @param offsetX Shadow x-axis offset. 1438 * @return WM_OK means set success, others means set failed. 1439 */ SetShadowOffsetX(float offsetX)1440 virtual WMError SetShadowOffsetX(float offsetX) { return WMError::WM_OK; } 1441 1442 /** 1443 * @brief Set shadow Y offset. 1444 * 1445 * @param offsetY Shadow y-axis offset. 1446 * @return WM_OK means set success, others means set failed. 1447 */ SetShadowOffsetY(float offsetY)1448 virtual WMError SetShadowOffsetY(float offsetY) { return WMError::WM_OK; } 1449 1450 /** 1451 * @brief Set blur property. 1452 * 1453 * @param radius Blur value. 1454 * @return WM_OK means set success, others means set failed. 1455 */ SetBlur(float radius)1456 virtual WMError SetBlur(float radius) { return WMError::WM_OK; } 1457 1458 /** 1459 * @brief Set Backdrop blur property. 1460 * 1461 * @param radius Backdrop blur value. 1462 * @return WM_OK means set success, others means set failed. 1463 */ SetBackdropBlur(float radius)1464 virtual WMError SetBackdropBlur(float radius) { return WMError::WM_OK; } 1465 1466 /** 1467 * @brief Set Backdrop blur style. 1468 * 1469 * @param blurStyle Backdrop blur value. 1470 * @return WM_OK means set success, others means set failed. 1471 */ SetBackdropBlurStyle(WindowBlurStyle blurStyle)1472 virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) { return WMError::WM_OK; } 1473 1474 /** 1475 * @brief Request to get focus. 1476 * 1477 * @return WM_OK means request success, others means request failed. 1478 */ RequestFocus()1479 virtual WMError RequestFocus() const { return WMError::WM_OK; } 1480 1481 /** 1482 * @brief Request to get focus or lose focus. 1483 * 1484 * @return WM_OK means request success, others means request failed. 1485 */ RequestFocusByClient(bool isFocused)1486 virtual WMError RequestFocusByClient(bool isFocused) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 1487 1488 /** 1489 * @brief Check current focus status. 1490 * 1491 * @return True means window is focused, false means window is unfocused. 1492 */ IsFocused()1493 virtual bool IsFocused() const { return false; } 1494 1495 /** 1496 * @brief Update surfaceNode after customAnimation. 1497 * 1498 * @param isAdd True means add custom animation, false means the opposite. 1499 * @return WM_OK means update success, others means update failed. 1500 */ UpdateSurfaceNodeAfterCustomAnimation(bool isAdd)1501 virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { return WMError::WM_OK; } 1502 1503 /** 1504 * @brief Set InputEvent Consumer. 1505 * 1506 * @param inputEventConsumer Consume input event object. 1507 * @return WM_OK means set success, others means set failed. 1508 */ SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer> & inputEventConsumer)1509 virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) {} 1510 1511 /** 1512 * @brief Consume KeyEvent from MMI. 1513 * 1514 * @param inputEvent Keyboard input event. 1515 */ ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent> & inputEvent)1516 virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) {} 1517 1518 /** 1519 * @brief Notify KeyEvent to arkui. 1520 * 1521 * @param inputEvent Keyboard input event 1522 */ PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)1523 virtual bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) {return false;} 1524 1525 /** 1526 * @brief Consume PointerEvent from MMI. 1527 * 1528 * @param inputEvent Pointer input event 1529 */ ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent> & inputEvent)1530 virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) {} 1531 1532 /** 1533 * @brief Request Vsync. 1534 * 1535 * @param vsyncCallback Callback of vsync. 1536 */ RequestVsync(const std::shared_ptr<VsyncCallback> & vsyncCallback)1537 virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) {} 1538 1539 /** 1540 * @brief get vsync period. 1541 * 1542 * @return vsync period. 1543 */ GetVSyncPeriod()1544 virtual int64_t GetVSyncPeriod() { return 0; } 1545 1546 /** 1547 * @brief flush frame rate of linker. 1548 * 1549 * @param rate frame rate. 1550 * @param animatorExpectedFrameRate animator expected frame rate. 1551 * @param rateType frame rate type. 1552 */ FlushFrameRate(uint32_t rate,int32_t animatorExpectedFrameRate,uint32_t rateType)1553 virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {} 1554 1555 /** 1556 * @brief Update Configuration. 1557 * 1558 * @param configuration Window configuration. 1559 */ UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1560 virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1561 1562 /** 1563 * @brief Update configuration for specified window. 1564 * 1565 * @param configuration Window configuration. 1566 * @param resourceManager The resource manager 1567 */ UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration> & configuration,const std::shared_ptr<Global::Resource::ResourceManager> & resourceManager)1568 virtual void UpdateConfigurationForSpecified(const std::shared_ptr<AppExecFwk::Configuration>& configuration, 1569 const std::shared_ptr<Global::Resource::ResourceManager>& resourceManager) {} 1570 1571 /** 1572 * @brief Update theme configuration. 1573 * @param configuration Window configuration. 1574 */ UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration> & configuration)1575 virtual void UpdateConfigurationSync(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {} 1576 1577 /** 1578 * @brief Register window lifecycle listener. 1579 * 1580 * @param listener WindowLifeCycle listener. 1581 * @return WM_OK means register success, others means register failed. 1582 */ RegisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1583 virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1584 1585 /** 1586 * @brief Unregister window lifecycle listener. 1587 * 1588 * @param listener WindowLifeCycle listener. 1589 * @return WM_OK means unregister success, others means unregister failed. 1590 */ UnregisterLifeCycleListener(const sptr<IWindowLifeCycle> & listener)1591 virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; } 1592 1593 /** 1594 * @brief Register window change listener. 1595 * 1596 * @param listener IWindowChangeListener. 1597 * @return WM_OK means register success, others means register failed. 1598 */ RegisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)1599 virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 1600 { 1601 return WMError::WM_OK; 1602 } 1603 1604 /** 1605 * @brief Unregister window change listener. 1606 * 1607 * @param listener IWindowChangeListener. 1608 * @return WM_OK means unregister success, others means unregister failed. 1609 */ UnregisterWindowChangeListener(const sptr<IWindowChangeListener> & listener)1610 virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener) 1611 { 1612 return WMError::WM_OK; 1613 } 1614 1615 /** 1616 * @brief Register avoid area change listener. 1617 * 1618 * @param listener IAvoidAreaChangedListener. 1619 * @return WM_OK means register success, others means register failed. 1620 */ RegisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener> & listener)1621 virtual WMError RegisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) 1622 { 1623 return WMError::WM_OK; 1624 } 1625 1626 /** 1627 * @brief Unregister avoid area change listener. 1628 * 1629 * @param listener IAvoidAreaChangedListener. 1630 * @return WM_OK means unregister success, others means unregister failed. 1631 */ UnregisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener> & listener)1632 virtual WMError UnregisterAvoidAreaChangeListener(const sptr<IAvoidAreaChangedListener>& listener) 1633 { 1634 return WMError::WM_OK; 1635 } 1636 1637 /** 1638 * @brief Register window drag listener. 1639 * 1640 * @param listener IWindowDragListener. 1641 * @return WM_OK means register success, others means register failed. 1642 */ RegisterDragListener(const sptr<IWindowDragListener> & listener)1643 virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 1644 1645 /** 1646 * @brief Unregister window drag listener. 1647 * 1648 * @param listener IWindowDragListener. 1649 * @return WM_OK means unregister success, others means unregister failed. 1650 */ UnregisterDragListener(const sptr<IWindowDragListener> & listener)1651 virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; } 1652 1653 /** 1654 * @brief Register display move listener. 1655 * 1656 * @param listener IDisplayMoveListener. 1657 * @return WM_OK means register success, others means register failed. 1658 */ RegisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)1659 virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 1660 1661 /** 1662 * @brief Unregister display move listener. 1663 * 1664 * @param listener IDisplayMoveListener. 1665 * @return WM_OK means unregister success, others means unregister failed. 1666 */ UnregisterDisplayMoveListener(sptr<IDisplayMoveListener> & listener)1667 virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; } 1668 1669 /** 1670 * @brief Register window destroyed listener. 1671 * 1672 * @param func Function to notify window destroyed. 1673 */ RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc & func)1674 virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) {} 1675 1676 /** 1677 * @brief Unregister window destroyed listener. 1678 * 1679 */ UnregisterWindowDestroyedListener()1680 virtual void UnregisterWindowDestroyedListener() {} 1681 1682 /** 1683 * @brief Register Occupied Area Change listener. 1684 * 1685 * @param listener IOccupiedAreaChangeListener. 1686 * @return WM_OK means register success, others means register failed. 1687 */ RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)1688 virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 1689 { 1690 return WMError::WM_OK; 1691 } 1692 1693 /** 1694 * @brief Unregister occupied area change listener. 1695 * 1696 * @param listener IOccupiedAreaChangeListener. 1697 * @return WM_OK means unregister success, others means unregister failed. 1698 */ UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener> & listener)1699 virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener) 1700 { 1701 return WMError::WM_OK; 1702 } 1703 1704 /** 1705 * @brief Register touch outside listener. 1706 * 1707 * @param listener ITouchOutsideListener. 1708 * @return WM_OK means register success, others means register failed. 1709 */ RegisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)1710 virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) { return WMError::WM_OK; } 1711 1712 /** 1713 * @brief Unregister touch outside listener. 1714 * 1715 * @param listener ITouchOutsideListener. 1716 * @return WM_OK means unregister success, others means unregister failed. 1717 */ UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener> & listener)1718 virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) 1719 { 1720 return WMError::WM_OK; 1721 } 1722 1723 /** 1724 * @brief Register Animation Transition Controller listener. 1725 * 1726 * @param listener IAnimationTransitionController. 1727 * @return WM_OK means register success, others means register failed. 1728 */ RegisterAnimationTransitionController(const sptr<IAnimationTransitionController> & listener)1729 virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener) 1730 { 1731 return WMError::WM_OK; 1732 } 1733 1734 /** 1735 * @brief Register screen shot listener. 1736 * 1737 * @param listener IScreenshotListener. 1738 * @return WM_OK means register success, others means register failed. 1739 */ RegisterScreenshotListener(const sptr<IScreenshotListener> & listener)1740 virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1741 1742 /** 1743 * @brief Unregister screen shot listener. 1744 * 1745 * @param listener IScreenshotListener. 1746 * @return WM_OK means unregister success, others means unregister failed. 1747 */ UnregisterScreenshotListener(const sptr<IScreenshotListener> & listener)1748 virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; } 1749 1750 /** 1751 * @brief Register dialog target touch listener. 1752 * 1753 * @param listener IDialogTargetTouchListener. 1754 * @return WM_OK means register success, others means register failed. 1755 */ RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1756 virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1757 { 1758 return WMError::WM_OK; 1759 } 1760 1761 /** 1762 * @brief Unregister dialog target touch listener. 1763 * 1764 * @param listener IDialogTargetTouchListener. 1765 * @return WM_OK means unregister success, others means unregister failed. 1766 */ UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener> & listener)1767 virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener) 1768 { 1769 return WMError::WM_OK; 1770 } 1771 1772 /** 1773 * @brief Register dialog death Recipient listener. 1774 * 1775 * @param listener IDialogDeathRecipientListener. 1776 */ RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1777 virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1778 1779 /** 1780 * @brief Unregister window death recipient listener. 1781 * 1782 * @param listener IDialogDeathRecipientListener. 1783 */ UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener> & listener)1784 virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {} 1785 1786 /** 1787 * @brief Notify touch dialog target. 1788 */ 1789 virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) {} 1790 1791 /** 1792 * @brief Set ace ability handler. 1793 * 1794 * @param handler Ace ability handler. 1795 */ SetAceAbilityHandler(const sptr<IAceAbilityHandler> & handler)1796 virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) {} 1797 1798 /** 1799 * @brief set window ui content 1800 * 1801 * @param contentInfo content info path 1802 * @param env 1803 * @param storage 1804 * @param isDistributed 1805 * @param ability 1806 * @return WMError 1807 */ 1808 virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage, 1809 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 1810 AppExecFwk::Ability* ability = nullptr) 1811 { 1812 return WMError::WM_OK; 1813 } 1814 1815 /** 1816 * @brief set window ui content 1817 * 1818 * @param contentName content info path 1819 * @param env Napi environment 1820 * @param storage Napi storage 1821 * @param type restore type 1822 * @param token parent token 1823 * @param ability Ability instance 1824 * @return WMError 1825 */ 1826 virtual WMError NapiSetUIContentByName(const std::string& contentName, napi_env env, napi_value storage, 1827 BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr, 1828 AppExecFwk::Ability* ability = nullptr) { return WMError::WM_OK; } 1829 1830 /** 1831 * @brief set window ui content 1832 * 1833 * @param contentInfo content info path 1834 * @param engine 1835 * @param storage 1836 * @param isDistributed 1837 * @param ability 1838 * @return WMError 1839 */ 1840 virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage, 1841 AppExecFwk::Ability* ability = nullptr) 1842 { 1843 return WMError::WM_OK; 1844 } 1845 1846 /** 1847 * @brief set window ui content by abc 1848 * 1849 * @param abcPath abc path 1850 * @param env 1851 * @param storage 1852 * @param ability 1853 * @return WMError 1854 */ 1855 virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage, 1856 AppExecFwk::Ability* ability = nullptr) 1857 { 1858 return WMError::WM_OK; 1859 } 1860 1861 /** 1862 * @brief Get ui content info. 1863 * 1864 * @return UI content info. 1865 */ 1866 virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION) 1867 { 1868 return {}; 1869 } 1870 1871 /** 1872 * @brief Set uiability restored router stack. 1873 * 1874 * @return WMError. 1875 */ SetRestoredRouterStack(const std::string & routerStack)1876 virtual WMError SetRestoredRouterStack(const std::string& routerStack) 1877 { 1878 return WMError::WM_OK; 1879 } 1880 1881 /** 1882 * @brief Get ui content object. 1883 * 1884 * @return UIContent object of ACE. 1885 */ GetUIContent()1886 virtual Ace::UIContent* GetUIContent() const { return nullptr; } 1887 1888 /** 1889 * @brief Get ui content object. 1890 * 1891 * @param winId window id. 1892 * @return UIContent object of ACE. 1893 */ GetUIContentWithId(uint32_t winId)1894 virtual Ace::UIContent* GetUIContentWithId(uint32_t winId) const { return nullptr; } 1895 1896 /** 1897 * @brief Window handle new want. 1898 * 1899 * @param want Want object of AAFwk. 1900 */ OnNewWant(const AAFwk::Want & want)1901 virtual void OnNewWant(const AAFwk::Want& want) {} 1902 1903 /** 1904 * @brief Set requested orientation. 1905 * 1906 * @param Orientation Screen orientation. 1907 * @param animation true means window rotation needs animation. Otherwise not needed. 1908 */ 1909 virtual void SetRequestedOrientation(Orientation orientation, bool needAnimation = true) {} 1910 1911 /** 1912 * @brief Get the Target Orientation ConfigInfo. 1913 * 1914 * @param targetOri target Orientation. 1915 * @param config Viewport config. 1916 * @param properties systemBar properties 1917 * @param avoidAreas avoidArea information 1918 * @return WMError 1919 */ GetTargetOrientationConfigInfo(Orientation targetOri,const std::map<WindowType,SystemBarProperty> & properties,Ace::ViewportConfig & config,std::map<AvoidAreaType,AvoidArea> & avoidAreas)1920 virtual WMError GetTargetOrientationConfigInfo(Orientation targetOri, 1921 const std::map<WindowType, SystemBarProperty>& properties, Ace::ViewportConfig& config, 1922 std::map<AvoidAreaType, AvoidArea>& avoidAreas) 1923 { 1924 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1925 } 1926 1927 /** 1928 * @brief Register window orientation set by developer 1929 * 1930 * @param listener IPreferredOrientationChangeListener. 1931 * @return WM_OK means register success, others means register failed 1932 */ RegisterPreferredOrientationChangeListener(const sptr<IPreferredOrientationChangeListener> & listener)1933 virtual WMError RegisterPreferredOrientationChangeListener( 1934 const sptr<IPreferredOrientationChangeListener>& listener) 1935 { 1936 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1937 } 1938 1939 /** 1940 * @brief Unregister window orientation set by developer 1941 * 9 1942 * @param listener IPreferredOrientationChangeListener. 1943 * @return WM_OK means register success, others means unregister failed 1944 */ UnregisterPreferredOrientationChangeListener(const sptr<IPreferredOrientationChangeListener> & listener)1945 virtual WMError UnregisterPreferredOrientationChangeListener( 1946 const sptr<IPreferredOrientationChangeListener>& listener) 1947 { 1948 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1949 } 1950 1951 /** 1952 * @brief Register window orientation change listener 1953 * 1954 * @param listener IWindowOrientationChangeListener. 1955 * @return WM_OK means register success, others means register failed 1956 */ RegisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener> & listener)1957 virtual WMError RegisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) 1958 { 1959 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1960 } 1961 1962 /** 1963 * @brief Unregister window orientation change listener 1964 * 1965 * @param listener IWindowOrientationChangeListener. 1966 * @return WM_OK means register success, others means unregister failed 1967 */ UnregisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener> & listener)1968 virtual WMError UnregisterOrientationChangeListener(const sptr<IWindowOrientationChangeListener>& listener) 1969 { 1970 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 1971 } 1972 1973 /** 1974 * @brief Notify caller window orientation set by developer 1975 * 1976 * @param ori Orientation set by developer 1977 */ NotifyPreferredOrientationChange(Orientation orientation)1978 virtual void NotifyPreferredOrientationChange(Orientation orientation) {} 1979 1980 /** 1981 * @brief Get requested orientation. 1982 * 1983 * @return Orientation screen orientation. 1984 */ GetRequestedOrientation()1985 virtual Orientation GetRequestedOrientation() { return Orientation::UNSPECIFIED; } 1986 1987 /** 1988 * @brief Set requested mode support info. 1989 * 1990 * @param windowModeSupportType Mode of window supported. 1991 */ SetRequestWindowModeSupportType(uint32_t windowModeSupportType)1992 virtual void SetRequestWindowModeSupportType(uint32_t windowModeSupportType) {} 1993 /** 1994 * @brief Get requested mode support info. 1995 * 1996 * @return Enumeration values under WindowModeSupport. 1997 */ GetRequestWindowModeSupportType()1998 virtual uint32_t GetRequestWindowModeSupportType() const { return 0; } 1999 /** 2000 * @brief Set touch hot areas. 2001 * 2002 * @param rects Hot areas of touching. 2003 * @return WM_OK means set success, others means set failed. 2004 */ SetTouchHotAreas(const std::vector<Rect> & rects)2005 virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) { return WMError::WM_OK; } 2006 2007 /** 2008 * @brief Set keyboard touch hot areas. 2009 * 2010 * @param hotAreas keyboard hot areas of touching. 2011 * @return WM_OK means set success, others means set failed. 2012 */ SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas & hotAreas)2013 virtual WMError SetKeyboardTouchHotAreas(const KeyboardTouchHotAreas& hotAreas) { return WMError::WM_OK; } 2014 2015 /** 2016 * @brief Get requested touch hot areas. 2017 * 2018 * @param rects Hot areas of touching. 2019 */ GetRequestedTouchHotAreas(std::vector<Rect> & rects)2020 virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const {} 2021 2022 /** 2023 * @brief Main handler available or not. 2024 * 2025 * @return True means main handler is available, false means the opposite. 2026 */ IsMainHandlerAvailable()2027 virtual bool IsMainHandlerAvailable() const { return false; } 2028 2029 /** 2030 * @brief Set window label name. 2031 * 2032 * @param label Window label name. 2033 * @return WM_OK means set success, others means set failed. 2034 */ SetAPPWindowLabel(const std::string & label)2035 virtual WMError SetAPPWindowLabel(const std::string& label) { return WMError::WM_OK; } 2036 2037 /** 2038 * @brief Set window icon. 2039 * 2040 * @param icon Window icon. 2041 * @return WM_OK means set success, others means set failed. 2042 */ SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap> & icon)2043 virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) { return WMError::WM_OK; } 2044 2045 /** 2046 * @brief disable main window decoration. It must be callled before loadContent. 2047 * 2048 */ DisableAppWindowDecor()2049 virtual WMError DisableAppWindowDecor() { return WMError::WM_OK; } 2050 2051 /** 2052 * @brief return window decoration is enabled. It is called by ACE 2053 * 2054 * @return true means window decoration is enabled. Otherwise disabled 2055 */ IsDecorEnable()2056 virtual bool IsDecorEnable() const { return false; } 2057 2058 /** 2059 * @brief maximize the main window. It is called by ACE when maximize button is clicked. 2060 * 2061 * @return WMError 2062 */ Maximize()2063 virtual WMError Maximize() { return WMError::WM_OK; } 2064 2065 /** 2066 * @brief maximize window with presentation enum. 2067 * 2068 * @param presentation the value means use presentation enum to layout when maximize window 2069 * @return WM_OK means maximize window ok, others means failed. 2070 */ Maximize(MaximizePresentation presentation)2071 virtual WMError Maximize(MaximizePresentation presentation) 2072 { 2073 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2074 } 2075 2076 /** 2077 * @brief maximize the main window according to MaximizeMode. called by ACE when maximize button is clicked. 2078 * 2079 * @return WMError 2080 */ MaximizeFloating()2081 virtual WMError MaximizeFloating() {return WMError::WM_OK;} 2082 2083 /** 2084 * @brief minimize the main window. It is called by ACE when minimize button is clicked. 2085 * 2086 * @return WMError 2087 */ Minimize()2088 virtual WMError Minimize() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2089 2090 /** 2091 * @brief recovery the main window. It is called by ACE when recovery button is clicked. 2092 * 2093 * @return WMError 2094 */ Recover()2095 virtual WMError Recover() { return WMError::WM_OK; } 2096 2097 /** 2098 * @brief After the app main window is minimized, if the Ability is not in the backgroud state, 2099 * you can restore app main window. 2100 * 2101 * @return WMError 2102 */ Restore()2103 virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2104 2105 /** 2106 * @brief close the window. It is called by ACE when close button is clicked. 2107 * 2108 * @return WMError 2109 */ Close()2110 virtual WMError Close() { return WMError::WM_OK; } 2111 2112 /** 2113 * @brief close the window. There is no pre-close process. 2114 * 2115 * @return WMError 2116 */ CloseDirectly()2117 virtual WMError CloseDirectly() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2118 2119 /** 2120 * @brief start move main window. It is called by ACE when title is moved. 2121 * 2122 */ StartMove()2123 virtual void StartMove() {} 2124 2125 /** 2126 * @brief get main window move flag. 2127 * 2128 * @return true means main window is moving. Otherwise is not moving. 2129 */ IsStartMoving()2130 virtual bool IsStartMoving() { return false; } 2131 2132 /** 2133 * @brief Start moving window. It is called by application. 2134 * 2135 * @return Errorcode of window. 2136 */ StartMoveWindow()2137 virtual WmErrorCode StartMoveWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2138 2139 /** 2140 * @brief Start moving window. It is called by application. 2141 * 2142 * @param offsetX expected pointer position x-axis offset in window when start moving. 2143 * @param offsetY expected pointer position y-axis offset in window when start moving. 2144 * @return Error code of window. 2145 */ StartMoveWindowWithCoordinate(int32_t offsetX,int32_t offsetY)2146 virtual WmErrorCode StartMoveWindowWithCoordinate(int32_t offsetX, 2147 int32_t offsetY) { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2148 2149 /** 2150 * @brief Stop moving window. It is called by application. Support pc window and pad free multi-window. 2151 * 2152 * @return Error code of window. 2153 */ StopMoveWindow()2154 virtual WmErrorCode StopMoveWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; } 2155 2156 /** 2157 * @brief Set flag that need remove window input channel. 2158 * 2159 * @param needRemoveWindowInputChannel True means remove input channel, false means not remove. 2160 */ SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel)2161 virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) {} 2162 2163 /** 2164 * @brief set global window maximize mode. It is called by ACE when maximize mode changed. 2165 * 2166 * @param mode MODE_AVOID_SYSTEM_BAR - avoid statusbar and dockbar; MODE_FULL_FILL - fullfill the screen 2167 * 2168 * @return WMError 2169 */ SetGlobalMaximizeMode(MaximizeMode mode)2170 virtual WMError SetGlobalMaximizeMode(MaximizeMode mode) {return WMError::WM_OK;} 2171 2172 /** 2173 * @brief get global window maximize mode. 2174 * 2175 * @return MaximizeMode 2176 */ GetGlobalMaximizeMode()2177 virtual MaximizeMode GetGlobalMaximizeMode() const {return MaximizeMode::MODE_FULL_FILL;} 2178 2179 // colorspace, gamut 2180 /** 2181 * @brief Is support wide gamut or not. 2182 * 2183 * @return True means support wide gamut, false means not support. 2184 */ IsSupportWideGamut()2185 virtual bool IsSupportWideGamut() { return false; } 2186 2187 /** 2188 * @brief Set color space. 2189 * 2190 * @param colorSpace ColorSpace object. 2191 */ SetColorSpace(ColorSpace colorSpace)2192 virtual void SetColorSpace(ColorSpace colorSpace) {} 2193 2194 /** 2195 * @brief Get color space object. 2196 * 2197 * @return ColorSpace object. 2198 */ GetColorSpace()2199 virtual ColorSpace GetColorSpace() { return ColorSpace::COLOR_SPACE_DEFAULT; } 2200 DumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)2201 virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) {} 2202 2203 /** 2204 * @brief window snapshot 2205 * 2206 * @return std::shared_ptr<Media::PixelMap> snapshot pixel 2207 */ Snapshot()2208 virtual std::shared_ptr<Media::PixelMap> Snapshot() { return nullptr; } 2209 2210 /** 2211 * @brief window SnapshotIgnorePrivacy 2212 * 2213 * @param pixelMap pixel map 2214 * @return the error code of this operation 2215 */ SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap> & pixelMap)2216 virtual WMError SnapshotIgnorePrivacy(std::shared_ptr<Media::PixelMap>& pixelMap) { return WMError::WM_OK; } 2217 2218 /** 2219 * @brief Handle and notify memory level. 2220 * 2221 * @param level memory level 2222 * @return the error code of window 2223 */ NotifyMemoryLevel(int32_t level)2224 virtual WMError NotifyMemoryLevel(int32_t level) { return WMError::WM_OK; } 2225 2226 /** 2227 * @brief Update configuration for all windows 2228 * 2229 * @param configuration configuration for app 2230 */ IsAllowHaveSystemSubWindow()2231 virtual bool IsAllowHaveSystemSubWindow() { return false; } 2232 2233 /** 2234 * @brief Set aspect ratio of this window 2235 * 2236 * @param ratio the aspect ratio of window except decoration 2237 * @return WMError 2238 */ SetAspectRatio(float ratio)2239 virtual WMError SetAspectRatio(float ratio) { return WMError::WM_OK; } 2240 2241 /** 2242 * @brief Unset aspect ratio 2243 * @return WMError 2244 */ ResetAspectRatio()2245 virtual WMError ResetAspectRatio() { return WMError::WM_OK; } 2246 2247 /** 2248 * @brief Get keyboard animation config 2249 * @return KeyboardAnimationConfig 2250 */ GetKeyboardAnimationConfig()2251 virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() { return {}; } 2252 2253 /** 2254 * @brief Set need default animation for window show and hide. 2255 * 2256 * @param needDefaultAnimation True means need default animation, false means not need. 2257 */ SetNeedDefaultAnimation(bool needDefaultAnimation)2258 virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) {} 2259 2260 /** 2261 * @brief Transfer Ability Result. 2262 * @return WMError 2263 */ TransferAbilityResult(uint32_t resultCode,const AAFwk::Want & want)2264 virtual WMError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { return WMError::WM_OK; } 2265 2266 /** 2267 * @brief Transfer UIExtension data to Extension Component. 2268 * @return WMError 2269 */ TransferExtensionData(const AAFwk::WantParams & wantParams)2270 virtual WMError TransferExtensionData(const AAFwk::WantParams& wantParams) { return WMError::WM_OK; } 2271 2272 /** 2273 * @brief Register transfer component data callback. 2274 * 2275 * @param func Function to notify transfer component data. 2276 */ RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc & func)2277 virtual void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) {} 2278 2279 /** 2280 * @brief Trigger BindUIExtensionModal callback. 2281 * It needs to be called when the UIExtension frame node is set to asynchronously bind to the modal window. 2282 */ TriggerBindModalUIExtension()2283 virtual void TriggerBindModalUIExtension() {} 2284 2285 /** 2286 * @brief Perform back event. 2287 * 2288 */ PerformBack()2289 virtual void PerformBack() {} 2290 2291 /** 2292 * @brief Set the drag enabled flag of a window. 2293 * 2294 * @param dragEnabled true means the window can be resized by dragging, otherwise means the opposite. 2295 * @return Errorcode of window. 2296 */ SetResizeByDragEnabled(bool dragEnabled)2297 virtual WMError SetResizeByDragEnabled(bool dragEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2298 2299 /** 2300 * @brief Set the raise enabled flag of a window. 2301 * 2302 * @param raiseEnabled true means the window can be raised by click, otherwise means the opposite. 2303 * @return Errorcode of window. 2304 */ SetRaiseByClickEnabled(bool raiseEnabled)2305 virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2306 2307 /** 2308 * @brief Raise one app sub window above another. 2309 * 2310 * @return WM_OK means raise success, others means raise failed. 2311 */ RaiseAboveTarget(int32_t subWindowId)2312 virtual WMError RaiseAboveTarget(int32_t subWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2313 2314 /** 2315 * @brief Hide non-system floating windows. 2316 * 2317 * @param shouldHide true means the non-system windows should be hidden, otherwise means the opposite. 2318 * @return Errorcode of window. 2319 */ HideNonSystemFloatingWindows(bool shouldHide)2320 virtual WMError HideNonSystemFloatingWindows(bool shouldHide) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2321 2322 /** 2323 * @brief Is floating window of app type or not. 2324 * 2325 * @return True means floating window of app type, false means the opposite. 2326 */ IsFloatingWindowAppType()2327 virtual bool IsFloatingWindowAppType() const { return false; } 2328 2329 /** 2330 * @brief Is pc window or not. 2331 * 2332 * @return True means pc window, false means the opposite. 2333 */ IsPcWindow()2334 virtual bool IsPcWindow() const { return false; } 2335 2336 /** 2337 * @brief Is pc window of app type or not. 2338 * 2339 * @return True means pc window of app type, false means the opposite. 2340 */ IsPcOrPadCapabilityEnabled()2341 virtual bool IsPcOrPadCapabilityEnabled() const { return false; } 2342 2343 /** 2344 * @brief Is pc window or pad free multi-window. 2345 * 2346 * @return True means pc window or pad free multi-window, false means the opposite. 2347 */ IsPcOrPadFreeMultiWindowMode()2348 virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; } 2349 2350 /** 2351 * @brief Judge whether SceneBoard is enabled. 2352 * 2353 * @return True means SceneBoard is enabled, false means the opposite. 2354 */ IsSceneBoardEnabled()2355 virtual bool IsSceneBoardEnabled() const { return false; } 2356 2357 /** 2358 * @brief get compatible mode in pc. 2359 * 2360 * @return True means window is compatible mode in pc, false means the opposite. 2361 */ GetCompatibleModeInPc()2362 virtual bool GetCompatibleModeInPc() const { return false; } 2363 2364 /** 2365 * @brief Register transfer component data callback. 2366 * 2367 * @param func Function to notify transfer component data. 2368 */ RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc & func)2369 virtual void RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc& func) {} 2370 2371 /** 2372 * @brief Set Text Field Avoid Info. 2373 * 2374 * @return Errorcode of window. 2375 */ SetTextFieldAvoidInfo(double textFieldPositionY,double textFieldHeight)2376 virtual WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) { return WMError::WM_OK; } 2377 2378 /** 2379 * @brief Transfer accessibility event data 2380 * 2381 * @param func Function to notify transfer component data. 2382 */ TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo & info,int64_t uiExtensionIdLevel)2383 virtual WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 2384 int64_t uiExtensionIdLevel) { return WMError::WM_OK; }; 2385 2386 /** 2387 * @brief Notify prepare to close window 2388 * 2389 * @return Errorcode of window. 2390 */ NotifyPrepareClosePiPWindow()2391 virtual WMError NotifyPrepareClosePiPWindow() { return WMError::WM_OK; } 2392 2393 /** 2394 * @brief update the pip window instance (w,h,r). 2395 * 2396 * @param width width of pip window. 2397 * @param height width of pip window. 2398 * @param reason reason of update. 2399 */ UpdatePiPRect(const Rect & rect,WindowSizeChangeReason reason)2400 virtual void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) {} 2401 2402 /** 2403 * @brief update the pip control status. 2404 * 2405 * @param controlType pip control type. 2406 * @param status pip control status. 2407 */ UpdatePiPControlStatus(PiPControlType controlType,PiPControlStatus status)2408 virtual void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) {} 2409 2410 /** 2411 * @brief set auto start status for window. 2412 * 2413 * @param isAutoStart true means auto start pip window when background, otherwise means the opposite. 2414 * @param priority 1 means height priority, 0 means low priority. 2415 * @param width width means width of the video content. 2416 * @param height height means height of the video content. 2417 */ SetAutoStartPiP(bool isAutoStart,uint32_t priority,uint32_t width,uint32_t height)2418 virtual void SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) {} 2419 2420 /** 2421 * @brief When get focused, keep the keyboard created by other windows, support system window and app subwindow. 2422 * 2423 * @param keepKeyboardFlag true means the keyboard should be preserved, otherwise means the opposite. 2424 * @return WM_OK means set keep keyboard flag success, others means failed. 2425 */ KeepKeyboardOnFocus(bool keepKeyboardFlag)2426 virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag) 2427 { 2428 return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; 2429 } 2430 2431 /** 2432 * @brief Register window visibility change listener. 2433 * 2434 * @param listener IWindowVisibilityChangedListener. 2435 * @return WM_OK means register success, others means register failed. 2436 */ RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)2437 virtual WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 2438 { 2439 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2440 } 2441 2442 /** 2443 * @brief Unregister window visibility change listener. 2444 * 2445 * @param listener IWindowVisibilityChangedListener. 2446 * @return WM_OK means unregister success, others means unregister failed. 2447 */ UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr & listener)2448 virtual WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener) 2449 { 2450 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2451 } 2452 2453 /** 2454 * @brief Register window displayId change listener. 2455 * 2456 * @param listener IDisplayIdChangedListener. 2457 * @return WM_OK means register success, others means register failed. 2458 */ RegisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)2459 virtual WMError RegisterDisplayIdChangeListener( 2460 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2461 2462 /** 2463 * @brief Unregister window displayId change listener. 2464 * 2465 * @param listener IDisplayIdChangedListener. 2466 * @return WM_OK means unregister success, others means unregister failed. 2467 */ UnregisterDisplayIdChangeListener(const IDisplayIdChangeListenerSptr & listener)2468 virtual WMError UnregisterDisplayIdChangeListener( 2469 const IDisplayIdChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2470 2471 /** 2472 * @brief Register system density change listener. 2473 * 2474 * @param listener ISystemDensityChangedListener. 2475 * @return WM_OK means register success, others means register failed. 2476 */ RegisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr & listener)2477 virtual WMError RegisterSystemDensityChangeListener( 2478 const ISystemDensityChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2479 2480 /** 2481 * @brief Unregister system density change listener. 2482 * 2483 * @param listener ISystemDensityChangedListener. 2484 * @return WM_OK means unregister success, others means unregister failed. 2485 */ UnregisterSystemDensityChangeListener(const ISystemDensityChangeListenerSptr & listener)2486 virtual WMError UnregisterSystemDensityChangeListener( 2487 const ISystemDensityChangeListenerSptr& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2488 2489 /** 2490 * @brief Get the window limits of current window. 2491 * 2492 * @param windowLimits. 2493 * @return WMError. 2494 */ GetWindowLimits(WindowLimits & windowLimits)2495 virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2496 2497 /** 2498 * @brief Set the window limits of current window. 2499 * 2500 * @param windowLimits. 2501 * @return WMError. 2502 */ 2503 virtual WMError SetWindowLimits(WindowLimits& windowLimits, bool isForcible = false) 2504 { 2505 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2506 } 2507 2508 /** 2509 * @brief Register listener, if timeout(seconds) pass with no interaction, the listener will be executed. 2510 * 2511 * @param listener IWindowNoInteractionListenerSptr. 2512 * @return WM_OK means unregister success, others means unregister failed. 2513 */ RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)2514 virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 2515 { 2516 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2517 } 2518 2519 /** 2520 * @brief Unregister window no interaction listener. 2521 * 2522 * @param listener IWindowNoInteractionListenerSptr. 2523 * @return WM_OK means unregister success, others means unregister failed. 2524 */ UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr & listener)2525 virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener) 2526 { 2527 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2528 } 2529 2530 /** 2531 * @brief Register window status change listener. 2532 * 2533 * @param listener IWindowStatusChangeListener. 2534 * @return WM_OK means register success, others means register failed. 2535 */ RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)2536 virtual WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 2537 { 2538 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2539 } 2540 2541 /** 2542 * @brief Unregister window status change listener. 2543 * 2544 * @param listener IWindowStatusChangeListener. 2545 * @return WM_OK means unregister success, others means unregister failed. 2546 */ UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener> & listener)2547 virtual WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) 2548 { 2549 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2550 } 2551 2552 /** 2553 * @brief Set Specific System Bar(include status bar and nav bar) Enable and Animation Properties 2554 * 2555 * @param systemBarEnable is system bar enabled 2556 * @param systemBarEnableAnimation is animation enabled 2557 * @param SystemBarProperty WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 2558 */ UpdateSpecificSystemBarEnabled(bool systemBarEnable,bool systemBarEnableAnimation,SystemBarProperty & property)2559 virtual void UpdateSpecificSystemBarEnabled(bool systemBarEnable, bool systemBarEnableAnimation, 2560 SystemBarProperty& property) {} 2561 2562 /** 2563 * @brief Set Specific System Bar(include status bar and nav bar) Property 2564 * 2565 * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR 2566 * @param property system bar prop,include content color, background color 2567 * @return WMError 2568 */ SetSpecificBarProperty(WindowType type,const SystemBarProperty & property)2569 virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) 2570 { 2571 return WMError::WM_OK; 2572 } 2573 2574 /** 2575 * @brief Set System Bar(include status bar and nav bar) Properties 2576 * 2577 * @param properties system bar properties 2578 * @param propertyFlags flags of system bar property 2579 * @return WMError 2580 */ SetSystemBarProperties(const std::map<WindowType,SystemBarProperty> & properties,const std::map<WindowType,SystemBarPropertyFlag> & propertyFlags)2581 virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties, 2582 const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags) 2583 { 2584 return WMError::WM_OK; 2585 } 2586 2587 /** 2588 * @brief Get System Bar(include status bar and nav bar) Properties 2589 * 2590 * @param properties system bar properties got 2591 * @return WMError 2592 */ GetSystemBarProperties(std::map<WindowType,SystemBarProperty> & properties)2593 virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties) 2594 { 2595 return WMError::WM_OK; 2596 } 2597 2598 /** 2599 * @brief Update System Bar (include status bar and nav bar) Properties by Flags 2600 * 2601 * @param systemBarProperties map of status bar and nav bar properties 2602 * @param systemBarPropertyFlags map of status bar and nav bar properties to be changed 2603 * @return WMError 2604 */ UpdateSystemBarProperties(const std::unordered_map<WindowType,SystemBarProperty> & systemBarProperties,const std::unordered_map<WindowType,SystemBarPropertyFlag> & systemBarPropertyFlags)2605 virtual WMError UpdateSystemBarProperties( 2606 const std::unordered_map<WindowType, SystemBarProperty>& systemBarProperties, 2607 const std::unordered_map<WindowType, SystemBarPropertyFlag>& systemBarPropertyFlags) 2608 { 2609 return WMError::WM_OK; 2610 } 2611 2612 /** 2613 * @brief Set the single frame composer enabled flag of a window. 2614 * 2615 * @param enable true means the single frame composer is enabled, otherwise means the opposite. 2616 * @return Errorcode of window. 2617 */ SetSingleFrameComposerEnabled(bool enable)2618 virtual WMError SetSingleFrameComposerEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2619 2620 /** 2621 * @brief Set the visibility of window decor. 2622 * 2623 * @param isVisible whether the window decor is visible. 2624 * @return Errorcode of window. 2625 */ SetDecorVisible(bool isVisible)2626 virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2627 2628 /** 2629 * @brief Get the visibility of window decor. 2630 * 2631 * @param isVisible whether the window decor is visible. 2632 * @return Errorcode of window. 2633 */ GetDecorVisible(bool & isVisible)2634 virtual WMError GetDecorVisible(bool& isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2635 2636 /** 2637 * @brief Enable or disable move window by title bar. 2638 * 2639 * @param enable The value true means to enable window moving, and false means the opposite. 2640 * @return Errorcode of window. 2641 */ SetWindowTitleMoveEnabled(bool enable)2642 virtual WMError SetWindowTitleMoveEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2643 2644 /** 2645 * @brief Set window container color. 2646 * 2647 * @param activeColor Background active color. 2648 * @param inactiveColor Background active color. 2649 * @return Errorcode of window. 2650 */ SetWindowContainerColor(const std::string & activeColor,const std::string & inactiveColor)2651 virtual WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor) 2652 { 2653 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2654 } 2655 2656 /** 2657 * @brief Enable drag window. 2658 * 2659 * @param enableDrag The value true means to enable window dragging, and false means the opposite. 2660 * @return Errorcode of window. 2661 */ EnableDrag(bool enableDrag)2662 virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2663 2664 /** 2665 * @brief Set whether to display the maximize, minimize, split buttons of main window. 2666 * 2667 * @param isMaximizeVisible Display maximize button if true, or hide maximize button if false. 2668 * @param isMinimizeVisible Display minimize button if true, or hide minimize button if false. 2669 * @param isSplitVisible Display split button if true, or hide split button if false. 2670 * @param isCloseVisible Display close button if true, or hide close button if false. 2671 * @return Errorcode of window. 2672 */ SetTitleButtonVisible(bool isMaximizeVisible,bool isMinimizeVisible,bool isSplitVisible,bool isCloseVisible)2673 virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible, 2674 bool isCloseVisible) 2675 { 2676 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2677 } 2678 2679 /** 2680 * @brief Set Window new title 2681 * 2682 * @param title Window new title 2683 * @return Errorcode of window. 2684 */ SetWindowTitle(const std::string & title)2685 virtual WMError SetWindowTitle(const std::string& title) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2686 2687 /** 2688 * @brief Set decor height of window. 2689 * 2690 * @param decorHeight Decor height of window 2691 * @return WM_OK means set success, others means set failed. 2692 */ SetDecorHeight(int32_t decorHeight)2693 virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2694 2695 /** 2696 * @brief Get decor height of window. 2697 * 2698 * @return Decor height of window. 2699 */ GetDecorHeight(int32_t & height)2700 virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2701 2702 /** 2703 * @brief Set decor button style of window. 2704 * 2705 * @param style Decor style of the window 2706 * @return WM_OK means set success, others means set failed. 2707 */ SetDecorButtonStyle(const DecorButtonStyle & style)2708 virtual WMError SetDecorButtonStyle(const DecorButtonStyle& style) 2709 { 2710 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2711 } 2712 2713 /** 2714 * @brief Get decor button style of window. 2715 * 2716 * @param style Decor style of the window 2717 * @return WM_OK means set success, others means set failed. 2718 */ GetDecorButtonStyle(DecorButtonStyle & style)2719 virtual WMError GetDecorButtonStyle(DecorButtonStyle& style) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2720 2721 /** 2722 * @brief Get the title buttons area of window. 2723 * 2724 * @param titleButtonRect. 2725 * @return WMError. 2726 */ GetTitleButtonArea(TitleButtonRect & titleButtonRect)2727 virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect) 2728 { 2729 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2730 } 2731 2732 /** 2733 * @brief Register window title buttons change listener. 2734 * 2735 * @param listener IWindowTitleButtonRectChangedListener. 2736 * @return WM_OK means register success, others means register failed. 2737 */ RegisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)2738 virtual WMError RegisterWindowTitleButtonRectChangeListener( 2739 const sptr<IWindowTitleButtonRectChangedListener>& listener) 2740 { 2741 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2742 } 2743 2744 /** 2745 * @brief Unregister window title buttons change listener. 2746 * 2747 * @param listener IWindowTitleButtonRectChangedListener. 2748 * @return WM_OK means unregister success, others means unregister failed. 2749 */ UnregisterWindowTitleButtonRectChangeListener(const sptr<IWindowTitleButtonRectChangedListener> & listener)2750 virtual WMError UnregisterWindowTitleButtonRectChangeListener( 2751 const sptr<IWindowTitleButtonRectChangedListener>& listener) 2752 { 2753 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2754 } 2755 2756 /** 2757 * @brief Set whether to use default density. 2758 * 2759 * @param enabled bool. 2760 * @return WM_OK means set success, others means failed. 2761 */ SetDefaultDensityEnabled(bool enabled)2762 virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2763 2764 /** 2765 * @brief Get whether to use default density. 2766 * 2767 * @return True means use default density, window's layout not follow to system change, false means the opposite. 2768 */ GetDefaultDensityEnabled()2769 virtual bool GetDefaultDensityEnabled() { return false; } 2770 2771 /** 2772 * @brief Set custom density of window. 2773 * 2774 * @param density the custom density of window. 2775 * @return WM_OK means set success, others means failed. 2776 */ SetCustomDensity(float density)2777 virtual WMError SetCustomDensity(float density) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2778 2779 /** 2780 * @brief Get custom density of window. 2781 * 2782 * @return custom density. 2783 */ GetCustomDensity()2784 virtual float GetCustomDensity() const { return UNDEFINED_DENSITY; } 2785 2786 /** 2787 * @brief Get the window density of current window. 2788 * 2789 * @param densityInfo the struct representing system density, default density and custom density. 2790 * @return WMError. 2791 */ GetWindowDensityInfo(WindowDensityInfo & densityInfo)2792 virtual WMError GetWindowDensityInfo(WindowDensityInfo& densityInfo) { return WMError::WM_OK; } 2793 2794 /** 2795 * @brief Get virtual pixel ratio. 2796 * 2797 * @return Value of PixelRatio obtained from displayInfo. 2798 */ GetVirtualPixelRatio()2799 virtual float GetVirtualPixelRatio() { return 1.0f; } 2800 2801 /** 2802 * @brief Hide None Secure Windows. 2803 * 2804 * @param shouldHide bool. 2805 * @return WMError 2806 */ HideNonSecureWindows(bool shouldHide)2807 virtual WMError HideNonSecureWindows(bool shouldHide) 2808 { 2809 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2810 } 2811 2812 /** 2813 * @brief Set water mark flag. 2814 * 2815 * @param isEnable bool. 2816 * @return WMError 2817 */ SetWaterMarkFlag(bool isEnable)2818 virtual WMError SetWaterMarkFlag(bool isEnable) 2819 { 2820 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2821 } 2822 2823 /** 2824 * @brief Hide the display content when snapshot. 2825 * 2826 * @param needHide bool. 2827 * @return WMError 2828 */ HidePrivacyContentForHost(bool needHide)2829 virtual WMError HidePrivacyContentForHost(bool needHide) 2830 { 2831 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2832 } 2833 2834 /** 2835 * @brief Set the application modality of main window. 2836 * 2837 * @param isModal bool. 2838 * @return WMError 2839 */ SetWindowModal(bool isModal)2840 virtual WMError SetWindowModal(bool isModal) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2841 2842 /** 2843 * @brief Set the modality of sub window. 2844 * 2845 * @param isModal bool. 2846 * @param modalityType ModalityType. 2847 * @return WMError 2848 */ 2849 virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY) 2850 { 2851 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2852 } 2853 2854 /** 2855 * @brief recovery the main window by function overloading. It is called by JsWindow. 2856 * 2857 * @param reason reason of update. 2858 * @return WMError 2859 */ Recover(uint32_t reason)2860 virtual WMError Recover(uint32_t reason) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2861 2862 /** 2863 * @brief Set to automatically save the window rect. 2864 * 2865 * @param enabled Enable the window rect auto-save if true, otherwise means the opposite. 2866 * @return WM_OK means set success, others means failed. 2867 */ 2868 virtual WMError SetWindowRectAutoSave(bool enabled, 2869 bool isSaveBySpecifiedFlag = false) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2870 2871 /** 2872 * @brief Get whether the auto-save the window rect is enabled or not. 2873 * 2874 * @param enabled True means the window rect auto-save is enabled, otherwise means the opposite. 2875 * @return WM_OK means set success, others means failed. 2876 */ IsWindowRectAutoSave(bool & enabled)2877 virtual WMError IsWindowRectAutoSave(bool& enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2878 2879 /** 2880 * @brief Sets the supported window modes. 2881 * 2882 * @param supportedWindowModes Supported window modes of the window. 2883 * @return WM_OK means set success, others means failed. 2884 */ SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode> & supportedWindowModes)2885 virtual WMError SetSupportedWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes) 2886 { 2887 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2888 } 2889 2890 /** 2891 * @brief Set whether the sub window supports simultaneous display on multiple screens 2892 * when the parent window is dragged to move or dragged to zoom. 2893 * 2894 * @param enabled The value true means sub window supports simultaneous display on multiple screens 2895 * when the parent window is dragged to move or dragged to zoom, and false means the opposite. 2896 * @return WM_OK means set success, others means failed. 2897 */ SetFollowParentMultiScreenPolicy(bool enabled)2898 virtual WMError SetFollowParentMultiScreenPolicy(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;} 2899 2900 /** 2901 * @brief Get the rect of host window. 2902 * 2903 * @param hostWindowId window Id of the host window. 2904 * @return Rect of window. 2905 */ GetHostWindowRect(int32_t hostWindowId)2906 virtual Rect GetHostWindowRect(int32_t hostWindowId) { return {}; } 2907 2908 /** 2909 * @brief Make multi-window become landscape or not. 2910 * 2911 * @param isLandscapeMultiWindow means whether multi-window's scale is landscape. 2912 * @return WMError WM_OK means set success, others means failed. 2913 */ SetLandscapeMultiWindow(bool isLandscapeMultiWindow)2914 virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) { return WMError::WM_OK; } 2915 2916 /** 2917 * @brief Register subwindow close listener. 2918 * 2919 * @param listener ISubWindowCloseListener. 2920 * @return WM_OK means register success, others means register failed. 2921 */ RegisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)2922 virtual WMError RegisterSubWindowCloseListeners( 2923 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2924 2925 /** 2926 * @brief Unregister subwindow close listener. 2927 * 2928 * @param listener ISubWindowCloseListeners. 2929 * @return WM_OK means unregister success, others means unregister failed. 2930 */ UnregisterSubWindowCloseListeners(const sptr<ISubWindowCloseListener> & listener)2931 virtual WMError UnregisterSubWindowCloseListeners( 2932 const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2933 2934 /** 2935 * @brief Register main window close listener. 2936 * 2937 * @param listener IMainWindowCloseListener. 2938 * @return WM_OK means register success, others means register failed. 2939 */ RegisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)2940 virtual WMError RegisterMainWindowCloseListeners( 2941 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2942 2943 /** 2944 * @brief Unregister main window close listener. 2945 * 2946 * @param listener IMainWindowCloseListener. 2947 * @return WM_OK means unregister success, others means unregister failed. 2948 */ UnregisterMainWindowCloseListeners(const sptr<IMainWindowCloseListener> & listener)2949 virtual WMError UnregisterMainWindowCloseListeners( 2950 const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2951 2952 /** 2953 * @brief Register window close async process listener. 2954 * 2955 * @param listener IWindowWillCloseListener. 2956 * @return WM_OK means register success, others means register failed. 2957 */ RegisterWindowWillCloseListeners(const sptr<IWindowWillCloseListener> & listener)2958 virtual WMError RegisterWindowWillCloseListeners( 2959 const sptr<IWindowWillCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2960 2961 /** 2962 * @brief Unregister window close async process listener. 2963 * 2964 * @param listener IWindowWillCloseListener. 2965 * @return WM_OK means unregister success, others means unregister failed. 2966 */ UnRegisterWindowWillCloseListeners(const sptr<IWindowWillCloseListener> & listener)2967 virtual WMError UnRegisterWindowWillCloseListeners( 2968 const sptr<IWindowWillCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2969 2970 /** 2971 * @brief Register switch free multi-window listener. 2972 * 2973 * @param listener ISwitchFreeMultiWindowListener. 2974 * @return WM_OK means register success, others means register failed. 2975 */ RegisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)2976 virtual WMError RegisterSwitchFreeMultiWindowListener( 2977 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2978 2979 /** 2980 * @brief Unregister switch free multi-window listener. 2981 * 2982 * @param listener ISwitchFreeMultiWindowListener. 2983 * @return WM_OK means unregister success, others means unregister failed. 2984 */ UnregisterSwitchFreeMultiWindowListener(const sptr<ISwitchFreeMultiWindowListener> & listener)2985 virtual WMError UnregisterSwitchFreeMultiWindowListener( 2986 const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 2987 2988 /** 2989 * @brief Set Shaped Window Mask. 2990 * 2991 * @param windowMask Mask of the shaped window. 2992 * @return WM_OK means set success, others means failed. 2993 */ SetWindowMask(const std::vector<std::vector<uint32_t>> & windowMask)2994 virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) 2995 { 2996 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 2997 } 2998 2999 /** 3000 * @brief Register keyboard panel info change listener. 3001 * 3002 * @param listener IKeyboardPanelInfoChangeListener. 3003 * @return WM_OK means register success, others means register failed. 3004 */ RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)3005 virtual WMError RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 3006 { 3007 return WMError::WM_OK; 3008 } 3009 3010 /** 3011 * @brief Unregister keyboard panel info change listener. 3012 * 3013 * @param listener IKeyboardPanelInfoChangeListener. 3014 * @return WM_OK means unregister success, others means unregister failed. 3015 */ UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener> & listener)3016 virtual WMError UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener) 3017 { 3018 return WMError::WM_OK; 3019 } 3020 3021 /** 3022 * @brief Get window by id 3023 * 3024 * @param windId window id 3025 * @return sptr<Window> 3026 */ 3027 static sptr<Window> GetWindowWithId(uint32_t windId); 3028 3029 /** 3030 * @brief register keyEvent filter. 3031 * 3032 * @param KeyEventFilterFunc callback func when window recieve keyEvent 3033 * @return WMError 3034 */ SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc)3035 virtual WMError SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc) 3036 { 3037 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3038 } 3039 3040 /** 3041 * @brief clear keyEvent filter. 3042 * 3043 * @return WMError 3044 */ ClearKeyEventFilter()3045 virtual WMError ClearKeyEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;} 3046 3047 /** 3048 * @brief register mouseEvent filter. 3049 * 3050 * @param mouseEventFilterFunc callback func when window receive mouseEvent 3051 * @return WMError 3052 */ SetMouseEventFilter(MouseEventFilterFunc mouseEventFilterFunc)3053 virtual WMError SetMouseEventFilter(MouseEventFilterFunc mouseEventFilterFunc) 3054 { 3055 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3056 } 3057 3058 /** 3059 * @brief clear mouseEvent filter. 3060 * 3061 * @return WMError 3062 */ ClearMouseEventFilter()3063 virtual WMError ClearMouseEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3064 3065 /** 3066 * @brief register touchEvent filter. 3067 * 3068 * @param touchEventFilterFunc callback func when window receive touchEvent 3069 * @return WMError 3070 */ SetTouchEventFilter(TouchEventFilterFunc touchEventFilterFunc)3071 virtual WMError SetTouchEventFilter(TouchEventFilterFunc touchEventFilterFunc) 3072 { 3073 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3074 } 3075 3076 /** 3077 * @brief clear touchEvent filter. 3078 * 3079 * @return WMError 3080 */ ClearTouchEventFilter()3081 virtual WMError ClearTouchEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3082 3083 /** 3084 * @brief Register window rect change listener. 3085 * 3086 * @param listener IWindowRectChangeListener. 3087 * @return WM_OK means register success, others means register failed. 3088 */ RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3089 virtual WMError RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3090 { 3091 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3092 } 3093 3094 /** 3095 * @brief Unregister window rect change listener. 3096 * 3097 * @param listener IWindowRectChangeListener. 3098 * @return WM_OK means unregister success, others means unregister failed. 3099 */ UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener> & listener)3100 virtual WMError UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener) 3101 { 3102 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3103 } 3104 3105 /** 3106 * @brief Flush layout size. 3107 * 3108 * @param width The width after layout 3109 * @param height The height after layout 3110 */ FlushLayoutSize(int32_t width,int32_t height)3111 virtual void FlushLayoutSize(int32_t width, int32_t height) {} 3112 3113 /** 3114 * @brief get callingWindow windowStatus. 3115 * @param windowStatus 3116 * @return WM_OK means set success, others means set Failed. 3117 */ GetCallingWindowWindowStatus(WindowStatus & windowStatus)3118 virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const 3119 { 3120 return WMError::WM_OK; 3121 } 3122 3123 /** 3124 * @brief get callingWindow windowStatus 3125 * @param rect. 3126 * @return WM_OK means set success, others means set failed 3127 */ GetCallingWindowRect(Rect & rect)3128 virtual WMError GetCallingWindowRect(Rect& rect) const 3129 { 3130 return WMError::WM_OK; 3131 } 3132 3133 /** 3134 * @brief Set gray scale of window 3135 * @param grayScale gray scale of window. 3136 * @return WM_OK means set success, others means set failed. 3137 */ SetGrayScale(float grayScale)3138 virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3139 3140 /** 3141 * @brief adjust keyboard layout 3142 * @param params 3143 * @return WM_OK means set success, others means set failed 3144 */ AdjustKeyboardLayout(const KeyboardLayoutParams params)3145 virtual WMError AdjustKeyboardLayout(const KeyboardLayoutParams params) { return WMError::WM_OK; } 3146 3147 /** 3148 * @brief Set the Dvsync Switch 3149 * 3150 * @param dvsyncSwitch bool. 3151 * @return * void 3152 */ SetUiDvsyncSwitch(bool dvsyncSwitch)3153 virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {} 3154 3155 /** 3156 * @brief Set whether to enable immersive mode. 3157 * @param enable the value true means to enable immersive mode, and false means the opposite. 3158 * @return WM_OK means set success, others means set failed. 3159 */ SetImmersiveModeEnabledState(bool enable)3160 virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; } 3161 3162 /** 3163 * @brief Get whether the immersive mode is enabled or not. 3164 * 3165 * @return true means the immersive mode is enabled, and false means the opposite. 3166 */ GetImmersiveModeEnabledState()3167 virtual bool GetImmersiveModeEnabledState() const { return true; } 3168 3169 /** 3170 * @brief Get the height of status bar. 3171 * 3172 * @return the height of status bar. 3173 */ GetStatusBarHeight()3174 virtual uint32_t GetStatusBarHeight() { return 0; } 3175 3176 /** 3177 * @brief Get whether the free multi-window mode is enabled or not. 3178 * 3179 * @return true means the free multi-window mode is enabled, and false means the opposite. 3180 */ GetFreeMultiWindowModeEnabledState()3181 virtual bool GetFreeMultiWindowModeEnabledState() { return false; } 3182 3183 /** 3184 * @brief Get the window status of current window. 3185 * 3186 * @param windowStatus 3187 * @return WMError. 3188 */ GetWindowStatus(WindowStatus & windowStatus)3189 virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3190 3191 /** 3192 * @brief Set the ContinueState of window. 3193 * 3194 * @param continueState of the window. 3195 * @return Errorcode of window. 3196 */ SetContinueState(int32_t continueState)3197 virtual WMError SetContinueState(int32_t continueState) { return WMError::WM_DO_NOTHING; } 3198 3199 /** 3200 * @brief Notify host that UIExtension timeout 3201 * 3202 * @param errorCode error code when UIExtension timeout 3203 */ NotifyExtensionTimeout(int32_t errorCode)3204 virtual void NotifyExtensionTimeout(int32_t errorCode) {} 3205 3206 /** 3207 * @brief Get Data Handler of UIExtension 3208 */ GetExtensionDataHandler()3209 virtual std::shared_ptr<IDataHandler> GetExtensionDataHandler() const { return nullptr; } 3210 3211 /** 3212 * @brief Get the real parent id of UIExtension 3213 * 3214 * @return Real parent id of UIExtension 3215 */ GetRealParentId()3216 virtual int32_t GetRealParentId() const { return static_cast<int32_t>(INVALID_WINDOW_ID); } 3217 3218 /** 3219 * @brief Get the parent window type of UIExtension 3220 * 3221 * @return Parent window type of UIExtension 3222 */ GetParentWindowType()3223 virtual WindowType GetParentWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 3224 3225 /** 3226 * @brief Get the root host window type of UIExtension. 3227 * 3228 * @return WindowType of the root host window. 3229 */ GetRootHostWindowType()3230 virtual WindowType GetRootHostWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; } 3231 3232 /** 3233 * @brief Set the root host window type of UIExtension. 3234 * 3235 * @param WindowType of the root host window. 3236 */ SetRootHostWindowType(WindowType & rootHostWindowType)3237 virtual void SetRootHostWindowType(WindowType& rootHostWindowType) {} 3238 3239 /** 3240 * @brief Notify modal UIExtension it may be covered 3241 * 3242 * @param byLoadContent True when called by loading content, false when called by creating non topmost subwindow 3243 */ NotifyModalUIExtensionMayBeCovered(bool byLoadContent)3244 virtual void NotifyModalUIExtensionMayBeCovered(bool byLoadContent) {} 3245 3246 /** 3247 * @brief Notify extension asynchronously 3248 * 3249 * @param notifyEvent event type 3250 * @return void 3251 */ NotifyExtensionEventAsync(uint32_t notifyEvent)3252 virtual void NotifyExtensionEventAsync(uint32_t notifyEvent) {} 3253 3254 /** 3255 * @brief Get whether this window is the first level sub window of UIExtension. 3256 * 3257 * @return true - is the first sub window of UIExtension, false - is not the first sub window of UIExtension 3258 */ GetIsUIExtFirstSubWindow()3259 virtual bool GetIsUIExtFirstSubWindow() const { return false; } 3260 3261 /** 3262 * @brief Get whether this window is a sub window of any level of UIExtension. 3263 * 3264 * @return true - is UIExtension sub window, false - is not UIExtension sub window. 3265 */ GetIsUIExtAnySubWindow()3266 virtual bool GetIsUIExtAnySubWindow() const { return false; } 3267 3268 /** 3269 * @brief Set whether to enable gesture back. 3270 * @param enable the value true means to enable gesture back, and false means the opposite. 3271 * @return WM_OK means set success, others means set failed. 3272 */ SetGestureBackEnabled(bool enable)3273 virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; } 3274 3275 /** 3276 * @brief Get whether to enable gesture back. 3277 * @param enable the value true means to enable gesture back, and false means the opposite. 3278 * @return WM_OK means get success, others means get failed. 3279 */ GetGestureBackEnabled(bool & enable)3280 virtual WMError GetGestureBackEnabled(bool& enable) { return WMError::WM_OK; } 3281 3282 /** 3283 * @brief this interface is invoked by the ACE to the native host. 3284 * @param eventName invoking event name, which is used to distinguish different invoking types. 3285 * @param value used to transfer parameters. 3286 * @return WM_OK means get success, others means get failed. 3287 */ OnContainerModalEvent(const std::string & eventName,const std::string & value)3288 virtual WMError OnContainerModalEvent(const std::string& eventName, 3289 const std::string& value) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3290 3291 /** 3292 * @brief Get the type of window. 3293 * 3294 * @return The string corresponding to the window. 3295 */ GetClassType()3296 virtual std::string GetClassType() const { return "Window"; } 3297 3298 /** 3299 * @brief Enable or disable window delay raise 3300 * 3301 * @param isEnabled Enable or disable window delay raise 3302 */ SetWindowDelayRaiseEnabled(bool isEnabled)3303 virtual WMError SetWindowDelayRaiseEnabled(bool isEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3304 3305 /** 3306 * @brief Get whether window delay raise is enabled 3307 * 3308 * @return True means window delay raise is enabled 3309 */ IsWindowDelayRaiseEnabled()3310 virtual bool IsWindowDelayRaiseEnabled() const { return false; } 3311 3312 /** 3313 * @brief Get whether is mid scene. 3314 * 3315 * @return True - is mid scene, false - is not mid scene. 3316 */ GetIsMidScene(bool & isMidScene)3317 virtual WMError GetIsMidScene(bool& isMidScene) { return WMError::WM_OK; } 3318 3319 /** 3320 * @brief Get layoutTransform of window uiContent. 3321 * 3322 * @return UiContent of layoutTransform. 3323 */ GetLayoutTransform()3324 virtual Transform GetLayoutTransform() const 3325 { 3326 static Transform trans; 3327 return trans; 3328 } 3329 3330 /** 3331 * @brief Show keyboard window 3332 * 3333 * @param mode Keyboard will show with special mode. 3334 * @return WM_OK means window show success, others means failed. 3335 */ ShowKeyboard(KeyboardViewMode mode)3336 virtual WMError ShowKeyboard(KeyboardViewMode mode) 3337 { 3338 return WMError::WM_OK; 3339 } 3340 3341 /** 3342 * @brief Change keyboard view mode 3343 * 3344 * @param mode Keyboard will update to the special mode. 3345 * @return WM_OK means view mode update success, others means failed. 3346 */ ChangeKeyboardViewMode(KeyboardViewMode mode)3347 virtual WMError ChangeKeyboardViewMode(KeyboardViewMode mode) 3348 { 3349 return WMError::WM_OK; 3350 } 3351 3352 /** 3353 * @brief Register window highlight change listener. 3354 * 3355 * @param listener IWindowHighlightChangeListener. 3356 * @return WM_OK means register success, others means register failed. 3357 */ RegisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener> & listener)3358 virtual WMError RegisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener>& listener) 3359 { 3360 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3361 } 3362 3363 /** 3364 * @brief Unregister window highlight change listener. 3365 * 3366 * @param listener IWindowHighlightChangeListener. 3367 * @return WM_OK means unregister success, others means unregister failed. 3368 */ UnregisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener> & listener)3369 virtual WMError UnregisterWindowHighlightChangeListeners(const sptr<IWindowHighlightChangeListener>& listener) 3370 { 3371 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3372 } 3373 3374 /** 3375 * @brief Set whether to enable exclusively highlight. 3376 * 3377 * @param isExclusivelyHighlighted the value true means to exclusively highlight, and false means the opposite. 3378 * @return WM_OK means set success, others means set failed. 3379 */ SetExclusivelyHighlighted(bool isExclusivelyHighlighted)3380 virtual WMError SetExclusivelyHighlighted(bool isExclusivelyHighlighted) 3381 { 3382 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3383 } 3384 3385 /** 3386 * @brief Get highlight property of window. 3387 * 3388 * @param highlighted True means the window is highlighted, and false means the opposite. 3389 * @return WM_OK means get success, others means get failed. 3390 */ IsWindowHighlighted(bool & highlighted)3391 virtual WMError IsWindowHighlighted(bool& highlighted) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3392 3393 /** 3394 * @brief Get cross screen axis state. 3395 * 3396 * @return The cross screen axis state of the Window. 3397 */ GetCrossAxisState()3398 virtual CrossAxisState GetCrossAxisState() { return CrossAxisState::STATE_INVALID; } 3399 3400 /** 3401 * @brief Register window screen axis state change listener. 3402 * 3403 * @param listener IWindowCrossAxisChangeListener. 3404 * @return WM_OK means register success, others means register failed. 3405 */ RegisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener> & listener)3406 virtual WMError RegisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener>& listener) 3407 { 3408 return WMError::WM_OK; 3409 } 3410 3411 /** 3412 * @brief Unregister window screen axis state change listener. 3413 * 3414 * @param listener IWindowCrossAxisChangeListener. 3415 * @return WM_OK means unregister success, others means unregister failed. 3416 */ UnregisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener> & listener)3417 virtual WMError UnregisterWindowCrossAxisListener(const sptr<IWindowCrossAxisListener>& listener) 3418 { 3419 return WMError::WM_OK; 3420 } 3421 3422 /** 3423 * @brief Get custom extension param. 3424 * 3425 * @param want the want to store param. 3426 */ GetExtensionConfig(AAFwk::WantParams & want)3427 virtual void GetExtensionConfig(AAFwk::WantParams& want) const {} 3428 3429 /** 3430 * @brief Update custom extension param. 3431 * 3432 * @param want the want to update param. 3433 */ UpdateExtensionConfig(const std::shared_ptr<AAFwk::Want> & want)3434 virtual void UpdateExtensionConfig(const std::shared_ptr<AAFwk::Want>& want) {} 3435 3436 /** 3437 * @brief Register window scene attach or detach framenode listener. 3438 * 3439 * @param listener IWindowAttachStateChangeListner. 3440 * @return WM_OK means register success, others means register failed. 3441 */ RegisterWindowAttachStateChangeListener(const sptr<IWindowAttachStateChangeListner> & listener)3442 virtual WMError RegisterWindowAttachStateChangeListener(const sptr<IWindowAttachStateChangeListner>& listener) 3443 { 3444 return WMError::WM_OK; 3445 } 3446 3447 /** 3448 * @brief Unregister window scene attach or detach framenode listener. 3449 * 3450 * @return WM_OK means unregister success 3451 */ UnregisterWindowAttachStateChangeListener()3452 virtual WMError UnregisterWindowAttachStateChangeListener() 3453 { 3454 return WMError::WM_OK; 3455 } 3456 3457 /** 3458 * @brief Get the api compatible version. 3459 * 3460 * @return Api compatible version 3461 */ GetApiCompatibleVersion()3462 virtual uint32_t GetApiCompatibleVersion() const { return 0; } 3463 3464 /** 3465 * @brief Set the parent window of a sub window. 3466 * 3467 * @param newParentWindowId new parent window id. 3468 * @return WM_OK means set parent window success, others means failed. 3469 */ SetParentWindow(int32_t newParentWindowId)3470 virtual WMError SetParentWindow(int32_t newParentWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3471 3472 /** 3473 * @brief Get the parent window of a sub window. 3474 * 3475 * @param parentWindow parent window. 3476 * @return WM_OK means get parent window success, others means failed. 3477 */ GetParentWindow(sptr<Window> & parentWindow)3478 virtual WMError GetParentWindow(sptr<Window>& parentWindow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3479 3480 /** 3481 * @brief Set the feature of subwindow follow the layout of the parent window. 3482 * 3483 * @param isFollow true - follow, false - not follow. 3484 * @return WM_OK means set success. 3485 */ SetFollowParentWindowLayoutEnabled(bool isFollow)3486 virtual WMError SetFollowParentWindowLayoutEnabled(bool isFollow) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } 3487 3488 /** 3489 * @brief Get is subwindow support maximize. 3490 * 3491 * @return true means subwindow support maximize, others means do not support. 3492 */ IsSubWindowMaximizeSupported()3493 virtual bool IsSubWindowMaximizeSupported() const { return false; } 3494 3495 /** 3496 * @brief Register keyboard show animation completion listener. 3497 * 3498 * @param listener IKeyboardDidShowListener. 3499 * @return WM_OK means register success, others means register failed. 3500 */ RegisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener> & listener)3501 virtual WMError RegisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener>& listener) 3502 { 3503 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3504 } 3505 3506 /** 3507 * @brief Unregister keyboard show animation completion listener. 3508 * 3509 * @param listener IKeyboardDidShowListener. 3510 * @return WM_OK means unregister success, others means unregister failed. 3511 */ UnregisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener> & listener)3512 virtual WMError UnregisterKeyboardDidShowListener(const sptr<IKeyboardDidShowListener>& listener) 3513 { 3514 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3515 } 3516 3517 /** 3518 * @brief Register keyboard hide animation completion listener. 3519 * 3520 * @param listener IKeyboardDidHideListener. 3521 * @return WM_OK means register success, others means register failed. 3522 */ RegisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener> & listener)3523 virtual WMError RegisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener>& listener) 3524 { 3525 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3526 } 3527 3528 /** 3529 * @brief Unregister keyboard hide animation completion listener. 3530 * 3531 * @param listener IKeyboardDidHideListener. 3532 * @return WM_OK means unregister success, others means unregister failed. 3533 */ UnregisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener> & listener)3534 virtual WMError UnregisterKeyboardDidHideListener(const sptr<IKeyboardDidHideListener>& listener) 3535 { 3536 return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; 3537 } 3538 }; 3539 } 3540 } 3541 #endif // OHOS_ROSEN_WINDOW_H 3542