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
28typedef struct napi_env__* napi_env;
29typedef struct napi_value__* napi_value;
30namespace OHOS::MMI {
31class PointerEvent;
32class KeyEvent;
33class AxisEvent;
34}
35namespace OHOS::AppExecFwk {
36class Configuration;
37class Ability;
38}
39
40namespace OHOS::AbilityRuntime {
41class AbilityContext;
42class Context;
43}
44
45namespace OHOS::AAFwk {
46class Want;
47class WantParams;
48}
49
50namespace OHOS::Ace {
51class UIContent;
52}
53
54namespace OHOS::Media {
55class PixelMap;
56}
57
58namespace OHOS::Accessibility {
59class AccessibilityEventInfo;
60}
61namespace OHOS {
62namespace Rosen {
63using NotifyNativeWinDestroyFunc = std::function<void(std::string windowName)>;
64using NotifyTransferComponentDataFunc = std::function<void(const AAFwk::WantParams& wantParams)>;
65using NotifyTransferComponentDataForResultFunc = std::function<AAFwk::WantParams(const AAFwk::WantParams& wantParams)>;
66using KeyEventFilterFunc = std::function<bool(MMI::KeyEvent&)>;
67class RSSurfaceNode;
68class RSTransaction;
69class ISession;
70
71/**
72 * @class IWindowLifeCycle
73 *
74 * @brief IWindowLifeCycle is a listener used to notify caller that lifecycle of window.
75 */
76class IWindowLifeCycle : virtual public RefBase {
77public:
78    /**
79     * @brief Notify caller that window is on the forground.
80     */
81    virtual void AfterForeground() {}
82    /**
83     * @brief Notify caller that window is on the background.
84     */
85    virtual void AfterBackground() {}
86    /**
87     * @brief Notify caller that window is focused.
88     */
89    virtual void AfterFocused() {}
90    /**
91     * @brief Notify caller that window is unfocused.
92     */
93    virtual void AfterUnfocused() {}
94    /**
95     * @brief Notify caller the error code when window go forground failed.
96     *
97     * @param ret Error code when window go forground failed.
98     */
99    virtual void ForegroundFailed(int32_t ret) {}
100    /**
101     * @brief Notify caller the error code when window go background failed.
102     *
103     * @param ret Error code when window go background failed.
104     */
105    virtual void BackgroundFailed(int32_t ret) {}
106    /**
107     * @brief Notify caller that window is active.
108     */
109    virtual void AfterActive() {}
110    /**
111     * @brief Notify caller that window is inactive.
112     */
113    virtual void AfterInactive() {}
114    /**
115     * @brief Notify caller that window is resumed.
116     */
117    virtual void AfterResumed() {}
118    /**
119     * @brief Notify caller that window is paused.
120     */
121    virtual void AfterPaused() {}
122    /**
123     * @brief Notify caller that window is destroyed.
124     */
125    virtual void AfterDestroyed() {}
126};
127
128/**
129 * @class IWindowChangeListener
130 *
131 * @brief IWindowChangeListener is used to observe the window size or window mode when window changed.
132 */
133class IWindowChangeListener : virtual public RefBase {
134public:
135    /**
136     * @brief Notify caller when window size changed.
137     *
138     * @param Rect Rect of the current window.
139     * @param reason Reason for window change.
140     * @param rsTransaction Synchronization transaction for animation
141     */
142    virtual void OnSizeChange(Rect rect, WindowSizeChangeReason reason,
143        const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {}
144    /**
145     * @brief Notify caller when window mode changed.
146     *
147     * @param mode Mode of the current window.
148     * @param hasDeco Window has decoration or not.
149     */
150    virtual void OnModeChange(WindowMode mode, bool hasDeco = true) {}
151};
152
153/**
154 * @class IWindowStatusChangeListener
155 *
156 * @brief IWindowStatusChangeListener is used to observe the window status when window status changed.
157 */
158class IWindowStatusChangeListener : virtual public RefBase {
159public:
160    /**
161     * @brief Notify caller when window status changed.
162     *
163     * @param status Mode of the current window.
164     */
165    virtual void OnWindowStatusChange(WindowStatus status) {}
166};
167
168/**
169 * @class IAvoidAreaChangedListener
170 *
171 * @brief IAvoidAreaChangedListener is used to observe the avoid area when avoid area size changed.
172 */
173class IAvoidAreaChangedListener : virtual public RefBase {
174public:
175    /**
176     * @brief Notify caller when avoid area size changed.
177     *
178     * @param avoidArea Area needed to be avoided.
179     * @param type Type of avoid area.
180     */
181    virtual void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) {}
182};
183
184/**
185 * @class IWindowDragListener
186 *
187 * @brief IWindowDragListener is used to observe the drag status when drag window.
188 */
189class IWindowDragListener : virtual public RefBase {
190public:
191    /**
192     * @brief Notify caller when drag window.
193     *
194     * @param x X-axis when drag window.
195     * @param y Y-axis when drag window.
196     * @param event Drag type.
197     */
198    virtual void OnDrag(int32_t x, int32_t y, DragEvent event) {}
199};
200
201/**
202 * @class IDisplayMoveListener
203 *
204 * @brief IDisplayMoveListener is used to observe display move status when display move.
205 */
206class IDisplayMoveListener : virtual public RefBase {
207public:
208    /**
209     * @brief Notify caller when display move.
210     *
211     * @param from Display id before display start move.
212     * @param to Display id after display move end.
213     */
214    virtual void OnDisplayMove(DisplayId from, DisplayId to) {}
215};
216
217/**
218 * @class IDispatchInputEventListener
219 *
220 * @brief IDispatchInputEventListener is used to dispatch input event.
221 */
222class IDispatchInputEventListener : virtual public RefBase {
223public:
224    /**
225     * @brief Dispatch PointerEvent.
226     *
227     * @param inputEvent Means PointerEvent.
228     */
229    virtual void OnDispatchPointerEvent(std::shared_ptr<MMI::PointerEvent>& inputEvent) {}
230    /**
231     * @brief Dispatch KeyEvent.
232     *
233     * @param inputEvent Means KeyEvent.
234     */
235    virtual void OnDispatchKeyEvent(std::shared_ptr<MMI::KeyEvent>& keyEvent) {}
236};
237
238/**
239 * @class IOccupiedAreaChangeListener
240 *
241 * @brief IOccupiedAreaChangeListener is used to observe OccupiedArea change.
242 */
243class IOccupiedAreaChangeListener : virtual public RefBase {
244public:
245    /**
246     * @brief Notify caller when OccupiedArea size change.
247     *
248     * @param info Occupied area info when occupied changed.
249     * @param rsTransaction Animation transaction.
250     */
251    virtual void OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info,
252        const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) {}
253};
254
255/**
256 * @class IAceAbilityHandler
257 *
258 * @brief IAceAbilityHandler is used to control Ace Ability.
259 */
260class IAceAbilityHandler : virtual public RefBase {
261public:
262    /**
263     * @brief Set BackgroundColor
264     *
265     * @param color Color of Background.
266     */
267    virtual void SetBackgroundColor(uint32_t color) {}
268    /**
269     * @brief Get BackgroundColor.
270     *
271     * @return Value of BackgroundColor and default color is white.
272     */
273    virtual uint32_t GetBackgroundColor() { return 0xffffffff; }
274};
275
276/**
277 * @class IInputEventConsumer
278 *
279 * @brief IInputEventConsumer is a Listener to observe InputEvent consumed or not.
280 */
281class IInputEventConsumer {
282public:
283    /**
284     * @brief Default construct func of IInputEventConsumer.
285     */
286    IInputEventConsumer() = default;
287    /**
288     * @brief Default Destructor func of IInputEventConsumer.
289     */
290    virtual ~IInputEventConsumer() = default;
291    /**
292     * @brief Observe KeyEvent of Multi-Model Input.
293     *
294     * @param keyEvent KeyEvent of Multi-Model Input.
295     */
296    virtual bool OnInputEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) const { return false; }
297    /**
298     * @brief Observe PointerEvent of Multi-Model Input.
299     *
300     * @param pointerEvent PointerEvent of Multi-Model Input.
301     */
302    virtual bool OnInputEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) const { return false; }
303    /**
304     * @brief Observe axisEvent of Multi-Model Input.
305     *
306     * @param axisEvent AxisEvent of Multi-Model Input.
307     */
308    virtual bool OnInputEvent(const std::shared_ptr<MMI::AxisEvent>& axisEvent) const { return false; }
309};
310
311/**
312 * @class ITouchOutsideListener
313 *
314 * @brief ITouchOutsideListener is a Listener to observe event when touch outside the window.
315 */
316class ITouchOutsideListener : virtual public RefBase {
317public:
318    /**
319     * @brief Observe the event when touch outside the window.
320     */
321    virtual void OnTouchOutside() const {}
322};
323
324/**
325 * @class IAnimationTransitionController
326 *
327 * @brief IAnimationTransitionController is a Listener to observe event about animation.
328 */
329class IAnimationTransitionController : virtual public RefBase {
330public:
331    /**
332     * @brief Observe the event when animation show.
333     */
334    virtual void AnimationForShown() {}
335    /**
336     * @brief Observe the event when animation hide.
337     */
338    virtual void AnimationForHidden() {}
339};
340
341/**
342 * @class IScreenshotListener
343 *
344 * @brief IScreenshotListener is a Listener to observe event when screenshot happened.
345 */
346class IScreenshotListener : virtual public RefBase {
347public:
348    /**
349     * @brief Observe event when screenshot happened.
350     */
351    virtual void OnScreenshot() {}
352};
353
354/**
355 * @class IDialogTargetTouchListener
356 *
357 * @brief IDialogTargetTouchListener is a Listener to observe event when touch dialog window.
358 */
359class IDialogTargetTouchListener : virtual public RefBase {
360public:
361    /**
362     * @brief Observe event when touch dialog window.
363     */
364    virtual void OnDialogTargetTouch() const {}
365};
366
367/**
368 * @class IDialogDeathRecipientListener
369 *
370 * @brief IDialogDeathRecipientListener is a Listener to observe event when mainwindow(bind to dialog) destroyed.
371 */
372class IDialogDeathRecipientListener : virtual public RefBase {
373public:
374    /**
375     * @brief Observe event when mainwindow(bind to dialog) destroyed.
376     */
377    virtual void OnDialogDeathRecipient() const {}
378};
379
380/**
381 * @class IWindowVisibilityChangedListener
382 *
383 * @brief Listener to observe one window visibility changed.
384*/
385class IWindowVisibilityChangedListener : virtual public RefBase {
386public:
387    virtual void OnWindowVisibilityChangedCallback(const bool isVisible) {};
388};
389using IWindowVisibilityListenerSptr = sptr<IWindowVisibilityChangedListener>;
390
391/**
392 * @class IWindowNoInteractionListenerSptr
393 *
394 * @brief Listener to observe no interaction event for a long time of window.
395*/
396class IWindowNoInteractionListener : virtual public RefBase {
397public:
398    /**
399     * @brief Observe event when no interaction for a long time.
400     */
401    virtual void OnWindowNoInteractionCallback() {};
402
403    /**
404     * @brief Set timeout of the listener.
405     *
406     * @param timeout.
407     */
408    virtual void SetTimeout(int64_t timeout) {};
409
410    /**
411     * @brief get timeout of the listener.
412     *
413     * @return timeout.
414     */
415    virtual int64_t GetTimeout() const { return 0;};
416};
417using IWindowNoInteractionListenerSptr = sptr<IWindowNoInteractionListener>;
418
419/**
420 * @class IWindowTitleButtonRectChangedListener
421 *
422 * @brief Listener to observe event when window size or the height of title bar changed.
423 */
424class IWindowTitleButtonRectChangedListener : virtual public RefBase {
425public:
426    /**
427     * @brief Notify caller when window size or the height of title bar changed.
428     * @param titleButtonRect An area of title buttons relative to the upper right corner of the window.
429     */
430    virtual void OnWindowTitleButtonRectChanged(const TitleButtonRect& titleButtonRect) {}
431};
432
433/**
434 * @class IWindowRectChangeListener
435 *
436 * @brief IWindowRectChangeListener is used to observe the window rect and its changing reason when window changed.
437 */
438class IWindowRectChangeListener : virtual public RefBase {
439public:
440    /**
441     * @brief Notify caller when window rect changed.
442     *
443     * @param Rect Rect of the current window.
444     * @param reason Reason for window size change.
445     */
446    virtual void OnRectChange(Rect rect, WindowSizeChangeReason reason) {}
447};
448
449/**
450 * @class ISubWindowCloseListener
451 *
452 * @brief ISubWindowCloseListener is used to observe the window rect and its changing reason when window changed.
453 */
454class ISubWindowCloseListener : virtual public RefBase {
455public:
456    /**
457     * @brief Notify caller when subwindow closed.
458     *
459     * @param terminateCloseProcess Whather need to terminate the subwindow close process.
460     */
461    virtual void OnSubWindowClose(bool& terminateCloseProcess) {}
462};
463
464/**
465 * @class IMainWindowCloseListener
466 *
467 * @brief IMainWindowCloseListener is used for preprocessing when the main window exits.
468 */
469class IMainWindowCloseListener : virtual public RefBase {
470public:
471    /**
472     * @brief Notify caller when main window closed.
473     *
474     * @param terminateCloseProcess Whether need to terminate the main window close process.
475     */
476    virtual void OnMainWindowClose(bool& terminateCloseProcess) {}
477};
478
479/**
480 * @class ISwitchFreeMultiWindowListener
481 *
482 * @brief ISwitchFreeMultiWindowListener is used to observe the free multi window state when it changed.
483 */
484class ISwitchFreeMultiWindowListener : virtual public RefBase {
485public:
486    /**
487     * @brief Notify caller when free multi window state changed.
488     *
489     * @param enable Whether free multi window state enabled.
490     */
491    virtual void OnSwitchFreeMultiWindow(bool enable) {}
492};
493
494/**
495 * @class IKeyboardPanelInfoChangeListener
496 *
497 * @brief IKeyboardPanelInfoChangeListener is used to observe the keyboard panel info.
498 */
499class IKeyboardPanelInfoChangeListener : virtual public RefBase {
500public:
501    /**
502     * @brief Notify caller when keyboard info changed.
503     *
504     * @param KeyboardPanelInfo keyboardPanelInfo of the keyboard panel;
505     */
506    virtual void OnKeyboardPanelInfoChanged(const KeyboardPanelInfo& keyboardPanelInfo) {}
507};
508
509static WMError DefaultCreateErrCode = WMError::WM_OK;
510class Window : virtual public RefBase {
511public:
512    /**
513     * @brief create window, include main_window/sub_window/system_window
514     *
515     * @param windowName window name, identify window instance
516     * @param option window propertion
517     * @param context ability context
518     * @return sptr<Window> If create window success,return window instance;Otherwise, return nullptr
519     */
520    static sptr<Window> Create(const std::string& windowName,
521        sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context = nullptr,
522        WMError& errCode = DefaultCreateErrCode);
523
524    /**
525     * @brief create main/uiextension window with session
526     *
527     * @param option window propertion
528     * @param context ability context
529     * @param iSession session token of window session
530     * @param errCode error code of create window
531     * @param identityToken identity token of sceneSession
532     * @return sptr<Window> If create window success, return window instance; Otherwise, return nullptr
533     */
534    static sptr<Window> Create(sptr<WindowOption>& option, const std::shared_ptr<AbilityRuntime::Context>& context,
535        const sptr<IRemoteObject>& iSession, WMError& errCode = DefaultCreateErrCode,
536        const std::string& identityToken = "");
537
538    /**
539     * @brief create pip window with session
540     *
541     * @param option window propertion
542     * @param pipTemplateInfo pipTemplateInfo
543     * @param context ability context
544     * @param errCode error code of create pip window
545     * @return sptr<Window> If create pip window success, return window instance; Otherwise, return nullptr
546     */
547    static sptr<Window> CreatePiP(sptr<WindowOption>& option, const PiPTemplateInfo& pipTemplateInfo,
548        const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, WMError& errCode = DefaultCreateErrCode);
549
550    /**
551     * @brief find window by windowName
552     *
553     * @param windowName
554     * @return sptr<Window> Return the window instance founded
555     */
556    static sptr<Window> Find(const std::string& windowName);
557
558    /**
559     * @brief Get parent main windowId, which is used for mainWindow,subWindow or dialog
560     *
561     * @param windowId window id that need to get parent main window
562     * @return uint32_t Return the parent main window id
563     */
564    static uint32_t GetParentMainWindowId(uint32_t windowId);
565
566    /**
567     * @brief Get the final show window by context. Its implemented in api8
568     *
569     * @param context Indicates the context on which the window depends
570     * @return sptr<Window>
571     */
572    static sptr<Window> GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
573    /**
574     * @brief Get the final show window by id. Its implemented in api8
575     *
576     * @param mainWinId main window id?
577     * @return sptr<Window>
578     */
579    static sptr<Window> GetTopWindowWithId(uint32_t mainWinId);
580    /**
581     * @brief Get the main window by context.
582     *
583     * @param context Indicates the context on which the window depends
584     * @return sptr<Window>
585     */
586    static sptr<Window> GetMainWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context = nullptr);
587    /**
588     * @brief Get the all sub windows by parent
589     *
590     * @param parentId parent window id
591     * @return std::vector<sptr<Window>>
592     */
593    static std::vector<sptr<Window>> GetSubWindow(uint32_t parentId);
594
595    /**
596     * @brief Update configuration for all windows
597     *
598     * @param configuration configuration for app
599     */
600    static void UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration);
601    /**
602     * @brief Get surface node from RS
603     *
604     * @return Surface node from RS
605     */
606    virtual std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const { return nullptr; }
607    /**
608     * @brief Get ability context
609     *
610     * @return Ability context from AbilityRuntime
611     */
612    virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const { return nullptr; }
613    /**
614     * @brief Get the window show rect
615     *
616     * @return Rect of window
617     */
618    virtual Rect GetRect() const { return {}; }
619    /**
620     * @brief Get window default rect from window property.
621     *
622     * @return Rect of window.
623     */
624    virtual Rect GetRequestRect() const { return {}; }
625    /**
626     * @brief Get the window type
627     *
628     * @return Type of window
629     */
630    virtual WindowType GetType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; }
631    /**
632     * @brief Get the window mode.
633     *
634     * @return Mode of window.
635     */
636    virtual WindowMode GetMode() const { return WindowMode::WINDOW_MODE_UNDEFINED; }
637    /**
638     * @brief Get alpha of window.
639     *
640     * @return Alpha of window.
641     */
642    virtual float GetAlpha() const { return 0.0f; }
643    /**
644     * @brief Get the name of window.
645     *
646     * @return Name of window.
647     */
648    virtual const std::string& GetWindowName() const
649    {
650        static const std::string name;
651        return name;
652    }
653    /**
654     * @brief Get id of window.
655     *
656     * @return ID of window.
657     */
658    virtual uint32_t GetWindowId() const { return INVALID_WINDOW_ID; }
659    /**
660     * @brief Get displayId of window.
661     *
662     * @return displayId of window.
663     */
664    virtual uint64_t GetDisplayId() const { return DISPLAY_ID_INVALID; }
665    /**
666     * @brief Get flag of window.
667     *
668     * @return Flag of window.
669     */
670    virtual uint32_t GetWindowFlags() const { return 0; }
671    /**
672     * @brief Get state of window.
673     *
674     * @return Current state of window.
675     */
676    virtual WindowState GetWindowState() const { return WindowState::STATE_INITIAL; }
677    /**
678     * @brief Set focusable property of window.
679     *
680     * @param isFocusable Window can be focused or not.
681     * @return Errorcode of window.
682     */
683    virtual WMError SetFocusable(bool isFocusable) { return WMError::WM_OK; }
684    /**
685     * @brief Get focusable property of window.
686     *
687     * @return True means window can be focused, false means window cannot be focused.
688     */
689    virtual bool GetFocusable() const { return false; }
690    /**
691     * @brief Set touchable property of window.
692     *
693     * @param isTouchable Window can be touched or not.
694     * @return Errorcode of window.
695     */
696    virtual WMError SetTouchable(bool isTouchable) { return WMError::WM_OK; }
697    /**
698     * @brief Get touchable property of window.
699     *
700     * @return True means window can be touched, false means window cannot be touched.
701     */
702    virtual bool GetTouchable() const { return false; }
703    /**
704     * @brief Get SystemBarProperty By WindowType.
705     *
706     * @param type Type of window.
707     * @return Property of system bar.
708     */
709    virtual SystemBarProperty GetSystemBarPropertyByType(WindowType type) const { return {}; }
710    /**
711     * @brief judge this window is full screen.
712     *
713     * @return true If SetFullScreen(true) is called , return true.
714     * @return false default return false
715     */
716    virtual bool IsFullScreen() const { return false; }
717    /**
718     * @brief judge window layout is full screen
719     *
720     * @return true this window layout is full screen
721     * @return false this window layout is not full screen
722     */
723    virtual bool IsLayoutFullScreen() const { return false; }
724    /**
725     * @brief Set the Window Type
726     *
727     * @param type window type
728     * @return WMError
729     */
730    virtual WMError SetWindowType(WindowType type) { return WMError::WM_OK; }
731    /**
732     * @brief Set the Window Mode
733     *
734     * @param mode window mode
735     * @return WMError
736     */
737    virtual WMError SetWindowMode(WindowMode mode) { return WMError::WM_OK; }
738    /**
739     * @brief Set whether the window is topmost
740     *
741     * @param topmost whether window is topmost
742     * @return WMError
743     */
744    virtual WMError SetTopmost(bool topmost) { return WMError::WM_OK; }
745    /**
746     * @brief Get whether window is topmost
747     *
748     * @return True means window is topmost
749     */
750    virtual bool IsTopmost() const { return false; }
751    /**
752     * @brief Set whether the main window is topmost
753     *
754     * @param isTopmost whether main window is topmost
755     * @return WMError
756     */
757    virtual WMError SetMainWindowTopmost(bool isTopmost) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
758    /**
759     * @brief Get whether main window is topmost
760     *
761     * @return True means main window is topmost
762     */
763    virtual bool IsMainWindowTopmost() const { return false; }
764    /**
765     * @brief Set alpha of window.
766     *
767     * @param alpha Alpha of window.
768     * @return WM_OK means success, others means set failed.
769     */
770    virtual WMError SetAlpha(float alpha) { return WMError::WM_OK; }
771    /**
772     * @brief Set transform of window property.
773     *
774     * @param trans Window Transform.
775     * @return WMError
776     */
777    virtual WMError SetTransform(const Transform& trans) { return WMError::WM_OK; }
778    /**
779     * @brief Get transform of window property.
780     *
781     * @return Property of transform.
782     */
783    virtual const Transform& GetTransform() const
784    {
785        static const Transform trans;
786        return trans;
787    }
788    /**
789     * @brief Add window flag.
790     *
791     * @param flag Flag of window.
792     * @return WM_OK means add success, others means failed.
793     */
794    virtual WMError AddWindowFlag(WindowFlag flag) { return WMError::WM_OK; }
795    /**
796     * @brief Remove window flag.
797     *
798     * @param flag Flag of window
799     * @return WM_OK means remove success, others means failed.
800     */
801    virtual WMError RemoveWindowFlag(WindowFlag flag) { return WMError::WM_OK; }
802    /**
803     * @brief Set window flag.
804     *
805     * @param flags Flag of window
806     * @return WM_OK means set success, others means failed.
807     */
808    virtual WMError SetWindowFlags(uint32_t flags) { return WMError::WM_OK; }
809    /**
810     * @brief Set the System Bar(include status bar and nav bar) Property
811     *
812     * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR
813     * @param property system bar prop,include content color, background color
814     * @return WMError
815     */
816    virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return WMError::WM_OK; }
817    /**
818     * @brief Get the Avoid Area By Type object
819     *
820     * @param type avoid area type.@see reference
821     * @param avoidArea
822     * @return WMError
823     */
824    virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) { return WMError::WM_OK; }
825    /**
826     * @brief Set this window layout full screen, with hide status bar and nav bar above on this window
827     *
828     * @param status
829     * @return WMError
830     */
831    virtual WMError SetLayoutFullScreen(bool status) { return WMError::WM_OK; }
832    /**
833     * @brief Set whether the title bar and dock bar will show, when the mouse hovers over hot area.
834     *
835     * @param isTitleHoverShown
836     * @param isDockHoverShown
837     * @return WMError
838     */
839    virtual WMError SetTitleAndDockHoverShown(bool isTitleHoverShown = true,
840        bool isDockHoverShown = true)
841    {
842        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
843    }
844    /**
845     * @brief Set this window full screen, with hide status bar and nav bar
846     *
847     * @param status if true, hide status bar and nav bar; Otherwise, show status bar and nav bar
848     * @return WMError
849     */
850    virtual WMError SetFullScreen(bool status) { return WMError::WM_OK; }
851    /**
852     * @brief destroy window
853     *
854     * @return WMError
855     */
856    virtual WMError Destroy() { return WMError::WM_OK; }
857    /**
858     * @brief Show window
859     *
860     * @param reason Reason for window state change.
861     * @param withAnimation True means window show with animation, false means window show without animation.
862     * @param withFocus True means window can get focus when it shows to foreground, false means the opposite;
863     * @return WM_OK means window show success, others means failed.
864     */
865    virtual WMError Show(uint32_t reason = 0, bool withAnimation = false,
866                         bool withFocus = true) { return WMError::WM_OK; }
867    /**
868     * @brief Hide window
869     *
870     * @param reason Reason for window state change.
871     * @param withAnimation True means window show with animation, false means window show without animation.
872     * @param isFromInnerkits True means remove command is from inner kits.
873     * @return WM_OK means window hide success, others means failed.
874     */
875    virtual WMError Hide(uint32_t reason = 0, bool withAnimation = false, bool isFromInnerkits = true)
876    {
877        return WMError::WM_OK;
878    }
879    /**
880     * @brief notify window first frame drawing completed.
881     *
882     * @return WMError
883     */
884    virtual WMError NotifyDrawingCompleted() { return WMError::WM_OK; }
885    /**
886     * @brief move the window to (x, y)
887     *
888     * @param x
889     * @param y
890     * @return WMError
891     */
892    virtual WMError MoveTo(int32_t x, int32_t y, bool isMoveToGlobal = false) { return WMError::WM_OK; }
893    /**
894     * @brief move the window to (x, y)
895     *
896     * @param x
897     * @param y
898     * @return WMError
899     */
900    virtual WMError MoveToAsync(int32_t x, int32_t y) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
901    /**
902     * @brief resize the window instance (w,h)
903     *
904     * @param width
905     * @param height
906     * @return WMError
907     */
908    virtual WMError Resize(uint32_t width, uint32_t height) { return WMError::WM_OK; }
909    /**
910     * @brief resize the window instance (w,h)
911     *
912     * @param width
913     * @param height
914     * @return WMError
915     */
916    virtual WMError ResizeAsync(uint32_t width, uint32_t height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
917    /**
918     * @brief set the window gravity
919     *
920     * @param gravity
921     * @param percent
922     * @return WMError
923     */
924    virtual WMError SetWindowGravity(WindowGravity gravity, uint32_t percent) { return WMError::WM_OK; }
925    /**
926     * @brief Set the screen always on
927     *
928     * @param keepScreenOn
929     * @return WMError
930     */
931    virtual WMError SetKeepScreenOn(bool keepScreenOn) { return WMError::WM_OK; }
932    /**
933     * @brief Get the screen is always on or not.
934     *
935     * @return True means screen is always on, false means the opposite.
936     */
937    virtual bool IsKeepScreenOn() const { return false; }
938    /**
939     * @brief Set the screen on
940     *
941     * @param turnScreenOn True means turn screen on, false means the opposite.
942     * @return WM_OK means set success, others means set failed.
943     */
944    virtual WMError SetTurnScreenOn(bool turnScreenOn) { return WMError::WM_OK; }
945    /**
946     * @brief Get the screen is on or not.
947     *
948     * @return True means screen is on, false means screen is off.
949     */
950    virtual bool IsTurnScreenOn() const { return false; }
951    /**
952     * @brief Set Background color.
953     *
954     * @param color Background color.
955     * @return WM_OK means set success, others means set failed.
956     */
957    virtual WMError SetBackgroundColor(const std::string& color) { return WMError::WM_OK; }
958    /**
959     * @brief Set transparent status.
960     *
961     * @param isTransparent True means set window transparent, false means the opposite.
962     * @return WM_OK means set success, others means set failed.
963     */
964    virtual WMError SetTransparent(bool isTransparent) { return WMError::WM_OK; }
965    /**
966     * @brief Get transparent status.
967     *
968     * @return True means window is transparent, false means the opposite.
969     */
970    virtual bool IsTransparent() const { return false; }
971    /**
972     * @brief Set brightness value of window.
973     *
974     * @param brightness Brightness of window.
975     * @return WM_OK means set success, others means set failed.
976     */
977    virtual WMError SetBrightness(float brightness) { return WMError::WM_OK; }
978    /**
979     * @brief Get brightness value of window.
980     *
981     * @return Brightness value of window.
982     */
983    virtual float GetBrightness() const { return 0.0f; }
984    /**
985     * @brief Set calling window.
986     *
987     * @param windowId Window id.
988     * @return WM_OK means set success, others means set failed.
989     */
990    virtual WMError SetCallingWindow(uint32_t windowId) { return WMError::WM_OK; }
991    /**
992     * @brief Set privacy mode of window.
993     *
994     * @param isPrivacyMode True means set window private, false means not set window private.
995     * @return WM_OK means set success, others means set failed.
996     */
997    virtual WMError SetPrivacyMode(bool isPrivacyMode) { return WMError::WM_OK; }
998    /**
999     * @brief Get privacy property of window.
1000     *
1001     * @return True means window is private and cannot be screenshot or recorded.
1002     */
1003    virtual bool IsPrivacyMode() const { return false; }
1004    /**
1005     * @brief Set privacy mode by system.
1006     *
1007     * @param isSystemPrivacyMode True means set window private, false means not set window private.
1008     */
1009    virtual void SetSystemPrivacyMode(bool isSystemPrivacyMode) {}
1010    /**
1011     * @brief Bind Dialog window to target token.
1012     *
1013     * @param targetToken Window token of target.
1014     * @return WM_OK means set success, others means set failed.
1015     */
1016    virtual WMError BindDialogTarget(sptr<IRemoteObject> targetToken) { return WMError::WM_OK; }
1017    /**
1018     * @brief Set whether the dialog window responds to back gesture.
1019     *
1020     * @param isEnabled Responds to back gesture if true, or ignore back gesture if false.
1021     * @return WM_OK means set success, others means set failed.
1022     */
1023    virtual WMError SetDialogBackGestureEnabled(bool isEnabled)
1024    {
1025        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1026    }
1027    /**
1028     * @brief Raise zorder of window to the top of APP Mainwindow.
1029     *
1030     * @return WM_OK means raise success, others means raise failed.
1031     */
1032    virtual WMError RaiseToAppTop() { return WMError::WM_OK; }
1033    /**
1034     * @brief Set skip flag of snapshot.
1035     *
1036     * @param isSkip True means skip the snapshot, false means the opposite.
1037     * @return WM_OK means set success, others means set failed.
1038     */
1039    virtual WMError SetSnapshotSkip(bool isSkip) { return WMError::WM_OK; }
1040
1041    // window effect
1042    /**
1043     * @brief Set corner radius of window.
1044     *
1045     * @param cornerRadius Corner radius of window
1046     * @return WM_OK means set success, others means set failed.
1047     */
1048    virtual WMError SetCornerRadius(float cornerRadius) { return WMError::WM_OK; }
1049    /**
1050     * @brief Set shadow radius of window.
1051     *
1052     * @param radius Shadow radius of window
1053     * @return WM_OK means set success, others means set failed.
1054     */
1055    virtual WMError SetShadowRadius(float radius) { return WMError::WM_OK; }
1056    /**
1057     * @brief Set shadow color of window.
1058     *
1059     * @param color Shadow color of window.
1060     * @return WM_OK means set success, others means set failed.
1061     */
1062    virtual WMError SetShadowColor(std::string color) { return WMError::WM_OK; }
1063    /**
1064     * @brief Set shadow X offset.
1065     *
1066     * @param offsetX Shadow x-axis offset.
1067     * @return WM_OK means set success, others means set failed.
1068     */
1069    virtual WMError SetShadowOffsetX(float offsetX) { return WMError::WM_OK; }
1070    /**
1071     * @brief Set shadow Y offset.
1072     *
1073     * @param offsetY Shadow y-axis offset.
1074     * @return WM_OK means set success, others means set failed.
1075     */
1076    virtual WMError SetShadowOffsetY(float offsetY) { return WMError::WM_OK; }
1077    /**
1078     * @brief Set blur property.
1079     *
1080     * @param radius Blur value.
1081     * @return WM_OK means set success, others means set failed.
1082     */
1083    virtual WMError SetBlur(float radius) { return WMError::WM_OK; }
1084    /**
1085     * @brief Set Backdrop blur property.
1086     *
1087     * @param radius Backdrop blur value.
1088     * @return WM_OK means set success, others means set failed.
1089     */
1090    virtual WMError SetBackdropBlur(float radius) { return WMError::WM_OK; }
1091    /**
1092     * @brief Set Backdrop blur style.
1093     *
1094     * @param blurStyle Backdrop blur value.
1095     * @return WM_OK means set success, others means set failed.
1096     */
1097    virtual WMError SetBackdropBlurStyle(WindowBlurStyle blurStyle) { return WMError::WM_OK; }
1098
1099    /**
1100     * @brief Request to get focus.
1101     *
1102     * @return WM_OK means request success, others means request failed.
1103     */
1104    virtual WMError RequestFocus() const { return WMError::WM_OK; }
1105    /**
1106     * @brief Request to get focus or lose focus.
1107     *
1108     * @return WM_OK means request success, others means request failed.
1109     */
1110    virtual WMError RequestFocusByClient(bool isFocused) const { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1111    /**
1112     * @brief Check current focus status.
1113     *
1114     * @return True means window is focused, false means window is unfocused.
1115     */
1116    virtual bool IsFocused() const { return false; }
1117    /**
1118     * @brief Update surfaceNode after customAnimation.
1119     *
1120     * @param isAdd True means add custom animation, false means the opposite.
1121     * @return WM_OK means update success, others means update failed.
1122     */
1123    virtual WMError UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { return WMError::WM_OK; }
1124    /**
1125     * @brief Set InputEvent Consumer.
1126     *
1127     * @param inputEventConsumer Consume input event object.
1128     * @return WM_OK means set success, others means set failed.
1129     */
1130    virtual void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) {}
1131    /**
1132     * @brief Consume KeyEvent from MMI.
1133     *
1134     * @param inputEvent Keyboard input event.
1135     */
1136    virtual void ConsumeKeyEvent(std::shared_ptr<MMI::KeyEvent>& inputEvent) {}
1137    /**
1138     * @brief Notify KeyEvent to arkui.
1139     *
1140     * @param inputEvent Keyboard input event
1141     */
1142    virtual bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) {return false;}
1143    /**
1144     * @brief Consume PointerEvent from MMI.
1145     *
1146     * @param inputEvent Pointer input event
1147     */
1148    virtual void ConsumePointerEvent(const std::shared_ptr<MMI::PointerEvent>& inputEvent) {}
1149    /**
1150     * @brief Request Vsync.
1151     *
1152     * @param vsyncCallback Callback of vsync.
1153     */
1154    virtual void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) {}
1155    /**
1156     * @brief get vsync period.
1157     *
1158     * @return vsync period.
1159     */
1160    virtual int64_t GetVSyncPeriod() { return 0; }
1161    /**
1162     * @brief flush frame rate of linker.
1163     *
1164     * @param rate frame rate.
1165     * @param animatorExpectedFrameRate animator expected frame rate.
1166     * @param rateType frame rate type.
1167     */
1168    virtual void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType) {}
1169    /**
1170     * @brief Update Configuration.
1171     *
1172     * @param configuration Window configuration.
1173     */
1174    virtual void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration) {}
1175    /**
1176     * @brief Register window lifecycle listener.
1177     *
1178     * @param listener WindowLifeCycle listener.
1179     * @return WM_OK means register success, others means register failed.
1180     */
1181    virtual WMError RegisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; }
1182    /**
1183     * @brief Unregister window lifecycle listener.
1184     *
1185     * @param listener WindowLifeCycle listener.
1186     * @return WM_OK means unregister success, others means unregister failed.
1187     */
1188    virtual WMError UnregisterLifeCycleListener(const sptr<IWindowLifeCycle>& listener) { return WMError::WM_OK; }
1189    /**
1190     * @brief Register window change listener.
1191     *
1192     * @param listener IWindowChangeListener.
1193     * @return WM_OK means register success, others means register failed.
1194     */
1195    virtual WMError RegisterWindowChangeListener(const sptr<IWindowChangeListener>& listener)
1196    {
1197        return WMError::WM_OK;
1198    }
1199    /**
1200     * @brief Unregister window change listener.
1201     *
1202     * @param listener IWindowChangeListener.
1203     * @return WM_OK means unregister success, others means unregister failed.
1204     */
1205    virtual WMError UnregisterWindowChangeListener(const sptr<IWindowChangeListener>& listener)
1206    {
1207        return WMError::WM_OK;
1208    }
1209    /**
1210     * @brief Register avoid area change listener.
1211     *
1212     * @param listener IAvoidAreaChangedListener.
1213     * @return WM_OK means register success, others means register failed.
1214     */
1215    virtual WMError RegisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener)
1216    {
1217        return WMError::WM_OK;
1218    }
1219    /**
1220     * @brief Unregister avoid area change listener.
1221     *
1222     * @param listener IAvoidAreaChangedListener.
1223     * @return WM_OK means unregister success, others means unregister failed.
1224     */
1225    virtual WMError UnregisterAvoidAreaChangeListener(sptr<IAvoidAreaChangedListener>& listener)
1226    {
1227        return WMError::WM_OK;
1228    }
1229    /**
1230     * @brief Register window drag listener.
1231     *
1232     * @param listener IWindowDragListener.
1233     * @return WM_OK means register success, others means register failed.
1234     */
1235    virtual WMError RegisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; }
1236    /**
1237     * @brief Unregister window drag listener.
1238     *
1239     * @param listener IWindowDragListener.
1240     * @return WM_OK means unregister success, others means unregister failed.
1241     */
1242    virtual WMError UnregisterDragListener(const sptr<IWindowDragListener>& listener) { return WMError::WM_OK; }
1243    /**
1244     * @brief Register display move listener.
1245     *
1246     * @param listener IDisplayMoveListener.
1247     * @return WM_OK means register success, others means register failed.
1248     */
1249    virtual WMError RegisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; }
1250    /**
1251     * @brief Unregister display move listener.
1252     *
1253     * @param listener IDisplayMoveListener.
1254     * @return WM_OK means unregister success, others means unregister failed.
1255     */
1256    virtual WMError UnregisterDisplayMoveListener(sptr<IDisplayMoveListener>& listener) { return WMError::WM_OK; }
1257    /**
1258     * @brief Register window destroyed listener.
1259     *
1260     * @param func Function to notify window destroyed.
1261     */
1262    virtual void RegisterWindowDestroyedListener(const NotifyNativeWinDestroyFunc& func) {}
1263    /**
1264     * @brief Unregister window destroyed listener.
1265     *
1266     */
1267    virtual void UnregisterWindowDestroyedListener() {}
1268    /**
1269     * @brief Register Occupied Area Change listener.
1270     *
1271     * @param listener IOccupiedAreaChangeListener.
1272     * @return WM_OK means register success, others means register failed.
1273     */
1274    virtual WMError RegisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener)
1275    {
1276        return WMError::WM_OK;
1277    }
1278    /**
1279     * @brief Unregister occupied area change listener.
1280     *
1281     * @param listener IOccupiedAreaChangeListener.
1282     * @return WM_OK means unregister success, others means unregister failed.
1283     */
1284    virtual WMError UnregisterOccupiedAreaChangeListener(const sptr<IOccupiedAreaChangeListener>& listener)
1285    {
1286        return WMError::WM_OK;
1287    }
1288    /**
1289     * @brief Register touch outside listener.
1290     *
1291     * @param listener ITouchOutsideListener.
1292     * @return WM_OK means register success, others means register failed.
1293     */
1294    virtual WMError RegisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener) { return WMError::WM_OK; }
1295    /**
1296     * @brief Unregister touch outside listener.
1297     *
1298     * @param listener ITouchOutsideListener.
1299     * @return WM_OK means unregister success, others means unregister failed.
1300     */
1301    virtual WMError UnregisterTouchOutsideListener(const sptr<ITouchOutsideListener>& listener)
1302    {
1303        return WMError::WM_OK;
1304    }
1305    /**
1306     * @brief Register Animation Transition Controller listener.
1307     *
1308     * @param listener IAnimationTransitionController.
1309     * @return WM_OK means register success, others means register failed.
1310     */
1311    virtual WMError RegisterAnimationTransitionController(const sptr<IAnimationTransitionController>& listener)
1312    {
1313        return WMError::WM_OK;
1314    }
1315    /**
1316     * @brief Register screen shot listener.
1317     *
1318     * @param listener IScreenshotListener.
1319     * @return WM_OK means register success, others means register failed.
1320     */
1321    virtual WMError RegisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; }
1322    /**
1323     * @brief Unregister screen shot listener.
1324     *
1325     * @param listener IScreenshotListener.
1326     * @return WM_OK means unregister success, others means unregister failed.
1327     */
1328    virtual WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) { return WMError::WM_OK; }
1329    /**
1330     * @brief Register dialog target touch listener.
1331     *
1332     * @param listener IDialogTargetTouchListener.
1333     * @return WM_OK means register success, others means register failed.
1334     */
1335    virtual WMError RegisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener)
1336    {
1337        return WMError::WM_OK;
1338    }
1339    /**
1340     * @brief Unregister dialog target touch listener.
1341     *
1342     * @param listener IDialogTargetTouchListener.
1343     * @return WM_OK means unregister success, others means unregister failed.
1344     */
1345    virtual WMError UnregisterDialogTargetTouchListener(const sptr<IDialogTargetTouchListener>& listener)
1346    {
1347        return WMError::WM_OK;
1348    }
1349    /**
1350     * @brief Register dialog death Recipient listener.
1351     *
1352     * @param listener IDialogDeathRecipientListener.
1353     */
1354    virtual void RegisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {}
1355    /**
1356     * @brief Unregister window death recipient listener.
1357     *
1358     * @param listener IDialogDeathRecipientListener.
1359     */
1360    virtual void UnregisterDialogDeathRecipientListener(const sptr<IDialogDeathRecipientListener>& listener) {}
1361    /**
1362     * @brief Notify touch dialog target.
1363     */
1364    virtual void NotifyTouchDialogTarget(int32_t posX = 0, int32_t posY = 0) {}
1365    /**
1366     * @brief Set ace ability handler.
1367     *
1368     * @param handler Ace ability handler.
1369     */
1370    virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) {}
1371    /**
1372     * @brief set window ui content
1373     *
1374     * @param contentInfo content info path
1375     * @param env
1376     * @param storage
1377     * @param isDistributed
1378     * @param ability
1379     * @return WMError
1380     */
1381    virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage,
1382        BackupAndRestoreType type = BackupAndRestoreType::NONE, sptr<IRemoteObject> token = nullptr,
1383        AppExecFwk::Ability* ability = nullptr)
1384    {
1385        return WMError::WM_OK;
1386    }
1387    /**
1388     * @brief set window ui content
1389     *
1390     * @param contentInfo content info path
1391     * @param engine
1392     * @param storage
1393     * @param isDistributed
1394     * @param ability
1395     * @return WMError
1396     */
1397    virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage,
1398        AppExecFwk::Ability* ability = nullptr)
1399    {
1400        return WMError::WM_OK;
1401    }
1402    /**
1403     * @brief set window ui content by abc
1404     *
1405     * @param abcPath abc path
1406     * @param env
1407     * @param storage
1408     * @param ability
1409     * @return WMError
1410     */
1411    virtual WMError SetUIContentByAbc(const std::string& abcPath, napi_env env, napi_value storage,
1412        AppExecFwk::Ability* ability = nullptr)
1413    {
1414        return WMError::WM_OK;
1415    }
1416    /**
1417     * @brief Get ui content info.
1418     *
1419     * @return UI content info.
1420     */
1421    virtual std::string GetContentInfo(BackupAndRestoreType type = BackupAndRestoreType::CONTINUATION)
1422    {
1423        return {};
1424    }
1425    /**
1426     * @brief Set uiability restored router stack.
1427     *
1428     * @return WMError.
1429     */
1430    virtual WMError SetRestoredRouterStack(const std::string& routerStack)
1431    {
1432        return WMError::WM_OK;
1433    }
1434    /**
1435     * @brief Get ui content object.
1436     *
1437     * @return UIContent object of ACE.
1438     */
1439    virtual Ace::UIContent* GetUIContent() const { return nullptr; }
1440    /**
1441     * @brief Get ui content object.
1442     *
1443     * @param winId window id.
1444     * @return UIContent object of ACE.
1445     */
1446    virtual Ace::UIContent* GetUIContentWithId(uint32_t winId) const { return nullptr; }
1447    /**
1448     * @brief Window handle new want.
1449     *
1450     * @param want Want object of AAFwk.
1451     */
1452    virtual void OnNewWant(const AAFwk::Want& want) {}
1453    /**
1454     * @brief Set requested orientation.
1455     *
1456     * @param Orientation Screen orientation.
1457     */
1458    virtual void SetRequestedOrientation(Orientation) {}
1459    /**
1460     * @brief Get requested orientation.
1461     *
1462     * @return Orientation screen orientation.
1463     */
1464    virtual Orientation GetRequestedOrientation() { return Orientation::UNSPECIFIED; }
1465    /**
1466     * @brief Set requested mode support info.
1467     *
1468     * @param modeSupportInfo Mode of window supported.
1469     */
1470    virtual void SetRequestModeSupportInfo(uint32_t modeSupportInfo) {}
1471    /**
1472     * @brief Get requested mode support info.
1473     *
1474     * @return Enumeration values under WindowModeSupport.
1475     */
1476    virtual uint32_t GetRequestModeSupportInfo() const { return 0; }
1477    /**
1478     * @brief Set touch hot areas.
1479     *
1480     * @param rects Hot areas of touching.
1481     * @return WM_OK means set success, others means set failed.
1482     */
1483    virtual WMError SetTouchHotAreas(const std::vector<Rect>& rects) { return WMError::WM_OK; }
1484    /**
1485     * @brief Get requested touch hot areas.
1486     *
1487     * @param rects Hot areas of touching.
1488     */
1489    virtual void GetRequestedTouchHotAreas(std::vector<Rect>& rects) const {}
1490    /**
1491     * @brief Main handler available or not.
1492     *
1493     * @return True means main handler is available, false means the opposite.
1494     */
1495    virtual bool IsMainHandlerAvailable() const { return false; }
1496    /**
1497     * @brief Set window label name.
1498     *
1499     * @param label Window label name.
1500     * @return WM_OK means set success, others means set failed.
1501     */
1502    virtual WMError SetAPPWindowLabel(const std::string& label) { return WMError::WM_OK; }
1503    /**
1504     * @brief Set window icon.
1505     *
1506     * @param icon Window icon.
1507     * @return WM_OK means set success, others means set failed.
1508     */
1509    virtual WMError SetAPPWindowIcon(const std::shared_ptr<Media::PixelMap>& icon) { return WMError::WM_OK; }
1510
1511    /**
1512     * @brief disable main window decoration. It must be callled before loadContent.
1513     *
1514     */
1515    virtual WMError DisableAppWindowDecor() { return WMError::WM_OK; }
1516    /**
1517     * @brief return window decoration is enabled. It is called by ACE
1518     *
1519     * @return true means window decoration is enabled. Otherwise disabled
1520     */
1521    virtual bool IsDecorEnable() const { return false; }
1522    /**
1523     * @brief maximize the main window. It is called by ACE when maximize button is clicked.
1524     *
1525     * @return WMError
1526     */
1527    virtual WMError Maximize() { return WMError::WM_OK; }
1528
1529    /**
1530     * @brief maximize window with presentation enum.
1531     *
1532     * @param presentation the value means use presentation enum to layout when maximize window
1533     * @return WM_OK means maximize window ok, others means failed.
1534     */
1535    virtual WMError Maximize(MaximizePresentation presentation)
1536    {
1537        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1538    }
1539
1540    /**
1541     * @brief maximize the main window according to MaximizeMode. called by ACE when maximize button is clicked.
1542     *
1543     * @return WMError
1544     */
1545    virtual WMError MaximizeFloating() {return WMError::WM_OK;}
1546    /**
1547     * @brief minimize the main window. It is called by ACE when minimize button is clicked.
1548     *
1549     * @return WMError
1550     */
1551    virtual WMError Minimize() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1552    /**
1553     * @brief recovery the main window. It is called by ACE when recovery button is clicked.
1554     *
1555     * @return WMError
1556     */
1557    virtual WMError Recover() { return WMError::WM_OK; }
1558
1559    /**
1560     * @brief After the app main window is minimized, if the Ability is not in the backgroud state,
1561     * you can restore app main window.
1562     *
1563     * @return WMError
1564     */
1565    virtual WMError Restore() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1566
1567    /**
1568     * @brief close the main window. It is called by ACE when close button is clicked.
1569     *
1570     * @return WMError
1571     */
1572    virtual WMError Close() { return WMError::WM_OK; }
1573    /**
1574     * @brief start move main window. It is called by ACE when title is moved.
1575     *
1576     */
1577    virtual void StartMove() {}
1578    /**
1579     * @brief get start move flag.
1580     *
1581     * @return true means window is moving. Otherwise is not moving
1582     *
1583     */
1584    virtual bool GetStartMoveFlag() { return false; }
1585    /**
1586     * @brief start move system window. It is called by application.
1587     *
1588     */
1589    virtual WmErrorCode StartMoveSystemWindow() { return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT; }
1590    /**
1591     * @brief Set flag that need remove window input channel.
1592     *
1593     * @param needRemoveWindowInputChannel True means remove input channel, false means not remove.
1594     */
1595    virtual void SetNeedRemoveWindowInputChannel(bool needRemoveWindowInputChannel) {}
1596    /**
1597     * @brief set global window maximize mode. It is called by ACE when maximize mode changed.
1598     *
1599     * @param mode MODE_AVOID_SYSTEM_BAR - avoid statusbar and dockbar; MODE_FULL_FILL - fullfill the screen
1600     *
1601     * @return WMError
1602     */
1603    virtual WMError SetGlobalMaximizeMode(MaximizeMode mode) {return WMError::WM_OK;}
1604    /**
1605     * @brief get global window maximize mode.
1606     *
1607     * @return MaximizeMode
1608     */
1609    virtual MaximizeMode GetGlobalMaximizeMode() const {return MaximizeMode::MODE_FULL_FILL;}
1610
1611    // colorspace, gamut
1612    /**
1613     * @brief Is support wide gamut or not.
1614     *
1615     * @return True means support wide gamut, false means not support.
1616     */
1617    virtual bool IsSupportWideGamut() { return false; }
1618    /**
1619     * @brief Set color space.
1620     *
1621     * @param colorSpace ColorSpace object.
1622     */
1623    virtual void SetColorSpace(ColorSpace colorSpace) {}
1624    /**
1625     * @brief Get color space object.
1626     *
1627     * @return ColorSpace object.
1628     */
1629    virtual ColorSpace GetColorSpace() { return ColorSpace::COLOR_SPACE_DEFAULT; }
1630
1631    virtual void DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) {}
1632    /**
1633     * @brief window snapshot
1634     *
1635     * @return std::shared_ptr<Media::PixelMap> snapshot pixel
1636     */
1637    virtual std::shared_ptr<Media::PixelMap> Snapshot() { return nullptr; }
1638
1639    /**
1640     * @brief Handle and notify memory level.
1641     *
1642     * @param level memory level
1643     * @return the error code of window
1644     */
1645    virtual WMError NotifyMemoryLevel(int32_t level) { return WMError::WM_OK; }
1646
1647    /**
1648     * @brief Update configuration for all windows
1649     *
1650     * @param configuration configuration for app
1651     */
1652    virtual bool IsAllowHaveSystemSubWindow() { return false; }
1653
1654    /**
1655     * @brief Set aspect ratio of this window
1656     *
1657     * @param ratio the aspect ratio of window except decoration
1658     * @return WMError
1659     */
1660    virtual WMError SetAspectRatio(float ratio) { return WMError::WM_OK; }
1661    /**
1662     * @brief Unset aspect ratio
1663     * @return WMError
1664     */
1665    virtual WMError ResetAspectRatio() { return WMError::WM_OK; }
1666    /**
1667     * @brief Get keyboard animation config
1668     * @return KeyboardAnimationConfig
1669     */
1670    virtual KeyboardAnimationConfig GetKeyboardAnimationConfig() { return {}; }
1671    /**
1672     * @brief Set need default animation for window show and hide.
1673     *
1674     * @param needDefaultAnimation True means need default animation, false means not need.
1675     */
1676    virtual void SetNeedDefaultAnimation(bool needDefaultAnimation) {}
1677    /**
1678     * @brief Transfer Ability Result.
1679     * @return WMError
1680     */
1681    virtual WMError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { return WMError::WM_OK; }
1682    /**
1683     * @brief Transfer UIExtension data to Extension Component.
1684     * @return WMError
1685     */
1686    virtual WMError TransferExtensionData(const AAFwk::WantParams& wantParams) { return WMError::WM_OK; }
1687    /**
1688     * @brief Register transfer component data callback.
1689     *
1690     * @param func Function to notify transfer component data.
1691     */
1692    virtual void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) {}
1693    /**
1694     * @brief Trigger BindUIExtensionModal callback.
1695     *        It needs to be called when the UIExtension frame node is set to asynchronously bind to the modal window.
1696     */
1697    virtual void TriggerBindModalUIExtension() {}
1698    /**
1699     * @brief Perform back event.
1700     *
1701     */
1702    virtual void PerformBack() {}
1703    /**
1704     * @brief Set the drag enabled flag of a window.
1705     *
1706     * @param dragEnabled true means the window can be resized by dragging, otherwise means the opposite.
1707     * @return Errorcode of window.
1708     */
1709    virtual WMError SetResizeByDragEnabled(bool dragEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1710    /**
1711     * @brief Set the raise enabled flag of a window.
1712     *
1713     * @param raiseEnabled true means the window can be raised by click, otherwise means the opposite.
1714     * @return Errorcode of window.
1715     */
1716    virtual WMError SetRaiseByClickEnabled(bool raiseEnabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1717    /**
1718     * @brief Raise one app sub window above another.
1719     *
1720     * @return WM_OK means raise success, others means raise failed.
1721     */
1722    virtual WMError RaiseAboveTarget(int32_t subWindowId) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1723
1724    /**
1725     * @brief Hide non-system floating windows.
1726     *
1727     * @param shouldHide true means the non-system windows should be hidden, otherwise means the opposite.
1728     * @return Errorcode of window.
1729     */
1730    virtual WMError HideNonSystemFloatingWindows(bool shouldHide) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1731
1732    /**
1733     * @brief Is floating window of app type or not.
1734     *
1735     * @return True means floating window of app type, false means the opposite.
1736     */
1737    virtual bool IsFloatingWindowAppType() const { return false; }
1738
1739    /**
1740     * @brief Is pc window of app type or not.
1741     *
1742     * @return True means pc window of app type, false means the opposite.
1743     */
1744    virtual bool IsPcOrPadCapabilityEnabled() const { return false; }
1745
1746    /**
1747     * @brief Is pc window or pad free multi-window.
1748     *
1749     * @return True means pc window or pad free multi-window, false means the opposite.
1750     */
1751    virtual bool IsPcOrPadFreeMultiWindowMode() const { return false; }
1752
1753    /**
1754     * @brief Register transfer component data callback.
1755     *
1756     * @param func Function to notify transfer component data.
1757     */
1758    virtual void RegisterTransferComponentDataForResultListener(const NotifyTransferComponentDataForResultFunc& func) {}
1759
1760    /**
1761     * @brief Set Text Field Avoid Info.
1762     *
1763     * @return Errorcode of window.
1764     */
1765    virtual WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) { return WMError::WM_OK; }
1766
1767    /**
1768     * @brief Transfer accessibility event data
1769     *
1770     * @param func Function to notify transfer component data.
1771    */
1772    virtual WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
1773        int64_t uiExtensionIdLevel) { return WMError::WM_OK; };
1774
1775    /**
1776     * @brief Notify prepare to close window
1777     *
1778     * @return Errorcode of window.
1779     */
1780    virtual WMError NotifyPrepareClosePiPWindow() { return WMError::WM_OK; }
1781
1782    /**
1783     * @brief update the pip window instance (w,h,r).
1784     *
1785     * @param width width of pip window.
1786     * @param height width of pip window.
1787     * @param reason reason of update.
1788     */
1789    virtual void UpdatePiPRect(const Rect& rect, WindowSizeChangeReason reason) {}
1790
1791    /**
1792     * @brief update the pip control status.
1793     *
1794     * @param controlType pip control type.
1795     * @param status pip control status.
1796     */
1797    virtual void UpdatePiPControlStatus(PiPControlType controlType, PiPControlStatus status) {}
1798
1799    /**
1800     * @brief set auto start status for window.
1801     *
1802     * @param isAutoStart true means auto start pip window when background, otherwise means the opposite.
1803     */
1804    virtual void SetAutoStartPiP(bool isAutoStart) {}
1805
1806    /**
1807     * @brief When get focused, keep the keyboard created by other windows, support system window and app subwindow.
1808     *
1809     * @param keepKeyboardFlag true means the keyboard should be preserved, otherwise means the opposite.
1810     * @return WM_OK means set keep keyboard flag success, others means failed.
1811    */
1812    virtual WmErrorCode KeepKeyboardOnFocus(bool keepKeyboardFlag)
1813    {
1814        return WmErrorCode::WM_ERROR_DEVICE_NOT_SUPPORT;
1815    }
1816
1817    /**
1818     * @brief Register window visibility change listener.
1819     *
1820     * @param listener IWindowVisibilityChangedListener.
1821     * @return WM_OK means register success, others means register failed.
1822     */
1823    virtual WMError RegisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener)
1824    {
1825        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1826    }
1827
1828    /**
1829     * @brief Unregister window visibility change listener.
1830     *
1831     * @param listener IWindowVisibilityChangedListener.
1832     * @return WM_OK means unregister success, others means unregister failed.
1833     */
1834    virtual WMError UnregisterWindowVisibilityChangeListener(const IWindowVisibilityListenerSptr& listener)
1835    {
1836        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1837    }
1838
1839    /**
1840     * @brief Get the window limits of current window.
1841     *
1842     * @param windowLimits.
1843     * @return WMError.
1844     */
1845    virtual WMError GetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1846
1847    /**
1848     * @brief Set the window limits of current window.
1849     *
1850     * @param windowLimits.
1851     * @return WMError.
1852     */
1853    virtual WMError SetWindowLimits(WindowLimits& windowLimits) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1854
1855    /**
1856     * @brief Register listener, if timeout(seconds) pass with no interaction, the listener will be executed.
1857     *
1858     * @param listener IWindowNoInteractionListenerSptr.
1859     * @return WM_OK means unregister success, others means unregister failed.
1860     */
1861    virtual WMError RegisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener)
1862    {
1863        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1864    }
1865
1866    /**
1867     * @brief Unregister window no interaction listener.
1868     *
1869     * @param listener IWindowNoInteractionListenerSptr.
1870     * @return WM_OK means unregister success, others means unregister failed.
1871     */
1872    virtual WMError UnregisterWindowNoInteractionListener(const IWindowNoInteractionListenerSptr& listener)
1873    {
1874        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1875    }
1876
1877    /**
1878     * @brief Register window status change listener.
1879     *
1880     * @param listener IWindowStatusChangeListener.
1881     * @return WM_OK means register success, others means register failed.
1882     */
1883    virtual WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener)
1884    {
1885        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1886    }
1887    /**
1888     * @brief Unregister window status change listener.
1889     *
1890     * @param listener IWindowStatusChangeListener.
1891     * @return WM_OK means unregister success, others means unregister failed.
1892     */
1893    virtual WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener)
1894    {
1895        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1896    }
1897
1898    /**
1899     * @brief Set Specific System Bar(include status bar and nav bar) Property
1900     *
1901     * @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR
1902     * @param property system bar prop,include content color, background color
1903     * @return WMError
1904     */
1905    virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
1906    {
1907        return WMError::WM_OK;
1908    }
1909
1910    /**
1911     * @brief Set System Bar(include status bar and nav bar) Properties
1912     *
1913     * @param properties system bar properties
1914     * @param propertyFlags flags of system bar property
1915     * @return WMError
1916     */
1917    virtual WMError SetSystemBarProperties(const std::map<WindowType, SystemBarProperty>& properties,
1918        const std::map<WindowType, SystemBarPropertyFlag>& propertyFlags)
1919    {
1920        return WMError::WM_OK;
1921    }
1922
1923    /**
1924     * @brief Get System Bar(include status bar and nav bar) Properties
1925     *
1926     * @param properties system bar properties got
1927     * @return WMError
1928     */
1929    virtual WMError GetSystemBarProperties(std::map<WindowType, SystemBarProperty>& properties)
1930    {
1931        return WMError::WM_OK;
1932    }
1933
1934    /**
1935     * @brief Set the single frame composer enabled flag of a window.
1936     *
1937     * @param enable true means the single frame composer is enabled, otherwise means the opposite.
1938     * @return Errorcode of window.
1939     */
1940    virtual WMError SetSingleFrameComposerEnabled(bool enable) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1941
1942    /**
1943     * @brief Set the visibility of window decor.
1944     *
1945     * @param isVisible whether the window decor is visible.
1946     * @return Errorcode of window.
1947     */
1948    virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1949
1950    /**
1951     * @brief Set window container color.
1952     *
1953     * @param activeColor Background active color.
1954     * @param inactiveColor Background active color.
1955     * @return Errorcode of window.
1956     */
1957    virtual WMError SetWindowContainerColor(const std::string& activeColor, const std::string& inactiveColor)
1958    {
1959        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1960    }
1961
1962    /**
1963     * @brief Enable drag window.
1964     *
1965     * @param enableDrag The value true means to enable window dragging, and false means the opposite.
1966     * @return Errorcode of window.
1967     */
1968    virtual WMError EnableDrag(bool enableDrag) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1969
1970    /**
1971     * @brief Set whether to display the maximize, minimize, split buttons of main window.
1972     *
1973     * @param isMaximizeVisible Display maximize button if true, or hide maximize button if false.
1974     * @param isMinimizeVisible Display minimize button if true, or hide minimize button if false.
1975     * @param isSplitVisible Display split button if true, or hide split button if false.
1976     * @param isCloseVisible Display close button if true, or hide close button if false.
1977     * @return Errorcode of window.
1978     */
1979    virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
1980        bool isCloseVisible)
1981    {
1982        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
1983    }
1984
1985    /**
1986     * @brief Set decor height of window.
1987     *
1988     * @param decorHeight Decor height of window
1989     * @return WM_OK means set success, others means set failed.
1990     */
1991    virtual WMError SetDecorHeight(int32_t decorHeight) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1992
1993    /**
1994     * @brief Get decor height of window.
1995     *
1996     * @return Decor height of window.
1997     */
1998    virtual WMError GetDecorHeight(int32_t& height) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
1999
2000    /**
2001     * @brief Get the title buttons area of window.
2002     *
2003     * @param titleButtonRect.
2004     * @return WMError.
2005    */
2006    virtual WMError GetTitleButtonArea(TitleButtonRect& titleButtonRect)
2007    {
2008        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2009    }
2010
2011    /**
2012     * @brief Register window title buttons change listener.
2013     *
2014     * @param listener IWindowTitleButtonRectChangedListener.
2015     * @return WM_OK means register success, others means register failed.
2016     */
2017    virtual WMError RegisterWindowTitleButtonRectChangeListener(
2018        const sptr<IWindowTitleButtonRectChangedListener>& listener)
2019    {
2020        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2021    }
2022
2023    /**
2024     * @brief Unregister window title buttons change listener.
2025     *
2026     * @param listener IWindowTitleButtonRectChangedListener.
2027     * @return WM_OK means unregister success, others means unregister failed.
2028     */
2029    virtual WMError UnregisterWindowTitleButtonRectChangeListener(
2030        const sptr<IWindowTitleButtonRectChangedListener>& listener)
2031    {
2032        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2033    }
2034
2035    /**
2036     * @brief Set whether to use default density.
2037     *
2038     * @param enabled bool.
2039     * @return WM_OK means set success, others means failed.
2040     */
2041    virtual WMError SetDefaultDensityEnabled(bool enabled) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2042
2043    /**
2044     * @brief Get whether to use default density.
2045     *
2046     * @return True means use default density, window's layout not follow to system change, false means the opposite.
2047     */
2048    virtual bool GetDefaultDensityEnabled() { return false; }
2049
2050    /**
2051     * @brief Get virtual pixel ratio.
2052     *
2053     * @return Value of PixelRatio obtained from displayInfo.
2054     */
2055    virtual float GetVirtualPixelRatio() { return 0.0f; }
2056
2057    /**
2058     * @brief Hide None Secure Windows.
2059     *
2060     * @param shouldHide bool.
2061     * @return WMError
2062     */
2063    virtual WMError HideNonSecureWindows(bool shouldHide)
2064    {
2065        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2066    }
2067
2068    /**
2069     * @brief Set water mark flag.
2070     *
2071     * @param isEnable bool.
2072     * @return WMError
2073     */
2074    virtual WMError SetWaterMarkFlag(bool isEnable)
2075    {
2076        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2077    }
2078
2079    /**
2080     * @brief Hide the display content when snapshot.
2081     *
2082     * @param needHide bool.
2083     * @return WMError
2084     */
2085    virtual WMError HidePrivacyContentForHost(bool needHide)
2086    {
2087        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2088    }
2089
2090    /**
2091     * @brief Set the modality of window.
2092     *
2093     * @param isModal bool.
2094     * @param modalityType ModalityType.
2095     * @return WMError
2096     */
2097    virtual WMError SetSubWindowModal(bool isModal, ModalityType modalityType = ModalityType::WINDOW_MODALITY)
2098    {
2099        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2100    }
2101
2102    /**
2103     * @brief recovery the main window by function overloading. It is called by JsWindow.
2104     *
2105     * @param reason reason of update.
2106     * @return WMError
2107     */
2108    virtual WMError Recover(uint32_t reason) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2109
2110    /**
2111     * @brief Get the rect of host window.
2112     *
2113     * @param hostWindowId window Id of the host window.
2114     * @return Rect of window.
2115     */
2116    virtual Rect GetHostWindowRect(int32_t hostWindowId) { return {}; }
2117
2118    /**
2119     * @brief Make multi-window become landscape or not.
2120     *
2121     * @param isLandscapeMultiWindow means whether multi-window's scale is landscape.
2122     * @return WMError WM_OK means set success, others means failed.
2123     */
2124    virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) { return WMError::WM_OK; }
2125
2126    /**
2127     * @brief Register subwindow close listener.
2128     *
2129     * @param listener ISubWindowCloseListener.
2130     * @return WM_OK means register success, others means register failed.
2131     */
2132    virtual WMError RegisterSubWindowCloseListeners(
2133        const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2134
2135    /**
2136     * @brief Unregister subwindow close listener.
2137     *
2138     * @param listener ISubWindowCloseListeners.
2139     * @return WM_OK means unregister success, others means unregister failed.
2140     */
2141    virtual WMError UnregisterSubWindowCloseListeners(
2142        const sptr<ISubWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2143
2144    /**
2145     * @brief Register main window close listener.
2146     *
2147     * @param listener IMainWindowCloseListener.
2148     * @return WM_OK means register success, others means register failed.
2149     */
2150    virtual WMError RegisterMainWindowCloseListeners(
2151        const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2152
2153    /**
2154     * @brief Unregister main window close listener.
2155     *
2156     * @param listener IMainWindowCloseListener.
2157     * @return WM_OK means unregister success, others means unregister failed.
2158     */
2159    virtual WMError UnregisterMainWindowCloseListeners(
2160        const sptr<IMainWindowCloseListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2161
2162    /**
2163     * @brief Register switch free multi-window listener.
2164     *
2165     * @param listener ISwitchFreeMultiWindowListener.
2166     * @return WM_OK means register success, others means register failed.
2167     */
2168    virtual WMError RegisterSwitchFreeMultiWindowListener(
2169        const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2170
2171    /**
2172     * @brief Unregister switch free multi-window listener.
2173     *
2174     * @param listener ISwitchFreeMultiWindowListener.
2175     * @return WM_OK means unregister success, others means unregister failed.
2176     */
2177    virtual WMError UnregisterSwitchFreeMultiWindowListener(
2178        const sptr<ISwitchFreeMultiWindowListener>& listener) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2179
2180    /**
2181     * @brief Set Shaped Window Mask.
2182     *
2183     * @param windowMask Mask of the shaped window.
2184     * @return WM_OK means set success, others means failed.
2185     */
2186    virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask)
2187    {
2188        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2189    }
2190
2191    /**
2192     * @brief Register keyboard panel info change listener.
2193     *
2194     * @param listener IKeyboardPanelInfoChangeListener.
2195     * @return WM_OK means register success, others means register failed.
2196     */
2197    virtual WMError RegisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener)
2198    {
2199        return WMError::WM_OK;
2200    }
2201
2202    /**
2203     * @brief Unregister keyboard panel info change listener.
2204     *
2205     * @param listener IKeyboardPanelInfoChangeListener.
2206     * @return WM_OK means unregister success, others means unregister failed.
2207     */
2208    virtual WMError UnregisterKeyboardPanelInfoChangeListener(const sptr<IKeyboardPanelInfoChangeListener>& listener)
2209    {
2210        return WMError::WM_OK;
2211    }
2212
2213    /**
2214     * @brief Get window by id
2215     *
2216     * @param windId window id
2217     * @return sptr<Window>
2218     */
2219    static sptr<Window> GetWindowWithId(uint32_t windId);
2220
2221    /**
2222     * @brief register keyEvent filter.
2223     *
2224     * @param KeyEventFilterFunc callback func when window recieve keyEvent
2225     * @return WMError
2226     */
2227    virtual WMError SetKeyEventFilter(KeyEventFilterFunc KeyEventFilterFunc)
2228    {
2229        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2230    }
2231
2232    /**
2233     * @brief clear keyEvent filter.
2234     *
2235     * @return WMError
2236    */
2237    virtual WMError ClearKeyEventFilter() { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;}
2238
2239    /**
2240     * @brief Register window rect change listener.
2241     *
2242     * @param listener IWindowRectChangeListener.
2243     * @return WM_OK means register success, others means register failed.
2244     */
2245    virtual WMError RegisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener)
2246    {
2247        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2248    }
2249
2250    /**
2251     * @brief Unregister window rect change listener.
2252     *
2253     * @param listener IWindowRectChangeListener.
2254     * @return WM_OK means unregister success, others means unregister failed.
2255     */
2256    virtual WMError UnregisterWindowRectChangeListener(const sptr<IWindowRectChangeListener>& listener)
2257    {
2258        return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
2259    }
2260
2261    /**
2262     * @brief get callingWindow windowStatus.
2263     * @param windowStatus
2264     * @return WM_OK means set success, others means set Failed.
2265     */
2266    virtual WMError GetCallingWindowWindowStatus(WindowStatus& windowStatus) const
2267    {
2268        return WMError::WM_OK;
2269    }
2270
2271    /**
2272     * @brief get callingWindow windowStatus
2273     * @param rect.
2274     * @return WM_OK means set success, others means set failed
2275     */
2276    virtual WMError GetCallingWindowRect(Rect& rect) const
2277    {
2278        return WMError::WM_OK;
2279    }
2280
2281    /**
2282     * @brief Set gray scale of window
2283     * @param grayScale gray scale of window.
2284     * @return WM_OK means set success, others means set failed.
2285     */
2286    virtual WMError SetGrayScale(float grayScale) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2287
2288    /**
2289     * @brief adjust keyboard layout
2290     * @param params
2291     * @return WM_OK means set success, others means set failed
2292     */
2293    virtual WMError AdjustKeyboardLayout(const KeyboardLayoutParams& params) { return WMError::WM_OK; }
2294
2295    /*
2296     * @brief Set the Dvsync Switch
2297     *
2298     * @param dvsyncSwitch bool.
2299     * @return * void
2300     */
2301    virtual void SetUiDvsyncSwitch(bool dvsyncSwitch) {}
2302
2303    /**
2304     * @brief Set whether to enable immersive mode.
2305     * @param enable the value true means to enable immersive mode, and false means the opposite.
2306     * @return WM_OK means set success, others means set failed.
2307     */
2308    virtual WMError SetImmersiveModeEnabledState(bool enable) { return WMError::WM_OK; }
2309
2310    /**
2311     * @brief Get whether the immersive mode is enabled or not.
2312     *
2313     * @return true means the immersive mode is enabled, and false means the opposite.
2314     */
2315    virtual bool GetImmersiveModeEnabledState() const { return true; }
2316
2317    /**
2318     * @brief Get the height of status bar.
2319     *
2320     * @return the height of status bar.
2321     */
2322    virtual uint32_t GetStatusBarHeight() { return 0; }
2323
2324    /**
2325     * @brief Get whether the free multi-window mode is enabled or not.
2326     *
2327     * @return true means the free multi-window mode is enabled, and false means the opposite.
2328     */
2329    virtual bool GetFreeMultiWindowModeEnabledState() { return false; }
2330
2331    /**
2332     * @brief Get the window status of current window.
2333     *
2334     * @param windowStatus
2335     * @return WMError.
2336     */
2337    virtual WMError GetWindowStatus(WindowStatus& windowStatus) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
2338
2339    /**
2340     * @brief Set the ContinueState of window.
2341     *
2342     * @param continueState of the window.
2343     * @return Errorcode of window.
2344     */
2345    virtual WMError SetContinueState(int32_t continueState) { return WMError::WM_DO_NOTHING; }
2346
2347    /**
2348     * @brief Notify host that UIExtension timeout
2349     *
2350     * @param errorCode error code when UIExtension timeout
2351     */
2352    virtual void NotifyExtensionTimeout(int32_t errorCode) {}
2353
2354    /*
2355     * @brief Get the real parent id of UIExtension
2356     *
2357     * @return Real parent id of UIExtension
2358     */
2359    virtual int32_t GetRealParentId() const { return static_cast<int32_t>(INVALID_WINDOW_ID); }
2360
2361    /*
2362     * @brief Get the parent window type of UIExtension
2363     *
2364     * @return Parent window type of UIExtension
2365     */
2366    virtual WindowType GetParentWindowType() const { return WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; }
2367
2368    /**
2369     * @brief Notify modal UIExtension it may be covered
2370     *
2371     * @param byLoadContent True when called by loading content, false when called by creating non topmost subwindow
2372     */
2373    virtual void NotifyModalUIExtensionMayBeCovered(bool byLoadContent) {}
2374
2375    /**
2376     * @brief Notify extension asynchronously
2377     *
2378     * @param notifyEvent event type
2379     * @return * void
2380     */
2381    virtual void NotifyExtensionEventAsync(uint32_t notifyEvent) {}
2382
2383    /**
2384     * @brief Get isUIExtFirstSubWindow flag
2385     *
2386     * @return true - is the first sub window of UIExtension, false - is not the first sub window of UIExtension
2387     */
2388    virtual bool GetIsUIExtFirstSubWindow() const { return false; }
2389
2390    /**
2391     * @brief Get whether this window is a sub window of any level of UIExtension.
2392     *
2393     * @return true - is UIExtension sub window, false - is not UIExtension sub window.
2394     */
2395    virtual bool GetIsUIExtAnySubWindow() const { return false; }
2396
2397    /**
2398     * @brief Set whether to enable gesture back.
2399     * @param enable the value true means to enable gesture back, and false means the opposite.
2400     * @return WM_OK means set success, others means set failed.
2401     */
2402    virtual WMError SetGestureBackEnabled(bool enable) { return WMError::WM_OK; }
2403
2404    /**
2405     * @brief Get whether the gesture back is enabled or not.
2406     *
2407     * @return the value true means to enable gesture back, and false means the opposite.
2408     */
2409    virtual bool GetGestureBackEnabled() const { return true; }
2410};
2411}
2412}
2413#endif // OHOS_ROSEN_WINDOW_H
2414