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