1e41f4b71Sopenharmony_ci# @ohos.display (Display)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **Display** module provides APIs for managing displays, such as obtaining information about the default display, obtaining information about all displays, and listening for the addition and removal of displays.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Modules to Import
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci```ts
12e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## DisplayState
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciEnumerates the display states.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci| Name| Value| Description|
24e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
25e41f4b71Sopenharmony_ci| STATE_UNKNOWN | 0 | Unknown.|
26e41f4b71Sopenharmony_ci| STATE_OFF | 1 | The display is shut down.|
27e41f4b71Sopenharmony_ci| STATE_ON | 2 | The display is powered on.|
28e41f4b71Sopenharmony_ci| STATE_DOZE | 3 | The display is in sleep mode.|
29e41f4b71Sopenharmony_ci| STATE_DOZE_SUSPEND | 4 | The display is in sleep mode, and the CPU is suspended.|
30e41f4b71Sopenharmony_ci| STATE_VR | 5 | The display is in VR mode.|
31e41f4b71Sopenharmony_ci| STATE_ON_SUSPEND | 6 | The display is powered on, and the CPU is suspended.|
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci## Orientation<sup>10+</sup>
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ciEnumerates the orientations of the display.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci| Name| Value| Description|
42e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
43e41f4b71Sopenharmony_ci| PORTRAIT | 0 | The display is in portrait mode.|
44e41f4b71Sopenharmony_ci| LANDSCAPE | 1 | The display is in landscape mode.|
45e41f4b71Sopenharmony_ci| PORTRAIT_INVERTED | 2 | The display is in reverse portrait mode.|
46e41f4b71Sopenharmony_ci| LANDSCAPE_INVERTED | 3 | The display is in reverse landscape mode.|
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci## FoldStatus<sup>10+</sup>
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ciEnumerates the folding statuses of a foldable device.
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci| Name| Value| Description|
57e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
58e41f4b71Sopenharmony_ci| FOLD_STATUS_UNKNOWN | 0 | The folding status of the device is unknown.|
59e41f4b71Sopenharmony_ci| FOLD_STATUS_EXPANDED | 1 | The device is fully open.|
60e41f4b71Sopenharmony_ci| FOLD_STATUS_FOLDED | 2 | The device is folded (completely closed).|
61e41f4b71Sopenharmony_ci| FOLD_STATUS_HALF_FOLDED | 3 | The device is half-folded, somehow between fully open and completely closed.|
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci## FoldDisplayMode<sup>10+</sup>
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ciEnumerates the display modes of a foldable device.
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| Name| Value| Description|
72e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
73e41f4b71Sopenharmony_ci| FOLD_DISPLAY_MODE_UNKNOWN | 0 | The display mode of the device is unknown.|
74e41f4b71Sopenharmony_ci| FOLD_DISPLAY_MODE_FULL | 1 | The device is displayed in full screen.|
75e41f4b71Sopenharmony_ci| FOLD_DISPLAY_MODE_MAIN | 2 | The main screen of the device is displayed.|
76e41f4b71Sopenharmony_ci| FOLD_DISPLAY_MODE_SUB | 3 | The subscreen of the device is displayed.|
77e41f4b71Sopenharmony_ci| FOLD_DISPLAY_MODE_COORDINATION | 4 | Both screens of the device are displayed in collaborative mode.|
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci## FoldCreaseRegion<sup>10+</sup>
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ciDefines the crease region of a foldable device.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci| Name  | Type| Readable| Writable| Description              |
88e41f4b71Sopenharmony_ci| ------ | -------- | ---- | ---- | ------------------ |
89e41f4b71Sopenharmony_ci| displayId   | number   | Yes  | No  | ID of the display where the crease is located.|
90e41f4b71Sopenharmony_ci| creaseRects    | Array\<[Rect](#rect9)>   | Yes  | No  | Crease region.|
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci## Rect<sup>9+</sup>
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ciDescribes a rectangle on the display.
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci| Name  | Type| Readable| Writable| Description              |
101e41f4b71Sopenharmony_ci| ------ | -------- | ---- | ---- | ------------------ |
102e41f4b71Sopenharmony_ci| left   | number   | Yes  | Yes  | Left boundary of the rectangle, in px. The value must be an integer.|
103e41f4b71Sopenharmony_ci| top    | number   | Yes  | Yes  | Top boundary of the rectangle, in px. The value must be an integer.|
104e41f4b71Sopenharmony_ci| width  | number   | Yes  | Yes  | Width of the rectangle, in px. The value must be an integer.  |
105e41f4b71Sopenharmony_ci| height | number   | Yes  | Yes  | Height of the rectangle, in px. The value must be an integer.  |
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci## WaterfallDisplayAreaRects<sup>9+</sup>
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ciDescribes the curved area (an area that is not intended for displaying content) on the waterfall display.
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci| Name  | Type     | Readable| Writable| Description              |
116e41f4b71Sopenharmony_ci| ------ | ------------- | ---- | ---- | ------------------ |
117e41f4b71Sopenharmony_ci| left   | [Rect](#rect9) | Yes  | No  | Bounding rectangle for the curved area, which is located on the left of the display surface.|
118e41f4b71Sopenharmony_ci| top    | [Rect](#rect9) | Yes  | No  | Bounding rectangle for the curved area, which is located at the top of the display surface.|
119e41f4b71Sopenharmony_ci| right  | [Rect](#rect9) | Yes  | No  | Bounding rectangle for the curved area, which is located on the right of the display surface.|
120e41f4b71Sopenharmony_ci| bottom | [Rect](#rect9) | Yes  | No  | Bounding rectangle for the curved area, which is located at the bottom of the display surface.|
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci## CutoutInfo<sup>9+</sup>
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ciDescribes the cutout, which is an area that is not intended for displaying content on the display.
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci| Name                       | Type     | Readable| Writable| Description              |
131e41f4b71Sopenharmony_ci| --------------------------- | ------------- | ---- | ---- | ------------------ |
132e41f4b71Sopenharmony_ci| boundingRects                | Array\<[Rect](#rect9)> | Yes  | No  | Bounding rectangle for punch holes and notches.|
133e41f4b71Sopenharmony_ci| waterfallDisplayAreaRects   | [WaterfallDisplayAreaRects](#waterfalldisplayarearects9) | Yes| No| Curved area on the waterfall display.|
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci## DisplayPhysicalResolution<sup>12+</sup>
136e41f4b71Sopenharmony_ciDescribes the display mode of a foldable device and the corresponding physical screen resolution information.
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci| Name                       | Type     | Read-Only| Optional| Description              |
143e41f4b71Sopenharmony_ci| --------------------------- | ------------- | ---- | ---- | ------------------ |
144e41f4b71Sopenharmony_ci| foldDisplayMode             | [FoldDisplayMode](#folddisplaymode10) | Yes  | No  | Display mode of the foldable device.|
145e41f4b71Sopenharmony_ci| physicalWidth   | number | Yes| No| Width of the foldable device, in px. The value must be an integer greater than 0.|
146e41f4b71Sopenharmony_ci| physicalHeight  | number | Yes| No| Height of the foldable device, in px. The value must be an integer greater than 0.|
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci## display.getDisplayByIdSync<sup>12+</sup>
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_cigetDisplayByIdSync(displayId: number): Display
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ciObtains a **Display** object based on the display ID.
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci**Parameters**
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci| Name| Type                     | Mandatory| Description      |
161e41f4b71Sopenharmony_ci| ------ | ------------------------- | ---- |----------|
162e41f4b71Sopenharmony_ci| displayId     | number                    | Yes  | Display ID. The value must be an integer greater than or equal to 0. An object can be obtained only when the passed-in display ID is correct. You can use the value of the **displayId** property in [WindowProperties](js-apis-window.md#windowproperties) as the input parameter.|
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci**Return value**
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci| Type                          | Description                                          |
167e41f4b71Sopenharmony_ci| ------------------------------| ----------------------------------------------|
168e41f4b71Sopenharmony_ci| [Display](#display) | **Display** object.|
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci**Error codes**
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci| ID| Error Message|
175e41f4b71Sopenharmony_ci| ------- | ----------------------- |
176e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2. Incorrect parameter types. |
177e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci**Example**
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci```ts
182e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_citry {
187e41f4b71Sopenharmony_ci  // Use the value of the displayId property in WindowProperties as the input parameter.
188e41f4b71Sopenharmony_ci  let displayId = 0; 
189e41f4b71Sopenharmony_ci  displayClass = display.getDisplayByIdSync(displayId);
190e41f4b71Sopenharmony_ci} catch (exception) {
191e41f4b71Sopenharmony_ci  console.error(`Failed to get display. Code: ${exception.code}, message: ${exception.message}`);
192e41f4b71Sopenharmony_ci}
193e41f4b71Sopenharmony_ci```
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci## display.getAllDisplayPhysicalResolution<sup>12+</sup>
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_cigetAllDisplayPhysicalResolution(): Promise&lt;Array&lt;DisplayPhysicalResolution&gt;&gt;
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ciObtains the display mode of the current foldable device and the corresponding physical screen resolution information.
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ci**Return value**
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci| Type| Description|
208e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
209e41f4b71Sopenharmony_ci| Promise&lt;Array&lt;[DisplayPhysicalResolution](#displayphysicalresolution12)&gt;&gt; | Promise used to return all the **DisplayPhysicalResolution** objects.|
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci**Error codes**
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci| ID| Error Message|
216e41f4b71Sopenharmony_ci| ------- | ----------------------- |
217e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ci**Example**
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci```ts
222e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
223e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_cilet promise = display.getAllDisplayPhysicalResolution();
226e41f4b71Sopenharmony_cipromise.then((resolutionObjects) => {
227e41f4b71Sopenharmony_ci  console.info('Obtaining physical resolution length: ' + resolutionObjects.length);
228e41f4b71Sopenharmony_ci  for (let i = 0; i < resolutionObjects.length; i++) {
229e41f4b71Sopenharmony_ci     console.info(`resolutionObjects[${i}].foldDisplayMode: ${resolutionObjects[i].foldDisplayMode}`);
230e41f4b71Sopenharmony_ci     console.info(`resolutionObjects[${i}].physicalWidth: ${resolutionObjects[i].physicalWidth}`); 
231e41f4b71Sopenharmony_ci     console.info(`resolutionObjects[${i}].physicalHeight: ${resolutionObjects[i].physicalHeight}`); 
232e41f4b71Sopenharmony_ci  }
233e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
234e41f4b71Sopenharmony_ci  console.error(`Failed to obtain physical resolution. Code: ${err.code}, message: ${err.message}`);
235e41f4b71Sopenharmony_ci});
236e41f4b71Sopenharmony_ci```
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci## display.getDefaultDisplaySync<sup>9+</sup>
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_cigetDefaultDisplaySync(): Display
241e41f4b71Sopenharmony_ci
242e41f4b71Sopenharmony_ciObtains the default display object. This API returns the result synchronously.
243e41f4b71Sopenharmony_ci
244e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
247e41f4b71Sopenharmony_ci
248e41f4b71Sopenharmony_ci**Return value**
249e41f4b71Sopenharmony_ci
250e41f4b71Sopenharmony_ci| Type                          | Description                                          |
251e41f4b71Sopenharmony_ci| ------------------------------| ----------------------------------------------|
252e41f4b71Sopenharmony_ci| [Display](#display) | Default display object.|
253e41f4b71Sopenharmony_ci
254e41f4b71Sopenharmony_ci**Error codes**
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci| ID| Error Message|
259e41f4b71Sopenharmony_ci| ------- | ----------------------- |
260e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
261e41f4b71Sopenharmony_ci
262e41f4b71Sopenharmony_ci**Example**
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ci```ts
265e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_cidisplayClass = display.getDefaultDisplaySync();
270e41f4b71Sopenharmony_ci```
271e41f4b71Sopenharmony_ci
272e41f4b71Sopenharmony_ci## display.getAllDisplays<sup>9+</sup>
273e41f4b71Sopenharmony_ci
274e41f4b71Sopenharmony_cigetAllDisplays(callback: AsyncCallback&lt;Array&lt;Display&gt;&gt;): void
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_ciObtains all display objects. This API uses an asynchronous callback to return the result.
277e41f4b71Sopenharmony_ci
278e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
279e41f4b71Sopenharmony_ci
280e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci**Parameters**
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
285e41f4b71Sopenharmony_ci| -------- | ---------------------------------------------------- | ---- | ------------------------------- |
286e41f4b71Sopenharmony_ci| callback | AsyncCallback&lt;Array&lt;[Display](#display)&gt;&gt; | Yes| Callback used to return all the display objects.|
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci**Error codes**
289e41f4b71Sopenharmony_ci
290e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
291e41f4b71Sopenharmony_ci
292e41f4b71Sopenharmony_ci| ID| Error Message|
293e41f4b71Sopenharmony_ci| ------- | ----------------------- |
294e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
295e41f4b71Sopenharmony_ci
296e41f4b71Sopenharmony_ci**Example**
297e41f4b71Sopenharmony_ci
298e41f4b71Sopenharmony_ci```ts
299e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
300e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
301e41f4b71Sopenharmony_ci
302e41f4b71Sopenharmony_cilet displayClass: Array<display.Display> = [];
303e41f4b71Sopenharmony_cidisplay.getAllDisplays((err: BusinessError, data: Array<display.Display>) => {
304e41f4b71Sopenharmony_ci  displayClass = data;
305e41f4b71Sopenharmony_ci  const errCode: number = err.code;
306e41f4b71Sopenharmony_ci  if (errCode) {
307e41f4b71Sopenharmony_ci    console.error(`Failed to obtain all the display objects. Code: ${err.code}, message: ${err.message}`);
308e41f4b71Sopenharmony_ci    return;
309e41f4b71Sopenharmony_ci  }
310e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining all the display objects. Data: ' + JSON.stringify(data));
311e41f4b71Sopenharmony_ci});
312e41f4b71Sopenharmony_ci```
313e41f4b71Sopenharmony_ci
314e41f4b71Sopenharmony_ci## display.getAllDisplays<sup>9+</sup>
315e41f4b71Sopenharmony_ci
316e41f4b71Sopenharmony_cigetAllDisplays(): Promise&lt;Array&lt;Display&gt;&gt;
317e41f4b71Sopenharmony_ci
318e41f4b71Sopenharmony_ciObtains all display objects. This API uses a promise to return the result.
319e41f4b71Sopenharmony_ci
320e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
321e41f4b71Sopenharmony_ci
322e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
323e41f4b71Sopenharmony_ci
324e41f4b71Sopenharmony_ci**Return value**
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci| Type| Description|
327e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
328e41f4b71Sopenharmony_ci| Promise&lt;Array&lt;[Display](#display)&gt;&gt; | Promise used to return all the display objects.|
329e41f4b71Sopenharmony_ci
330e41f4b71Sopenharmony_ci**Error codes**
331e41f4b71Sopenharmony_ci
332e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
333e41f4b71Sopenharmony_ci
334e41f4b71Sopenharmony_ci| ID| Error Message|
335e41f4b71Sopenharmony_ci| ------- | ----------------------- |
336e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
337e41f4b71Sopenharmony_ci
338e41f4b71Sopenharmony_ci**Example**
339e41f4b71Sopenharmony_ci
340e41f4b71Sopenharmony_ci```ts
341e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
342e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_cilet displayClass: Array<display.Display> =[];
345e41f4b71Sopenharmony_cilet promise: Promise<Array<display.Display>> = display.getAllDisplays();
346e41f4b71Sopenharmony_cipromise.then((data: Array<display.Display>) => {
347e41f4b71Sopenharmony_ci  displayClass = data;
348e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining all the display objects. Data: ' + JSON.stringify(data));
349e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
350e41f4b71Sopenharmony_ci  console.error(`Failed to obtain all the display objects. Code: ${err.code}, message: ${err.message}`);
351e41f4b71Sopenharmony_ci});
352e41f4b71Sopenharmony_ci```
353e41f4b71Sopenharmony_ci
354e41f4b71Sopenharmony_ci## display.on('add'|'remove'|'change')
355e41f4b71Sopenharmony_ci
356e41f4b71Sopenharmony_cion(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void
357e41f4b71Sopenharmony_ci
358e41f4b71Sopenharmony_ciSubscribes to display changes.
359e41f4b71Sopenharmony_ci
360e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
361e41f4b71Sopenharmony_ci
362e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
363e41f4b71Sopenharmony_ci
364e41f4b71Sopenharmony_ci**Parameters**
365e41f4b71Sopenharmony_ci
366e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description                                                                                                                             |
367e41f4b71Sopenharmony_ci| -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------------------------|
368e41f4b71Sopenharmony_ci| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
369e41f4b71Sopenharmony_ci| callback | Callback&lt;number&gt; | Yes| Callback used to return the ID of the display, which is an integer.                                                                                                    |
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci**Error codes**
372e41f4b71Sopenharmony_ci
373e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ci| ID| Error Message|
376e41f4b71Sopenharmony_ci| ------- | ----------------------- |
377e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
378e41f4b71Sopenharmony_ci
379e41f4b71Sopenharmony_ci**Example**
380e41f4b71Sopenharmony_ci
381e41f4b71Sopenharmony_ci```ts
382e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
383e41f4b71Sopenharmony_ci
384e41f4b71Sopenharmony_cilet callback: Callback<number> = (data: number) => {
385e41f4b71Sopenharmony_ci  console.info('Listening enabled. Data: ' + JSON.stringify(data));
386e41f4b71Sopenharmony_ci};
387e41f4b71Sopenharmony_ci
388e41f4b71Sopenharmony_cidisplay.on("add", callback);
389e41f4b71Sopenharmony_ci```
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci## display.off('add'|'remove'|'change')
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_cioff(type: 'add'|'remove'|'change', callback?: Callback&lt;number&gt;): void
394e41f4b71Sopenharmony_ci
395e41f4b71Sopenharmony_ciUnsubscribes from display changes.
396e41f4b71Sopenharmony_ci
397e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
398e41f4b71Sopenharmony_ci
399e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
400e41f4b71Sopenharmony_ci
401e41f4b71Sopenharmony_ci**Parameters**
402e41f4b71Sopenharmony_ci
403e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
404e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
405e41f4b71Sopenharmony_ci| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
406e41f4b71Sopenharmony_ci| callback | Callback&lt;number&gt; | No| Callback used for unsubscription. If this parameter is not specified, all callbacks of the specified type will be unregistered.|
407e41f4b71Sopenharmony_ci
408e41f4b71Sopenharmony_ci**Error codes**
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
411e41f4b71Sopenharmony_ci
412e41f4b71Sopenharmony_ci| ID| Error Message|
413e41f4b71Sopenharmony_ci| ------- | ----------------------- |
414e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
415e41f4b71Sopenharmony_ci
416e41f4b71Sopenharmony_ci**Example**
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ci```ts
419e41f4b71Sopenharmony_ci
420e41f4b71Sopenharmony_ci// Unregister all the callbacks that have been registered through on().
421e41f4b71Sopenharmony_cidisplay.off("remove");
422e41f4b71Sopenharmony_ci
423e41f4b71Sopenharmony_cilet callback: Callback<number> = (data: number) => {
424e41f4b71Sopenharmony_ci  console.info('Succeeded in unregistering the callback for display remove. Data: ' + JSON.stringify(data))
425e41f4b71Sopenharmony_ci};
426e41f4b71Sopenharmony_ci// Unregister the specified callback.
427e41f4b71Sopenharmony_cidisplay.off('remove', callback);
428e41f4b71Sopenharmony_ci```
429e41f4b71Sopenharmony_ci
430e41f4b71Sopenharmony_ci## display.isFoldable<sup>10+</sup>
431e41f4b71Sopenharmony_ciisFoldable(): boolean
432e41f4b71Sopenharmony_ci
433e41f4b71Sopenharmony_ciChecks whether the device is foldable.
434e41f4b71Sopenharmony_ci
435e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
436e41f4b71Sopenharmony_ci
437e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
438e41f4b71Sopenharmony_ci
439e41f4b71Sopenharmony_ci**Return value**
440e41f4b71Sopenharmony_ci
441e41f4b71Sopenharmony_ci| Type| Description|
442e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
443e41f4b71Sopenharmony_ci| boolean | Returns **true** if the device is foldable, and returns **false** otherwise.|
444e41f4b71Sopenharmony_ci
445e41f4b71Sopenharmony_ci**Error codes**
446e41f4b71Sopenharmony_ci
447e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
448e41f4b71Sopenharmony_ci
449e41f4b71Sopenharmony_ci| ID| Error Message|
450e41f4b71Sopenharmony_ci| ------- | ----------------------- |
451e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
452e41f4b71Sopenharmony_ci
453e41f4b71Sopenharmony_ci**Example**
454e41f4b71Sopenharmony_ci
455e41f4b71Sopenharmony_ci```ts
456e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
457e41f4b71Sopenharmony_ci
458e41f4b71Sopenharmony_cilet ret: boolean = false;
459e41f4b71Sopenharmony_ciret = display.isFoldable();
460e41f4b71Sopenharmony_ci```
461e41f4b71Sopenharmony_ci
462e41f4b71Sopenharmony_ci## display.getFoldStatus<sup>10+</sup>
463e41f4b71Sopenharmony_cigetFoldStatus(): FoldStatus
464e41f4b71Sopenharmony_ci
465e41f4b71Sopenharmony_ciObtains the folding status of the foldable device.
466e41f4b71Sopenharmony_ci
467e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
468e41f4b71Sopenharmony_ci
469e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_ci**Return value**
472e41f4b71Sopenharmony_ci
473e41f4b71Sopenharmony_ci| Type| Description|
474e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
475e41f4b71Sopenharmony_ci| [FoldStatus](#foldstatus10) | Folding status of the device.|
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ci**Error codes**
478e41f4b71Sopenharmony_ci
479e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci| ID| Error Message|
482e41f4b71Sopenharmony_ci| ------- | ----------------------- |
483e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
484e41f4b71Sopenharmony_ci
485e41f4b71Sopenharmony_ci**Example**
486e41f4b71Sopenharmony_ci
487e41f4b71Sopenharmony_ci```ts
488e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
489e41f4b71Sopenharmony_ci
490e41f4b71Sopenharmony_cilet data: display.FoldStatus = display.getFoldStatus();
491e41f4b71Sopenharmony_ciconsole.info('Succeeded in obtaining fold status. Data: ' + JSON.stringify(data));
492e41f4b71Sopenharmony_ci```
493e41f4b71Sopenharmony_ci
494e41f4b71Sopenharmony_ci## display.getFoldDisplayMode<sup>10+</sup>
495e41f4b71Sopenharmony_cigetFoldDisplayMode(): FoldDisplayMode
496e41f4b71Sopenharmony_ci
497e41f4b71Sopenharmony_ciObtains the display mode of the foldable device.
498e41f4b71Sopenharmony_ci
499e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
500e41f4b71Sopenharmony_ci
501e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
502e41f4b71Sopenharmony_ci
503e41f4b71Sopenharmony_ci**Return value**
504e41f4b71Sopenharmony_ci
505e41f4b71Sopenharmony_ci| Type| Description|
506e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
507e41f4b71Sopenharmony_ci| [FoldDisplayMode](#folddisplaymode10) | Display mode of the device.|
508e41f4b71Sopenharmony_ci
509e41f4b71Sopenharmony_ci**Error codes**
510e41f4b71Sopenharmony_ci
511e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
512e41f4b71Sopenharmony_ci
513e41f4b71Sopenharmony_ci| ID| Error Message|
514e41f4b71Sopenharmony_ci| ------- | ----------------------- |
515e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
516e41f4b71Sopenharmony_ci
517e41f4b71Sopenharmony_ci**Example**
518e41f4b71Sopenharmony_ci
519e41f4b71Sopenharmony_ci```ts
520e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
521e41f4b71Sopenharmony_ci
522e41f4b71Sopenharmony_cilet data: display.FoldDisplayMode = display.getFoldDisplayMode();
523e41f4b71Sopenharmony_ciconsole.info('Succeeded in obtaining fold display mode. Data: ' + JSON.stringify(data));
524e41f4b71Sopenharmony_ci```
525e41f4b71Sopenharmony_ci
526e41f4b71Sopenharmony_ci## display.getCurrentFoldCreaseRegion<sup>10+</sup>
527e41f4b71Sopenharmony_cigetCurrentFoldCreaseRegion(): FoldCreaseRegion
528e41f4b71Sopenharmony_ci
529e41f4b71Sopenharmony_ciObtains the crease region of the foldable device in the current display mode.
530e41f4b71Sopenharmony_ci
531e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
532e41f4b71Sopenharmony_ci
533e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
534e41f4b71Sopenharmony_ci
535e41f4b71Sopenharmony_ci**Return value**
536e41f4b71Sopenharmony_ci
537e41f4b71Sopenharmony_ci| Type| Description|
538e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
539e41f4b71Sopenharmony_ci| [FoldCreaseRegion](#foldcreaseregion10) | Crease region of the device.|
540e41f4b71Sopenharmony_ci
541e41f4b71Sopenharmony_ci**Error codes**
542e41f4b71Sopenharmony_ci
543e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
544e41f4b71Sopenharmony_ci
545e41f4b71Sopenharmony_ci| ID| Error Message|
546e41f4b71Sopenharmony_ci| ------- | ----------------------- |
547e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
548e41f4b71Sopenharmony_ci
549e41f4b71Sopenharmony_ci**Example**
550e41f4b71Sopenharmony_ci
551e41f4b71Sopenharmony_ci```ts
552e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
553e41f4b71Sopenharmony_ci
554e41f4b71Sopenharmony_cilet data: display.FoldCreaseRegion = display.getCurrentFoldCreaseRegion();
555e41f4b71Sopenharmony_ciconsole.info('Succeeded in obtaining current fold crease region. Data: ' + JSON.stringify(data));
556e41f4b71Sopenharmony_ci```
557e41f4b71Sopenharmony_ci
558e41f4b71Sopenharmony_ci## display.on('foldStatusChange')<sup>10+</sup>
559e41f4b71Sopenharmony_ci
560e41f4b71Sopenharmony_cion(type: 'foldStatusChange', callback: Callback&lt;FoldStatus&gt;): void
561e41f4b71Sopenharmony_ci
562e41f4b71Sopenharmony_ciSubscribes to folding status change events of the foldable device.
563e41f4b71Sopenharmony_ci
564e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
565e41f4b71Sopenharmony_ci
566e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
567e41f4b71Sopenharmony_ci
568e41f4b71Sopenharmony_ci**Parameters**
569e41f4b71Sopenharmony_ci
570e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
571e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
572e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'foldStatusChange'** is triggered when the folding status of the device changes.|
573e41f4b71Sopenharmony_ci| callback | Callback&lt;[FoldStatus](#foldstatus10)&gt; | Yes  | Callback used to return the folding status.|
574e41f4b71Sopenharmony_ci
575e41f4b71Sopenharmony_ci**Error codes**
576e41f4b71Sopenharmony_ci
577e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
578e41f4b71Sopenharmony_ci
579e41f4b71Sopenharmony_ci| ID| Error Message|
580e41f4b71Sopenharmony_ci| ------- | ----------------------- |
581e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
582e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
583e41f4b71Sopenharmony_ci
584e41f4b71Sopenharmony_ci**Example**
585e41f4b71Sopenharmony_ci
586e41f4b71Sopenharmony_ci```ts
587e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
588e41f4b71Sopenharmony_ci
589e41f4b71Sopenharmony_cilet callback: Callback<display.FoldStatus> = (data: display.FoldStatus) => {
590e41f4b71Sopenharmony_ci  console.info('Listening enabled. Data: ' + JSON.stringify(data));
591e41f4b71Sopenharmony_ci};
592e41f4b71Sopenharmony_cidisplay.on('foldStatusChange', callback);
593e41f4b71Sopenharmony_ci```
594e41f4b71Sopenharmony_ci
595e41f4b71Sopenharmony_ci## display.off('foldStatusChange')<sup>10+</sup>
596e41f4b71Sopenharmony_ci
597e41f4b71Sopenharmony_cioff(type: 'foldStatusChange', callback?: Callback&lt;FoldStatus&gt;): void
598e41f4b71Sopenharmony_ci
599e41f4b71Sopenharmony_ciUnsubscribes from folding status change events of the foldable device.
600e41f4b71Sopenharmony_ci
601e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
602e41f4b71Sopenharmony_ci
603e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
604e41f4b71Sopenharmony_ci
605e41f4b71Sopenharmony_ci**Parameters**
606e41f4b71Sopenharmony_ci
607e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
608e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
609e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'foldStatusChange'** is triggered when the folding status of the device changes.|
610e41f4b71Sopenharmony_ci| callback | Callback&lt;[FoldStatus](#foldstatus10)&gt; | No  | Callback used for unsubscription. If this parameter is not specified, all callbacks of the specified type will be unregistered.|
611e41f4b71Sopenharmony_ci
612e41f4b71Sopenharmony_ci**Error codes**
613e41f4b71Sopenharmony_ci
614e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ci| ID| Error Message|
617e41f4b71Sopenharmony_ci| ------- | ----------------------- |
618e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
619e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
620e41f4b71Sopenharmony_ci
621e41f4b71Sopenharmony_ci**Example**
622e41f4b71Sopenharmony_ci
623e41f4b71Sopenharmony_ci```ts
624e41f4b71Sopenharmony_ci
625e41f4b71Sopenharmony_ci// Unregister all the callbacks that have been registered through on().
626e41f4b71Sopenharmony_cidisplay.off('foldStatusChange');
627e41f4b71Sopenharmony_ci
628e41f4b71Sopenharmony_cilet callback: Callback<display.FoldStatus> = (data: display.FoldStatus) => {
629e41f4b71Sopenharmony_ci  console.info('unregistering FoldStatus changes callback. Data: ' + JSON.stringify(data));
630e41f4b71Sopenharmony_ci};
631e41f4b71Sopenharmony_ci// Unregister the specified callback.
632e41f4b71Sopenharmony_cidisplay.off('foldStatusChange', callback);
633e41f4b71Sopenharmony_ci```
634e41f4b71Sopenharmony_ci
635e41f4b71Sopenharmony_ci## display.on('foldAngleChange')<sup>12+</sup>
636e41f4b71Sopenharmony_ci
637e41f4b71Sopenharmony_cion(type: 'foldAngleChange', callback: Callback&lt;Array&lt;number&gt;&gt;): void
638e41f4b71Sopenharmony_ci
639e41f4b71Sopenharmony_ciSubscribes to folding angle change events of the foldable device.
640e41f4b71Sopenharmony_ci
641e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
642e41f4b71Sopenharmony_ci
643e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
644e41f4b71Sopenharmony_ci
645e41f4b71Sopenharmony_ci**Parameters**
646e41f4b71Sopenharmony_ci
647e41f4b71Sopenharmony_ci| Name  | Type                                     | Mandatory| Description                                                   |
648e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
649e41f4b71Sopenharmony_ci| type     | string                                   | Yes| Event type. The event **'foldAngleChange'** is triggered when the folding angle of the device changes.|
650e41f4b71Sopenharmony_ci| callback | Callback&lt;Array&lt;number&gt;&gt; | Yes| Callback used to return the folding angle (0–180 degrees).|
651e41f4b71Sopenharmony_ci
652e41f4b71Sopenharmony_ci**Error codes**
653e41f4b71Sopenharmony_ci
654e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
655e41f4b71Sopenharmony_ci
656e41f4b71Sopenharmony_ci| ID| Error Message|
657e41f4b71Sopenharmony_ci| ------- | ----------------------- |
658e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
659e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ci**Example**
662e41f4b71Sopenharmony_ci
663e41f4b71Sopenharmony_ci```ts
664e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
665e41f4b71Sopenharmony_ci
666e41f4b71Sopenharmony_cilet callback: Callback<Array<number>> = (angles: Array<number>) => {
667e41f4b71Sopenharmony_ci  console.info('Listening fold angles length: ' + angles.length);
668e41f4b71Sopenharmony_ci};
669e41f4b71Sopenharmony_cidisplay.on('foldAngleChange', callback);
670e41f4b71Sopenharmony_ci```
671e41f4b71Sopenharmony_ci
672e41f4b71Sopenharmony_ci## display.off('foldAngleChange')<sup>12+</sup>
673e41f4b71Sopenharmony_ci
674e41f4b71Sopenharmony_cioff(type: 'foldAngleChange', callback?: Callback&lt;Array&lt;number&gt;&gt;): void
675e41f4b71Sopenharmony_ci
676e41f4b71Sopenharmony_ciUnsubscribes from folding angle change events of the foldable device.
677e41f4b71Sopenharmony_ci
678e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
679e41f4b71Sopenharmony_ci
680e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
681e41f4b71Sopenharmony_ci
682e41f4b71Sopenharmony_ci**Parameters**
683e41f4b71Sopenharmony_ci
684e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
685e41f4b71Sopenharmony_ci| -------- |-------------------------------------------| ---- | ------------------------------------------------------- |
686e41f4b71Sopenharmony_ci| type     | string                                    | Yes | Event type. The event **'foldAngleChange'** is triggered when the folding angle of the device changes.|
687e41f4b71Sopenharmony_ci| callback | Callback&lt;Array&lt;number&gt;&gt; | No | Callback used for unsubscription. If this parameter is not specified, all callbacks of the specified type will be unregistered.|
688e41f4b71Sopenharmony_ci
689e41f4b71Sopenharmony_ci**Error codes**
690e41f4b71Sopenharmony_ci
691e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_ci| ID| Error Message|
694e41f4b71Sopenharmony_ci| ------- | ----------------------- |
695e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
696e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
697e41f4b71Sopenharmony_ci
698e41f4b71Sopenharmony_ci**Example**
699e41f4b71Sopenharmony_ci
700e41f4b71Sopenharmony_ci```ts
701e41f4b71Sopenharmony_cidisplay.off('foldAngleChange');
702e41f4b71Sopenharmony_ci```
703e41f4b71Sopenharmony_ci
704e41f4b71Sopenharmony_ci## display.on('captureStatusChange')<sup>12+</sup>
705e41f4b71Sopenharmony_ci
706e41f4b71Sopenharmony_cion(type: 'captureStatusChange', callback: Callback&lt;boolean&gt;): void
707e41f4b71Sopenharmony_ci
708e41f4b71Sopenharmony_ciSubscribes to screen capture, projection, or recording status changes.
709e41f4b71Sopenharmony_ci
710e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
711e41f4b71Sopenharmony_ci
712e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
713e41f4b71Sopenharmony_ci
714e41f4b71Sopenharmony_ci**Parameters**
715e41f4b71Sopenharmony_ci
716e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
717e41f4b71Sopenharmony_ci| -------- |-------------------------------------------| ---- | ------------------------------------------------------- |
718e41f4b71Sopenharmony_ci| type     | string                                   | Yes| Event type. The event **'captureStatusChange'** is triggered when the screen capture, projection, or recording status changes.|
719e41f4b71Sopenharmony_ci| callback | Callback&lt;boolean&gt; | Yes| Callback used to return the screen capture, projection, or recording status change. The value **true** means that the device starts screen capture, projection, or recording, and **false** means that the device stops screen capture, projection, or recording.|
720e41f4b71Sopenharmony_ci
721e41f4b71Sopenharmony_ci**Error codes**
722e41f4b71Sopenharmony_ci
723e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
724e41f4b71Sopenharmony_ci
725e41f4b71Sopenharmony_ci| ID| Error Message|
726e41f4b71Sopenharmony_ci| ------- | ----------------------- |
727e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
728e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
729e41f4b71Sopenharmony_ci
730e41f4b71Sopenharmony_ci**Example**
731e41f4b71Sopenharmony_ci
732e41f4b71Sopenharmony_ci```ts
733e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
734e41f4b71Sopenharmony_ci
735e41f4b71Sopenharmony_cilet callback: Callback<boolean> = (captureStatus: boolean) => {
736e41f4b71Sopenharmony_ci  console.info('Listening capture status: ' + captureStatus);
737e41f4b71Sopenharmony_ci};
738e41f4b71Sopenharmony_cidisplay.on('captureStatusChange', callback);
739e41f4b71Sopenharmony_ci```
740e41f4b71Sopenharmony_ci
741e41f4b71Sopenharmony_ci## display.off('captureStatusChange')<sup>12+</sup>
742e41f4b71Sopenharmony_ci
743e41f4b71Sopenharmony_cioff(type: 'captureStatusChange', callback?: Callback&lt;boolean&gt;): void
744e41f4b71Sopenharmony_ci
745e41f4b71Sopenharmony_ciUnsubscribes from screen capture, projection, or recording status changes.
746e41f4b71Sopenharmony_ci
747e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
748e41f4b71Sopenharmony_ci
749e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
750e41f4b71Sopenharmony_ci
751e41f4b71Sopenharmony_ci**Parameters**
752e41f4b71Sopenharmony_ci
753e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
754e41f4b71Sopenharmony_ci| -------- |-------------------------------------------| ---- | ------------------------------------------------------- |
755e41f4b71Sopenharmony_ci| type     | string                                   | Yes| Event type. The event **'captureStatusChange'** is triggered when the screen capture, projection, or recording status changes.|
756e41f4b71Sopenharmony_ci| callback | Callback&lt;boolean&gt; | No| Callback used for unsubscription. If this parameter is not specified, all callbacks of the specified type will be unregistered.|
757e41f4b71Sopenharmony_ci
758e41f4b71Sopenharmony_ci**Error codes**
759e41f4b71Sopenharmony_ci
760e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
761e41f4b71Sopenharmony_ci
762e41f4b71Sopenharmony_ci| ID| Error Message|
763e41f4b71Sopenharmony_ci| ------- | ----------------------- |
764e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
765e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
766e41f4b71Sopenharmony_ci
767e41f4b71Sopenharmony_ci**Example**
768e41f4b71Sopenharmony_ci
769e41f4b71Sopenharmony_ci```ts
770e41f4b71Sopenharmony_cidisplay.off('captureStatusChange');
771e41f4b71Sopenharmony_ci```
772e41f4b71Sopenharmony_ci
773e41f4b71Sopenharmony_ci## display.isCaptured<sup>12+</sup>
774e41f4b71Sopenharmony_ciisCaptured(): boolean
775e41f4b71Sopenharmony_ci
776e41f4b71Sopenharmony_ciChecks whether the device screen is being captured, projected, or recorded.
777e41f4b71Sopenharmony_ci
778e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
779e41f4b71Sopenharmony_ci
780e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
781e41f4b71Sopenharmony_ci
782e41f4b71Sopenharmony_ci**Return value**
783e41f4b71Sopenharmony_ci
784e41f4b71Sopenharmony_ci| Type| Description|
785e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
786e41f4b71Sopenharmony_ci| boolean | **true**: The device screen is being captured, projected, or recorded.<br> **false**: The device screen is not being captured, projected, or recorded.|
787e41f4b71Sopenharmony_ci
788e41f4b71Sopenharmony_ci**Error codes**
789e41f4b71Sopenharmony_ci
790e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
791e41f4b71Sopenharmony_ci
792e41f4b71Sopenharmony_ci| ID| Error Message|
793e41f4b71Sopenharmony_ci| ------- | ----------------------- |
794e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
795e41f4b71Sopenharmony_ci
796e41f4b71Sopenharmony_ci**Example**
797e41f4b71Sopenharmony_ci
798e41f4b71Sopenharmony_ci```ts
799e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
800e41f4b71Sopenharmony_ci
801e41f4b71Sopenharmony_cilet ret: boolean = false;
802e41f4b71Sopenharmony_ciret = display.isCaptured();
803e41f4b71Sopenharmony_ci```
804e41f4b71Sopenharmony_ci
805e41f4b71Sopenharmony_ci## display.on('foldDisplayModeChange')<sup>10+</sup>
806e41f4b71Sopenharmony_ci
807e41f4b71Sopenharmony_cion(type: 'foldDisplayModeChange', callback: Callback&lt;FoldDisplayMode&gt;): void
808e41f4b71Sopenharmony_ci
809e41f4b71Sopenharmony_ciSubscribes to display mode change events of the foldable device.
810e41f4b71Sopenharmony_ci
811e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
812e41f4b71Sopenharmony_ci
813e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
814e41f4b71Sopenharmony_ci
815e41f4b71Sopenharmony_ci**Parameters**
816e41f4b71Sopenharmony_ci
817e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
818e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
819e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'foldDisplayModeChange'** is triggered when the display mode of the device changes.|
820e41f4b71Sopenharmony_ci| callback | Callback&lt;[FoldDisplayMode](#folddisplaymode10)&gt; | Yes  | Callback used to return the display mode.|
821e41f4b71Sopenharmony_ci
822e41f4b71Sopenharmony_ci**Error codes**
823e41f4b71Sopenharmony_ci
824e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
825e41f4b71Sopenharmony_ci
826e41f4b71Sopenharmony_ci| ID| Error Message|
827e41f4b71Sopenharmony_ci| ------- | ----------------------- |
828e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
829e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
830e41f4b71Sopenharmony_ci
831e41f4b71Sopenharmony_ci**Example**
832e41f4b71Sopenharmony_ci
833e41f4b71Sopenharmony_ci```ts
834e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
835e41f4b71Sopenharmony_ci
836e41f4b71Sopenharmony_cilet callback: Callback<display.FoldDisplayMode> = (data: display.FoldDisplayMode) => {
837e41f4b71Sopenharmony_ci  console.info('Listening enabled. Data: ' + JSON.stringify(data));
838e41f4b71Sopenharmony_ci};
839e41f4b71Sopenharmony_cidisplay.on('foldDisplayModeChange', callback);
840e41f4b71Sopenharmony_ci```
841e41f4b71Sopenharmony_ci
842e41f4b71Sopenharmony_ci## display.off('foldDisplayModeChange')<sup>10+</sup>
843e41f4b71Sopenharmony_ci
844e41f4b71Sopenharmony_cioff(type: 'foldDisplayModeChange', callback?: Callback&lt;FoldDisplayMode&gt;): void
845e41f4b71Sopenharmony_ci
846e41f4b71Sopenharmony_ciUnsubscribes from display mode change events of the foldable device.
847e41f4b71Sopenharmony_ci
848e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
849e41f4b71Sopenharmony_ci
850e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
851e41f4b71Sopenharmony_ci
852e41f4b71Sopenharmony_ci**Parameters**
853e41f4b71Sopenharmony_ci
854e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
855e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
856e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'foldDisplayModeChange'** is triggered when the display mode of the device changes.|
857e41f4b71Sopenharmony_ci| callback | Callback&lt;[FoldDisplayMode](#folddisplaymode10)&gt; | No  | Callback used for unsubscription. If this parameter is not specified, all callbacks of the specified type will be unregistered.|
858e41f4b71Sopenharmony_ci
859e41f4b71Sopenharmony_ci**Error codes**
860e41f4b71Sopenharmony_ci
861e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
862e41f4b71Sopenharmony_ci
863e41f4b71Sopenharmony_ci| ID| Error Message|
864e41f4b71Sopenharmony_ci| ------- | ----------------------- |
865e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
866e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
867e41f4b71Sopenharmony_ci
868e41f4b71Sopenharmony_ci**Example**
869e41f4b71Sopenharmony_ci
870e41f4b71Sopenharmony_ci```ts
871e41f4b71Sopenharmony_ci
872e41f4b71Sopenharmony_ci// Unregister all the callbacks that have been registered through on().
873e41f4b71Sopenharmony_cidisplay.off('foldDisplayModeChange');
874e41f4b71Sopenharmony_ci
875e41f4b71Sopenharmony_cilet callback: Callback<display.FoldDisplayMode> = (data: display.FoldDisplayMode) => {
876e41f4b71Sopenharmony_ci  console.info('unregistering FoldDisplayMode changes callback. Data: ' + JSON.stringify(data));
877e41f4b71Sopenharmony_ci};
878e41f4b71Sopenharmony_ci// Unregister the specified callback.
879e41f4b71Sopenharmony_cidisplay.off('foldDisplayModeChange', callback);
880e41f4b71Sopenharmony_ci```
881e41f4b71Sopenharmony_ci
882e41f4b71Sopenharmony_ci
883e41f4b71Sopenharmony_ci## display.getDefaultDisplay<sup>(deprecated)</sup>
884e41f4b71Sopenharmony_ci
885e41f4b71Sopenharmony_cigetDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void
886e41f4b71Sopenharmony_ci
887e41f4b71Sopenharmony_ciObtains the default display object. This API uses an asynchronous callback to return the result.
888e41f4b71Sopenharmony_ci
889e41f4b71Sopenharmony_ci> **NOTE**
890e41f4b71Sopenharmony_ci> 
891e41f4b71Sopenharmony_ci> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getDefaultDisplaySync()](#displaygetdefaultdisplaysync9) instead.
892e41f4b71Sopenharmony_ci
893e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
894e41f4b71Sopenharmony_ci
895e41f4b71Sopenharmony_ci**Parameters**
896e41f4b71Sopenharmony_ci
897e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
898e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
899e41f4b71Sopenharmony_ci| callback | AsyncCallback&lt;[Display](#display)&gt; | Yes| Callback used to return the default display object.|
900e41f4b71Sopenharmony_ci
901e41f4b71Sopenharmony_ci**Example**
902e41f4b71Sopenharmony_ci
903e41f4b71Sopenharmony_ci```ts
904e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
905e41f4b71Sopenharmony_ci
906e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
907e41f4b71Sopenharmony_cidisplay.getDefaultDisplay((err: BusinessError, data: display.Display) => {
908e41f4b71Sopenharmony_ci  const errCode: number = err.code;
909e41f4b71Sopenharmony_ci  if (errCode) {
910e41f4b71Sopenharmony_ci    console.error(`Failed to obtain the default display object. Code: ${err.code}, message: ${err.message}`);
911e41f4b71Sopenharmony_ci    return;
912e41f4b71Sopenharmony_ci  }
913e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining the default display object. Data:' + JSON.stringify(data));
914e41f4b71Sopenharmony_ci  displayClass = data;
915e41f4b71Sopenharmony_ci});
916e41f4b71Sopenharmony_ci```
917e41f4b71Sopenharmony_ci
918e41f4b71Sopenharmony_ci## display.getDefaultDisplay<sup>(deprecated)</sup>
919e41f4b71Sopenharmony_ci
920e41f4b71Sopenharmony_cigetDefaultDisplay(): Promise&lt;Display&gt;
921e41f4b71Sopenharmony_ci
922e41f4b71Sopenharmony_ciObtains the default display object. This API uses a promise to return the result.
923e41f4b71Sopenharmony_ci
924e41f4b71Sopenharmony_ci> **NOTE**
925e41f4b71Sopenharmony_ci> 
926e41f4b71Sopenharmony_ci> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getDefaultDisplaySync()](#displaygetdefaultdisplaysync9) instead.
927e41f4b71Sopenharmony_ci
928e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
929e41f4b71Sopenharmony_ci
930e41f4b71Sopenharmony_ci**Return value**
931e41f4b71Sopenharmony_ci
932e41f4b71Sopenharmony_ci| Type                              | Description                                          |
933e41f4b71Sopenharmony_ci| ---------------------------------- | ---------------------------------------------- |
934e41f4b71Sopenharmony_ci| Promise&lt;[Display](#display)&gt; | Promise used to return the default display object.|
935e41f4b71Sopenharmony_ci
936e41f4b71Sopenharmony_ci**Example**
937e41f4b71Sopenharmony_ci
938e41f4b71Sopenharmony_ci```ts
939e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
940e41f4b71Sopenharmony_ci
941e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
942e41f4b71Sopenharmony_cilet promise: Promise<display.Display> = display.getDefaultDisplay();
943e41f4b71Sopenharmony_cipromise.then((data: display.Display) => {
944e41f4b71Sopenharmony_ci  displayClass = data;
945e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining the default display object. Data:' + JSON.stringify(data));
946e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
947e41f4b71Sopenharmony_ci  console.error(`Failed to obtain the default display object. Code: ${err.code}, message: ${err.message}`);
948e41f4b71Sopenharmony_ci});
949e41f4b71Sopenharmony_ci```
950e41f4b71Sopenharmony_ci
951e41f4b71Sopenharmony_ci## display.getAllDisplay<sup>(deprecated)</sup>
952e41f4b71Sopenharmony_ci
953e41f4b71Sopenharmony_cigetAllDisplay(callback: AsyncCallback&lt;Array&lt;Display&gt;&gt;): void
954e41f4b71Sopenharmony_ci
955e41f4b71Sopenharmony_ciObtains all display objects. This API uses an asynchronous callback to return the result.
956e41f4b71Sopenharmony_ci
957e41f4b71Sopenharmony_ci> **NOTE**
958e41f4b71Sopenharmony_ci> 
959e41f4b71Sopenharmony_ci> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getAllDisplays()](#displaygetalldisplays9) instead.
960e41f4b71Sopenharmony_ci
961e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
962e41f4b71Sopenharmony_ci
963e41f4b71Sopenharmony_ci**Parameters**
964e41f4b71Sopenharmony_ci
965e41f4b71Sopenharmony_ci| Name  | Type                                                | Mandatory| Description                           |
966e41f4b71Sopenharmony_ci| -------- | ---------------------------------------------------- | ---- | ------------------------------- |
967e41f4b71Sopenharmony_ci| callback | AsyncCallback&lt;Array&lt;[Display](#display)&gt;&gt; | Yes  | Callback used to return all the display objects.|
968e41f4b71Sopenharmony_ci
969e41f4b71Sopenharmony_ci**Example**
970e41f4b71Sopenharmony_ci
971e41f4b71Sopenharmony_ci```ts
972e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
973e41f4b71Sopenharmony_ci
974e41f4b71Sopenharmony_cidisplay.getAllDisplay((err: BusinessError, data: Array<display.Display>) => {
975e41f4b71Sopenharmony_ci  const errCode: number = err.code;
976e41f4b71Sopenharmony_ci  if (errCode) {
977e41f4b71Sopenharmony_ci    console.error(`Failed to obtain all the display objects. Code: ${err.code}, message: ${err.message}`);
978e41f4b71Sopenharmony_ci    return;
979e41f4b71Sopenharmony_ci  }
980e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining all the display objects. Data: ' + JSON.stringify(data));
981e41f4b71Sopenharmony_ci});
982e41f4b71Sopenharmony_ci```
983e41f4b71Sopenharmony_ci
984e41f4b71Sopenharmony_ci## display.getAllDisplay<sup>(deprecated)</sup>
985e41f4b71Sopenharmony_ci
986e41f4b71Sopenharmony_cigetAllDisplay(): Promise&lt;Array&lt;Display&gt;&gt;
987e41f4b71Sopenharmony_ci
988e41f4b71Sopenharmony_ciObtains all display objects. This API uses a promise to return the result.
989e41f4b71Sopenharmony_ci
990e41f4b71Sopenharmony_ci> **NOTE**
991e41f4b71Sopenharmony_ci> 
992e41f4b71Sopenharmony_ci> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getAllDisplays()](#displaygetalldisplays9-1) instead.
993e41f4b71Sopenharmony_ci
994e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
995e41f4b71Sopenharmony_ci
996e41f4b71Sopenharmony_ci**Return value**
997e41f4b71Sopenharmony_ci
998e41f4b71Sopenharmony_ci| Type                                           | Description                                                   |
999e41f4b71Sopenharmony_ci| ----------------------------------------------- | ------------------------------------------------------- |
1000e41f4b71Sopenharmony_ci| Promise&lt;Array&lt;[Display](#display)&gt;&gt; | Promise used to return all the display objects.|
1001e41f4b71Sopenharmony_ci
1002e41f4b71Sopenharmony_ci**Example**
1003e41f4b71Sopenharmony_ci
1004e41f4b71Sopenharmony_ci```ts
1005e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1006e41f4b71Sopenharmony_ci
1007e41f4b71Sopenharmony_cilet promise: Promise<Array<display.Display>> = display.getAllDisplay();
1008e41f4b71Sopenharmony_cipromise.then((data: Array<display.Display>) => {
1009e41f4b71Sopenharmony_ci  console.info('Succeeded in obtaining all the display objects. Data: ' + JSON.stringify(data));
1010e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
1011e41f4b71Sopenharmony_ci  console.error(`Failed to obtain all the display objects. Code: ${err.code}, message: ${err.message}`);
1012e41f4b71Sopenharmony_ci});
1013e41f4b71Sopenharmony_ci```
1014e41f4b71Sopenharmony_ci
1015e41f4b71Sopenharmony_ci## Display
1016e41f4b71Sopenharmony_ciImplements a **Display** instance, with properties and APIs defined.
1017e41f4b71Sopenharmony_ci
1018e41f4b71Sopenharmony_ciBefore calling any API in **Display**, you must use [getAllDisplays()](#displaygetalldisplays9) or [getDefaultDisplaySync()](#displaygetdefaultdisplaysync9) to obtain a **Display** instance.
1019e41f4b71Sopenharmony_ci
1020e41f4b71Sopenharmony_ci### Attributes
1021e41f4b71Sopenharmony_ci
1022e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
1023e41f4b71Sopenharmony_ci
1024e41f4b71Sopenharmony_ci| Name| Type| Read-Only| Optional| Description                                                                                                           |
1025e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |---------------------------------------------------------------------------------------------------------------|
1026e41f4b71Sopenharmony_ci| id | number | Yes| No| ID of the display. The value must be an integer.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                            |
1027e41f4b71Sopenharmony_ci| name | string | Yes| No| Name of the display.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                                     |
1028e41f4b71Sopenharmony_ci| alive | boolean | Yes| No| Whether the display is alive.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                                    |
1029e41f4b71Sopenharmony_ci| state | [DisplayState](#displaystate) | Yes| No| State of the display.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                                     |
1030e41f4b71Sopenharmony_ci| refreshRate | number | Yes| No| Refresh rate of the display, in hz. The value must be an integer.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                            |
1031e41f4b71Sopenharmony_ci| rotation | number | Yes| No| Clockwise rotation angle of the screen of the display.<br>The value **0** indicates that the screen of the display rotates clockwise by 0°.<br>The value **1** indicates that the screen of the display rotates clockwise by 90°.<br>The value **2** indicates that the screen of the display rotates clockwise by 180°.<br>The value **3** indicates that the screen of the display rotates clockwise by 270°.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
1032e41f4b71Sopenharmony_ci| width | number | Yes| No| Screen width of the display, in px. The value must be an integer.<br>**Atomic service API**: This API can be used in atomic services since API version 11.                                                                                       |
1033e41f4b71Sopenharmony_ci| height | number | Yes| No| Screen height of the display, in px. The value must be an integer.<br>**Atomic service API**: This API can be used in atomic services since API version 11.                                                                                       |
1034e41f4b71Sopenharmony_ci| densityDPI | number | Yes| No| Physical pixel density of the display, that is, the number of pixels per inch. The value is a floating point number, in px. The value range is [80.0, 640.0]. Generally, the value is **160.0** or **480.0**. The actual value depends on the optional values provided by the device in use.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                  |
1035e41f4b71Sopenharmony_ci| orientation<sup>10+</sup> | [Orientation](#orientation10) | Yes| No| Orientation of the display.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                                 |
1036e41f4b71Sopenharmony_ci| densityPixels | number | Yes| No| Logical pixel density of the display, which is the scaling coefficient between physical pixels and logical pixels. The calculation method is as follows:<br>![densityPixels](figures/densityPixels.jpg)<br>The value is a floating point number and is restricted by the range of **densityDPI**. The value range is [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.<br>**Atomic service API**: This API can be used in atomic services since API version 11.                                                                 |
1037e41f4b71Sopenharmony_ci| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. The value must be a floating point number. Generally, the value is the same as that of **densityPixels**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                   |
1038e41f4b71Sopenharmony_ci| xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction. The value must be a floating point number.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                   |
1039e41f4b71Sopenharmony_ci| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction. The value must be a floating point number.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                   |
1040e41f4b71Sopenharmony_ci| colorSpaces<sup>11+</sup> | Array<[colorSpaceManager.ColorSpace](../apis-arkgraphics2d/js-apis-colorSpaceManager.md)> | Yes| No| All color spaces supported by the display.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                               |
1041e41f4b71Sopenharmony_ci| hdrFormats<sup>11+</sup> | Array<[hdrCapability.HDRFormat](../apis-arkgraphics2d/js-apis-hdrCapability.md)> | Yes| No| All HDR formats supported by the display.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                              |
1042e41f4b71Sopenharmony_ci| availableWidth<sup>12+</sup> | number | Yes| No| Width of the available area on the screen of a 2-in-1 device, in px. The value is an integer greater than 0.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                   |
1043e41f4b71Sopenharmony_ci| availableHeight<sup>12+</sup> | number | Yes| No| Height of the available area on the screen of a 2-in-1 device, in px. The value is an integer greater than 0.<br>**Atomic service API**: This API can be used in atomic services since API version 12.                                                                                   |
1044e41f4b71Sopenharmony_ci
1045e41f4b71Sopenharmony_ci### getCutoutInfo<sup>9+</sup>
1046e41f4b71Sopenharmony_cigetCutoutInfo(callback: AsyncCallback&lt;CutoutInfo&gt;): void
1047e41f4b71Sopenharmony_ci
1048e41f4b71Sopenharmony_ciObtains the cutout information of the display. This API uses an asynchronous callback to return the result. You are advised not to use the cutout area during application layout.
1049e41f4b71Sopenharmony_ci
1050e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
1051e41f4b71Sopenharmony_ci
1052e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
1053e41f4b71Sopenharmony_ci
1054e41f4b71Sopenharmony_ci**Parameters**
1055e41f4b71Sopenharmony_ci
1056e41f4b71Sopenharmony_ci| Name     | Type                       | Mandatory| Description                                                        |
1057e41f4b71Sopenharmony_ci| ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
1058e41f4b71Sopenharmony_ci| callback    | AsyncCallback&lt;[CutoutInfo](#cutoutinfo9)&gt;   | Yes  | Callback used to return the **CutoutInfo** object.|
1059e41f4b71Sopenharmony_ci
1060e41f4b71Sopenharmony_ci**Error codes**
1061e41f4b71Sopenharmony_ci
1062e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
1063e41f4b71Sopenharmony_ci
1064e41f4b71Sopenharmony_ci| ID| Error Message|
1065e41f4b71Sopenharmony_ci| ------- | ----------------------- |
1066e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
1067e41f4b71Sopenharmony_ci
1068e41f4b71Sopenharmony_ci**Example**
1069e41f4b71Sopenharmony_ci
1070e41f4b71Sopenharmony_ci```ts
1071e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1072e41f4b71Sopenharmony_ci
1073e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
1074e41f4b71Sopenharmony_cidisplayClass = display.getDefaultDisplaySync();
1075e41f4b71Sopenharmony_ci
1076e41f4b71Sopenharmony_cidisplayClass.getCutoutInfo((err: BusinessError, data: display.CutoutInfo) => {
1077e41f4b71Sopenharmony_ci  const errCode: number = err.code;
1078e41f4b71Sopenharmony_ci  if (errCode) {
1079e41f4b71Sopenharmony_ci    console.error(`Failed to get cutoutInfo. Code: ${err.code}, message: ${err.message}`);
1080e41f4b71Sopenharmony_ci    return;
1081e41f4b71Sopenharmony_ci  }
1082e41f4b71Sopenharmony_ci  console.info('Succeeded in getting cutoutInfo. data: ' + JSON.stringify(data));
1083e41f4b71Sopenharmony_ci});
1084e41f4b71Sopenharmony_ci```
1085e41f4b71Sopenharmony_ci### getCutoutInfo<sup>9+</sup>
1086e41f4b71Sopenharmony_cigetCutoutInfo(): Promise&lt;CutoutInfo&gt;
1087e41f4b71Sopenharmony_ci
1088e41f4b71Sopenharmony_ciObtains the cutout information of the display. This API uses a promise to return the result. You are advised not to use the cutout area during application layout.
1089e41f4b71Sopenharmony_ci
1090e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
1091e41f4b71Sopenharmony_ci
1092e41f4b71Sopenharmony_ci**System capability**: SystemCapability.WindowManager.WindowManager.Core
1093e41f4b71Sopenharmony_ci
1094e41f4b71Sopenharmony_ci**Return value**
1095e41f4b71Sopenharmony_ci
1096e41f4b71Sopenharmony_ci| Type               | Description                     |
1097e41f4b71Sopenharmony_ci| ------------------- | ------------------------- |
1098e41f4b71Sopenharmony_ci| Promise&lt;[CutoutInfo](#cutoutinfo9)&gt; | Promise used to return the **CutoutInfo** object.|
1099e41f4b71Sopenharmony_ci
1100e41f4b71Sopenharmony_ci**Error codes**
1101e41f4b71Sopenharmony_ci
1102e41f4b71Sopenharmony_ciFor details about the error codes, see [Display Error Codes](errorcode-display.md).
1103e41f4b71Sopenharmony_ci
1104e41f4b71Sopenharmony_ci| ID| Error Message|
1105e41f4b71Sopenharmony_ci| ------- | ----------------------- |
1106e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
1107e41f4b71Sopenharmony_ci
1108e41f4b71Sopenharmony_ci**Example**
1109e41f4b71Sopenharmony_ci
1110e41f4b71Sopenharmony_ci```ts
1111e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1112e41f4b71Sopenharmony_ci
1113e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
1114e41f4b71Sopenharmony_cidisplayClass = display.getDefaultDisplaySync();
1115e41f4b71Sopenharmony_cilet promise: Promise<display.CutoutInfo> = displayClass.getCutoutInfo();
1116e41f4b71Sopenharmony_cipromise.then((data: display.CutoutInfo) => {
1117e41f4b71Sopenharmony_ci  console.info('Succeeded in getting cutoutInfo. Data: ' + JSON.stringify(data));
1118e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
1119e41f4b71Sopenharmony_ci  console.error(`Failed to obtain all the display objects. Code: ${err.code}, message: ${err.message}`);
1120e41f4b71Sopenharmony_ci});
1121e41f4b71Sopenharmony_ci```
1122e41f4b71Sopenharmony_ci
1123e41f4b71Sopenharmony_ci### getAvailableArea<sup>12+</sup>
1124e41f4b71Sopenharmony_cigetAvailableArea(): Promise&lt;Rect&gt;
1125e41f4b71Sopenharmony_ci
1126e41f4b71Sopenharmony_ciObtains the available area of the screen of the current 2-in-1 device. This API uses a promise to return the result.
1127e41f4b71Sopenharmony_ci
1128e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
1129e41f4b71Sopenharmony_ci
1130e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
1131e41f4b71Sopenharmony_ci
1132e41f4b71Sopenharmony_ci**Return value**
1133e41f4b71Sopenharmony_ci
1134e41f4b71Sopenharmony_ci| Type               | Description                     |
1135e41f4b71Sopenharmony_ci| ------------------- | ------------------------- |
1136e41f4b71Sopenharmony_ci| Promise&lt;[Rect](#rect9)&gt; | Promise used to return the available area, which is a rectangle.|
1137e41f4b71Sopenharmony_ci
1138e41f4b71Sopenharmony_ci**Error codes**
1139e41f4b71Sopenharmony_ci
1140e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
1141e41f4b71Sopenharmony_ci
1142e41f4b71Sopenharmony_ci| ID| Error Message|
1143e41f4b71Sopenharmony_ci| ------- | ----------------------- |
1144e41f4b71Sopenharmony_ci| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
1145e41f4b71Sopenharmony_ci| 1400001 | Invalid display or screen. |
1146e41f4b71Sopenharmony_ci
1147e41f4b71Sopenharmony_ci**Example**
1148e41f4b71Sopenharmony_ci
1149e41f4b71Sopenharmony_ci```ts
1150e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
1151e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
1152e41f4b71Sopenharmony_ci
1153e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
1154e41f4b71Sopenharmony_citry {
1155e41f4b71Sopenharmony_ci  displayClass = display.getDefaultDisplaySync();
1156e41f4b71Sopenharmony_ci  let promise = displayClass.getAvailableArea();
1157e41f4b71Sopenharmony_ci  promise.then((data) => {
1158e41f4b71Sopenharmony_ci    console.info('Succeeded get the available area in this display. data: ' + JSON.stringify(data));
1159e41f4b71Sopenharmony_ci  }).catch((err: BusinessError) => {
1160e41f4b71Sopenharmony_ci    console.error(`Failed to get the available area in this display. Code: ${err.code}, message: ${err.message}`);
1161e41f4b71Sopenharmony_ci  })
1162e41f4b71Sopenharmony_ci} catch (exception) {
1163e41f4b71Sopenharmony_ci  console.error(`Failed to obtain the default display object. Code: ${exception.code}, message: ${exception.message}`);
1164e41f4b71Sopenharmony_ci}
1165e41f4b71Sopenharmony_ci```
1166e41f4b71Sopenharmony_ci
1167e41f4b71Sopenharmony_ci### on('availableAreaChange')<sup>12+</sup>
1168e41f4b71Sopenharmony_cion(type: 'availableAreaChange', callback: Callback&lt;Rect&gt;): void
1169e41f4b71Sopenharmony_ci
1170e41f4b71Sopenharmony_ciSubscribes to changes of the available area on the screen of the current 2-in-1 device. This API uses an asynchronous callback to return the result.
1171e41f4b71Sopenharmony_ci
1172e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
1173e41f4b71Sopenharmony_ci
1174e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
1175e41f4b71Sopenharmony_ci
1176e41f4b71Sopenharmony_ci**Parameters**
1177e41f4b71Sopenharmony_ci
1178e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
1179e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
1180e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'availableAreaChange'** is triggered when the available area of the screen changes.|
1181e41f4b71Sopenharmony_ci| callback | Callback&lt;[Rect](#rect9)&gt; | Yes  | Callback used to return the new available area.|
1182e41f4b71Sopenharmony_ci
1183e41f4b71Sopenharmony_ci**Error codes**
1184e41f4b71Sopenharmony_ci
1185e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
1186e41f4b71Sopenharmony_ci
1187e41f4b71Sopenharmony_ci| ID| Error Message|
1188e41f4b71Sopenharmony_ci| ------- | ----------------------- |
1189e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
1190e41f4b71Sopenharmony_ci| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
1191e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
1192e41f4b71Sopenharmony_ci
1193e41f4b71Sopenharmony_ci**Example**
1194e41f4b71Sopenharmony_ci
1195e41f4b71Sopenharmony_ci```ts
1196e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
1197e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
1198e41f4b71Sopenharmony_ci
1199e41f4b71Sopenharmony_cilet callback: Callback<display.Rect> = (data: display.Rect) => {
1200e41f4b71Sopenharmony_ci  console.info('Listening enabled. Data: ' + JSON.stringify(data));
1201e41f4b71Sopenharmony_ci};
1202e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
1203e41f4b71Sopenharmony_citry {
1204e41f4b71Sopenharmony_ci  displayClass = display.getDefaultDisplaySync();
1205e41f4b71Sopenharmony_ci  displayClass.on("availableAreaChange", callback);
1206e41f4b71Sopenharmony_ci} catch (exception) {
1207e41f4b71Sopenharmony_ci  console.error(`Failed to register callback. Code: ${exception.code}, message: ${exception.message}`);
1208e41f4b71Sopenharmony_ci}
1209e41f4b71Sopenharmony_ci```
1210e41f4b71Sopenharmony_ci
1211e41f4b71Sopenharmony_ci### off('availableAreaChange')<sup>12+</sup>
1212e41f4b71Sopenharmony_ci
1213e41f4b71Sopenharmony_cioff(type: 'availableAreaChange', callback?: Callback&lt;Rect&gt;): void
1214e41f4b71Sopenharmony_ci
1215e41f4b71Sopenharmony_ciUnsubscribes from changes of the available area on the screen of the current 2-in-1 device.
1216e41f4b71Sopenharmony_ci
1217e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
1218e41f4b71Sopenharmony_ci
1219e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Window.SessionManager
1220e41f4b71Sopenharmony_ci
1221e41f4b71Sopenharmony_ci**Parameters**
1222e41f4b71Sopenharmony_ci
1223e41f4b71Sopenharmony_ci| Name  | Type                                      | Mandatory| Description                                                   |
1224e41f4b71Sopenharmony_ci| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
1225e41f4b71Sopenharmony_ci| type     | string                                   | Yes  | Event type. The event **'availableAreaChange'** is triggered when the available area of the screen changes.|
1226e41f4b71Sopenharmony_ci| callback | Callback&lt;[Rect](#rect9)&gt; | No  | Callback used for unsubscription. If no value is passed in, all subscriptions to the specified event are canceled.|
1227e41f4b71Sopenharmony_ci
1228e41f4b71Sopenharmony_ci**Error codes**
1229e41f4b71Sopenharmony_ci
1230e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Display Error Codes](errorcode-display.md).
1231e41f4b71Sopenharmony_ci
1232e41f4b71Sopenharmony_ci| ID| Error Message|
1233e41f4b71Sopenharmony_ci| ------- | ----------------------- |
1234e41f4b71Sopenharmony_ci| 401     | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.|
1235e41f4b71Sopenharmony_ci| 801 | Capability not supported. Failed to call the API due to limited device capabilities. |
1236e41f4b71Sopenharmony_ci| 1400003 | This display manager service works abnormally. |
1237e41f4b71Sopenharmony_ci
1238e41f4b71Sopenharmony_ci**Example**
1239e41f4b71Sopenharmony_ci
1240e41f4b71Sopenharmony_ci```ts
1241e41f4b71Sopenharmony_ciimport { Callback } from '@kit.BasicServicesKit';
1242e41f4b71Sopenharmony_ciimport { display } from '@kit.ArkUI';
1243e41f4b71Sopenharmony_ci
1244e41f4b71Sopenharmony_cilet callback: Callback<display.Rect> = (data: display.Rect) => {
1245e41f4b71Sopenharmony_ci  console.info('Listening enabled. Data: ' + JSON.stringify(data));
1246e41f4b71Sopenharmony_ci};
1247e41f4b71Sopenharmony_cilet displayClass: display.Display | null = null;
1248e41f4b71Sopenharmony_citry {
1249e41f4b71Sopenharmony_ci  displayClass = display.getDefaultDisplaySync();
1250e41f4b71Sopenharmony_ci  displayClass.off("availableAreaChange", callback);
1251e41f4b71Sopenharmony_ci} catch (exception) {
1252e41f4b71Sopenharmony_ci  console.error(`Failed to unregister callback. Code: ${exception.code}, message: ${exception.message}`);
1253e41f4b71Sopenharmony_ci}
1254e41f4b71Sopenharmony_ci```
1255