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 * Create virtual screen. if surfaceId is valid, this permission is necessary. 218 * 219 * @permission ohos.permission.CAPTURE_SCREEN 220 * @param { VirtualScreenOption } options Indicates the options of the virtual screen. 221 * @param { AsyncCallback<Screen> } callback Callback used to return the created virtual screen 222 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 223 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 224 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 225 * <br>2. Incorrect parameter types. 226 * @throws { BusinessError } 1400001 - Invalid display or screen. 227 * @syscap SystemCapability.WindowManager.WindowManager.Core 228 * @systemapi Hide this for inner system use. 229 * @since 9 230 */ 231 function createVirtualScreen(options: VirtualScreenOption, callback: AsyncCallback<Screen>): void; 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 * @returns { Promise<Screen> } Promise 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 * 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): Promise<Screen>; 249 250 /** 251 * Destroy virtual screen. 252 * 253 * @param { number } screenId Indicates the screen id of the virtual screen. 254 * @param { AsyncCallback<void> } callback Callback used to return the result. 255 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 256 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 257 * <br>2. Incorrect parameter types. 258 * @throws { BusinessError } 1400002 - Unauthorized operation. 259 * @syscap SystemCapability.WindowManager.WindowManager.Core 260 * @systemapi Hide this for inner system use. 261 * @since 9 262 */ 263 function destroyVirtualScreen(screenId: number, callback: AsyncCallback<void>): void; 264 265 /** 266 * Destroy virtual screen. 267 * 268 * @param { number } screenId Indicates the screen id of the virtual screen. 269 * @returns { Promise<void> } Promise that returns no value. 270 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 271 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 272 * <br>2. Incorrect parameter types. 273 * @throws { BusinessError } 1400002 - Unauthorized operation. 274 * @syscap SystemCapability.WindowManager.WindowManager.Core 275 * @systemapi Hide this for inner system use. 276 * @since 9 277 */ 278 function destroyVirtualScreen(screenId: number): Promise<void>; 279 280 /** 281 * Set surface for the virtual screen. 282 * 283 * @permission ohos.permission.CAPTURE_SCREEN 284 * @param { number } screenId Indicates the screen id of the virtual screen. 285 * @param { string } surfaceId Indicates the surface id. 286 * @param { AsyncCallback<void> } callback Callback used to return the result 287 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 288 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 290 * <br>2. Incorrect parameter types. 291 * @throws { BusinessError } 1400001 - Invalid display or screen. 292 * @syscap SystemCapability.WindowManager.WindowManager.Core 293 * @systemapi Hide this for inner system use. 294 * @since 9 295 */ 296 function setVirtualScreenSurface(screenId: number, surfaceId: string, callback: AsyncCallback<void>): void; 297 298 /** 299 * Set surface for the virtual screen. 300 * 301 * @permission ohos.permission.CAPTURE_SCREEN 302 * @param { number } screenId Indicates the screen id of the virtual screen. 303 * @param { string } surfaceId Indicates the surface id. 304 * @returns { Promise<void> } Promise that returns no value 305 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 306 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 307 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 308 * <br>2. Incorrect parameter types. 309 * @throws { BusinessError } 1400001 - Invalid display or screen. 310 * @syscap SystemCapability.WindowManager.WindowManager.Core 311 * @systemapi Hide this for inner system use. 312 * @since 9 313 */ 314 function setVirtualScreenSurface(screenId: number, surfaceId: string): Promise<void>; 315 316 /** 317 * Get screen rotation lock status. 318 * 319 * @param { AsyncCallback<boolean> } callback If true, auto rotate is locked. If false, auto rotate is unlocked 320 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 321 * @syscap SystemCapability.WindowManager.WindowManager.Core 322 * @systemapi Hide this for inner system use. 323 * @since 9 324 */ 325 function isScreenRotationLocked(callback: AsyncCallback<boolean>): void; 326 327 /** 328 * Get screen rotation lock status. 329 * 330 * @returns { Promise<boolean> } If true, auto rotate is locked. If false, auto rotate is unlocked 331 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 332 * @syscap SystemCapability.WindowManager.WindowManager.Core 333 * @systemapi Hide this for inner system use. 334 * @since 9 335 */ 336 function isScreenRotationLocked(): Promise<boolean>; 337 338 /** 339 * Set screen rotation lock status. 340 * 341 * @param { boolean } isLocked Indicates whether the screen rotation switch is locked. 342 * @param { AsyncCallback<void> } callback Callback used to return the result. 343 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 345 * <br>2. Incorrect parameter types. 346 * @syscap SystemCapability.WindowManager.WindowManager.Core 347 * @systemapi Hide this for inner system use. 348 * @since 9 349 */ 350 function setScreenRotationLocked(isLocked: boolean, callback: AsyncCallback<void>): void; 351 352 /** 353 * Set screen rotation lock status. 354 * 355 * @param { boolean } isLocked Indicates whether the screen rotation switch is locked. 356 * @returns { Promise<void> } Promise that returns no value. 357 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 358 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 359 * <br>2. Incorrect parameter types. 360 * @syscap SystemCapability.WindowManager.WindowManager.Core 361 * @systemapi Hide this for inner system use. 362 * @since 9 363 */ 364 function setScreenRotationLocked(isLocked: boolean): Promise<void>; 365 366 /** 367 * Set multi screen mode(mirror/extend). 368 * 369 * @param { number } primaryScreenId - primary screen id. 370 * @param { number } secondaryScreenId - secondary screen id. 371 * @param { MultiScreenMode } secondaryScreenMode - secondary screen mode. 372 * @returns { Promise<void> } Promise that returns no value. 373 * @throws { BusinessError } 202 - Permission verification failed, non-system application uses system API. 374 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 375 * 2. Incorrect parameter types. 376 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 377 * @syscap SystemCapability.WindowManager.WindowManager.Core 378 * @systemapi Hide this for inner system use. 379 * @since 13 380 */ 381 function setMultiScreenMode(primaryScreenId: number, secondaryScreenId: number, 382 secondaryScreenMode: MultiScreenMode): Promise<void>; 383 384 /** 385 * Set multi screen relative position. 386 * 387 * @param { MultiScreenPositionOptions } mainScreenOptions - main screen position. 388 * @param { MultiScreenPositionOptions } secondaryScreenOptions - secondary screen position. 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 setMultiScreenRelativePosition(mainScreenOptions: MultiScreenPositionOptions, 399 secondaryScreenOptions: MultiScreenPositionOptions): Promise<void>; 400 401 /** 402 * Indicate the screen mode 403 * 404 * @enum { number } 405 * @syscap SystemCapability.WindowManager.WindowManager.Core 406 * @systemapi Hide this for inner system use. 407 * @since 13 408 */ 409 enum MultiScreenMode { 410 411 /** 412 * Indicate that the screen is in mirror mode. 413 * 414 * @syscap SystemCapability.WindowManager.WindowManager.Core 415 * @systemapi Hide this for inner system use. 416 * @since 13 417 */ 418 SCREEN_MIRROR = 0, 419 420 /** 421 * Indicate that the screen is in extend mode. 422 * 423 * @syscap SystemCapability.WindowManager.WindowManager.Core 424 * @systemapi Hide this for inner system use. 425 * @since 13 426 */ 427 SCREEN_EXTEND = 1 428 } 429 430 /** 431 * The parameter of making extend screen 432 * 433 * @interface MultiScreenPositionOptions 434 * @syscap SystemCapability.WindowManager.WindowManager.Core 435 * @systemapi Hide this for inner system use. 436 * @since 13 437 */ 438 interface MultiScreenPositionOptions { 439 /** 440 * Screen id 441 * 442 * @type { number } 443 * @syscap SystemCapability.WindowManager.WindowManager.Core 444 * @systemapi Hide this for inner system use. 445 * @since 13 446 */ 447 id: number; 448 449 /** 450 * The start coordinate X of the screen origin 451 * 452 * @type { number } 453 * @syscap SystemCapability.WindowManager.WindowManager.Core 454 * @systemapi Hide this for inner system use. 455 * @since 13 456 */ 457 startX: number; 458 459 /** 460 * The start coordinate Y of the screen origin 461 * 462 * @type { number } 463 * @syscap SystemCapability.WindowManager.WindowManager.Core 464 * @systemapi Hide this for inner system use. 465 * @since 13 466 */ 467 startY: number; 468 } 469 470 /** 471 * The parameter of making expand screen 472 * 473 * @interface ExpandOption 474 * @syscap SystemCapability.WindowManager.WindowManager.Core 475 * @systemapi Hide this for inner system use. 476 * @since 9 477 */ 478 interface ExpandOption { 479 /** 480 * Screen id 481 * 482 * @type { number } 483 * @syscap SystemCapability.WindowManager.WindowManager.Core 484 * @systemapi Hide this for inner system use. 485 * @since 9 486 */ 487 screenId: number; 488 489 /** 490 * The start coordinate X of the screen origin 491 * 492 * @type { number } 493 * @syscap SystemCapability.WindowManager.WindowManager.Core 494 * @systemapi Hide this for inner system use. 495 * @since 9 496 */ 497 startX: number; 498 499 /** 500 * The start coordinate Y of the screen origin 501 * 502 * @type { number } 503 * @syscap SystemCapability.WindowManager.WindowManager.Core 504 * @systemapi Hide this for inner system use. 505 * @since 9 506 */ 507 startY: number; 508 } 509 510 /** 511 * The parameter for creating virtual screen. 512 * 513 * @interface VirtualScreenOption 514 * @syscap SystemCapability.WindowManager.WindowManager.Core 515 * @systemapi Hide this for inner system use. 516 * @since 9 517 */ 518 interface VirtualScreenOption { 519 /** 520 * Indicates the name of the virtual screen. 521 * 522 * @type { string } 523 * @syscap SystemCapability.WindowManager.WindowManager.Core 524 * @systemapi Hide this for inner system use. 525 * @since 9 526 */ 527 name: string; 528 529 /** 530 * Indicates the width of the virtual screen. 531 * 532 * @type { number } 533 * @syscap SystemCapability.WindowManager.WindowManager.Core 534 * @systemapi Hide this for inner system use. 535 * @since 9 536 */ 537 width: number; 538 539 /** 540 * Indicates the height of the virtual screen. 541 * 542 * @type { number } 543 * @syscap SystemCapability.WindowManager.WindowManager.Core 544 * @systemapi Hide this for inner system use. 545 * @since 9 546 */ 547 height: number; 548 549 /** 550 * Indicates the density of the virtual screen. 551 * 552 * @type { number } 553 * @syscap SystemCapability.WindowManager.WindowManager.Core 554 * @systemapi Hide this for inner system use. 555 * @since 9 556 */ 557 density: number; 558 559 /** 560 * Indicates the surface id of the virtual screen. 561 * 562 * @type { string } 563 * @syscap SystemCapability.WindowManager.WindowManager.Core 564 * @systemapi Hide this for inner system use. 565 * @since 9 566 */ 567 surfaceId: string; 568 } 569 570 /** 571 * Indicate the source mode of the screen 572 * 573 * @enum { number } 574 * @syscap SystemCapability.WindowManager.WindowManager.Core 575 * @systemapi Hide this for inner system use. 576 * @since 10 577 */ 578 enum ScreenSourceMode { 579 /** 580 * Indicate that the screen is the default screen. 581 * 582 * @syscap SystemCapability.WindowManager.WindowManager.Core 583 * @systemapi Hide this for inner system use. 584 * @since 10 585 */ 586 SCREEN_MAIN = 0, 587 588 /** 589 * Indicate that the screen is in mirror mode. 590 * 591 * @syscap SystemCapability.WindowManager.WindowManager.Core 592 * @systemapi Hide this for inner system use. 593 * @since 10 594 */ 595 SCREEN_MIRROR = 1, 596 597 /** 598 * Indicate that the screen is in extend mode. 599 * 600 * @syscap SystemCapability.WindowManager.WindowManager.Core 601 * @systemapi Hide this for inner system use. 602 * @since 10 603 */ 604 SCREEN_EXTEND = 2, 605 606 /** 607 * Indicate that the screen stands alone. 608 * 609 * @syscap SystemCapability.WindowManager.WindowManager.Core 610 * @systemapi Hide this for inner system use. 611 * @since 10 612 */ 613 SCREEN_ALONE = 3 614 } 615 616 /** 617 * Interface for screen 618 * 619 * @interface Screen 620 * @syscap SystemCapability.WindowManager.WindowManager.Core 621 * @systemapi Hide this for inner system use. 622 * @since 9 623 */ 624 interface Screen { 625 /** 626 * Screen id 627 * 628 * @type { number } 629 * @readonly 630 * @syscap SystemCapability.WindowManager.WindowManager.Core 631 * @systemapi Hide this for inner system use. 632 * @since 9 633 */ 634 readonly id: number; 635 636 /** 637 * Group id 638 * 639 * @type { number } 640 * @readonly 641 * @syscap SystemCapability.WindowManager.WindowManager.Core 642 * @systemapi Hide this for inner system use. 643 * @since 9 644 */ 645 readonly parent: number; 646 647 /** 648 * Mode supported by the screen 649 * 650 * @type { Array<ScreenModeInfo> } 651 * @readonly 652 * @syscap SystemCapability.WindowManager.WindowManager.Core 653 * @systemapi Hide this for inner system use. 654 * @since 9 655 */ 656 readonly supportedModeInfo: Array<ScreenModeInfo>; 657 658 /** 659 * Currently active mode 660 * 661 * @type { number } 662 * @readonly 663 * @syscap SystemCapability.WindowManager.WindowManager.Core 664 * @systemapi Hide this for inner system use. 665 * @since 9 666 */ 667 readonly activeModeIndex: number; 668 669 /** 670 * Orientation of the screen 671 * 672 * @type { Orientation } 673 * @readonly 674 * @syscap SystemCapability.WindowManager.WindowManager.Core 675 * @systemapi Hide this for inner system use. 676 * @since 9 677 */ 678 readonly orientation: Orientation; 679 680 /** 681 * Source mode of the screen 682 * 683 * @type { ScreenSourceMode } 684 * @readonly 685 * @syscap SystemCapability.WindowManager.WindowManager.Core 686 * @systemapi Hide this for inner system use. 687 * @since 10 688 */ 689 readonly sourceMode: ScreenSourceMode; 690 691 /** 692 * Screen Serial Number 693 * 694 * @type { ?string } 695 * @readonly 696 * @syscap SystemCapability.WindowManager.WindowManager 697 * @systemapi Hide this for inner system use. 698 * @since 15 699 */ 700 readonly serialNumber?: string; 701 702 /** 703 * Set the orientation of the screen 704 * 705 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 706 * @param { AsyncCallback<void> } callback Callback used to return the result. 707 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 708 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 709 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 710 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 711 * @syscap SystemCapability.WindowManager.WindowManager.Core 712 * @systemapi Hide this for inner system use. 713 * @since 9 714 */ 715 setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void; 716 717 /** 718 * Set the orientation of the screen 719 * 720 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 721 * @returns { Promise<void> } Promise that returns no value. 722 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 723 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 724 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 725 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 726 * @syscap SystemCapability.WindowManager.WindowManager.Core 727 * @systemapi Hide this for inner system use. 728 * @since 9 729 */ 730 setOrientation(orientation: Orientation): Promise<void>; 731 732 /** 733 * Active the mode 734 * 735 * @param { number } modeIndex Index of the mode to set. 736 * @param { AsyncCallback<void> } callback Callback used to return the result. 737 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 738 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 739 * <br>2. Incorrect parameter types. 740 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 741 * @syscap SystemCapability.WindowManager.WindowManager.Core 742 * @systemapi Hide this for inner system use. 743 * @since 9 744 */ 745 setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): void; 746 747 /** 748 * Active the mode 749 * 750 * @param { number } modeIndex Index of the mode to set. 751 * @returns { Promise<void> } Promise that returns no value. 752 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 753 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 754 * <br>2. Incorrect parameter types. 755 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 756 * @syscap SystemCapability.WindowManager.WindowManager.Core 757 * @systemapi Hide this for inner system use. 758 * @since 9 759 */ 760 setScreenActiveMode(modeIndex: number): Promise<void>; 761 762 /** 763 * Set display density of the screen 764 * 765 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 766 * @param { AsyncCallback<void> } callback Callback used to return the result. 767 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 768 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 769 * <br>2. Incorrect parameter types. 770 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 771 * @syscap SystemCapability.WindowManager.WindowManager.Core 772 * @systemapi Hide this for inner system use. 773 * @since 9 774 */ 775 setDensityDpi(densityDpi: number, callback: AsyncCallback<void>): void; 776 777 /** 778 * Set display density of the screen 779 * 780 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 781 * @returns { Promise<void> } Promise that returns no value. 782 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 783 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 784 * <br>2. Incorrect parameter types. 785 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 786 * @syscap SystemCapability.WindowManager.WindowManager.Core 787 * @systemapi Hide this for inner system use. 788 * @since 9 789 */ 790 setDensityDpi(densityDpi: number): Promise<void>; 791 } 792 793 /** 794 * Screen orientation 795 * 796 * @enum { number } 797 * @syscap SystemCapability.WindowManager.WindowManager.Core 798 * @systemapi Hide this for inner system use. 799 * @since 9 800 */ 801 enum Orientation { 802 /** 803 * Indicates that the orientation of the screen is unspecified. 804 * 805 * @syscap SystemCapability.WindowManager.WindowManager.Core 806 * @systemapi Hide this for inner system use. 807 * @since 9 808 */ 809 UNSPECIFIED = 0, 810 811 /** 812 * Indicates that the orientation of the screen is vertical. 813 * 814 * @syscap SystemCapability.WindowManager.WindowManager.Core 815 * @systemapi Hide this for inner system use. 816 * @since 9 817 */ 818 VERTICAL = 1, 819 820 /** 821 * Indicates that the orientation of the screen is horizontal. 822 * 823 * @syscap SystemCapability.WindowManager.WindowManager.Core 824 * @systemapi Hide this for inner system use. 825 * @since 9 826 */ 827 HORIZONTAL = 2, 828 829 /** 830 * Indicates that the orientation of the screen is reverse_vertical. 831 * 832 * @syscap SystemCapability.WindowManager.WindowManager.Core 833 * @systemapi Hide this for inner system use. 834 * @since 9 835 */ 836 REVERSE_VERTICAL = 3, 837 838 /** 839 * Indicates that the orientation of the screen is reverse_horizontal. 840 * 841 * @syscap SystemCapability.WindowManager.WindowManager.Core 842 * @systemapi Hide this for inner system use. 843 * @since 9 844 */ 845 REVERSE_HORIZONTAL = 4 846 } 847 848 /** 849 * The information of the screen 850 * 851 * @interface ScreenModeInfo 852 * @syscap SystemCapability.WindowManager.WindowManager.Core 853 * @systemapi Hide this for inner system use. 854 * @since 9 855 */ 856 interface ScreenModeInfo { 857 /** 858 * Screen id 859 * 860 * @type { number } 861 * @syscap SystemCapability.WindowManager.WindowManager.Core 862 * @systemapi Hide this for inner system use. 863 * @since 9 864 */ 865 id: number; 866 867 /** 868 * Indicates the width of the screen 869 * 870 * @type { number } 871 * @syscap SystemCapability.WindowManager.WindowManager.Core 872 * @systemapi Hide this for inner system use. 873 * @since 9 874 */ 875 width: number; 876 877 /** 878 * Indicates the height of the screen 879 * 880 * @type { number } 881 * @syscap SystemCapability.WindowManager.WindowManager.Core 882 * @systemapi Hide this for inner system use. 883 * @since 9 884 */ 885 height: number; 886 887 /** 888 * Indicates the refreshRate of the screen 889 * 890 * @type { number } 891 * @syscap SystemCapability.WindowManager.WindowManager.Core 892 * @systemapi Hide this for inner system use. 893 * @since 9 894 */ 895 refreshRate: number; 896 } 897} 898 899export default screen;