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