1e0dac50fSopenharmony_ci/*
2e0dac50fSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3e0dac50fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e0dac50fSopenharmony_ci * you may not use this file except in compliance with the License.
5e0dac50fSopenharmony_ci * You may obtain a copy of the License at
6e0dac50fSopenharmony_ci *
7e0dac50fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e0dac50fSopenharmony_ci *
9e0dac50fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e0dac50fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e0dac50fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e0dac50fSopenharmony_ci * See the License for the specific language governing permissions and
13e0dac50fSopenharmony_ci * limitations under the License.
14e0dac50fSopenharmony_ci */
15e0dac50fSopenharmony_ci
16e0dac50fSopenharmony_ci#ifndef OHOS_ROSEN_DM_COMMON_H
17e0dac50fSopenharmony_ci#define OHOS_ROSEN_DM_COMMON_H
18e0dac50fSopenharmony_ci
19e0dac50fSopenharmony_ci#include <refbase.h>
20e0dac50fSopenharmony_ci#include <string>
21e0dac50fSopenharmony_ci#include <map>
22e0dac50fSopenharmony_ci
23e0dac50fSopenharmony_ci#ifdef _WIN32
24e0dac50fSopenharmony_ci#define WINDOW_EXPORT __attribute__((dllexport))
25e0dac50fSopenharmony_ci#else
26e0dac50fSopenharmony_ci#define WINDOW_EXPORT __attribute__((visibility("default")))
27e0dac50fSopenharmony_ci#endif
28e0dac50fSopenharmony_ci
29e0dac50fSopenharmony_cinamespace OHOS {
30e0dac50fSopenharmony_cinamespace Rosen {
31e0dac50fSopenharmony_ciusing DisplayId = uint64_t;
32e0dac50fSopenharmony_ciusing ScreenId = uint64_t;
33e0dac50fSopenharmony_cinamespace {
34e0dac50fSopenharmony_ciconstexpr DisplayId DISPLAY_ID_INVALID = -1ULL;
35e0dac50fSopenharmony_ciconstexpr ScreenId SCREEN_ID_INVALID = -1ULL;
36e0dac50fSopenharmony_ciconstexpr int DOT_PER_INCH = 160;
37e0dac50fSopenharmony_ciconst static std::string DEFAULT_SCREEN_NAME = "buildIn";
38e0dac50fSopenharmony_ciconstexpr int DOT_PER_INCH_MAXIMUM_VALUE = 1000;
39e0dac50fSopenharmony_ciconstexpr int DOT_PER_INCH_MINIMUM_VALUE = 80;
40e0dac50fSopenharmony_ciconstexpr uint32_t BASELINE_DENSITY = 160;
41e0dac50fSopenharmony_ci}
42e0dac50fSopenharmony_ci
43e0dac50fSopenharmony_ci/**
44e0dac50fSopenharmony_ci * @brief Power state change reason.
45e0dac50fSopenharmony_ci */
46e0dac50fSopenharmony_cienum class PowerStateChangeReason : uint32_t {
47e0dac50fSopenharmony_ci    POWER_BUTTON = 0,
48e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_INIT = 0,
49e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_TIMEOUT = 1,
50e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_RUNNING_LOCK = 2,
51e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_BATTERY = 3,
52e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_THERMAL = 4,
53e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_WORK = 5,
54e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_SYSTEM = 6,
55e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_APPLICATION = 10,
56e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_SETTINGS = 11,
57e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_HARD_KEY = 12,
58e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_TOUCH = 13,
59e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_CABLE = 14,
60e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_SENSOR = 15,
61e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_LID = 16,
62e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_CAMERA = 17,
63e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_ACCESS = 18,
64e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_RESET = 19,
65e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_POWER_KEY = 20,
66e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_KEYBOARD = 21,
67e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_MOUSE = 22,
68e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_DOUBLE_CLICK = 23,
69e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_SWITCH = 25,
70e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PRE_BRIGHT = 26,
71e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PRE_BRIGHT_AUTH_SUCCESS = 27,
72e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PRE_BRIGHT_AUTH_FAIL_SCREEN_ON = 28,
73e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PRE_BRIGHT_AUTH_FAIL_SCREEN_OFF = 29,
74e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_DISPLAY_SWITCH = 30,
75e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PROXIMITY = 32,
76e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_AOD_SLIDING = 40,
77e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_PEN = 41,
78e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_SHUT_DOWN = 42,
79e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_REMOTE = 100,
80e0dac50fSopenharmony_ci    STATE_CHANGE_REASON_UNKNOWN = 1000,
81e0dac50fSopenharmony_ci};
82e0dac50fSopenharmony_ci
83e0dac50fSopenharmony_ci/**
84e0dac50fSopenharmony_ci * @brief Enumerates the state of the screen power.
85e0dac50fSopenharmony_ci */
86e0dac50fSopenharmony_cienum class ScreenPowerState : uint32_t {
87e0dac50fSopenharmony_ci    POWER_ON,
88e0dac50fSopenharmony_ci    POWER_STAND_BY,
89e0dac50fSopenharmony_ci    POWER_SUSPEND,
90e0dac50fSopenharmony_ci    POWER_OFF,
91e0dac50fSopenharmony_ci    POWER_BUTT,
92e0dac50fSopenharmony_ci    INVALID_STATE,
93e0dac50fSopenharmony_ci};
94e0dac50fSopenharmony_ci
95e0dac50fSopenharmony_ci/**
96e0dac50fSopenharmony_ci * @brief Enumerates the state of the display.
97e0dac50fSopenharmony_ci */
98e0dac50fSopenharmony_cienum class DisplayState : uint32_t {
99e0dac50fSopenharmony_ci    UNKNOWN,
100e0dac50fSopenharmony_ci    OFF,
101e0dac50fSopenharmony_ci    ON,
102e0dac50fSopenharmony_ci    DOZE,
103e0dac50fSopenharmony_ci    DOZE_SUSPEND,
104e0dac50fSopenharmony_ci    VR,
105e0dac50fSopenharmony_ci    ON_SUSPEND,
106e0dac50fSopenharmony_ci};
107e0dac50fSopenharmony_ci
108e0dac50fSopenharmony_ci/**
109e0dac50fSopenharmony_ci * @brief Enumerates display events.
110e0dac50fSopenharmony_ci */
111e0dac50fSopenharmony_cienum class DisplayEvent : uint32_t {
112e0dac50fSopenharmony_ci    UNLOCK,
113e0dac50fSopenharmony_ci    KEYGUARD_DRAWN,
114e0dac50fSopenharmony_ci};
115e0dac50fSopenharmony_ci
116e0dac50fSopenharmony_ci/**
117e0dac50fSopenharmony_ci * @brief Enumerates DMError.
118e0dac50fSopenharmony_ci */
119e0dac50fSopenharmony_cienum class DMError : int32_t {
120e0dac50fSopenharmony_ci    DM_OK = 0,
121e0dac50fSopenharmony_ci    DM_ERROR_INIT_DMS_PROXY_LOCKED = 100,
122e0dac50fSopenharmony_ci    DM_ERROR_IPC_FAILED = 101,
123e0dac50fSopenharmony_ci    DM_ERROR_REMOTE_CREATE_FAILED = 110,
124e0dac50fSopenharmony_ci    DM_ERROR_NULLPTR = 120,
125e0dac50fSopenharmony_ci    DM_ERROR_INVALID_PARAM = 130,
126e0dac50fSopenharmony_ci    DM_ERROR_WRITE_INTERFACE_TOKEN_FAILED = 140,
127e0dac50fSopenharmony_ci    DM_ERROR_DEATH_RECIPIENT = 150,
128e0dac50fSopenharmony_ci    DM_ERROR_INVALID_MODE_ID = 160,
129e0dac50fSopenharmony_ci    DM_ERROR_WRITE_DATA_FAILED = 170,
130e0dac50fSopenharmony_ci    DM_ERROR_RENDER_SERVICE_FAILED = 180,
131e0dac50fSopenharmony_ci    DM_ERROR_UNREGISTER_AGENT_FAILED = 190,
132e0dac50fSopenharmony_ci    DM_ERROR_INVALID_CALLING = 200,
133e0dac50fSopenharmony_ci    DM_ERROR_INVALID_PERMISSION = 201,
134e0dac50fSopenharmony_ci    DM_ERROR_NOT_SYSTEM_APP = 202,
135e0dac50fSopenharmony_ci    DM_ERROR_DEVICE_NOT_SUPPORT = 801,
136e0dac50fSopenharmony_ci    DM_ERROR_UNKNOWN = -1,
137e0dac50fSopenharmony_ci};
138e0dac50fSopenharmony_ci
139e0dac50fSopenharmony_ci/**
140e0dac50fSopenharmony_ci * @brief Enumerates DM error codes.
141e0dac50fSopenharmony_ci */
142e0dac50fSopenharmony_cienum class DmErrorCode : int32_t {
143e0dac50fSopenharmony_ci    DM_OK = 0,
144e0dac50fSopenharmony_ci    DM_ERROR_NO_PERMISSION = 201,
145e0dac50fSopenharmony_ci    DM_ERROR_NOT_SYSTEM_APP = 202,
146e0dac50fSopenharmony_ci    DM_ERROR_INVALID_PARAM = 401,
147e0dac50fSopenharmony_ci    DM_ERROR_DEVICE_NOT_SUPPORT = 801,
148e0dac50fSopenharmony_ci    DM_ERROR_INVALID_SCREEN = 1400001,
149e0dac50fSopenharmony_ci    DM_ERROR_INVALID_CALLING = 1400002,
150e0dac50fSopenharmony_ci    DM_ERROR_SYSTEM_INNORMAL = 1400003,
151e0dac50fSopenharmony_ci};
152e0dac50fSopenharmony_ci
153e0dac50fSopenharmony_ci/**
154e0dac50fSopenharmony_ci * @brief Constructs the mapping of the DM errors to the DM error codes.
155e0dac50fSopenharmony_ci */
156e0dac50fSopenharmony_ciconst std::map<DMError, DmErrorCode> DM_JS_TO_ERROR_CODE_MAP {
157e0dac50fSopenharmony_ci    {DMError::DM_OK,                                    DmErrorCode::DM_OK                          },
158e0dac50fSopenharmony_ci    {DMError::DM_ERROR_INVALID_PERMISSION,              DmErrorCode::DM_ERROR_NO_PERMISSION         },
159e0dac50fSopenharmony_ci    {DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED,           DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
160e0dac50fSopenharmony_ci    {DMError::DM_ERROR_IPC_FAILED,                      DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
161e0dac50fSopenharmony_ci    {DMError::DM_ERROR_REMOTE_CREATE_FAILED,            DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
162e0dac50fSopenharmony_ci    {DMError::DM_ERROR_NULLPTR,                         DmErrorCode::DM_ERROR_INVALID_SCREEN        },
163e0dac50fSopenharmony_ci    {DMError::DM_ERROR_INVALID_PARAM,                   DmErrorCode::DM_ERROR_INVALID_PARAM         },
164e0dac50fSopenharmony_ci    {DMError::DM_ERROR_WRITE_INTERFACE_TOKEN_FAILED,    DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
165e0dac50fSopenharmony_ci    {DMError::DM_ERROR_DEATH_RECIPIENT,                 DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
166e0dac50fSopenharmony_ci    {DMError::DM_ERROR_INVALID_MODE_ID,                 DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
167e0dac50fSopenharmony_ci    {DMError::DM_ERROR_WRITE_DATA_FAILED,               DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
168e0dac50fSopenharmony_ci    {DMError::DM_ERROR_RENDER_SERVICE_FAILED,           DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
169e0dac50fSopenharmony_ci    {DMError::DM_ERROR_UNREGISTER_AGENT_FAILED,         DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
170e0dac50fSopenharmony_ci    {DMError::DM_ERROR_INVALID_CALLING,                 DmErrorCode::DM_ERROR_INVALID_CALLING       },
171e0dac50fSopenharmony_ci    {DMError::DM_ERROR_NOT_SYSTEM_APP,                  DmErrorCode::DM_ERROR_NOT_SYSTEM_APP        },
172e0dac50fSopenharmony_ci    {DMError::DM_ERROR_UNKNOWN,                         DmErrorCode::DM_ERROR_SYSTEM_INNORMAL       },
173e0dac50fSopenharmony_ci};
174e0dac50fSopenharmony_ci
175e0dac50fSopenharmony_ciusing DisplayStateCallback = std::function<void(DisplayState)>;
176e0dac50fSopenharmony_ci
177e0dac50fSopenharmony_ci/**
178e0dac50fSopenharmony_ci * @brief Enumerates display power events.
179e0dac50fSopenharmony_ci */
180e0dac50fSopenharmony_cienum class DisplayPowerEvent : uint32_t {
181e0dac50fSopenharmony_ci    WAKE_UP,
182e0dac50fSopenharmony_ci    SLEEP,
183e0dac50fSopenharmony_ci    DISPLAY_ON,
184e0dac50fSopenharmony_ci    DISPLAY_OFF,
185e0dac50fSopenharmony_ci    DESKTOP_READY,
186e0dac50fSopenharmony_ci    DOZE,
187e0dac50fSopenharmony_ci    DOZE_SUSPEND,
188e0dac50fSopenharmony_ci};
189e0dac50fSopenharmony_ci
190e0dac50fSopenharmony_ci/**
191e0dac50fSopenharmony_ci * @brief Enumerates event status.
192e0dac50fSopenharmony_ci */
193e0dac50fSopenharmony_cienum class EventStatus : uint32_t {
194e0dac50fSopenharmony_ci    BEGIN,
195e0dac50fSopenharmony_ci    END,
196e0dac50fSopenharmony_ci};
197e0dac50fSopenharmony_ci
198e0dac50fSopenharmony_ciclass IDisplayPowerEventListener : public RefBase {
199e0dac50fSopenharmony_cipublic:
200e0dac50fSopenharmony_ci    /**
201e0dac50fSopenharmony_ci     * @brief Notify when display power event status changed.
202e0dac50fSopenharmony_ci     */
203e0dac50fSopenharmony_ci    virtual void OnDisplayPowerEvent(DisplayPowerEvent event, EventStatus status) = 0;
204e0dac50fSopenharmony_ci};
205e0dac50fSopenharmony_ci
206e0dac50fSopenharmony_ci/**
207e0dac50fSopenharmony_ci * @brief Enumerates screen change events.
208e0dac50fSopenharmony_ci */
209e0dac50fSopenharmony_cienum class ScreenChangeEvent : uint32_t {
210e0dac50fSopenharmony_ci    UPDATE_ORIENTATION,
211e0dac50fSopenharmony_ci    UPDATE_ROTATION,
212e0dac50fSopenharmony_ci    CHANGE_MODE,
213e0dac50fSopenharmony_ci    VIRTUAL_PIXEL_RATIO_CHANGED,
214e0dac50fSopenharmony_ci};
215e0dac50fSopenharmony_ci
216e0dac50fSopenharmony_ci/**
217e0dac50fSopenharmony_ci * @brief Enumerates screen group change events.
218e0dac50fSopenharmony_ci */
219e0dac50fSopenharmony_cienum class ScreenGroupChangeEvent : uint32_t {
220e0dac50fSopenharmony_ci    ADD_TO_GROUP,
221e0dac50fSopenharmony_ci    REMOVE_FROM_GROUP,
222e0dac50fSopenharmony_ci    CHANGE_GROUP,
223e0dac50fSopenharmony_ci};
224e0dac50fSopenharmony_ci
225e0dac50fSopenharmony_ci/**
226e0dac50fSopenharmony_ci * @brief Enumerates rotations.
227e0dac50fSopenharmony_ci */
228e0dac50fSopenharmony_cienum class Rotation : uint32_t {
229e0dac50fSopenharmony_ci    ROTATION_0,
230e0dac50fSopenharmony_ci    ROTATION_90,
231e0dac50fSopenharmony_ci    ROTATION_180,
232e0dac50fSopenharmony_ci    ROTATION_270,
233e0dac50fSopenharmony_ci};
234e0dac50fSopenharmony_ci
235e0dac50fSopenharmony_ci/**
236e0dac50fSopenharmony_ci * @brief Enumerates orientations.
237e0dac50fSopenharmony_ci */
238e0dac50fSopenharmony_cienum class Orientation : uint32_t {
239e0dac50fSopenharmony_ci    BEGIN = 0,
240e0dac50fSopenharmony_ci    UNSPECIFIED = BEGIN,
241e0dac50fSopenharmony_ci    VERTICAL = 1,
242e0dac50fSopenharmony_ci    HORIZONTAL = 2,
243e0dac50fSopenharmony_ci    REVERSE_VERTICAL = 3,
244e0dac50fSopenharmony_ci    REVERSE_HORIZONTAL = 4,
245e0dac50fSopenharmony_ci    SENSOR = 5,
246e0dac50fSopenharmony_ci    SENSOR_VERTICAL = 6,
247e0dac50fSopenharmony_ci    SENSOR_HORIZONTAL = 7,
248e0dac50fSopenharmony_ci    AUTO_ROTATION_RESTRICTED = 8,
249e0dac50fSopenharmony_ci    AUTO_ROTATION_PORTRAIT_RESTRICTED = 9,
250e0dac50fSopenharmony_ci    AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10,
251e0dac50fSopenharmony_ci    LOCKED = 11,
252e0dac50fSopenharmony_ci    FOLLOW_RECENT = 12,
253e0dac50fSopenharmony_ci    AUTO_ROTATION_UNSPECIFIED = 13,
254e0dac50fSopenharmony_ci    USER_ROTATION_PORTRAIT = 14,
255e0dac50fSopenharmony_ci    USER_ROTATION_LANDSCAPE = 15,
256e0dac50fSopenharmony_ci    USER_ROTATION_PORTRAIT_INVERTED = 16,
257e0dac50fSopenharmony_ci    USER_ROTATION_LANDSCAPE_INVERTED = 17,
258e0dac50fSopenharmony_ci    FOLLOW_DESKTOP = 18,
259e0dac50fSopenharmony_ci    END = FOLLOW_DESKTOP,
260e0dac50fSopenharmony_ci};
261e0dac50fSopenharmony_ci
262e0dac50fSopenharmony_ci/**
263e0dac50fSopenharmony_ci * @brief Enumerates display orientations.
264e0dac50fSopenharmony_ci */
265e0dac50fSopenharmony_cienum class DisplayOrientation : uint32_t {
266e0dac50fSopenharmony_ci    PORTRAIT = 0,
267e0dac50fSopenharmony_ci    LANDSCAPE,
268e0dac50fSopenharmony_ci    PORTRAIT_INVERTED,
269e0dac50fSopenharmony_ci    LANDSCAPE_INVERTED,
270e0dac50fSopenharmony_ci    UNKNOWN,
271e0dac50fSopenharmony_ci};
272e0dac50fSopenharmony_ci
273e0dac50fSopenharmony_ci/**
274e0dac50fSopenharmony_ci * @brief Enumerates display change events.
275e0dac50fSopenharmony_ci */
276e0dac50fSopenharmony_cienum class DisplayChangeEvent : uint32_t {
277e0dac50fSopenharmony_ci    UPDATE_ORIENTATION,
278e0dac50fSopenharmony_ci    UPDATE_ROTATION,
279e0dac50fSopenharmony_ci    DISPLAY_SIZE_CHANGED,
280e0dac50fSopenharmony_ci    DISPLAY_FREEZED,
281e0dac50fSopenharmony_ci    DISPLAY_UNFREEZED,
282e0dac50fSopenharmony_ci    DISPLAY_VIRTUAL_PIXEL_RATIO_CHANGED,
283e0dac50fSopenharmony_ci    UPDATE_ORIENTATION_FROM_WINDOW,
284e0dac50fSopenharmony_ci    UPDATE_ROTATION_FROM_WINDOW,
285e0dac50fSopenharmony_ci    UPDATE_REFRESHRATE,
286e0dac50fSopenharmony_ci    UNKNOWN,
287e0dac50fSopenharmony_ci};
288e0dac50fSopenharmony_ci
289e0dac50fSopenharmony_ci/**
290e0dac50fSopenharmony_ci * @brief Enumerates screen source mode.
291e0dac50fSopenharmony_ci */
292e0dac50fSopenharmony_cienum class ScreenSourceMode: uint32_t {
293e0dac50fSopenharmony_ci    SCREEN_MAIN = 0,
294e0dac50fSopenharmony_ci    SCREEN_MIRROR = 1,
295e0dac50fSopenharmony_ci    SCREEN_EXTEND = 2,
296e0dac50fSopenharmony_ci    SCREEN_ALONE = 3,
297e0dac50fSopenharmony_ci};
298e0dac50fSopenharmony_ci
299e0dac50fSopenharmony_ci/**
300e0dac50fSopenharmony_ci * @brief Enumerates the fold status.
301e0dac50fSopenharmony_ci */
302e0dac50fSopenharmony_cienum class FoldStatus: uint32_t {
303e0dac50fSopenharmony_ci    UNKNOWN = 0,
304e0dac50fSopenharmony_ci    EXPAND = 1,
305e0dac50fSopenharmony_ci    FOLDED = 2,
306e0dac50fSopenharmony_ci    HALF_FOLD = 3,
307e0dac50fSopenharmony_ci};
308e0dac50fSopenharmony_ci
309e0dac50fSopenharmony_ci/**
310e0dac50fSopenharmony_ci * @brief Enumerates the fold display mode.
311e0dac50fSopenharmony_ci */
312e0dac50fSopenharmony_cienum class FoldDisplayMode: uint32_t {
313e0dac50fSopenharmony_ci    UNKNOWN = 0,
314e0dac50fSopenharmony_ci    FULL = 1,
315e0dac50fSopenharmony_ci    MAIN = 2,
316e0dac50fSopenharmony_ci    SUB = 3,
317e0dac50fSopenharmony_ci    COORDINATION = 4,
318e0dac50fSopenharmony_ci};
319e0dac50fSopenharmony_ci
320e0dac50fSopenharmony_ci/**
321e0dac50fSopenharmony_ci * @brief displayRect
322e0dac50fSopenharmony_ci */
323e0dac50fSopenharmony_cistruct DMRect {
324e0dac50fSopenharmony_ci    int32_t posX_;
325e0dac50fSopenharmony_ci    int32_t posY_;
326e0dac50fSopenharmony_ci    uint32_t width_;
327e0dac50fSopenharmony_ci    uint32_t height_;
328e0dac50fSopenharmony_ci
329e0dac50fSopenharmony_ci    bool operator==(const DMRect& a) const
330e0dac50fSopenharmony_ci    {
331e0dac50fSopenharmony_ci        return (posX_ == a.posX_ && posY_ == a.posY_ && width_ == a.width_ && height_ == a.height_);
332e0dac50fSopenharmony_ci    }
333e0dac50fSopenharmony_ci
334e0dac50fSopenharmony_ci    bool operator!=(const DMRect& a) const
335e0dac50fSopenharmony_ci    {
336e0dac50fSopenharmony_ci        return !this->operator==(a);
337e0dac50fSopenharmony_ci    }
338e0dac50fSopenharmony_ci
339e0dac50fSopenharmony_ci    bool IsUninitializedRect() const
340e0dac50fSopenharmony_ci    {
341e0dac50fSopenharmony_ci        return (posX_ == 0 && posY_ == 0 && width_ == 0 && height_ == 0);
342e0dac50fSopenharmony_ci    }
343e0dac50fSopenharmony_ci
344e0dac50fSopenharmony_ci    bool IsInsideOf(const DMRect& a) const
345e0dac50fSopenharmony_ci    {
346e0dac50fSopenharmony_ci        return (posX_ >= a.posX_ && posY_ >= a.posY_ &&
347e0dac50fSopenharmony_ci            posX_ + width_ <= a.posX_ + a.width_ && posY_ + height_ <= a.posY_ + a.height_);
348e0dac50fSopenharmony_ci    }
349e0dac50fSopenharmony_ci    static DMRect NONE()
350e0dac50fSopenharmony_ci    {
351e0dac50fSopenharmony_ci        return {0, 0, 0, 0};
352e0dac50fSopenharmony_ci    }
353e0dac50fSopenharmony_ci};
354e0dac50fSopenharmony_ci}
355e0dac50fSopenharmony_ci}
356e0dac50fSopenharmony_ci#endif // OHOS_ROSEN_DM_COMMON_H
357