1# OH_DisplayManager
2
3
4## Overview
5
6The OH_DisplayManager module provides the display management capability.
7
8**System capability**: SystemCapability.WindowManager.WindowManager.Core
9
10**Since**: 12
11
12
13## Summary
14
15
16### Files
17
18| Name| Description| 
19| -------- | -------- |
20| [oh_display_info.h](oh__display__info_8h.md) | Declares the common enums and definitions of the display manager.| 
21| [oh_display_manager.h](oh__display__manager_8h.md) | Declares the functions for basic display management. You can call the functions to obtain various information about the default display and listen for display status changes, such as rotation, folding, and unfolding.| 
22
23
24### Structs
25
26| Name| Description| 
27| -------- | -------- |
28| struct  [NativeDisplayManager_Rect](_native_display_manager___rect.md) | Describes a rectangle.| 
29| struct  [NativeDisplayManager_WaterfallDisplayAreaRects](ive_display_manager___waterfall_display_area_rects.md) | Describes the curved area on the waterfall display.| 
30| struct  [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) | Describes the cutout, which is an area that is not intended for displaying content on the display.| 
31
32
33### Types
34
35| Name| Description| 
36| -------- | -------- |
37| typedef enum [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) | Defines an enum for the clockwise rotation angles of a display.| 
38| typedef enum [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) | Defines an enum for the orientations of a display.| 
39| typedef enum [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) | Defines an enum for the status codes returned by the display manager interface.| 
40| typedef enum [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) | Defines an enum for the display modes of a foldable device.| 
41| typedef struct [NativeDisplayManager_Rect](_native_display_manager___rect.md) [NativeDisplayManager_Rect](#nativedisplaymanager_rect) | Defines a struct for a rectangle.| 
42| typedef struct [NativeDisplayManager_WaterfallDisplayAreaRects](ive_display_manager___waterfall_display_area_rects.md) [NativeDisplayManager_WaterfallDisplayAreaRects](#nativedisplaymanager_waterfalldisplayarearects) | Defines a struct for the curved area on the waterfall display.| 
43| typedef struct [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) [NativeDisplayManager_CutoutInfo](#nativedisplaymanager_cutoutinfo) | Defines a struct for the cutout, which is an area that is not intended for displaying content on the display.| 
44| typedef void(\* [OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback)) (uint64_t displayId) | Defines a callback function used to listen for status changes of a display.| 
45| typedef void(\* [OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback)) ([NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) displayMode) | Defines a callback function used to listen for folded/unfolded state changes of a display.| 
46
47
48### Enums
49
50| Name| Description| 
51| -------- | -------- |
52| [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 } | Enumerates the clockwise rotation angles of a display.| 
53| [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>} | Enumerates the orientations of a display.| 
54| [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>} | Enumerates the status codes returned by the display manager interface.| 
55| [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>} | Enumerates the display modes of a foldable device.| 
56
57
58### Functions
59
60| Name| Description| 
61| -------- | -------- |
62| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayId](#oh_nativedisplaymanager_getdefaultdisplayid) (uint64_t \*displayId) | Obtains the ID of the default display.| 
63| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayWidth](#oh_nativedisplaymanager_getdefaultdisplaywidth) (int32_t \*displayWidth) | Obtains the width of the default display.| 
64| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayHeight](#oh_nativedisplaymanager_getdefaultdisplayheight) (int32_t \*displayHeight) | Obtains the height of the default display.| 
65| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayRotation](#oh_nativedisplaymanager_getdefaultdisplayrotation) ([NativeDisplayManager_Rotation](#nativedisplaymanager_rotation) \*displayRotation) | Obtains the clockwise rotation angle of the default display.| 
66| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayOrientation](#oh_nativedisplaymanager_getdefaultdisplayorientation) ([NativeDisplayManager_Orientation](#nativedisplaymanager_orientation) \*displayOrientation) | Obtains the orientation of the default display.| 
67| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio](#oh_nativedisplaymanager_getdefaultdisplayvirtualpixelratio) (float \*virtualPixels) | Obtains the virtual pixel ratio of the default display.| 
68| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayRefreshRate](#oh_nativedisplaymanager_getdefaultdisplayrefreshrate) (uint32_t \*refreshRate) | Obtains the refresh rate of the default display.| 
69| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityDpi](#oh_nativedisplaymanager_getdefaultdisplaydensitydpi) (int32_t \*densityDpi) | Obtains the physical pixel density of the default display.| 
70| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityPixels](#oh_nativedisplaymanager_getdefaultdisplaydensitypixels) (float \*densityPixels) | Obtains the logical pixel density of the default display.| 
71| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayScaledDensity](#oh_nativedisplaymanager_getdefaultdisplayscaleddensity) (float \*scaledDensity) | Obtains the scale factor of the font displayed on the default display.| 
72| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi](#oh_nativedisplaymanager_getdefaultdisplaydensityxdpi) (float \*xDpi) | Obtains the number of physical pixels that are displayed horizontally per inch on the default display.| 
73| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi](#oh_nativedisplaymanager_getdefaultdisplaydensityydpi) (float \*yDpi) | Obtains the number of physical pixels that are displayed vertically per inch on the default display.| 
74| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo) ([NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) \*\*cutoutInfo) | Obtains the cutout information of the default display.| 
75| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_destroydefaultdisplaycutoutinfo) ([NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md) \*cutoutInfo) | Destroys the cutout information of the default display.| 
76| bool [OH_NativeDisplayManager_IsFoldable](#oh_nativedisplaymanager_isfoldable) () | Checks whether the device is foldable.| 
77| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_GetFoldDisplayMode](#oh_nativedisplaymanager_getfolddisplaymode) ([NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode) \*displayMode) | Obtains the display mode of the foldable device.| 
78| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_RegisterDisplayChangeListener](#oh_nativedisplaymanager_registerdisplaychangelistener) ([OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback) displayChangeCallback, uint32_t \*listenerIndex) | Registers a listener for status changes (such as rotation, refresh rate, DPI, and resolution changes) of the display.| 
79| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_UnregisterDisplayChangeListener](#oh_nativedisplaymanager_unregisterdisplaychangelistener) (uint32_t listenerIndex) | Cancels the listening for status changes of the display.| 
80| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_registerfolddisplaymodechangelistener) ([OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback) displayModeChangeCallback, uint32_t \*listenerIndex) | Registers a listener for folded/unfolded state changes of the display.| 
81| [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode) [OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener) (uint32_t listenerIndex) | Cancels the listening for folded/unfolded state changes of the display.| 
82
83
84## Type Description
85
86
87### NativeDisplayManager_CutoutInfo
88
89```
90typedef struct NativeDisplayManager_CutoutInfo NativeDisplayManager_CutoutInfo
91```
92
93**Description**
94
95Defines a struct for the cutout, which is an area that is not intended for displaying content on the display.
96
97**System capability**: SystemCapability.WindowManager.WindowManager.Core
98
99**Since**: 12
100
101
102### NativeDisplayManager_ErrorCode
103
104```
105typedef enum NativeDisplayManager_ErrorCode NativeDisplayManager_ErrorCode
106```
107
108**Description**
109
110Defines an enum for the status codes returned by the display manager interface.
111
112**System capability**: SystemCapability.WindowManager.WindowManager.Core
113
114**Since**: 12
115
116
117### NativeDisplayManager_FoldDisplayMode
118
119```
120typedef enum NativeDisplayManager_FoldDisplayMode NativeDisplayManager_FoldDisplayMode
121```
122
123**Description**
124
125Defines an enum for the display modes of a foldable device.
126
127**System capability**: SystemCapability.WindowManager.WindowManager.Core
128
129**Since**: 12
130
131
132### NativeDisplayManager_Orientation
133
134```
135typedef enum NativeDisplayManager_Orientation NativeDisplayManager_Orientation
136```
137
138**Description**
139
140Defines an enum for the orientations of a display.
141
142**System capability**: SystemCapability.WindowManager.WindowManager.Core
143
144**Since**: 12
145
146
147### NativeDisplayManager_Rect
148
149```
150typedef struct NativeDisplayManager_Rect NativeDisplayManager_Rect
151```
152
153**Description**
154
155Defines a struct for a rectangle.
156
157**System capability**: SystemCapability.WindowManager.WindowManager.Core
158
159**Since**: 12
160
161
162### NativeDisplayManager_Rotation
163
164```
165typedef enum NativeDisplayManager_Rotation NativeDisplayManager_Rotation
166```
167
168**Description**
169
170Defines an enum for the clockwise rotation angles of a display.
171
172**System capability**: SystemCapability.WindowManager.WindowManager.Core
173
174**Since**: 12
175
176
177### NativeDisplayManager_WaterfallDisplayAreaRects
178
179```
180typedef struct NativeDisplayManager_WaterfallDisplayAreaRects NativeDisplayManager_WaterfallDisplayAreaRects
181```
182
183**Description**
184
185Defines a struct for the curved area on the waterfall display.
186
187**System capability**: SystemCapability.WindowManager.WindowManager.Core
188
189**Since**: 12
190
191
192### OH_NativeDisplayManager_DisplayChangeCallback
193
194```
195typedef void(* OH_NativeDisplayManager_DisplayChangeCallback) (uint64_t displayId)
196```
197
198**Description**
199
200Defines a callback function used to listen for status changes of a display.
201
202**System capability**: SystemCapability.Window.SessionManager
203
204**Since**: 12
205
206**Parameters**
207
208| Name| Description| 
209| -------- | -------- |
210| displayId | ID of the display.| 
211
212
213### OH_NativeDisplayManager_FoldDisplayModeChangeCallback
214
215```
216typedef void(* OH_NativeDisplayManager_FoldDisplayModeChangeCallback) (NativeDisplayManager_FoldDisplayMode displayMode)
217```
218
219**Description**
220
221Defines a callback function used to listen for folded/unfolded state changes of a display.
222
223**System capability**: SystemCapability.Window.SessionManager
224
225**Since**: 12
226
227**Parameters**
228
229| Name| Description| 
230| -------- | -------- |
231| displayMode | Folded or unfolded state of the display. For details about the available options, see [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode).| 
232
233
234## Enum Description
235
236
237### NativeDisplayManager_ErrorCode
238
239```
240enum NativeDisplayManager_ErrorCode
241```
242
243**Description**
244
245Enumerates the status codes returned by the display manager interface.
246
247**System capability**: SystemCapability.WindowManager.WindowManager.Core
248
249**Since**: 12
250
251| Value| Description| 
252| -------- | -------- |
253| DISPLAY_MANAGER_OK | The operation is successful.| 
254| DISPLAY_MANAGER_ERROR_NO_PERMISSION | Permission verification failed. The application does not have the permission to use the API.| 
255| DISPLAY_MANAGER_ERROR_NOT_SYSTEM_APP | Permission verification failed. A non-system application attempts to call a system API.| 
256| DISPLAY_MANAGER_ERROR_INVALID_PARAM | Parameter check fails.| 
257| DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED | The device does not support the API.| 
258| DISPLAY_MANAGER_ERROR_INVALID_SCREEN | The display is invalid.| 
259| DISPLAY_MANAGER_ERROR_INVALID_CALL | The current operation object does not have the operation permission.| 
260| DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL | The system service is abnormal.| 
261
262
263### NativeDisplayManager_FoldDisplayMode
264
265```
266enum NativeDisplayManager_FoldDisplayMode
267```
268
269**Description**
270
271Enumerates the display modes of a foldable device.
272
273**System capability**: SystemCapability.WindowManager.WindowManager.Core
274
275**Since**: 12
276
277| Value| Description| 
278| -------- | -------- |
279| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_UNKNOWN | The display mode of the device is unknown.| 
280| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_FULL | The device is displayed in full screen.| 
281| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN | The main screen of the device is displayed.| 
282| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_SUB | The subscreen of the device is displayed.| 
283| DISPLAY_MANAGER_FOLD_DISPLAY_MODE_COORDINATION | Both screens of the device are displayed in collaborative mode.| 
284
285
286### NativeDisplayManager_Orientation
287
288```
289enum NativeDisplayManager_Orientation
290```
291
292**Description**
293
294Enumerates the orientations of a display.
295
296**System capability**: SystemCapability.WindowManager.WindowManager.Core
297
298**Since**: 12
299
300| Value| Description| 
301| -------- | -------- |
302| DISPLAY_MANAGER_PORTRAIT | The display is in portrait mode.| 
303| DISPLAY_MANAGER_LANDSCAPE | The display is in landscape mode.| 
304| DISPLAY_MANAGER_PORTRAIT_INVERTED | The display is in reverse portrait mode.| 
305| DISPLAY_MANAGER_LANDSCAPE_INVERTED | The display is in reverse landscape mode.| 
306| DISPLAY_MANAGER_UNKNOWN | The screen orientation is unknown.| 
307
308
309### NativeDisplayManager_Rotation
310
311```
312enum NativeDisplayManager_Rotation
313```
314
315**Description**
316
317Enumerates the clockwise rotation angles of a display.
318
319**System capability**: SystemCapability.WindowManager.WindowManager.Core
320
321**Since**: 12
322
323| Value| Description| 
324| -------- | -------- |
325| DISPLAY_MANAGER_ROTATION_0 | The display is rotated clockwise by 0 degrees.| 
326| DISPLAY_MANAGER_ROTATION_90 | The display is rotated clockwise by 90 degrees.| 
327| DISPLAY_MANAGER_ROTATION_180 | The display is rotated clockwise by 180 degrees.| 
328| DISPLAY_MANAGER_ROTATION_270 | The display is rotated clockwise by 270 degrees.| 
329
330
331## Function Description
332
333
334### OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo()
335
336```
337NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo (NativeDisplayManager_CutoutInfo **cutoutInfo)
338```
339
340**Description**
341
342Obtains the cutout information of the default display.
343
344**System capability**: SystemCapability.WindowManager.WindowManager.Core
345
346**Since**: 12
347
348**Parameters**
349
350| Name| Description| 
351| -------- | -------- |
352| cutoutInfo | Double pointer to the cutout information. For details, see [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md).| 
353
354**Returns**
355
356Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
357
358
359### OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo()
360
361```
362NativeDisplayManager_ErrorCode OH_NativeDisplayManager_DestroyDefaultDisplayCutoutInfo (NativeDisplayManager_CutoutInfo *cutoutInfo)
363```
364
365**Description**
366
367Destroys the cutout information of the default display.
368
369**System capability**: SystemCapability.WindowManager.WindowManager.Core
370
371**Since**: 12
372
373**Parameters**
374
375| Name| Description| 
376| -------- | -------- |
377| cutoutInfo | Pointer to the cutout information object obtained by calling [OH_NativeDisplayManager_CreateDefaultDisplayCutoutInfo](#oh_nativedisplaymanager_createdefaultdisplaycutoutinfo). For details, see [NativeDisplayManager_CutoutInfo](_native_display_manager___cutout_info.md).| 
378
379**Returns**
380
381Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
382
383
384### OH_NativeDisplayManager_GetDefaultDisplayDensityDpi()
385
386```
387NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityDpi (int32_t *densityDpi)
388```
389
390**Description**
391
392Obtains the physical pixel density of the default display.
393
394**System capability**: SystemCapability.WindowManager.WindowManager.Core
395
396**Since**: 12
397
398**Parameters**
399
400| Name| Description| 
401| -------- | -------- |
402| densityDpi | Pointer to the physical pixel density, that is, the number of pixels per inch. The value is a floating point number, in px. The actual value depends on the options provided in device settings.  | 
403
404**Returns**
405
406Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
407
408
409### OH_NativeDisplayManager_GetDefaultDisplayDensityPixels()
410
411```
412NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityPixels (float *densityPixels)
413```
414
415**Description**
416
417Obtains the logical pixel density of the default display.
418
419**System capability**: SystemCapability.WindowManager.WindowManager.Core
420
421**Since**: 12
422
423**Parameters**
424
425| Name| Description| 
426| -------- | -------- |
427| densityPixels | Pointer to the logical pixel density, which indicates the scaling coefficient of the physical pixels and logical pixels. The value is a floating point number in the range [0.5, 4.0]. Generally, the value is **1.0** or **3.0**. The actual value depends on the density DPI provided by the device in use.  | 
428
429**Returns**
430
431Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
432
433
434### OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi()
435
436```
437NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi (float *xDpi)
438```
439
440**Description**
441
442Obtains the number of physical pixels that are displayed horizontally per inch on the default display.
443
444**System capability**: SystemCapability.WindowManager.WindowManager.Core
445
446**Since**: 12
447
448**Parameters**
449
450| Name| Description| 
451| -------- | -------- |
452| xDpi | Pointer to the number of physical pixels displayed horizontally per inch. The value is a floating point number.| 
453
454**Returns**
455
456Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
457
458
459### OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi()
460
461```
462NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi (float *yDpi)
463```
464
465**Description**
466
467Obtains the number of physical pixels that are displayed vertically per inch on the default display.
468
469**System capability**: SystemCapability.WindowManager.WindowManager.Core
470
471**Since**: 12
472
473**Parameters**
474
475| Name| Description| 
476| -------- | -------- |
477| yDpi | Pointer to the number of physical pixels displayed vertically per inch. The value is a floating point number.| 
478
479**Returns**
480
481Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
482
483
484### OH_NativeDisplayManager_GetDefaultDisplayHeight()
485
486```
487NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayHeight (int32_t *displayHeight)
488```
489
490**Description**
491
492Obtains the height of the default display.
493
494**System capability**: SystemCapability.WindowManager.WindowManager.Core
495
496**Since**: 12
497
498**Parameters**
499
500| Name| Description| 
501| -------- | -------- |
502| displayHeight | Pointer to the height, in px. The value is an integer.| 
503
504**Returns**
505
506Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
507
508
509### OH_NativeDisplayManager_GetDefaultDisplayId()
510
511```
512NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayId (uint64_t *displayId)
513```
514
515**Description**
516
517Obtains the ID of the default display.
518
519**System capability**: SystemCapability.WindowManager.WindowManager.Core
520
521**Since**: 12
522
523**Parameters**
524
525| Name| Description| 
526| -------- | -------- |
527| displayId | Pointer to the display ID. The value is a non-negative integer.| 
528
529**Returns**
530
531Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
532
533
534### OH_NativeDisplayManager_GetDefaultDisplayOrientation()
535
536```
537NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayOrientation (NativeDisplayManager_Orientation *displayOrientation)
538```
539
540**Description**
541
542Obtains the orientation of the default display.
543
544**System capability**: SystemCapability.WindowManager.WindowManager.Core
545
546**Since**: 12
547
548**Parameters**
549
550| Name| Description| 
551| -------- | -------- |
552| displayOrientation | Pointer to the orientation. For details about the available options, see [NativeDisplayManager_Orientation](#nativedisplaymanager_orientation).| 
553
554**Returns**
555
556Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
557
558
559### OH_NativeDisplayManager_GetDefaultDisplayRefreshRate()
560
561```
562NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRefreshRate (uint32_t *refreshRate)
563```
564
565**Description**
566
567Obtains the refresh rate of the default display.
568
569**System capability**: SystemCapability.WindowManager.WindowManager.Core
570
571**Since**: 12
572
573**Parameters**
574
575| Name| Description| 
576| -------- | -------- |
577| refreshRate | Pointer to the refresh rate. The value is an integer, in Hz.| 
578
579**Returns**
580
581Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
582
583
584### OH_NativeDisplayManager_GetDefaultDisplayRotation()
585
586```
587NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRotation (NativeDisplayManager_Rotation *displayRotation)
588```
589
590**Description**
591
592Obtains the clockwise rotation angle of the default display.
593
594**System capability**: SystemCapability.WindowManager.WindowManager.Core
595
596**Since**: 12
597
598**Parameters**
599
600| Name| Description| 
601| -------- | -------- |
602| displayRotation | Pointer to the clockwise rotation angle. For details about the available options, see [NativeDisplayManager_Rotation](#nativedisplaymanager_rotation).| 
603
604**Returns**
605
606Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
607
608
609### OH_NativeDisplayManager_GetDefaultDisplayScaledDensity()
610
611```
612NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayScaledDensity (float *scaledDensity)
613```
614
615**Description**
616
617Obtains the scale factor of the font displayed on the default display.
618
619**System capability**: SystemCapability.WindowManager.WindowManager.Core
620
621**Since**: 12
622
623**Parameters**
624
625| Name| Description| 
626| -------- | -------- |
627| scaledDensity | Pointer to the scale factor. The value is a floating-point number, and it is usually the same as that of **densityPixels**.| 
628
629**Returns**
630
631Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
632
633
634### OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio()
635
636```
637NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio (float *virtualPixels)
638```
639
640**Description**
641
642Obtains the virtual pixel ratio of the default display.
643
644**System capability**: SystemCapability.WindowManager.WindowManager.Core
645
646**Since**: 12
647
648**Parameters**
649
650| Name| Description| 
651| -------- | -------- |
652| virtualPixels | Pointer to the virtual pixel ratio. The value is a floating-point number, and it is usually the same as that of **densityPixels**.| 
653
654**Returns**
655
656Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
657
658
659### OH_NativeDisplayManager_GetDefaultDisplayWidth()
660
661```
662NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayWidth (int32_t *displayWidth)
663```
664
665**Description**
666
667Obtains the width of the default display.
668
669**System capability**: SystemCapability.WindowManager.WindowManager.Core
670
671**Since**: 12
672
673**Parameters**
674
675| Name| Description| 
676| -------- | -------- |
677| displayWidth | Pointer to the width, in px. The value is an integer.| 
678
679**Returns**
680
681Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
682
683
684### OH_NativeDisplayManager_GetFoldDisplayMode()
685
686```
687NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetFoldDisplayMode (NativeDisplayManager_FoldDisplayMode *displayMode)
688```
689
690**Description**
691
692Obtains the display mode of the foldable device.
693
694**System capability**: SystemCapability.Window.SessionManager
695
696**Since**: 12
697
698**Parameters**
699
700| Name| Description| 
701| -------- | -------- |
702| displayMode | Pointer to the display mode. For details about the available options, see [NativeDisplayManager_FoldDisplayMode](#nativedisplaymanager_folddisplaymode).| 
703
704**Returns**
705
706Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
707
708
709### OH_NativeDisplayManager_IsFoldable()
710
711```
712bool OH_NativeDisplayManager_IsFoldable ()
713```
714
715**Description**
716
717Checks whether the device is foldable.
718
719**System capability**: SystemCapability.WindowManager.WindowManager.Core
720
721**Since**: 12
722
723**Returns**
724
725Returns the check result. The value **true** means that the device is foldable, and **false** means the opposite.
726
727
728### OH_NativeDisplayManager_RegisterDisplayChangeListener()
729
730```
731NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayChangeListener (OH_NativeDisplayManager_DisplayChangeCallback displayChangeCallback, uint32_t *listenerIndex )
732```
733
734**Description**
735
736Registers a listener for status changes (such as rotation, refresh rate, DPI, and resolution changes) of the display.
737
738**System capability**: SystemCapability.WindowManager.WindowManager.Core
739
740**Since**: 12
741
742**Parameters**
743
744| Name| Description| 
745| -------- | -------- |
746| displayChangeCallback | Callback function triggered when the display status is changed. For details, see [OH_NativeDisplayManager_DisplayChangeCallback](#oh_nativedisplaymanager_displaychangecallback).| 
747| listenerIndex | Pointer to the index of the listener registered. It is used as an input parameter of [OH_NativeDisplayManager_UnregisterDisplayChangeListener](#oh_nativedisplaymanager_unregisterdisplaychangelistener).| 
748
749**Returns**
750
751Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
752
753
754### OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener()
755
756```
757NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener (OH_NativeDisplayManager_FoldDisplayModeChangeCallback displayModeChangeCallback, uint32_t *listenerIndex )
758```
759
760**Description**
761
762Registers a listener for folded/unfolded state changes of the display.
763
764**System capability**: SystemCapability.Window.SessionManager
765
766**Since**: 12
767
768**Parameters**
769
770| Name| Description| 
771| -------- | -------- |
772| displayModeChangeCallback | Callback function triggered when the folded/unfolded state of the display is changed. For details, see [OH_NativeDisplayManager_FoldDisplayModeChangeCallback](#oh_nativedisplaymanager_folddisplaymodechangecallback).| 
773| listenerIndex | Pointer to the index of the listener registered. It is used as an input parameter of [OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_unregisterfolddisplaymodechangelistener).| 
774
775**Returns**
776
777Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
778
779
780### OH_NativeDisplayManager_UnregisterDisplayChangeListener()
781
782```
783NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeListener (uint32_t listenerIndex)
784```
785
786**Description**
787
788Cancels the listening for status changes of the display.
789
790**System capability**: SystemCapability.WindowManager.WindowManager.Core
791
792**Since**: 12
793
794**Parameters**
795
796| Name| Description| 
797| -------- | -------- |
798| listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterDisplayChangeListener](#oh_nativedisplaymanager_registerdisplaychangelistener) is called.| 
799
800**Returns**
801
802Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
803
804
805### OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener()
806
807```
808NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener (uint32_t listenerIndex)
809```
810
811**Description**
812
813Cancels the listening for folded/unfolded state changes of the display.
814
815**System capability**: SystemCapability.Window.SessionManager
816
817**Since**: 12
818
819**Parameters**
820
821| Name| Description| 
822| -------- | -------- |
823| listenerIndex | Index of the listener returned when [OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener](#oh_nativedisplaymanager_registerfolddisplaymodechangelistener) is called.| 
824
825**Returns**
826
827Returns a status code defined in [NativeDisplayManager_ErrorCode](#nativedisplaymanager_errorcode).
828