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 * The parameter of making expand screen 368 * 369 * @interface ExpandOption 370 * @syscap SystemCapability.WindowManager.WindowManager.Core 371 * @systemapi Hide this for inner system use. 372 * @since 9 373 */ 374 interface ExpandOption { 375 /** 376 * Screen id 377 * 378 * @type { number } 379 * @syscap SystemCapability.WindowManager.WindowManager.Core 380 * @systemapi Hide this for inner system use. 381 * @since 9 382 */ 383 screenId: number; 384 385 /** 386 * The start coordinate X of the screen origin 387 * 388 * @type { number } 389 * @syscap SystemCapability.WindowManager.WindowManager.Core 390 * @systemapi Hide this for inner system use. 391 * @since 9 392 */ 393 startX: number; 394 395 /** 396 * The start coordinate Y of the screen origin 397 * 398 * @type { number } 399 * @syscap SystemCapability.WindowManager.WindowManager.Core 400 * @systemapi Hide this for inner system use. 401 * @since 9 402 */ 403 startY: number; 404 } 405 406 /** 407 * The parameter for creating virtual screen. 408 * 409 * @interface VirtualScreenOption 410 * @syscap SystemCapability.WindowManager.WindowManager.Core 411 * @systemapi Hide this for inner system use. 412 * @since 9 413 */ 414 interface VirtualScreenOption { 415 /** 416 * Indicates the name of the virtual screen. 417 * 418 * @type { string } 419 * @syscap SystemCapability.WindowManager.WindowManager.Core 420 * @systemapi Hide this for inner system use. 421 * @since 9 422 */ 423 name: string; 424 425 /** 426 * Indicates the width of the virtual screen. 427 * 428 * @type { number } 429 * @syscap SystemCapability.WindowManager.WindowManager.Core 430 * @systemapi Hide this for inner system use. 431 * @since 9 432 */ 433 width: number; 434 435 /** 436 * Indicates the height of the virtual screen. 437 * 438 * @type { number } 439 * @syscap SystemCapability.WindowManager.WindowManager.Core 440 * @systemapi Hide this for inner system use. 441 * @since 9 442 */ 443 height: number; 444 445 /** 446 * Indicates the density of the virtual screen. 447 * 448 * @type { number } 449 * @syscap SystemCapability.WindowManager.WindowManager.Core 450 * @systemapi Hide this for inner system use. 451 * @since 9 452 */ 453 density: number; 454 455 /** 456 * Indicates the surface id of the virtual screen. 457 * 458 * @type { string } 459 * @syscap SystemCapability.WindowManager.WindowManager.Core 460 * @systemapi Hide this for inner system use. 461 * @since 9 462 */ 463 surfaceId: string; 464 } 465 466 /** 467 * Indicate the source mode of the screen 468 * 469 * @enum { number } 470 * @syscap SystemCapability.WindowManager.WindowManager.Core 471 * @systemapi Hide this for inner system use. 472 * @since 10 473 */ 474 enum ScreenSourceMode { 475 /** 476 * Indicate that the screen is the default screen. 477 * 478 * @syscap SystemCapability.WindowManager.WindowManager.Core 479 * @systemapi Hide this for inner system use. 480 * @since 10 481 */ 482 SCREEN_MAIN = 0, 483 484 /** 485 * Indicate that the screen is in mirror mode. 486 * 487 * @syscap SystemCapability.WindowManager.WindowManager.Core 488 * @systemapi Hide this for inner system use. 489 * @since 10 490 */ 491 SCREEN_MIRROR = 1, 492 493 /** 494 * Indicate that the screen is in extend mode. 495 * 496 * @syscap SystemCapability.WindowManager.WindowManager.Core 497 * @systemapi Hide this for inner system use. 498 * @since 10 499 */ 500 SCREEN_EXTEND = 2, 501 502 /** 503 * Indicate that the screen stands alone. 504 * 505 * @syscap SystemCapability.WindowManager.WindowManager.Core 506 * @systemapi Hide this for inner system use. 507 * @since 10 508 */ 509 SCREEN_ALONE = 3 510 } 511 512 /** 513 * Interface for screen 514 * 515 * @interface Screen 516 * @syscap SystemCapability.WindowManager.WindowManager.Core 517 * @systemapi Hide this for inner system use. 518 * @since 9 519 */ 520 interface Screen { 521 /** 522 * Screen id 523 * 524 * @type { number } 525 * @syscap SystemCapability.WindowManager.WindowManager.Core 526 * @systemapi Hide this for inner system use. 527 * @since 9 528 */ 529 readonly id: number; 530 531 /** 532 * Group id 533 * 534 * @type { number } 535 * @syscap SystemCapability.WindowManager.WindowManager.Core 536 * @systemapi Hide this for inner system use. 537 * @since 9 538 */ 539 readonly parent: number; 540 541 /** 542 * Mode supported by the screen 543 * 544 * @type { Array<ScreenModeInfo> } 545 * @syscap SystemCapability.WindowManager.WindowManager.Core 546 * @systemapi Hide this for inner system use. 547 * @since 9 548 */ 549 readonly supportedModeInfo: Array<ScreenModeInfo>; 550 551 /** 552 * Currently active mode 553 * 554 * @type { number } 555 * @syscap SystemCapability.WindowManager.WindowManager.Core 556 * @systemapi Hide this for inner system use. 557 * @since 9 558 */ 559 readonly activeModeIndex: number; 560 561 /** 562 * Orientation of the screen 563 * 564 * @type { Orientation } 565 * @syscap SystemCapability.WindowManager.WindowManager.Core 566 * @systemapi Hide this for inner system use. 567 * @since 9 568 */ 569 readonly orientation: Orientation; 570 571 /** 572 * Source mode of the screen 573 * 574 * @type { ScreenSourceMode } 575 * @syscap SystemCapability.WindowManager.WindowManager.Core 576 * @systemapi Hide this for inner system use. 577 * @since 10 578 */ 579 readonly sourceMode: ScreenSourceMode; 580 581 /** 582 * Set the orientation of the screen 583 * 584 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 585 * @param { AsyncCallback<void> } callback Callback used to return the result. 586 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 587 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 588 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 589 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 590 * @syscap SystemCapability.WindowManager.WindowManager.Core 591 * @systemapi Hide this for inner system use. 592 * @since 9 593 */ 594 setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void; 595 596 /** 597 * Set the orientation of the screen 598 * 599 * @param { Orientation } orientation Screen orientation. orientation value must from enum Orientation. 600 * @returns { Promise<void> } Promise that returns no value. 601 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 603 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 604 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 605 * @syscap SystemCapability.WindowManager.WindowManager.Core 606 * @systemapi Hide this for inner system use. 607 * @since 9 608 */ 609 setOrientation(orientation: Orientation): Promise<void>; 610 611 /** 612 * Active the mode 613 * 614 * @param { number } modeIndex Index of the mode to set. 615 * @param { AsyncCallback<void> } callback Callback used to return the result. 616 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 617 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 618 * <br>2. Incorrect parameter types. 619 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 620 * @syscap SystemCapability.WindowManager.WindowManager.Core 621 * @systemapi Hide this for inner system use. 622 * @since 9 623 */ 624 setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): void; 625 626 /** 627 * Active the mode 628 * 629 * @param { number } modeIndex Index of the mode to set. 630 * @returns { Promise<void> } Promise that returns no value. 631 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 632 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 633 * <br>2. Incorrect parameter types. 634 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 635 * @syscap SystemCapability.WindowManager.WindowManager.Core 636 * @systemapi Hide this for inner system use. 637 * @since 9 638 */ 639 setScreenActiveMode(modeIndex: number): Promise<void>; 640 641 /** 642 * Set display density of the screen 643 * 644 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 645 * @param { AsyncCallback<void> } callback Callback used to return the result. 646 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 647 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 648 * <br>2. Incorrect parameter types. 649 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 650 * @syscap SystemCapability.WindowManager.WindowManager.Core 651 * @systemapi Hide this for inner system use. 652 * @since 9 653 */ 654 setDensityDpi(densityDpi: number, callback: AsyncCallback<void>): void; 655 656 /** 657 * Set display density of the screen 658 * 659 * @param { number } densityDpi Pixel density. The value ranges from 80 to 640. 660 * @returns { Promise<void> } Promise that returns no value. 661 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 662 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 663 * <br>2. Incorrect parameter types. 664 * @throws { BusinessError } 1400003 - This display manager service works abnormally. 665 * @syscap SystemCapability.WindowManager.WindowManager.Core 666 * @systemapi Hide this for inner system use. 667 * @since 9 668 */ 669 setDensityDpi(densityDpi: number): Promise<void>; 670 } 671 672 /** 673 * Screen orientation 674 * 675 * @enum { number } 676 * @syscap SystemCapability.WindowManager.WindowManager.Core 677 * @systemapi Hide this for inner system use. 678 * @since 9 679 */ 680 enum Orientation { 681 /** 682 * Indicates that the orientation of the screen is unspecified. 683 * 684 * @syscap SystemCapability.WindowManager.WindowManager.Core 685 * @systemapi Hide this for inner system use. 686 * @since 9 687 */ 688 UNSPECIFIED = 0, 689 690 /** 691 * Indicates that the orientation of the screen is vertical. 692 * 693 * @syscap SystemCapability.WindowManager.WindowManager.Core 694 * @systemapi Hide this for inner system use. 695 * @since 9 696 */ 697 VERTICAL = 1, 698 699 /** 700 * Indicates that the orientation of the screen is horizontal. 701 * 702 * @syscap SystemCapability.WindowManager.WindowManager.Core 703 * @systemapi Hide this for inner system use. 704 * @since 9 705 */ 706 HORIZONTAL = 2, 707 708 /** 709 * Indicates that the orientation of the screen is reverse_vertical. 710 * 711 * @syscap SystemCapability.WindowManager.WindowManager.Core 712 * @systemapi Hide this for inner system use. 713 * @since 9 714 */ 715 REVERSE_VERTICAL = 3, 716 717 /** 718 * Indicates that the orientation of the screen is reverse_horizontal. 719 * 720 * @syscap SystemCapability.WindowManager.WindowManager.Core 721 * @systemapi Hide this for inner system use. 722 * @since 9 723 */ 724 REVERSE_HORIZONTAL = 4 725 } 726 727 /** 728 * The information of the screen 729 * 730 * @interface ScreenModeInfo 731 * @syscap SystemCapability.WindowManager.WindowManager.Core 732 * @systemapi Hide this for inner system use. 733 * @since 9 734 */ 735 interface ScreenModeInfo { 736 /** 737 * Screen id 738 * 739 * @type { number } 740 * @syscap SystemCapability.WindowManager.WindowManager.Core 741 * @systemapi Hide this for inner system use. 742 * @since 9 743 */ 744 id: number; 745 746 /** 747 * Indicates the width of the screen 748 * 749 * @type { number } 750 * @syscap SystemCapability.WindowManager.WindowManager.Core 751 * @systemapi Hide this for inner system use. 752 * @since 9 753 */ 754 width: number; 755 756 /** 757 * Indicates the height of the screen 758 * 759 * @type { number } 760 * @syscap SystemCapability.WindowManager.WindowManager.Core 761 * @systemapi Hide this for inner system use. 762 * @since 9 763 */ 764 height: number; 765 766 /** 767 * Indicates the refreshRate of the screen 768 * 769 * @type { number } 770 * @syscap SystemCapability.WindowManager.WindowManager.Core 771 * @systemapi Hide this for inner system use. 772 * @since 9 773 */ 774 refreshRate: number; 775 } 776} 777 778export default screen; 779