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_DRAWING_CONTENT_INFO_H
17 #define OHOS_ROSEN_WINDOW_DRAWING_CONTENT_INFO_H
18 
19 #include "wm_common.h"
20 
21 namespace OHOS::Rosen {
22  /**
23  * @enum WindowDrawingContentState
24  *
25  * @brief DrawingContent state of a window
26  */
27 enum WindowDrawingContentState {
28     WINDOW_DRAWING_CONTENT_CHANGE = 0,
29     WINDOW_DRAWING_CONTENT_NO_CHANGE,
30     WINDOW_DRAWING_CONTENT_UNKNOWN_TYPE,
31 };
32 
33 /**
34  * @class WindowDrawingContentInfo
35  *
36  * @brief DrawingContent info of window.
37  */
38 class WindowDrawingContentInfo : public Parcelable {
39 public:
40     /**
41      * @brief Default construct of WindowDrawingContentInfo.
42      */
43     WindowDrawingContentInfo() = default;
44     /**
45      * @brief Construct of WindowDrawingContentInfo.
46      *
47      * @param winId Window id.
48      * @param pid Process id.
49      * @param uid User id.
50      * @param drawing content True means window is drawing, false means the opposite.
51      * @param winType Type of window.
52      */
WindowDrawingContentInfo(uint32_t winId,int32_t pid,int32_t uid,bool drawingContentState,WindowType winType)53     WindowDrawingContentInfo(uint32_t winId, int32_t pid, int32_t uid, bool drawingContentState,
54         WindowType winType) : windowId_(winId), pid_(pid), uid_(uid),
55         drawingContentState_(drawingContentState), windowType_(winType) {};
56     /**
57      * @brief Deconstruct of WindowDrawingContentInfo.
58      */
59     ~WindowDrawingContentInfo() = default;
60 
61     /**
62      * @brief Marshalling WindowDrawingContentInfo.
63      *
64      * @param parcel Package of WindowDrawingContentInfo.
65      * @return True means marshall success, false means marshall failed.
66      */
67     virtual bool Marshalling(Parcel& parcel) const override;
68     /**
69      * @brief Unmarshalling WindowDrawingContentInfo.
70      *
71      * @param parcel Package of WindowDrawingContentInfo.
72      * @return WindowDrawingContentInfo object.
73      */
74     static WindowDrawingContentInfo* Unmarshalling(Parcel& parcel);
75 
76     uint32_t windowId_ { INVALID_WINDOW_ID };
77     int32_t pid_ { 0 };
78     int32_t uid_ { 0 };
79     bool drawingContentState_ {false};
80     WindowType windowType_ { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW };
81 };
82 } // namespace OHOS::Rosen
83 #endif // OHOS_ROSEN_WINDOW_VISIBILITY_INFO_H