• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# OH_DisplayManager
2
3
4## 概述
5
6提供屏幕管理的能力。
7
8**系统能力:** SystemCapability.WindowManager.WindowManager.Core
9
10**起始版本:** 12
11
12## 汇总
13
14### 文件
15
16| 名称 | 描述 |
17| -------- | -------- |
18| [oh_display_capture.h](oh__display__capture_8h.md) | 提供屏幕截屏的能力。 |
19| [oh_display_info.h](oh__display__info_8h.md) | 提供屏幕的公共枚举、公共定义等。 |
20| [oh_display_manager.h](oh__display__manager_8h.md) | 提供屏幕管理的一些基础能力,包括获取默认显示设备的信息,以及监听显示设备的旋转、折叠、展开等状态变化的能力。 |
21
22
23### 结构体
24
25| 名称 | 描述 |
26| -------- | -------- |
27| struct  [NativeDisplayManager_Rect](_native_display_manager___rect.md) | 矩形区域。 |
28| struct  [NativeDisplayManager_WaterfallDisplayAreaRects](ive_display_manager___waterfall_display_area_rects.md) | 瀑布屏曲面部分显示区域。 |
29| struct  [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) | 挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。 |
30| struct  [NativeDisplayManager_DisplayHdrFormat](_native_display_manager___display_hdr_format.md) | 显示设备支持的所有HDR格式。 |
31| struct  [NativeDisplayManager_DisplayColorSpace](_native_display_manager___display_color_space.md) | 显示设备支持的所有色域类型。 |
32| struct  [NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md) | 显示设备的对象属性。 |
33| struct  [NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md) | 多显示设备的Display对象。 |
34
35### 宏定义
36
37| 名称 | 描述 |
38| -------- | -------- |
39| [OH_DISPLAY_NAME_LENGTH](#oh_display_name_length)   32 | 屏幕名称的最大长度。  |
40
41### 类型定义
42
43| 名称 | 描述 |
44| -------- | -------- |
45| typedef enum [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) | 屏幕顺时针的旋转角度。 |
46| typedef enum [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) | 屏幕的旋转方向。 |
47| typedef enum [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) | 屏幕管理接口返回状态码枚举。 |
48| typedef enum [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) | 可折叠设备的显示模式枚举。 |
49| typedef struct [NativeDisplayManager_Rect](_native_display_manager___rect.md) [NativeDisplayManager_Rect](#nativedisplaymanager_rect) | 矩形区域。 |
50| typedef struct [NativeDisplayManager_WaterfallDisplayAreaRects](ive_display_manager___waterfall_display_area_rects.md) [NativeDisplayManager_WaterfallDisplayAreaRects](#nativedisplaymanager_waterfalldisplayarearects) | 瀑布屏曲面部分显示区域。 |
51| typedef struct [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) [NativeDisplayManager_CutoutInfo](#nativedisplaymanager_cutoutinfo) | 挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。 |
52| typedef enum [NativeDisplayManager_DisplayState](#nativedisplaymanager_displaystate) [NativeDisplayManager_DisplayState](#nativedisplaymanager_displaystate) | 显示设备的状态枚举。 |
53| typedef struct [NativeDisplayManager_DisplayHdrFormat](_native_display_manager___display_hdr_format.md) [NativeDisplayManager_DisplayHdrFormat](#nativedisplaymanager_displayhdrformat) | 显示设备支持的所有HDR格式。 |
54| typedef struct [NativeDisplayManager_DisplayColorSpace](_native_display_manager___display_color_space.md) [NativeDisplayManager_DisplayColorSpace](#nativedisplaymanager_displaycolorspace) | 显示设备支持的所有色域类型。 |
55| typedef struct [NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md) [NativeDisplayManager_DisplayInfo](#nativedisplaymanager_displayinfo) | 显示设备的对象属性。 |
56| typedef struct [NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md) [NativeDisplayManager_DisplaysInfo](#nativedisplaymanager_displaysinfo) | 多显示设备的Display对象。 |
57| typedef void(\* [OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback)) (uint64_t displayId) | 注册屏幕状态变化的回调函数。 |
58| typedef void(\* [OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback)) ([NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) displayMode) | 注册屏幕展开、折叠状态变化的回调函数。 |
59
60
61### 枚举
62
63| 名称 | 描述 |
64| -------- | -------- |
65| [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation-1) { DISPLAY_MANAGER_ROTATION_0 = 0, DISPLAY_MANAGER_ROTATION_90 = 1, DISPLAY_MANAGER_ROTATION_180 = 2, DISPLAY_MANAGER_ROTATION_270 = 3 } | 屏幕顺时针的旋转角度。 |
66| [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation-1) {<br/>DISPLAY_MANAGER_PORTRAIT = 0, DISPLAY_MANAGER_LANDSCAPE = 1, DISPLAY_MANAGER_PORTRAIT_INVERTED = 2, DISPLAY_MANAGER_LANDSCAPE_INVERTED = 3,<br/>DISPLAY_MANAGER_UNKNOWN<br/>} | 屏幕的旋转方向。 |
67| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode-1) {<br/>DISPLAY_MANAGER_OK = 0, DISPLAY_MANAGER_ERROR_NO_PERMISSION = 201, DISPLAY_MANAGER_ERROR_NOT_SYSTEM_APP = 202, DISPLAY_MANAGER_ERROR_INVALID_PARAM = 401,<br/>DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED = 801, DISPLAY_MANAGER_ERROR_INVALID_SCREEN = 1400001, DISPLAY_MANAGER_ERROR_INVALID_CALL = 1400002, DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL = 1400003<br/>} | 屏幕管理接口返回状态码枚举。 |
68| [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode-1) {<br/>DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN = 0, DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL = 1, DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN = 2, DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB = 3,<br/>DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION = 4<br/>} | 可折叠设备的显示模式枚举。 |
69| [NativeDisplayManager_DisplayState](#nativedisplaymanager_displaystate-1) {<br/>DISPLAY_MANAGER_DISPLAY_STATE_UNKNOWN = 0, DISPLAY_MANAGER_DISPLAY_STATE_OFF = 1, DISPLAY_MANAGER_DISPLAY_STATE_ON = 2, DISPLAY_MANAGER_DISPLAY_STATE_DOZE = 3,<br/>DISPLAY_MANAGER_DISPLAY_STATE_DOZE_SUSPEND = 4, DISPLAY_MANAGER_DISPLAY_STATE_VR = 5, DISPLAY_MANAGER_DISPLAY_STATE_ON_SUSPEND = 6<br/>} | 显示设备的状态枚举。 |
70
71
72### 函数
73
74| 名称 | 描述 |
75| -------- | -------- |
76| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CaptureScreenPixelmap](#oh_nativedisplaymanager_capturescreenpixelmap) (uint32_t displayId, OH_PixelmapNative \*\*pixelMap) | 获取屏幕全屏截图,此接口仅支持在平板和2in1设备上使用,可以通过设置不同的屏幕id号截取不同屏幕的截图。 |
77| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayId](#oh_nativedisplaymanager_getdefaultdisplayid) (uint64_t \*displayId) | 获取默认屏幕的id号。 |
78| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayWidth](#oh_nativedisplaymanager_getdefaultdisplaywidth) (int32_t \*displayWidth) | 获取默认屏幕的宽度。 |
79| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayHeight](#oh_nativedisplaymanager_getdefaultdisplayheight) (int32_t \*displayHeight) | 获取默认屏幕的高度。 |
80| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayRotation](#oh_nativedisplaymanager_getdefaultdisplayrotation) ([NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) \*displayRotation) | 获取默认屏幕的顺时针旋转角度。 |
81| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayOrientation](#oh_nativedisplaymanager_getdefaultdisplayorientation) ([NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) \*displayOrientation) | 获取默认屏幕的旋转方向。 |
82| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio](#oh_nativedisplaymanager_getdefaultdisplayvirtualpixelratio) (float \*virtualPixels) | 获取默认屏幕的虚拟像素密度。 |
83| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayRefreshRate](#oh_nativedisplaymanager_getdefaultdisplayrefreshrate) (uint32_t \*refreshRate) | 获取默认屏幕的刷新率。 |
84| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityDpi](#oh_nativedisplaymanager_getdefaultdisplaydensitydpi) (int32_t \*densityDpi) | 获取屏幕的物理像素密度。 |
85| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityPixels](#oh_nativedisplaymanager_getdefaultdisplaydensitypixels) (float \*densityPixels) | 获取屏幕逻辑像素的密度。 |
86| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayScaledDensity](#oh_nativedisplaymanager_getdefaultdisplayscaleddensity) (float \*scaledDensity) | 获取屏幕显示字体的缩放因子。 |
87| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi](#oh_nativedisplaymanager_getdefaultdisplaydensityxdpi) (float \*xDpi) | 获取屏幕X方向中每英寸屏幕的物理像素值。 |
88| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi](#oh_nativedisplaymanager_getdefaultdisplaydensityydpi) (float \*yDpi) | 获取Y方向中每英寸屏幕的物理像素值。 |
89| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo) ([NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) \*\*cutoutInfo) | 获取挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。 |
90| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_destroydefaultdisplaycutoutinfo) ([NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) \*cutoutInfo) | 销毁挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。 |
91| bool [OH_NativeDisplayManager_IsFoldable](#oh_nativedisplaymanager_isfoldable) () | 查询设备是否可折叠。 |
92| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetFoldDisplayMode](#oh_nativedisplaymanager_getfolddisplaymode) ([NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) \*displayMode) | 获取可折叠设备的显示模式。 |
93| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_RegisterDisplayChangeListener](#oh_nativedisplaymanager_registerdisplaychangelistener) ([OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback) displayChangeCallback, uint32_t \*listenerIndex) | 注册屏幕状态变化监听(如旋转变化、刷新率、DPI、分辨率等变化)。 |
94| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_UnregisterDisplayChangeListener](#oh_nativedisplaymanager_unregisterdisplaychangelistener) (uint32_t listenerIndex) | 取消屏幕状态变化的监听。 |
95| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_registerfolddisplaymodechangelistener) ([OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback) displayModeChangeCallback, uint32_t \*listenerIndex) | 注册屏幕展开、折叠状态变化的监听。 |
96| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener) (uint32_t listenerIndex) | 取消屏幕展开、折叠状态变化的监听。 |
97| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CreateAllDisplays](#oh_nativedisplaymanager_createalldisplays) ([NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md) \*\*allDisplays) | 获取当前所有屏幕信息对象。 |
98| void [OH_NativeDisplayManager_DestroyAllDisplays](#oh_nativedisplaymanager_destroyalldisplays) ([NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md) \*allDisplays) | 销毁所有屏幕的信息对象。 |
99| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CreateDisplayById](#oh_nativedisplaymanager_createdisplaybyid) (uint32_t displayId, [NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md) \*\*displayInfo) | 获取指定屏幕的信息对象。 |
100| void [OH_NativeDisplayManager_DestroyDisplay](#oh_nativedisplaymanager_destroydisplay) ([NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md) \*displayInfo) | 销毁指定屏幕的信息对象。 |
101| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CreatePrimaryDisplay](#oh_nativedisplaymanager_createprimarydisplay) ([NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md) \*\*displayInfo) | 获取主屏信息对象。除2in1之外的设备获取的是设备自带屏幕的屏幕信息;2in1设备外接屏幕时获取的是当前主屏幕的屏幕信息;2in1设备没有外接屏幕时获取的是自带屏幕的屏幕信息。 |
102
103## 宏定义说明
104
105
106### OH_DISPLAY_NAME_LENGTH
107
108```
109#define OH_DISPLAY_NAME_LENGTH   32
110```
111
112**描述**
113
114屏幕名称的最大长度。
115
116**起始版本:** 14
117
118## 类型定义说明
119
120### NativeDisplayManager_DisplayColorSpace
121
122```
123typedef struct NativeDisplayManager_DisplayColorSpace NativeDisplayManager_DisplayColorSpace
124```
125
126**描述**
127
128显示设备支持的所有色域类型。
129
130**起始版本:** 14
131
132
133### NativeDisplayManager_DisplayHdrFormat
134
135```
136typedef struct NativeDisplayManager_DisplayHdrFormat NativeDisplayManager_DisplayHdrFormat
137```
138
139**描述**
140
141显示设备支持的所有HDR格式。
142
143**起始版本:** 14
144
145
146### NativeDisplayManager_DisplayInfo
147
148```
149typedef struct NativeDisplayManager_DisplayInfo NativeDisplayManager_DisplayInfo
150```
151
152**描述**
153
154显示设备的对象属性。
155
156**起始版本:** 14
157
158
159### NativeDisplayManager_DisplaysInfo
160
161```
162typedef struct NativeDisplayManager_DisplaysInfo NativeDisplayManager_DisplaysInfo
163```
164
165**描述**
166
167多显示设备的Display对象。
168
169**起始版本:** 14
170
171
172### NativeDisplayManager_DisplayState
173
174```
175typedef enum NativeDisplayManager_DisplayState NativeDisplayManager_DisplayState
176```
177
178**描述**
179
180显示设备的状态枚举。
181
182**起始版本:** 14
183
184### NativeDisplayManager_CutoutInfo
185
186```
187typedef struct NativeDisplayManager_CutoutInfo NativeDisplayManager_CutoutInfo
188```
189
190**描述**
191
192挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。
193
194**系统能力:** SystemCapability.WindowManager.WindowManager.Core
195
196**起始版本:** 12
197
198
199### NativeDisplayManager_ErrorCode
200
201```
202typedef enum NativeDisplayManager_ErrorCode NativeDisplayManager_ErrorCode
203```
204
205**描述**
206
207屏幕管理接口返回状态码枚举。
208
209**系统能力:** SystemCapability.WindowManager.WindowManager.Core
210
211**起始版本:** 12
212
213
214### NativeDisplayManager_FoldDisplayMode
215
216```
217typedef enum NativeDisplayManager_FoldDisplayMode NativeDisplayManager_FoldDisplayMode
218```
219
220**描述**
221
222可折叠设备的显示模式枚举。
223
224**系统能力:** SystemCapability.WindowManager.WindowManager.Core
225
226**起始版本:** 12
227
228
229### NativeDisplayManager_Orientation
230
231```
232typedef enum NativeDisplayManager_Orientation NativeDisplayManager_Orientation
233```
234
235**描述**
236
237屏幕的旋转方向。
238
239**系统能力:** SystemCapability.WindowManager.WindowManager.Core
240
241**起始版本:** 12
242
243
244### NativeDisplayManager_Rect
245
246```
247typedef struct NativeDisplayManager_Rect NativeDisplayManager_Rect
248```
249
250**描述**
251
252矩形区域。
253
254**系统能力:** SystemCapability.WindowManager.WindowManager.Core
255
256**起始版本:** 12
257
258
259### NativeDisplayManager_Rotation
260
261```
262typedef enum NativeDisplayManager_Rotation NativeDisplayManager_Rotation
263```
264
265**描述**
266
267屏幕顺时针的旋转角度。
268
269**系统能力:** SystemCapability.WindowManager.WindowManager.Core
270
271**起始版本:** 12
272
273
274### NativeDisplayManager_WaterfallDisplayAreaRects
275
276```
277typedef struct NativeDisplayManager_WaterfallDisplayAreaRects NativeDisplayManager_WaterfallDisplayAreaRects
278```
279
280**描述**
281
282瀑布屏曲面部分显示区域。
283
284**系统能力:** SystemCapability.WindowManager.WindowManager.Core
285
286**起始版本:** 12
287
288
289### OH_NativeDisplayManager_DisplayChangeCallback
290
291```
292typedef void(* OH_NativeDisplayManager_DisplayChangeCallback) (uint64_t displayId)
293```
294
295**描述**
296
297注册屏幕状态变化的回调函数。
298
299**系统能力:** SystemCapability.Window.SessionManager
300
301**起始版本:** 12
302
303**参数:**
304
305| 名称 | 描述 |
306| -------- | -------- |
307| displayId | 屏幕状态发生变化的编号。 |
308
309
310### OH_NativeDisplayManager_FoldDisplayModeChangeCallback
311
312```
313typedef void(* OH_NativeDisplayManager_FoldDisplayModeChangeCallback) (NativeDisplayManager_FoldDisplayMode displayMode)
314```
315
316**描述**
317
318注册屏幕展开、折叠状态变化的回调函数。
319
320**系统能力:** SystemCapability.Window.SessionManager
321
322**起始版本:** 12
323
324**参数:**
325
326| 名称 | 描述 |
327| -------- | -------- |
328| displayMode | 折叠/展开动作执行后屏幕的状态,具体可见[NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode)。 |
329
330
331## 枚举类型说明
332
333### NativeDisplayManager_DisplayState
334
335```
336enum NativeDisplayManager_DisplayState
337```
338
339**描述**
340
341显示设备的状态枚举。
342
343**起始版本:** 14
344
345| 枚举值 | 描述 |
346| -------- | -------- |
347| DISPLAY_MANAGER_DISPLAY_STATE_UNKNOWN | 表示显示设备状态未知。 |
348| DISPLAY_MANAGER_DISPLAY_STATE_OFF | 表示显示设备状态为关闭。 |
349| DISPLAY_MANAGER_DISPLAY_STATE_ON | 表示显示设备状态为开启。 |
350| DISPLAY_MANAGER_DISPLAY_STATE_DOZE | 表示显示设备为低电耗模式。 |
351| DISPLAY_MANAGER_DISPLAY_STATE_DOZE_SUSPEND | 表示显示设备为睡眠模式,CPU为挂起状态。 |
352| DISPLAY_MANAGER_DISPLAY_STATE_VR | 表示显示设备为VR模式。 |
353| DISPLAY_MANAGER_DISPLAY_STATE_ON_SUSPEND | d表示显示设备为开启状态,CPU为挂起状态。 |
354
355### NativeDisplayManager_ErrorCode
356
357```
358enum NativeDisplayManager_ErrorCode
359```
360
361**描述**
362
363屏幕管理接口返回状态码枚举。
364
365**系统能力:** SystemCapability.WindowManager.WindowManager.Core
366
367**起始版本:** 12
368
369| 枚举值 | 描述 |
370| -------- | -------- |
371| DISPLAY_MANAGER_OK | 成功。 |
372| DISPLAY_MANAGER_ERROR_NO_PERMISSION | 权限校验失败,应用无权限使用该API,需要申请权限。 |
373| DISPLAY_MANAGER_ERROR_NOT_SYSTEM_APP | 权限校验失败,非系统应用使用了系统API。 |
374| DISPLAY_MANAGER_ERROR_INVALID_PARAM | 参数检查失败。 |
375| DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED | 该设备不支持此API。 |
376| DISPLAY_MANAGER_ERROR_INVALID_SCREEN | 操作的显示设备无效。 |
377| DISPLAY_MANAGER_ERROR_INVALID_CALL | 当前操作对象无操作权限。 |
378| DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL | 系统服务工作异常。 |
379
380
381### NativeDisplayManager_FoldDisplayMode
382
383```
384enum NativeDisplayManager_FoldDisplayMode
385```
386
387**描述**
388
389可折叠设备的显示模式枚举。
390
391**系统能力:** SystemCapability.WindowManager.WindowManager.Core
392
393**起始版本:** 12
394
395| 枚举值 | 描述 |
396| -------- | -------- |
397| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN | 表示设备当前折叠显示模式未知。 |
398| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL | 表示设备当前全屏显示。 |
399| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN | 表示设备当前主屏幕显示。 |
400| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB | 表示设备当前子屏幕显示。 |
401| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION | 表示设备当前双屏协同显示。 |
402
403
404### NativeDisplayManager_Orientation
405
406```
407enum NativeDisplayManager_Orientation
408```
409
410**描述**
411
412屏幕的旋转方向。
413
414**系统能力:** SystemCapability.WindowManager.WindowManager.Core
415
416**起始版本:** 12
417
418| 枚举值 | 描述 |
419| -------- | -------- |
420| DISPLAY_MANAGER_PORTRAIT | 表示设备当前以竖屏方式显示。 |
421| DISPLAY_MANAGER_LANDSCAPE | 表示设备当前以横屏方式显示。 |
422| DISPLAY_MANAGER_PORTRAIT_INVERTED | 表示设备当前以反向竖屏方式显示。 |
423| DISPLAY_MANAGER_LANDSCAPE_INVERTED | 表示设备当前以反向横屏方式显示。 |
424| DISPLAY_MANAGER_UNKNOWN | 表示显示未识别屏幕方向。 |
425
426
427### NativeDisplayManager_Rotation
428
429```
430enum NativeDisplayManager_Rotation
431```
432
433**描述**
434
435屏幕顺时针的旋转角度。
436
437**系统能力:** SystemCapability.WindowManager.WindowManager.Core
438
439**起始版本:** 12
440
441| 枚举值 | 描述 |
442| -------- | -------- |
443| DISPLAY_MANAGER_ROTATION_0 | 代表屏幕顺时针旋转角度0度。 |
444| DISPLAY_MANAGER_ROTATION_90 | 代表屏幕顺时针旋转角度90度。 |
445| DISPLAY_MANAGER_ROTATION_180 | 代表屏幕顺时针旋转角度180度。 |
446| DISPLAY_MANAGER_ROTATION_270 | 代表屏幕顺时针旋转角度270度。 |
447
448
449## 函数说明
450
451
452### OH_NativeDisplayManager_CaptureScreenPixelmap()
453
454```
455NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CaptureScreenPixelmap (uint32_t displayId, OH_PixelmapNative **pixelMap )
456```
457
458**描述**
459
460获取屏幕全屏截图,此接口仅支持在平板和2in1设备上使用,可以通过设置不同的屏幕id号截取不同屏幕的截图。
461
462**需要权限:**
463
464ohos.permission.CUSTOM_SCREEN_CAPTURE
465
466**系统能力:** SystemCapability.Window.SessionManager.Core
467
468**起始版本:** 14
469
470**参数:**
471
472| 名称 | 描述 |
473| -------- | -------- |
474| displayId | 需要截屏的屏幕id号,该值为非负整数。 |
475| pixelMap | 创建指定屏幕id的OH_PixelmapNative对象,此处作为出参返回。 |
476
477**返回:**
478
479返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
480
481
482### OH_NativeDisplayManager_CreateAllDisplays()
483
484```
485NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays (NativeDisplayManager_DisplaysInfo **allDisplays)
486```
487
488**描述**
489
490获取当前所有屏幕信息对象。
491
492**系统能力:** SystemCapability.Window.SessionManager.Core
493
494**起始版本:** 14
495
496**参数:**
497
498| 名称 | 描述 |
499| -------- | -------- |
500| allDisplays | 当前所有的屏幕信息,具体可见[NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md), 此处作为出参返回。 |
501
502**返回:**
503
504返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
505
506
507### OH_NativeDisplayManager_CreateDisplayById()
508
509```
510NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById (uint32_t displayId, NativeDisplayManager_DisplayInfo **displayInfo )
511```
512
513**描述**
514
515获取指定屏幕的信息对象。
516
517**系统能力:** SystemCapability.Window.SessionManager.Core
518
519**起始版本:** 14
520
521**参数:**
522
523| 名称 | 描述 |
524| -------- | -------- |
525| displayId | 指定屏幕的id编号,该值为非负整数。 |
526| displayInfo | 指定的屏幕信息对象,具体可见[NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md),此处作为出参返回。 |
527
528**返回:**
529
530返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
531
532
533### OH_NativeDisplayManager_CreatePrimaryDisplay()
534
535```
536NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreatePrimaryDisplay (NativeDisplayManager_DisplayInfo **displayInfo)
537```
538
539**描述**
540
541获取主屏信息对象。除2in1之外的设备获取的是设备自带屏幕的屏幕信息;2in1设备外接屏幕时获取的是当前主屏幕的屏幕信息;2in1设备没有外接屏幕时获取的是自带屏幕的屏幕信息。
542
543**系统能力:** SystemCapability.Window.SessionManager.Core
544
545**起始版本:** 14
546
547**参数:**
548
549| 名称 | 描述 |
550| -------- | -------- |
551| displayInfo | 主屏的屏幕信息对象,具体可见[NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md),此处作为出参返回。 |
552
553**返回:**
554
555返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
556
557
558### OH_NativeDisplayManager_DestroyAllDisplays()
559
560```
561void OH_NativeDisplayManager_DestroyAllDisplays (NativeDisplayManager_DisplaysInfo *allDisplays)
562```
563
564**描述**
565
566销毁所有屏幕的信息对象。
567
568**系统能力:** SystemCapability.Window.SessionManager.Core
569
570**起始版本:** 14
571
572**参数:**
573
574| 名称 | 描述 |
575| -------- | -------- |
576| allDisplays | 销毁通过[OH_NativeDisplayManager_CreateAllDisplays](#oh_nativedisplaymanager_createalldisplays)接口获取的所有的屏幕信息,具体可见[NativeDisplayManager_DisplaysInfo](_native_display_manager___displays_info.md)。 |
577
578
579### OH_NativeDisplayManager_DestroyDisplay()
580
581```
582void OH_NativeDisplayManager_DestroyDisplay (NativeDisplayManager_DisplayInfo *displayInfo)
583```
584
585**描述**
586
587销毁指定屏幕的信息对象。
588
589**系统能力:** SystemCapability.Window.SessionManager.Core
590
591**起始版本:** 14
592
593**参数:**
594
595| 名称 | 描述 |
596| -------- | -------- |
597| displayInfo | 销毁通过[OH_NativeDisplayManager_CreateDisplayById](#oh_nativedisplaymanager_createdisplaybyid)或者[OH_NativeDisplayManager_CreatePrimaryDisplay](#oh_nativedisplaymanager_createprimarydisplay)接口获取到的屏幕信息,具体可见[NativeDisplayManager_DisplayInfo](_native_display_manager___display_info.md)。 |
598
599### OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo()
600
601```
602NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo (NativeDisplayManager_CutoutInfo **cutoutInfo)
603```
604
605**描述**
606
607获取挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。
608
609**系统能力:** SystemCapability.WindowManager.WindowManager.Core
610
611**起始版本:** 12
612
613**参数:**
614
615| 名称 | 描述 |
616| -------- | -------- |
617| cutoutInfo | 挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息,具体可见[NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md),此处作为出参返回。 |
618
619**返回:**
620
621返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
622
623
624### OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo()
625
626```
627NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo (NativeDisplayManager_CutoutInfo *cutoutInfo)
628```
629
630**描述**
631
632销毁挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息。
633
634**系统能力:** SystemCapability.WindowManager.WindowManager.Core
635
636**起始版本:** 12
637
638**参数:**
639
640| 名称 | 描述 |
641| -------- | -------- |
642| cutoutInfo | 销毁通过[OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo)接口获取的挖孔屏、刘海屏、瀑布屏等不可用屏幕区域信息对象,具体可见[NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md)。 |
643
644**返回:**
645
646返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
647
648
649### OH_NativeDisplayManager_GetDefaultDisplayDensityDpi()
650
651```
652NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityDpi (int32_t *densityDpi)
653```
654
655**描述**
656
657获取屏幕的物理像素密度。
658
659**系统能力:** SystemCapability.WindowManager.WindowManager.Core
660
661**起始版本:** 12
662
663**参数:**
664
665| 名称 | 描述 |
666| -------- | -------- |
667| densityDpi | 屏幕的物理像素密度,表示每英寸上的像素点数。该参数为整数,单位为px,实际能取到的值取决于不同设备设置里提供的可选值。此处作为出参返回。 |
668
669**返回:**
670
671返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
672
673
674### OH_NativeDisplayManager_GetDefaultDisplayDensityPixels()
675
676```
677NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityPixels (float *densityPixels)
678```
679
680**描述**
681
682获取屏幕逻辑像素的密度。
683
684**系统能力:** SystemCapability.WindowManager.WindowManager.Core
685
686**起始版本:** 12
687
688**参数:**
689
690| 名称 | 描述 |
691| -------- | -------- |
692| densityPixels | 设备逻辑像素的密度,代表物理像素与逻辑像素的缩放系数,该参数为浮点数,受densityDPI范围限制,取值范围在[0.5,4.0]。一般取值1.0、3.0等,实际取值取决于不同设备提供的densityDpi。此处作为出参返回。 |
693
694**返回:**
695
696返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
697
698
699### OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi()
700
701```
702NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi (float *xDpi)
703```
704
705**描述**
706
707获取屏幕X方向中每英寸屏幕的物理像素值。
708
709**系统能力:** SystemCapability.WindowManager.WindowManager.Core
710
711**起始版本:** 12
712
713**参数:**
714
715| 名称 | 描述 |
716| -------- | -------- |
717| xDpi | X方向中每英寸屏幕的物理像素值,该参数为浮点数,此处作为出参返回。 |
718
719**返回:**
720
721返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
722
723
724### OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi()
725
726```
727NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi (float *yDpi)
728```
729
730**描述**
731
732获取Y方向中每英寸屏幕的物理像素值。
733
734**系统能力:** SystemCapability.WindowManager.WindowManager.Core
735
736**起始版本:** 12
737
738**参数:**
739
740| 名称 | 描述 |
741| -------- | -------- |
742| yDpi | 获取Y方向中每英寸屏幕的物理像素值,该参数为浮点数,此处作为出参返回。 |
743
744**返回:**
745
746返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
747
748
749### OH_NativeDisplayManager_GetDefaultDisplayHeight()
750
751```
752NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayHeight (int32_t *displayHeight)
753```
754
755**描述**
756
757获取默认屏幕的高度。
758
759**系统能力:** SystemCapability.WindowManager.WindowManager.Core
760
761**起始版本:** 12
762
763**参数:**
764
765| 名称 | 描述 |
766| -------- | -------- |
767| displayHeight | 默认屏幕的高度,单位为px,该参数应为整数,此处作为出参返回。 |
768
769**返回:**
770
771返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
772
773
774### OH_NativeDisplayManager_GetDefaultDisplayId()
775
776```
777NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayId (uint64_t *displayId)
778```
779
780**描述**
781
782获取默认屏幕的id号。
783
784**系统能力:** SystemCapability.WindowManager.WindowManager.Core
785
786**起始版本:** 12
787
788**参数:**
789
790| 名称 | 描述 |
791| -------- | -------- |
792| displayId | 默认屏幕的id号,非负整数,此处作为出参返回。 |
793
794**返回:**
795
796返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
797
798
799### OH_NativeDisplayManager_GetDefaultDisplayOrientation()
800
801```
802NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayOrientation (NativeDisplayManager_Orientation *displayOrientation)
803```
804
805**描述**
806
807获取默认屏幕的旋转方向。
808
809**系统能力:** SystemCapability.WindowManager.WindowManager.Core
810
811**起始版本:** 12
812
813**参数:**
814
815| 名称 | 描述 |
816| -------- | -------- |
817| displayOrientation | 屏幕当前显示的方向,具体可见[NativeDisplayManager_Orientation](#nativedisplaymanager_orientation),此处作为出参返回。 |
818
819**返回:**
820
821返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
822
823
824### OH_NativeDisplayManager_GetDefaultDisplayRefreshRate()
825
826```
827NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRefreshRate (uint32_t *refreshRate)
828```
829
830**描述**
831
832获取默认屏幕的刷新率。
833
834**系统能力:** SystemCapability.WindowManager.WindowManager.Core
835
836**起始版本:** 12
837
838**参数:**
839
840| 名称 | 描述 |
841| -------- | -------- |
842| refreshRate | 屏幕的刷新率,该参数应为整数,单位为hz,此处作为出参返回。 |
843
844**返回:**
845
846返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
847
848
849### OH_NativeDisplayManager_GetDefaultDisplayRotation()
850
851```
852NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRotation (NativeDisplayManager_Rotation *displayRotation)
853```
854
855**描述**
856
857获取默认屏幕的顺时针旋转角度。
858
859**系统能力:** SystemCapability.WindowManager.WindowManager.Core
860
861**起始版本:** 12
862
863**参数:**
864
865| 名称 | 描述 |
866| -------- | -------- |
867| displayRotation | 默认屏幕的顺时针旋转角度,具体可见[NativeDisplayManager_Rotation](#nativedisplaymanager_rotation),此处作为出参返回。 |
868
869**返回:**
870
871返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
872
873
874### OH_NativeDisplayManager_GetDefaultDisplayScaledDensity()
875
876```
877NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayScaledDensity (float *scaledDensity)
878```
879
880**描述**
881
882获取屏幕显示字体的缩放因子。
883
884**系统能力:** SystemCapability.WindowManager.WindowManager.Core
885
886**起始版本:** 12
887
888**参数:**
889
890| 名称 | 描述 |
891| -------- | -------- |
892| scaledDensity | 显示字体的缩放因子,该参数为浮点数,通常与densityPixels相同,此处作为出参返回。 |
893
894**返回:**
895
896返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
897
898
899### OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio()
900
901```
902NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio (float *virtualPixels)
903```
904
905**描述**
906
907获取默认屏幕的虚拟像素密度。
908
909**系统能力:** SystemCapability.WindowManager.WindowManager.Core
910
911**起始版本:** 12
912
913**参数:**
914
915| 名称 | 描述 |
916| -------- | -------- |
917| virtualPixels | 屏幕的虚拟像素密度,该参数为浮点数,通常与densityPixels相同,此处作为出参返回。 |
918
919**返回:**
920
921返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
922
923
924### OH_NativeDisplayManager_GetDefaultDisplayWidth()
925
926```
927NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayWidth (int32_t *displayWidth)
928```
929
930**描述**
931
932获取默认屏幕的宽度。
933
934**系统能力:** SystemCapability.WindowManager.WindowManager.Core
935
936**起始版本:** 12
937
938**参数:**
939
940| 名称 | 描述 |
941| -------- | -------- |
942| displayWidth | 默认屏幕的宽度,单位为px,该参数应为整数,此处作为出参返回。 |
943
944**返回:**
945
946返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
947
948
949### OH_NativeDisplayManager_GetFoldDisplayMode()
950
951```
952NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetFoldDisplayMode (NativeDisplayManager_FoldDisplayMode *displayMode)
953```
954
955**描述**
956
957获取可折叠设备的显示模式。
958
959**系统能力:** SystemCapability.Window.SessionManager
960
961**起始版本:** 12
962
963**参数:**
964
965| 名称 | 描述 |
966| -------- | -------- |
967| displayMode | 折叠设备当前的显示模式,具体可见[NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode),此处作为出参返回。 |
968
969**返回:**
970
971返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
972
973
974### OH_NativeDisplayManager_IsFoldable()
975
976```
977bool OH_NativeDisplayManager_IsFoldable ()
978```
979
980**描述**
981
982查询设备是否可折叠。
983
984**系统能力:** SystemCapability.WindowManager.WindowManager.Core
985
986**起始版本:** 12
987
988**返回:**
989
990返回查询设备是否可折叠的结果。true表示设备可折叠,false表示设备不可折叠。
991
992
993### OH_NativeDisplayManager_RegisterDisplayChangeListener()
994
995```
996NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayChangeListener (OH_NativeDisplayManager_DisplayChangeCallback displayChangeCallback, uint32_t *listenerIndex )
997```
998
999**描述**
1000
1001注册屏幕状态变化监听(如旋转变化、刷新率、DPI、分辨率等变化)。
1002
1003**系统能力:** SystemCapability.WindowManager.WindowManager.Core
1004
1005**起始版本:** 12
1006
1007**参数:**
1008
1009| 名称 | 描述 |
1010| -------- | -------- |
1011| displayChangeCallback | 屏幕状态变化后触发的回调函数,回调函数定义见[OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback)。 |
1012| listenerIndex | 注册成功后返回的监听编号,调用取消注册函数[OH_NativeDisplayManager_UnregisterDisplayChangeListener](#oh_nativedisplaymanager_unregisterdisplaychangelistener)时作为入参使用,此处作为出参返回。 |
1013
1014**返回:**
1015
1016返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
1017
1018
1019### OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener()
1020
1021```
1022NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener (OH_NativeDisplayManager_FoldDisplayModeChangeCallback displayModeChangeCallback, uint32_t *listenerIndex )
1023```
1024
1025**描述**
1026
1027注册屏幕展开、折叠状态变化的监听。
1028
1029**系统能力:** SystemCapability.Window.SessionManager
1030
1031**起始版本:** 12
1032
1033**参数:**
1034
1035| 名称 | 描述 |
1036| -------- | -------- |
1037| displayModeChangeCallback | 屏幕展开和折叠变化后触发的回调函数,回调函数定义见[OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback)。 |
1038| listenerIndex | 注册成功后返回的监听编号,调用取消注册函数[OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener)时作为入参使用,此处作为出参返回。 |
1039
1040**返回:**
1041
1042返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
1043
1044
1045### OH_NativeDisplayManager_UnregisterDisplayChangeListener()
1046
1047```
1048NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeListener (uint32_t listenerIndex)
1049```
1050
1051**描述**
1052
1053取消屏幕状态变化的监听。
1054
1055**系统能力:** SystemCapability.WindowManager.WindowManager.Core
1056
1057**起始版本:** 12
1058
1059**参数:**
1060
1061| 名称 | 描述 |
1062| -------- | -------- |
1063| listenerIndex | 调用注册函数[OH_NativeDisplayManager_RegisterDisplayChangeListener](#oh_nativedisplaymanager_registerdisplaychangelistener)时获取到的监听编号。 |
1064
1065**返回:**
1066
1067返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
1068
1069
1070### OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener()
1071
1072```
1073NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener (uint32_t listenerIndex)
1074```
1075
1076**描述**
1077
1078取消屏幕展开、折叠状态变化的监听。
1079
1080**系统能力:** SystemCapability.Window.SessionManager
1081
1082**起始版本:** 12
1083
1084**参数:**
1085
1086| 名称 | 描述 |
1087| -------- | -------- |
1088| listenerIndex | 调用注册函数[OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_registerfolddisplaymodechangelistener)时获取到的监听编号。 |
1089
1090**返回:**
1091
1092返回屏幕管理接口的通用状态码,具体可见[NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode)。
1093