• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22
23/**
24 * Interface of screen manager
25 *
26 * @namespace screen
27 * @syscap SystemCapability.WindowManager.WindowManager.Core
28 * @systemapi Hide this for inner system use.
29 * @since 9
30 */
31declare namespace screen {
32  /**
33   * Get all screen instances, then can get or set detail information.
34   *
35   * @param { AsyncCallback<Array<Screen>> } callback the callback of all screens info
36   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
37   * @throws { BusinessError } 1400001 - Invalid display or screen.
38   * @syscap SystemCapability.WindowManager.WindowManager.Core
39   * @systemapi Hide this for inner system use.
40   * @since 9
41   */
42  function getAllScreens(callback: AsyncCallback<Array<Screen>>): void;
43
44  /**
45   * Get all screen instances, then can get or set detail information.
46   *
47   * @returns { Promise<Array<Screen>> } the result of all screens info
48   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
49   * @throws { BusinessError } 1400001 - Invalid display or screen.
50   * @syscap SystemCapability.WindowManager.WindowManager.Core
51   * @systemapi Hide this for inner system use.
52   * @since 9
53   */
54  function getAllScreens(): Promise<Array<Screen>>;
55
56  /**
57   * Register the callback for screen changes.
58   *
59   * @param { 'connect' | 'disconnect' | 'change' } eventType the event of screen changes. This parameter is of string
60   * type and cannot be empty.
61   * @param { Callback<number> } callback Callback used to return the screen ID. This parameter is callable.
62   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
63   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
64   * <br>2. Incorrect parameter types.
65   * @syscap SystemCapability.WindowManager.WindowManager.Core
66   * @systemapi Hide this for inner system use.
67   * @since 9
68   */
69  function on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback<number>): void;
70
71  /**
72   * Unregister the callback for screen changes.
73   *
74   * @param { 'connect' | 'disconnect' | 'change' } eventType the event of screen changes. This parameter is of string
75   * type and cannot be empty.
76   * @param { Callback<number> } callback Callback used to return the screen ID. If this parameter is specified, it must
77   * be a callback.
78   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
79   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
80   * <br>2. Incorrect parameter types.
81   * @syscap SystemCapability.WindowManager.WindowManager.Core
82   * @systemapi Hide this for inner system use.
83   * @since 9
84   */
85  function off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback<number>): void;
86
87  /**
88   * Make screens as expand-screen
89   *
90   * @param { Array<ExpandOption> } options Parameters for expanding the screen. The options must be valid, and make
91   * sure it's type of Array<ExpandOption>.
92   * @param { AsyncCallback<number> } callback callback used to return the group ID of the expanded screens. It must
93   * be a callback.
94   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
95   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
96   * <br>2. Incorrect parameter types.
97   * @throws { BusinessError } 1400001 - Invalid display or screen.
98   * @syscap SystemCapability.WindowManager.WindowManager.Core
99   * @systemapi Hide this for inner system use.
100   * @since 9
101   */
102  function makeExpand(options: Array<ExpandOption>, callback: AsyncCallback<number>): void;
103
104  /**
105   * Make screens as expand-screen
106   *
107   * @param { Array<ExpandOption> } options Parameters for expanding the screen. The options must be valid, and make
108   * sure it's type of Array<ExpandOption>.
109   * @returns { Promise<number> } used to return the group ID of the expanded screens
110   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
111   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
112   * <br>2. Incorrect parameter types.
113   * @throws { BusinessError } 1400001 - Invalid display or screen.
114   * @syscap SystemCapability.WindowManager.WindowManager.Core
115   * @systemapi Hide this for inner system use.
116   * @since 9
117   */
118  function makeExpand(options: Array<ExpandOption>): Promise<number>;
119
120  /**
121   * Stop expand screens
122   *
123   * @param { Array<number> } expandScreen IDs of expand screens to stop. The size of the expandScreen Array should not
124   * exceed 1000.
125   * @param { AsyncCallback<void> } callback used to return the result
126   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
127   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
128   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
129   * @throws { BusinessError } 1400001 - Invalid display or screen.
130   * @syscap SystemCapability.WindowManager.WindowManager.Core
131   * @systemapi Hide this for inner system use.
132   * @since 10
133   */
134  function stopExpand(expandScreen: Array<number>, callback: AsyncCallback<void>): void;
135
136  /**
137   * Stop expand screens
138   *
139   * @param { Array<number> } expandScreen IDs of expand screens to stop. The size of the expandScreen Array should not
140   * exceed 1000.
141   * @returns { Promise<void> } promise used to return the result
142   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
143   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
144   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
145   * @throws { BusinessError } 1400001 - Invalid display or screen.
146   * @syscap SystemCapability.WindowManager.WindowManager.Core
147   * @systemapi Hide this for inner system use.
148   * @since 10
149   */
150  function stopExpand(expandScreen: Array<number>): Promise<void>;
151
152  /**
153   * Make screens as mirror-screen
154   *
155   * @param { number } mainScreen ID of the primary screen. It's type should be int.
156   * @param { Array<number> } mirrorScreen IDs of secondary screens
157   * @param { AsyncCallback<number> } callback Callback used to return the group ID of the secondary screens
158   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
159   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
160   * <br>2. Incorrect parameter types.
161   * @throws { BusinessError } 1400001 - Invalid display or screen.
162   * @syscap SystemCapability.WindowManager.WindowManager.Core
163   * @systemapi Hide this for inner system use.
164   * @since 9
165   */
166  function makeMirror(mainScreen: number, mirrorScreen: Array<number>, callback: AsyncCallback<number>): void;
167
168  /**
169   * Make screens as mirror-screen
170   *
171   * @param { number } mainScreen ID of the primary screen. It's type should be int.
172   * @param { Array<number> } mirrorScreen IDs of secondary screens
173   * @returns { Promise<number> } Promise used to return the group ID of the secondary screens
174   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
175   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
176   * <br>2. Incorrect parameter types.
177   * @throws { BusinessError } 1400001 - Invalid display or screen.
178   * @syscap SystemCapability.WindowManager.WindowManager.Core
179   * @systemapi Hide this for inner system use.
180   * @since 9
181   */
182  function makeMirror(mainScreen: number, mirrorScreen: Array<number>): Promise<number>;
183
184  /**
185   * Stop mirror screens
186   *
187   * @param { Array<number> } mirrorScreen IDs of mirror screens to stop. The size of the mirrorScreen Array should not
188   * exceed 1000.
189   * @param { AsyncCallback<void> } callback used to return the result
190   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
191   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
192   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
193   * @throws { BusinessError } 1400001 - Invalid display or screen.
194   * @syscap SystemCapability.WindowManager.WindowManager.Core
195   * @systemapi Hide this for inner system use.
196   * @since 10
197   */
198  function stopMirror(mirrorScreen: Array<number>, callback: AsyncCallback<void>): void;
199
200  /**
201   * Stop mirror screens
202   *
203   * @param { Array<number> } mirrorScreen IDs of mirror screens to stop. The size of the mirrorScreen Array should not
204   * exceed 1000.
205   * @returns { Promise<void> } promise used to return the result
206   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
207   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
208   * 2. Incorrect parameter types. 3. Parameter verification failed.
209   * @throws { BusinessError } 1400001 - Invalid display or screen.
210   * @syscap SystemCapability.WindowManager.WindowManager.Core
211   * @systemapi Hide this for inner system use.
212   * @since 10
213   */
214  function stopMirror(mirrorScreen: Array<number>): Promise<void>;
215
216  /**
217   * Make screens as unique-screen
218   *
219   * @param { Array<number> } uniqueScreen IDs of the unique screens. It's type should be int.
220   * @returns { Promise<Array<number>> } Promise used to return the display IDs of unique screens.
221   * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API.
222   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
223   * 2. Incorrect parameter types. 3. Parameter verification failed.
224   * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
225   * @throws { BusinessError } 1400001 - Invalid display or screen.
226   * @throws { BusinessError } 1400003 - This display manager service works abnormally.
227   * @syscap SystemCapability.Window.SessionManager
228   * @systemapi Hide this for inner system use.
229   * @since 18
230   */
231  function makeUnique(uniqueScreen: Array<number>): Promise<Array<number>>;
232
233  /**
234   * Create virtual screen. if surfaceId is valid, this permission is necessary.
235   *
236   * @permission ohos.permission.CAPTURE_SCREEN
237   * @param { VirtualScreenOption } options Indicates the options of the virtual screen.
238   * @param { AsyncCallback<Screen> } callback Callback used to return the created virtual screen
239   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
240   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
241   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
242   * <br>2. Incorrect parameter types.
243   * @throws { BusinessError } 1400001 - Invalid display or screen.
244   * @syscap SystemCapability.WindowManager.WindowManager.Core
245   * @systemapi Hide this for inner system use.
246   * @since 9
247   */
248  function createVirtualScreen(options: VirtualScreenOption, callback: AsyncCallback<Screen>): void;
249
250  /**
251   * Create virtual screen. if surfaceId is valid, this permission is necessary.
252   *
253   * @permission ohos.permission.CAPTURE_SCREEN
254   * @param { VirtualScreenOption } options Indicates the options of the virtual screen.
255   * @returns { Promise<Screen> } Promise used to return the created virtual screen
256   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
257   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
258   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
259   * 2. Incorrect parameter types.
260   * @throws { BusinessError } 1400001 - Invalid display or screen.
261   * @syscap SystemCapability.WindowManager.WindowManager.Core
262   * @systemapi Hide this for inner system use.
263   * @since 9
264   */
265  function createVirtualScreen(options: VirtualScreenOption): Promise<Screen>;
266
267  /**
268   * Destroy virtual screen.
269   *
270   * @param { number } screenId Indicates the screen id of the virtual screen.
271   * @param { AsyncCallback<void> } callback Callback used to return the result.
272   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
273   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
274   * <br>2. Incorrect parameter types.
275   * @throws { BusinessError } 1400002 - Unauthorized operation.
276   * @syscap SystemCapability.WindowManager.WindowManager.Core
277   * @systemapi Hide this for inner system use.
278   * @since 9
279   */
280  function destroyVirtualScreen(screenId: number, callback: AsyncCallback<void>): void;
281
282  /**
283   * Destroy virtual screen.
284   *
285   * @param { number } screenId Indicates the screen id of the virtual screen.
286   * @returns { Promise<void> } Promise that returns no value.
287   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
288   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
289   * <br>2. Incorrect parameter types.
290   * @throws { BusinessError } 1400002 - Unauthorized operation.
291   * @syscap SystemCapability.WindowManager.WindowManager.Core
292   * @systemapi Hide this for inner system use.
293   * @since 9
294   */
295  function destroyVirtualScreen(screenId: number): Promise<void>;
296
297  /**
298   * Set surface for the virtual screen.
299   *
300   * @permission ohos.permission.CAPTURE_SCREEN
301   * @param { number } screenId Indicates the screen id of the virtual screen.
302   * @param { string } surfaceId Indicates the surface id.
303   * @param { AsyncCallback<void> } callback Callback used to return the result
304   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
305   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
306   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
307   * <br>2. Incorrect parameter types.
308   * @throws { BusinessError } 1400001 - Invalid display or screen.
309   * @syscap SystemCapability.WindowManager.WindowManager.Core
310   * @systemapi Hide this for inner system use.
311   * @since 9
312   */
313  function setVirtualScreenSurface(screenId: number, surfaceId: string, callback: AsyncCallback<void>): void;
314
315  /**
316   * Set surface for the virtual screen.
317   *
318   * @permission ohos.permission.CAPTURE_SCREEN
319   * @param { number } screenId Indicates the screen id of the virtual screen.
320   * @param { string } surfaceId Indicates the surface id.
321   * @returns { Promise<void> } Promise that returns no value
322   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
323   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
324   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
325   * <br>2. Incorrect parameter types.
326   * @throws { BusinessError } 1400001 - Invalid display or screen.
327   * @syscap SystemCapability.WindowManager.WindowManager.Core
328   * @systemapi Hide this for inner system use.
329   * @since 9
330   */
331  function setVirtualScreenSurface(screenId: number, surfaceId: string): Promise<void>;
332
333  /**
334   * Get screen rotation lock status.
335   *
336   * @param { AsyncCallback<boolean> } callback If true, auto rotate is locked. If false, auto rotate is unlocked
337   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
338   * @syscap SystemCapability.WindowManager.WindowManager.Core
339   * @systemapi Hide this for inner system use.
340   * @since 9
341   */
342  function isScreenRotationLocked(callback: AsyncCallback<boolean>): void;
343
344  /**
345   * Get screen rotation lock status.
346   *
347   * @returns { Promise<boolean> } If true, auto rotate is locked. If false, auto rotate is unlocked
348   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
349   * @syscap SystemCapability.WindowManager.WindowManager.Core
350   * @systemapi Hide this for inner system use.
351   * @since 9
352   */
353  function isScreenRotationLocked(): Promise<boolean>;
354
355  /**
356   * Set screen rotation lock status.
357   *
358   * @param { boolean } isLocked Indicates whether the screen rotation switch is locked.
359   * @param { AsyncCallback<void> } callback Callback used to return the result.
360   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
361   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
362   * <br>2. Incorrect parameter types.
363   * @syscap SystemCapability.WindowManager.WindowManager.Core
364   * @systemapi Hide this for inner system use.
365   * @since 9
366   */
367  function setScreenRotationLocked(isLocked: boolean, callback: AsyncCallback<void>): void;
368
369  /**
370   * Set screen rotation lock status.
371   *
372   * @param { boolean } isLocked Indicates whether the screen rotation switch is locked.
373   * @returns { Promise<void> } Promise that returns no value.
374   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
375   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
376   * <br>2. Incorrect parameter types.
377   * @syscap SystemCapability.WindowManager.WindowManager.Core
378   * @systemapi Hide this for inner system use.
379   * @since 9
380   */
381  function setScreenRotationLocked(isLocked: boolean): Promise<void>;
382
383  /**
384   * Set multi screen mode(mirror/extend).
385   *
386   * @param { number } primaryScreenId - primary screen id.
387   * @param { number } secondaryScreenId - secondary screen id.
388   * @param { MultiScreenMode } secondaryScreenMode - secondary screen mode.
389   * @returns { Promise<void> } Promise that returns no value.
390   * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API.
391   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
392   *                                                                   2. Incorrect parameter types.
393   * @throws { BusinessError } 1400003 - This display manager service works abnormally.
394   * @syscap SystemCapability.WindowManager.WindowManager.Core
395   * @systemapi Hide this for inner system use.
396   * @since 13
397   */
398  function setMultiScreenMode(primaryScreenId: number, secondaryScreenId: number,
399    secondaryScreenMode: MultiScreenMode): Promise<void>;
400
401    /**
402   * Set multi screen relative position.
403   *
404   * @param { MultiScreenPositionOptions } mainScreenOptions - main screen position.
405   * @param { MultiScreenPositionOptions } secondaryScreenOptions - secondary screen position.
406   * @returns { Promise<void> } Promise that returns no value.
407   * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API.
408   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
409   *                                                                   2. Incorrect parameter types.
410   * @throws { BusinessError } 1400003 - This display manager service works abnormally.
411   * @syscap SystemCapability.WindowManager.WindowManager.Core
412   * @systemapi Hide this for inner system use.
413   * @since 13
414   */
415  function setMultiScreenRelativePosition(mainScreenOptions: MultiScreenPositionOptions,
416    secondaryScreenOptions: MultiScreenPositionOptions): Promise<void>;
417
418  /**
419   * Indicate the screen mode
420   *
421   * @enum { number }
422   * @syscap SystemCapability.WindowManager.WindowManager.Core
423   * @systemapi Hide this for inner system use.
424   * @since 13
425   */
426  enum MultiScreenMode {
427
428    /**
429     * Indicate that the screen is in mirror mode.
430     *
431     * @syscap SystemCapability.WindowManager.WindowManager.Core
432     * @systemapi Hide this for inner system use.
433     * @since 13
434     */
435    SCREEN_MIRROR = 0,
436
437    /**
438     * Indicate that the screen is in extend mode.
439     *
440     * @syscap SystemCapability.WindowManager.WindowManager.Core
441     * @systemapi Hide this for inner system use.
442     * @since 13
443     */
444    SCREEN_EXTEND = 1
445  }
446
447  /**
448   * The parameter of making extend screen
449   *
450   * @interface MultiScreenPositionOptions
451   * @syscap SystemCapability.WindowManager.WindowManager.Core
452   * @systemapi Hide this for inner system use.
453   * @since 13
454   */
455  interface MultiScreenPositionOptions {
456    /**
457     * Screen id
458     *
459     * @type { number }
460     * @syscap SystemCapability.WindowManager.WindowManager.Core
461     * @systemapi Hide this for inner system use.
462     * @since 13
463     */
464    id: number;
465
466    /**
467     * The start coordinate X of the screen origin
468     *
469     * @type { number }
470     * @syscap SystemCapability.WindowManager.WindowManager.Core
471     * @systemapi Hide this for inner system use.
472     * @since 13
473     */
474    startX: number;
475
476    /**
477     * The start coordinate Y of the screen origin
478     *
479     * @type { number }
480     * @syscap SystemCapability.WindowManager.WindowManager.Core
481     * @systemapi Hide this for inner system use.
482     * @since 13
483     */
484    startY: number;
485  }
486
487  /**
488   * The parameter of making expand screen
489   *
490   * @interface ExpandOption
491   * @syscap SystemCapability.WindowManager.WindowManager.Core
492   * @systemapi Hide this for inner system use.
493   * @since 9
494   */
495  interface ExpandOption {
496    /**
497     * Screen id
498     *
499     * @type { number }
500     * @syscap SystemCapability.WindowManager.WindowManager.Core
501     * @systemapi Hide this for inner system use.
502     * @since 9
503     */
504    screenId: number;
505
506    /**
507     * The start coordinate X of the screen origin
508     *
509     * @type { number }
510     * @syscap SystemCapability.WindowManager.WindowManager.Core
511     * @systemapi Hide this for inner system use.
512     * @since 9
513     */
514    startX: number;
515
516    /**
517     * The start coordinate Y of the screen origin
518     *
519     * @type { number }
520     * @syscap SystemCapability.WindowManager.WindowManager.Core
521     * @systemapi Hide this for inner system use.
522     * @since 9
523     */
524    startY: number;
525  }
526
527  /**
528   * The parameter for creating virtual screen.
529   *
530   * @interface VirtualScreenOption
531   * @syscap SystemCapability.WindowManager.WindowManager.Core
532   * @systemapi Hide this for inner system use.
533   * @since 9
534   */
535  interface VirtualScreenOption {
536    /**
537     * Indicates the name of the virtual screen.
538     *
539     * @type { string }
540     * @syscap SystemCapability.WindowManager.WindowManager.Core
541     * @systemapi Hide this for inner system use.
542     * @since 9
543     */
544    name: string;
545
546    /**
547     * Indicates the width of the virtual screen.
548     *
549     * @type { number }
550     * @syscap SystemCapability.WindowManager.WindowManager.Core
551     * @systemapi Hide this for inner system use.
552     * @since 9
553     */
554    width: number;
555
556    /**
557     * Indicates the height of the virtual screen.
558     *
559     * @type { number }
560     * @syscap SystemCapability.WindowManager.WindowManager.Core
561     * @systemapi Hide this for inner system use.
562     * @since 9
563     */
564    height: number;
565
566    /**
567     * Indicates the density of the virtual screen.
568     *
569     * @type { number }
570     * @syscap SystemCapability.WindowManager.WindowManager.Core
571     * @systemapi Hide this for inner system use.
572     * @since 9
573     */
574    density: number;
575
576    /**
577     * Indicates the surface id of the virtual screen.
578     *
579     * @type { string }
580     * @syscap SystemCapability.WindowManager.WindowManager.Core
581     * @systemapi Hide this for inner system use.
582     * @since 9
583     */
584    surfaceId: string;
585  }
586
587  /**
588   * Indicate the source mode of the screen
589   *
590   * @enum { number }
591   * @syscap SystemCapability.WindowManager.WindowManager.Core
592   * @systemapi Hide this for inner system use.
593   * @since 10
594   */
595  enum ScreenSourceMode {
596    /**
597     * Indicate that the screen is the default screen.
598     *
599     * @syscap SystemCapability.WindowManager.WindowManager.Core
600     * @systemapi Hide this for inner system use.
601     * @since 10
602     */
603    SCREEN_MAIN = 0,
604
605    /**
606     * Indicate that the screen is in mirror mode.
607     *
608     * @syscap SystemCapability.WindowManager.WindowManager.Core
609     * @systemapi Hide this for inner system use.
610     * @since 10
611     */
612    SCREEN_MIRROR = 1,
613
614    /**
615     * Indicate that the screen is in extend mode.
616     *
617     * @syscap SystemCapability.WindowManager.WindowManager.Core
618     * @systemapi Hide this for inner system use.
619     * @since 10
620     */
621    SCREEN_EXTEND = 2,
622
623    /**
624     * Indicate that the screen stands alone.
625     *
626     * @syscap SystemCapability.WindowManager.WindowManager.Core
627     * @systemapi Hide this for inner system use.
628     * @since 10
629     */
630    SCREEN_ALONE = 3
631  }
632
633  /**
634   * Interface for screen
635   *
636   * @interface Screen
637   * @syscap SystemCapability.WindowManager.WindowManager.Core
638   * @systemapi Hide this for inner system use.
639   * @since 9
640   */
641  interface Screen {
642    /**
643     * Screen id
644     *
645     * @type { number }
646     * @readonly
647     * @syscap SystemCapability.WindowManager.WindowManager.Core
648     * @systemapi Hide this for inner system use.
649     * @since 9
650     */
651    readonly id: number;
652
653    /**
654     * Group id
655     *
656     * @type { number }
657     * @readonly
658     * @syscap SystemCapability.WindowManager.WindowManager.Core
659     * @systemapi Hide this for inner system use.
660     * @since 9
661     */
662    readonly parent: number;
663
664    /**
665     * Mode supported by the screen
666     *
667     * @type { Array<ScreenModeInfo> }
668     * @readonly
669     * @syscap SystemCapability.WindowManager.WindowManager.Core
670     * @systemapi Hide this for inner system use.
671     * @since 9
672     */
673    readonly supportedModeInfo: Array<ScreenModeInfo>;
674
675    /**
676     * Currently active mode
677     *
678     * @type { number }
679     * @readonly
680     * @syscap SystemCapability.WindowManager.WindowManager.Core
681     * @systemapi Hide this for inner system use.
682     * @since 9
683     */
684    readonly activeModeIndex: number;
685
686    /**
687     * Orientation of the screen
688     *
689     * @type { Orientation }
690     * @readonly
691     * @syscap SystemCapability.WindowManager.WindowManager.Core
692     * @systemapi Hide this for inner system use.
693     * @since 9
694     */
695    readonly orientation: Orientation;
696
697    /**
698     * Source mode of the screen
699     *
700     * @type { ScreenSourceMode }
701     * @readonly
702     * @syscap SystemCapability.WindowManager.WindowManager.Core
703     * @systemapi Hide this for inner system use.
704     * @since 10
705     */
706    readonly sourceMode: ScreenSourceMode;
707
708    /**
709     * Screen Serial Number
710     *
711     * @type { ?string }
712     * @readonly
713     * @syscap SystemCapability.WindowManager.WindowManager
714     * @systemapi Hide this for inner system use.
715     * @since 15
716     */
717    readonly serialNumber?: string;
718
719    /**
720     * Set the orientation of the screen
721     *
722     * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation.
723     * @param { AsyncCallback<void> } callback Callback used to return the result.
724     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
725     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
726     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
727     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
728     * @syscap SystemCapability.WindowManager.WindowManager.Core
729     * @systemapi Hide this for inner system use.
730     * @since 9
731     */
732    setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void;
733
734    /**
735     * Set the orientation of the screen
736     *
737     * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation.
738     * @returns { Promise<void> } Promise that returns no value.
739     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
740     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
741     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
742     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
743     * @syscap SystemCapability.WindowManager.WindowManager.Core
744     * @systemapi Hide this for inner system use.
745     * @since 9
746     */
747    setOrientation(orientation: Orientation): Promise<void>;
748
749    /**
750     * Active the mode
751     *
752     * @param { number } modeIndex Index of the mode to set.
753     * @param { AsyncCallback<void> } callback Callback used to return the result.
754     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
755     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
756     * <br>2. Incorrect parameter types.
757     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
758     * @syscap SystemCapability.WindowManager.WindowManager.Core
759     * @systemapi Hide this for inner system use.
760     * @since 9
761     */
762    setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): void;
763
764    /**
765     * Active the mode
766     *
767     * @param { number } modeIndex Index of the mode to set.
768     * @returns { Promise<void> } Promise that returns no value.
769     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
770     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
771     * <br>2. Incorrect parameter types.
772     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
773     * @syscap SystemCapability.WindowManager.WindowManager.Core
774     * @systemapi Hide this for inner system use.
775     * @since 9
776     */
777    setScreenActiveMode(modeIndex: number): Promise<void>;
778
779    /**
780     * Set display density of the screen
781     *
782     * @param { number } densityDpi Pixel density. The value ranges from 80 to 640.
783     * @param { AsyncCallback<void> } callback Callback used to return the result.
784     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
785     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
786     * <br>2. Incorrect parameter types.
787     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
788     * @syscap SystemCapability.WindowManager.WindowManager.Core
789     * @systemapi Hide this for inner system use.
790     * @since 9
791     */
792    setDensityDpi(densityDpi: number, callback: AsyncCallback<void>): void;
793
794    /**
795     * Set display density of the screen
796     *
797     * @param { number } densityDpi Pixel density. The value ranges from 80 to 640.
798     * @returns { Promise<void> } Promise that returns no value.
799     * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
800     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
801     * <br>2. Incorrect parameter types.
802     * @throws { BusinessError } 1400003 - This display manager service works abnormally.
803     * @syscap SystemCapability.WindowManager.WindowManager.Core
804     * @systemapi Hide this for inner system use.
805     * @since 9
806     */
807    setDensityDpi(densityDpi: number): Promise<void>;
808  }
809
810  /**
811   * Screen orientation
812   *
813   * @enum { number }
814   * @syscap SystemCapability.WindowManager.WindowManager.Core
815   * @systemapi Hide this for inner system use.
816   * @since 9
817   */
818  enum Orientation {
819    /**
820     * Indicates that the orientation of the screen is unspecified.
821     *
822     * @syscap SystemCapability.WindowManager.WindowManager.Core
823     * @systemapi Hide this for inner system use.
824     * @since 9
825     */
826    UNSPECIFIED = 0,
827
828    /**
829     * Indicates that the orientation of the screen is vertical.
830     *
831     * @syscap SystemCapability.WindowManager.WindowManager.Core
832     * @systemapi Hide this for inner system use.
833     * @since 9
834     */
835    VERTICAL = 1,
836
837    /**
838     * Indicates that the orientation of the screen is horizontal.
839     *
840     * @syscap SystemCapability.WindowManager.WindowManager.Core
841     * @systemapi Hide this for inner system use.
842     * @since 9
843     */
844    HORIZONTAL = 2,
845
846    /**
847     * Indicates that the orientation of the screen is reverse_vertical.
848     *
849     * @syscap SystemCapability.WindowManager.WindowManager.Core
850     * @systemapi Hide this for inner system use.
851     * @since 9
852     */
853    REVERSE_VERTICAL = 3,
854
855    /**
856     * Indicates that the orientation of the screen is reverse_horizontal.
857     *
858     * @syscap SystemCapability.WindowManager.WindowManager.Core
859     * @systemapi Hide this for inner system use.
860     * @since 9
861     */
862    REVERSE_HORIZONTAL = 4
863  }
864
865  /**
866   * The information of the screen
867   *
868   * @interface ScreenModeInfo
869   * @syscap SystemCapability.WindowManager.WindowManager.Core
870   * @systemapi Hide this for inner system use.
871   * @since 9
872   */
873  interface ScreenModeInfo {
874    /**
875     * Screen id
876     *
877     * @type { number }
878     * @syscap SystemCapability.WindowManager.WindowManager.Core
879     * @systemapi Hide this for inner system use.
880     * @since 9
881     */
882    id: number;
883
884    /**
885     * Indicates the width of the screen
886     *
887     * @type { number }
888     * @syscap SystemCapability.WindowManager.WindowManager.Core
889     * @systemapi Hide this for inner system use.
890     * @since 9
891     */
892    width: number;
893
894   /**
895     * Indicates the height of the screen
896     *
897     * @type { number }
898     * @syscap SystemCapability.WindowManager.WindowManager.Core
899     * @systemapi Hide this for inner system use.
900     * @since 9
901     */
902    height: number;
903
904    /**
905     * Indicates the refreshRate of the screen
906     *
907     * @type { number }
908     * @syscap SystemCapability.WindowManager.WindowManager.Core
909     * @systemapi Hide this for inner system use.
910     * @since 9
911     */
912    refreshRate: number;
913  }
914}
915
916export default screen;
917