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