1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
17#define OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
18
19#include <inttypes.h>
20#include <iomanip>
21#include <map>
22#include <sstream>
23#include <string>
24
25#include <iremote_broker.h>
26#include <want.h>
27
28namespace OHOS::AAFwk {
29class AbilityStartSetting;
30class ProcessOptions;
31class StartWindowOption;
32}
33namespace OHOS::AppExecFwk {
34struct AbilityInfo;
35}
36
37namespace OHOS::Rosen {
38class RSTransaction;
39constexpr int32_t ROTATE_ANIMATION_DURATION = 400;
40constexpr int32_t INVALID_SESSION_ID = 0;
41
42enum class WSError : int32_t {
43    WS_OK = 0,
44    WS_DO_NOTHING,
45    WS_ERROR_NO_MEM,
46    WS_ERROR_DESTROYED_OBJECT,
47    WS_ERROR_INVALID_WINDOW,
48    WS_ERROR_INVALID_WINDOW_MODE_OR_SIZE,
49    WS_ERROR_INVALID_OPERATION,
50    WS_ERROR_INVALID_PERMISSION,
51    WS_ERROR_NOT_SYSTEM_APP,
52    WS_ERROR_NO_REMOTE_ANIMATION,
53    WS_ERROR_INVALID_DISPLAY,
54    WS_ERROR_INVALID_PARENT,
55    WS_ERROR_OPER_FULLSCREEN_FAILED,
56    WS_ERROR_REPEAT_OPERATION,
57    WS_ERROR_INVALID_SESSION,
58    WS_ERROR_INVALID_CALLING,
59    WS_ERROR_UNCLEARABLE_SESSION,
60    WS_ERROR_FAIL_TO_GET_SNAPSHOT,
61    WS_ERROR_INTERNAL_ERROR,
62    WS_ERROR_NO_UI_CONTENT_ERROR,
63
64    WS_ERROR_DEVICE_NOT_SUPPORT = 801, // the value do not change.It is defined on all system
65
66    WS_ERROR_NEED_REPORT_BASE = 1000, // error code > 1000 means need report
67    WS_ERROR_NULLPTR,
68    WS_ERROR_INVALID_TYPE,
69    WS_ERROR_INVALID_PARAM,
70    WS_ERROR_SAMGR,
71    WS_ERROR_IPC_FAILED,
72    WS_ERROR_NEED_REPORT_END,
73    WS_ERROR_START_ABILITY_FAILED,
74    WS_ERROR_SET_SESSION_LABEL_FAILED,
75    WS_ERROR_SET_SESSION_ICON_FAILED,
76    WS_ERROR_INVALID_SESSION_LISTENER,
77    WS_ERROR_START_UI_EXTENSION_ABILITY_FAILED,
78    WS_ERROR_MIN_UI_EXTENSION_ABILITY_FAILED,
79    WS_ERROR_TERMINATE_UI_EXTENSION_ABILITY_FAILED,
80    WS_ERROR_PRE_HANDLE_COLLABORATOR_FAILED,
81
82    WS_ERROR_EDM_CONTROLLED = 2097215, // enterprise limit
83};
84
85enum class WSErrorCode : int32_t {
86    WS_OK = 0,
87    WS_ERROR_NO_PERMISSION = 201,
88    WS_ERROR_INVALID_PARAM = 401,
89    WS_ERROR_DEVICE_NOT_SUPPORT = 801,
90    WS_ERROR_TIMEOUT = 901,
91    WS_ERROR_NOT_REGISTER_SYNC_CALLBACK = 100011,
92    WS_ERROR_TRANSFER_DATA_FAILED       = 100012,
93    WS_ERROR_REPEAT_OPERATION = 1300001,
94    WS_ERROR_STATE_ABNORMALLY = 1300002,
95    WS_ERROR_SYSTEM_ABNORMALLY = 1300003,
96    WS_ERROR_INVALID_CALLING = 1300004,
97    WS_ERROR_STAGE_ABNORMALLY = 1300005,
98    WS_ERROR_CONTEXT_ABNORMALLY = 1300006,
99
100    WS_ERROR_EDM_CONTROLLED = 16000013, // enterprise limit
101};
102
103const std::map<WSError, WSErrorCode> WS_JS_TO_ERROR_CODE_MAP {
104    { WSError::WS_OK,                    WSErrorCode::WS_OK },
105    { WSError::WS_DO_NOTHING,            WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
106    { WSError::WS_ERROR_INVALID_SESSION, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
107    { WSError::WS_ERROR_INVALID_PARAM, WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
108    { WSError::WS_ERROR_IPC_FAILED,      WSErrorCode::WS_ERROR_SYSTEM_ABNORMALLY },
109    { WSError::WS_ERROR_NULLPTR,         WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
110    { WSError::WS_ERROR_EDM_CONTROLLED,  WSErrorCode::WS_ERROR_EDM_CONTROLLED },
111    { WSError::WS_ERROR_INVALID_WINDOW,  WSErrorCode::WS_ERROR_STATE_ABNORMALLY },
112};
113
114enum class SessionState : uint32_t {
115    STATE_DISCONNECT = 0,
116    STATE_CONNECT,
117    STATE_FOREGROUND,
118    STATE_ACTIVE,
119    STATE_INACTIVE,
120    STATE_BACKGROUND,
121    STATE_END,
122};
123
124enum ContinueState {
125    CONTINUESTATE_UNKNOWN = -1,
126    CONTINUESTATE_ACTIVE = 0,
127    CONTINUESTATE_INACTIVE = 1,
128    CONTINUESTATE_MAX
129};
130
131enum class StartMethod : int32_t {
132    START_NORMAL,
133    START_CALL
134};
135
136/**
137 * @brief collaborator type.
138 */
139enum CollaboratorType : int32_t {
140    DEFAULT_TYPE = 0,
141    RESERVE_TYPE,
142    OTHERS_TYPE,
143};
144
145enum AncoSceneState: int32_t {
146    DEFAULT_STATE = 0,
147    NOTIFY_START,
148    NOTIFY_CREATE,
149    NOTIFY_LOAD,
150    NOTIFY_UPDATE,
151    NOTIFY_FOREGROUND,
152};
153
154/**
155 * @brief collaborator type.
156 */
157enum SessionOperationType : int32_t {
158    TYPE_DEFAULT = 0,
159    TYPE_CLEAR,
160};
161
162enum class ManagerState : uint32_t {
163    MANAGER_STATE_SCREEN_LOCKED = 0,
164};
165
166/**
167 * @brief Enumerates picture in picture control status.
168 */
169enum class WsPiPControlStatus : int32_t {
170    PLAY = 1,
171    PAUSE = 0,
172    OPEN = 1,
173    CLOSE = 0,
174    ENABLED = -2,
175    DISABLED = -3,
176};
177
178/**
179 * @brief Enumerates picture in picture control type.
180 */
181enum class WsPiPControlType : uint32_t {
182    VIDEO_PLAY_PAUSE = 0,
183    VIDEO_PREVIOUS = 1,
184    VIDEO_NEXT = 2,
185    FAST_FORWARD = 3,
186    FAST_BACKWARD = 4,
187    HANG_UP_BUTTON = 5,
188    MICROPHONE_SWITCH = 6,
189    CAMERA_SWITCH = 7,
190    MUTE_SWITCH = 8,
191    END,
192};
193
194enum class FocusChangeReason {
195    /**
196     * default focus change reason
197     */
198    DEFAULT = 0,
199    /**
200     * focus change for move up
201     */
202    MOVE_UP,
203    /**
204     * focus change for click
205     */
206    CLICK,
207    /**
208     * focus change for foreground
209     */
210    FOREGROUND,
211    /**
212     * focus change for background
213     */
214    BACKGROUND,
215    /**
216     * focus change for split screen.5
217     */
218    SPLIT_SCREEN,
219    /**
220     * focus change for full screen
221     */
222    FULL_SCREEN,
223    /**
224     * focus change for global search
225     */
226    SCB_SESSION_REQUEST,
227    /**
228     * focus change for floating scene
229     */
230    FLOATING_SCENE,
231    /**
232     * focus change for losing focus
233     */
234    SCB_SESSION_REQUEST_UNFOCUS,
235    /**
236     * focus change for client requerst.10
237     */
238    CLIENT_REQUEST,
239    /**
240     * focus change for wind
241     */
242    WIND,
243    /**
244     * focus change for app foreground
245     */
246    APP_FOREGROUND,
247    /**
248     * focus change for app background
249     */
250    APP_BACKGROUND,
251    /**
252     * focus change for recent,Multitasking
253     */
254    RECENT,
255    /**
256     * focus change for inner app.
257     */
258    SCB_START_APP,
259    /**
260     * focus for setting focuable.
261     */
262    FOCUSABLE,
263    /**
264     * select last focused app when requestSessionUnFocus.
265     */
266    LAST_FOCUSED_APP,
267    /**
268     * focus for zOrder pass through VOICE_INTERACTION.
269     */
270    VOICE_INTERACTION,
271    /**
272     * focus change max.
273     */
274    MAX,
275};
276
277enum class SceneType : uint8_t {
278    DEFAULT = 0,
279    WINDOW_SCENE,
280    SYSTEM_WINDOW_SCENE,
281    TRANSFORM_SCENE,
282    PANEL_SCENE,
283    INPUT_SCENE,
284};
285
286struct SessionViewportConfig {
287    bool isDensityFollowHost_ = false;
288    float density_ = 1.0f; // Indicates the host's density, if following the host, use it, otherwise get it from DMS.
289    uint64_t displayId_ = 0;
290    int32_t orientation_ = 0;
291    uint32_t transform_ = 0;
292};
293
294struct SessionInfo {
295    std::string bundleName_ = "";
296    std::string moduleName_ = "";
297    std::string abilityName_ = "";
298    int32_t appIndex_ = 0;
299    bool isSystem_ = false;
300    SceneType sceneType_ = SceneType::WINDOW_SCENE;
301    uint32_t windowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW
302    sptr<IRemoteObject> callerToken_ = nullptr;
303    sptr<IRemoteObject> rootToken_ = nullptr;
304    uint64_t screenId_ = -1;
305    bool isPersistentRecover_ = false;
306    bool isFromIcon_ = false;
307
308    mutable std::shared_ptr<AAFwk::Want> want = nullptr; // want for ability start
309    std::shared_ptr<AAFwk::Want> closeAbilityWant = nullptr;
310    std::shared_ptr<AAFwk::AbilityStartSetting> startSetting = nullptr;
311    std::shared_ptr<AAFwk::ProcessOptions> processOptions = nullptr;
312    std::shared_ptr<AAFwk::StartWindowOption> startWindowOption = nullptr;
313    mutable std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo = nullptr;
314    int32_t resultCode = -1;
315    int32_t requestCode = -1;
316    int32_t errorCode = -1;
317    std::string errorReason = "";
318    int32_t persistentId_ = INVALID_SESSION_ID;
319    int32_t callerPersistentId_ = INVALID_SESSION_ID;
320    std::string callerBundleName_ = "";
321    std::string callerAbilityName_ = "";
322    uint32_t callState_ = 0;
323    uint32_t callingTokenId_ = 0;
324    bool reuse = false;
325    int32_t windowMode = 0;
326    StartMethod startMethod = StartMethod::START_NORMAL;
327    bool lockedState = false;
328    std::string time = "";
329    ContinueState continueState = ContinueState::CONTINUESTATE_ACTIVE;
330    int64_t uiAbilityId_ = 0;
331    int32_t ancoSceneState = 0;
332    bool isClearSession = false;
333    std::string sessionAffinity = "";
334    int32_t collaboratorType_ = CollaboratorType::DEFAULT_TYPE;
335    SessionState sessionState_ = SessionState::STATE_DISCONNECT;
336    uint32_t requestOrientation_ = 0;
337    bool isRotable_ = false;
338    bool isSetPointerAreas_ = false;
339    bool isCastSession_ = false;
340    uint32_t windowInputType_ = 0;
341    std::string continueSessionId_ = "";
342    bool isCalledRightlyByCallerId_ = false;
343    bool fullScreenStart_ = false;
344    bool isAtomicService_ = false;
345    bool isBackTransition_ = false;
346    bool needClearInNotShowRecent_ = false;
347
348    /*
349     * UIExtension
350     */
351    int32_t realParentId_ = INVALID_SESSION_ID;
352    uint32_t uiExtensionUsage_ = 0;
353    bool isAsyncModalBinding_ = false;
354    uint32_t parentWindowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW
355    SessionViewportConfig config_;
356
357    /*
358     * Multi instance
359     */
360    bool isNewAppInstance_ = false;
361    std::string appInstanceKey_;
362};
363
364enum class SessionFlag : uint32_t {
365    SESSION_FLAG_NEED_AVOID = 1,
366    SESSION_FLAG_PARENT_LIMIT = 1 << 1,
367    SESSION_FLAG_SHOW_WHEN_LOCKED = 1 << 2,
368    SESSION_FLAG_FORBID_SPLIT_MOVE = 1 << 3,
369    SESSION_FLAG_WATER_MARK = 1 << 4,
370    SESSION_FLAG_END = 1 << 5,
371};
372
373enum class SizeChangeReason : uint32_t {
374    UNDEFINED = 0,
375    MAXIMIZE,
376    RECOVER,
377    ROTATION,
378    DRAG,
379    DRAG_START,
380    DRAG_END,
381    RESIZE,
382    MOVE,
383    HIDE,
384    TRANSFORM,
385    CUSTOM_ANIMATION_SHOW,
386    FULL_TO_SPLIT,
387    SPLIT_TO_FULL,
388    FULL_TO_FLOATING,
389    FLOATING_TO_FULL,
390    PIP_START,
391    PIP_SHOW,
392    PIP_AUTO_START,
393    PIP_RATIO_CHANGE,
394    PIP_RESTORE,
395    END,
396};
397
398enum class SessionEvent : uint32_t {
399    EVENT_MAXIMIZE = 100,
400    EVENT_RECOVER,
401    EVENT_MINIMIZE,
402    EVENT_CLOSE,
403    EVENT_START_MOVE,
404    EVENT_END_MOVE,
405    EVENT_MAXIMIZE_FLOATING,
406    EVENT_TERMINATE,
407    EVENT_EXCEPTION,
408    EVENT_SPLIT_PRIMARY,
409    EVENT_SPLIT_SECONDARY,
410    EVENT_DRAG_START,
411    EVENT_DRAG,
412};
413
414enum class BrokerStates: uint32_t {
415    BROKER_UNKOWN = 1,
416    BROKER_STARTED = 0,
417    BROKER_NOT_START = -1,
418};
419
420inline bool GreatOrEqual(double left, double right)
421{
422    constexpr double epsilon = -0.00001f;
423    return (left - right) > epsilon;
424}
425
426inline bool LessOrEqual(double left, double right)
427{
428    constexpr double epsilon = 0.00001f;
429    return (left - right) < epsilon;
430}
431
432inline bool NearEqual(const double left, const double right, const double epsilon)
433{
434    return (std::fabs(left - right) <= epsilon);
435}
436
437inline bool NearEqual(const float& left, const float& right)
438{
439    constexpr double epsilon = 0.001f;
440    return NearEqual(left, right, epsilon);
441}
442
443inline bool NearEqual(const int32_t& left, const int32_t& right)
444{
445    return left == right;
446}
447
448inline bool NearZero(const double left)
449{
450    constexpr double epsilon = 0.001f;
451    return NearEqual(left, 0.0, epsilon);
452}
453
454template<typename T>
455struct WSRectT {
456    T posX_ = 0;
457    T posY_ = 0;
458    T width_ = 0;
459    T height_ = 0;
460
461    bool operator==(const WSRectT<T>& a) const
462    {
463        return (NearEqual(posX_, a.posX_) && NearEqual(posY_, a.posY_) &&
464                NearEqual(width_, a.width_) && NearEqual(height_, a.height_));
465    }
466
467    bool operator!=(const WSRectT<T>& a) const
468    {
469        return !this->operator==(a);
470    }
471
472    bool IsEmpty() const
473    {
474        if (NearZero(posX_) && NearZero(posY_) && NearZero(width_) && NearZero(height_)) {
475            return true;
476        }
477        return false;
478    }
479
480    inline bool IsInRegion(int32_t pointX, int32_t pointY) const
481    {
482        return GreatOrEqual(pointX, posX_) && LessOrEqual(pointX, posX_ + width_) &&
483               GreatOrEqual(pointY, posY_) && LessOrEqual(pointY, posY_ + height_);
484    }
485
486    inline bool IsOverlap(const WSRectT<T>& rect) const
487    {
488        int32_t xStart = std::max(posX_, rect.posX_);
489        int32_t xEnd = std::min(posX_ + static_cast<int32_t>(width_),
490            rect.posX_ + static_cast<int32_t>(rect.width_));
491        int32_t yStart = std::max(posY_, rect.posY_);
492        int32_t yEnd = std::min(posY_ + static_cast<int32_t>(height_),
493            rect.posY_ + static_cast<int32_t>(rect.height_));
494        return (yStart < yEnd) && (xStart < xEnd);
495    }
496
497    inline bool IsInvalid() const
498    {
499        return IsEmpty() || LessOrEqual(width_, 0) || LessOrEqual(height_, 0);
500    }
501
502    inline std::string ToString() const
503    {
504        constexpr int precision = 2;
505        std::stringstream ss;
506        ss << "[" << std::fixed << std::setprecision(precision) << posX_ << " " << posY_ << " " <<
507            width_ << " " << height_ << "]";
508        return ss.str();
509    }
510};
511
512using WSRect = WSRectT<int32_t>;
513using WSRectF = WSRectT<float>;
514
515struct WindowShadowConfig {
516    float offsetX_ = 0.0f;
517    float offsetY_ = 0.0f;
518    float alpha_ = 0.0f;
519    float radius_ = 0.0f;
520    std::string color_ = "#000000";
521};
522
523struct KeyboardSceneAnimationConfig {
524    std::string curveType_ = "default";
525    float ctrlX1_ = 0.2f;
526    float ctrlY1_ = 0.0f;
527    float ctrlX2_ = 0.2f;
528    float ctrlY2_ = 1.0f;
529    uint32_t duration_ = 150;
530};
531
532struct WindowAnimationConfig {
533    int32_t duration_ = 0;
534    std::string curveType_ = "easeOut";
535    float ctrlX1_ = 0.2f;
536    float ctrlY1_ = 0.0f;
537    float ctrlX2_ = 0.2f;
538    float ctrlY2_ = 1.0f;
539    float scaleX_ = 0.0f;
540    float scaleY_ = 0.0f;
541    float rotationX_ = 0.0f;
542    float rotationY_ = 0.0f;
543    float rotationZ_ = 0.0f;
544    int32_t angle_ = 0;
545    float translateX_ = 0.0f;
546    float translateY_ = 0.0f;
547    float opacity_ = 0;
548};
549
550struct StartingWindowInfo {
551    int32_t startingWindowBackgroundId_;
552    int32_t startingWindowIconId_;
553    uint32_t startingWindowBackgroundColor_;
554    std::string startingWindowIconPath_;
555};
556
557struct StartingWindowAnimationConfig {
558    bool enabled_ = true;
559    int duration_ = 200;
560    std::string curve_ = "linear";
561    float opacityStart_ = 1;
562    float opacityEnd_ = 0;
563};
564
565struct SystemUIStatusBarConfig {
566    bool showInLandscapeMode_ = false;
567    std::string immersiveStatusBarBgColor_ = "#4c000000";
568    std::string immersiveStatusBarContentColor_ = "#ffffff";
569};
570
571struct StatusBarConfig {
572    bool showHide_ = false;
573    std::string contentColor_;
574    std::string backgroundColor_;
575};
576
577struct WindowImmersive {
578    StatusBarConfig desktopStatusBarConfig_;
579    StatusBarConfig leftRightStatusBarConfig_;
580    StatusBarConfig upDownStatusBarConfig_;
581};
582
583struct AppWindowSceneConfig {
584    float floatCornerRadius_ = 0.0f;
585    std::string multiWindowUIType_ = "HandsetSmartWindow";
586    bool backgroundScreenLock_ = false;
587    std::string rotationMode_ = "windowRotation";
588    WindowShadowConfig focusedShadow_;
589    WindowShadowConfig unfocusedShadow_;
590    KeyboardSceneAnimationConfig keyboardAnimationIn_;
591    KeyboardSceneAnimationConfig keyboardAnimationOut_;
592    WindowAnimationConfig windowAnimation_;
593    StartingWindowAnimationConfig startingWindowAnimationConfig_;
594    SystemUIStatusBarConfig systemUIStatusBarConfig_;
595    WindowImmersive windowImmersive_;
596};
597
598struct DeviceScreenConfig {
599    std::string rotationPolicy_ = "11"; // default use phone policy
600    bool isRightPowerButton_ = true;
601};
602
603struct SceneAnimationConfig {
604    std::shared_ptr<RSTransaction> rsTransaction_ = nullptr;
605    int32_t animationDuration_ = ROTATE_ANIMATION_DURATION;
606};
607
608struct RotateAnimationConfig {
609    int32_t duration_ = ROTATE_ANIMATION_DURATION;
610};
611
612struct SessionEventParam {
613    int32_t pointerX_ = 0;
614    int32_t pointerY_ = 0;
615    int32_t sessionWidth_ = 0;
616    int32_t sessionHeight_ = 0;
617};
618
619/**
620 * @brief Enumerates session gravity.
621 */
622enum class SessionGravity : uint32_t {
623    SESSION_GRAVITY_FLOAT = 0,
624    SESSION_GRAVITY_BOTTOM,
625    SESSION_GRAVITY_DEFAULT,
626};
627
628/**
629 * @brief TerminateType session terminate type.
630 */
631enum class TerminateType : uint32_t {
632    CLOSE_AND_KEEP_MULTITASK = 0,
633    CLOSE_AND_CLEAR_MULTITASK,
634    CLOSE_AND_START_CALLER,
635    CLOSE_BY_EXCEPTION,
636};
637
638/**
639 * @brief System animaged scene type.
640 */
641enum class SystemAnimatedSceneType : uint32_t {
642    SCENE_ENTER_MISSION_CENTER, // Enter the mission center
643    SCENE_EXIT_MISSION_CENTER, // Exit the mission center
644    SCENE_ENTER_TFS_WINDOW, // Three-finger sliding window recovery
645    SCENE_EXIT_TFU_WINDOW, // The three-finger up window disappears
646    SCENE_ENTER_WINDOW_FULL_SCREEN, // Enter the window full screen
647    SCENE_EXIT_WINDOW_FULL_SCREEN, // Exit the window full screen
648    SCENE_ENTER_MAX_WINDOW, // Enter the window maximization state
649    SCENE_EXIT_MAX_WINDOW, // Exit the window maximization state
650    SCENE_ENTER_SPLIT_SCREEN, // Enter the split screen
651    SCENE_EXIT_SPLIT_SCREEN, // Exit the split screen
652    SCENE_ENTER_APP_CENTER, // Enter the app center
653    SCENE_EXIT_APP_CENTER, // Exit the app center
654    SCENE_APPEAR_MISSION_CENTER, // A special case scenario that displays the mission center
655    SCENE_ENTER_WIND_CLEAR, // Enter win+D in clear screen mode
656    SCENE_ENTER_WIND_RECOVER, // Enter win+D in recover mode
657    SCENE_ENTER_RECENTS, // Enter recents
658    SCENE_EXIT_RECENTS, // Exit recent.
659    SCENE_OTHERS, // 1.Default state 2.The state in which the animation ends
660};
661
662/**
663 * @brief Session UI parameters
664 */
665struct SessionUIParam {
666    bool interactive_ { true };
667    WSRect rect_;
668    float scaleX_ { 1.0f };
669    float scaleY_ { 1.0f };
670    float pivotX_ { 1.0f };
671    float pivotY_ { 1.0f };
672    float transX_ { 0.0f }; // global translateX
673    float transY_ { 0.0f }; // global translateY
674    uint32_t zOrder_ { 0 };
675    std::string sessionName_;
676    bool needSync_ { true };
677};
678
679enum class SessionUIDirtyFlag {
680    NONE = 0,
681    VISIBLE = 1,
682    INTERACTIVE = 1 << 1,
683    RECT = 1 << 2,
684    SCALE = 1 << 3,
685    TOUCH_HOT_AREA = 1 << 4,
686    Z_ORDER = 1 << 5,
687    AVOID_AREA = 1 << 6,
688};
689
690/**
691 * @brief State for post-process focus
692 */
693struct PostProcessFocusState {
694    bool enabled_ { false };
695    bool isFocused_ { false };
696    bool byForeground_ { true };
697    FocusChangeReason reason_ { FocusChangeReason::DEFAULT };
698
699    void Reset()
700    {
701        enabled_ = false;
702        isFocused_ = false;
703        byForeground_ = true;
704        reason_ = FocusChangeReason::DEFAULT;
705    }
706};
707} // namespace OHOS::Rosen
708#endif // OHOS_ROSEN_WINDOW_SCENE_WS_COMMON_H
709