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 AbilityKit 19 */ 20 21import { AsyncCallback } from '../@ohos.base'; 22import Context from './Context'; 23import AbilityLifecycleCallback from '../@ohos.app.ability.AbilityLifecycleCallback'; 24import EnvironmentCallback from '../@ohos.app.ability.EnvironmentCallback'; 25import type ApplicationStateChangeCallback from '../@ohos.app.ability.ApplicationStateChangeCallback'; 26import { ProcessInformation } from './ProcessInformation'; 27import type ConfigurationConstant from '../@ohos.app.ability.ConfigurationConstant'; 28import Want from '../@ohos.app.ability.Want'; 29 30/** 31 * The context of an application. It allows access to application-specific resources. 32 * 33 * @extends Context 34 * @syscap SystemCapability.Ability.AbilityRuntime.Core 35 * @stagemodelonly 36 * @since 9 37 */ 38/** 39 * The context of an application. It allows access to application-specific resources. 40 * 41 * @extends Context 42 * @syscap SystemCapability.Ability.AbilityRuntime.Core 43 * @stagemodelonly 44 * @crossplatform 45 * @since 10 46 */ 47/** 48 * The context of an application. It allows access to application-specific resources. 49 * 50 * @extends Context 51 * @syscap SystemCapability.Ability.AbilityRuntime.Core 52 * @stagemodelonly 53 * @crossplatform 54 * @atomicservice 55 * @since 11 56 */ 57export default class ApplicationContext extends Context { 58 /** 59 * Register ability lifecycle callback. 60 * 61 * @param { 'abilityLifecycle' } type - abilityLifecycle. 62 * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. 63 * @returns { number } Returns the number code of the callback. 64 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 65 * @syscap SystemCapability.Ability.AbilityRuntime.Core 66 * @stagemodelonly 67 * @since 9 68 */ 69 /** 70 * Register ability lifecycle callback. 71 * 72 * @param { 'abilityLifecycle' } type - abilityLifecycle. 73 * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. 74 * @returns { number } Returns the number code of the callback. 75 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 76 * @syscap SystemCapability.Ability.AbilityRuntime.Core 77 * @stagemodelonly 78 * @crossplatform 79 * @since 10 80 */ 81 /** 82 * Register ability lifecycle callback. 83 * 84 * @param { 'abilityLifecycle' } type - abilityLifecycle. 85 * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. 86 * @returns { number } Returns the number code of the callback. 87 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 88 * @syscap SystemCapability.Ability.AbilityRuntime.Core 89 * @stagemodelonly 90 * @crossplatform 91 * @atomicservice 92 * @since 11 93 */ 94 on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): number; 95 96 /** 97 * Unregister ability lifecycle callback. 98 * 99 * @param { 'abilityLifecycle' } type - abilityLifecycle. 100 * @param { number } callbackId - Indicates the number code of the callback. 101 * @param { AsyncCallback<void> } callback - The callback of off. 102 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 103 * @syscap SystemCapability.Ability.AbilityRuntime.Core 104 * @stagemodelonly 105 * @since 9 106 */ 107 /** 108 * Unregister ability lifecycle callback. 109 * 110 * @param { 'abilityLifecycle' } type - abilityLifecycle. 111 * @param { number } callbackId - Indicates the number code of the callback. 112 * @param { AsyncCallback<void> } callback - The callback of off. 113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 114 * @syscap SystemCapability.Ability.AbilityRuntime.Core 115 * @stagemodelonly 116 * @crossplatform 117 * @since 10 118 */ 119 /** 120 * Unregister ability lifecycle callback. 121 * 122 * @param { 'abilityLifecycle' } type - abilityLifecycle. 123 * @param { number } callbackId - Indicates the number code of the callback. 124 * @param { AsyncCallback<void> } callback - The callback of off. 125 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 126 * @syscap SystemCapability.Ability.AbilityRuntime.Core 127 * @stagemodelonly 128 * @crossplatform 129 * @atomicservice 130 * @since 11 131 */ 132 off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback<void>): void; 133 134 /** 135 * Unregister ability lifecycle callback. 136 * 137 * @param { 'abilityLifecycle' } type - abilityLifecycle. 138 * @param { number } callbackId - Indicates the number code of the callback. 139 * @returns { Promise<void> } The promise returned by the function. 140 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 141 * @syscap SystemCapability.Ability.AbilityRuntime.Core 142 * @stagemodelonly 143 * @since 9 144 */ 145 /** 146 * Unregister ability lifecycle callback. 147 * 148 * @param { 'abilityLifecycle' } type - abilityLifecycle. 149 * @param { number } callbackId - Indicates the number code of the callback. 150 * @returns { Promise<void> } The promise returned by the function. 151 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 152 * @syscap SystemCapability.Ability.AbilityRuntime.Core 153 * @stagemodelonly 154 * @atomicservice 155 * @since 11 156 */ 157 /** 158 * Unregister ability lifecycle callback. 159 * 160 * @param { 'abilityLifecycle' } type - abilityLifecycle. 161 * @param { number } callbackId - Indicates the number code of the callback. 162 * @returns { Promise<void> } The promise returned by the function. 163 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 164 * @syscap SystemCapability.Ability.AbilityRuntime.Core 165 * @stagemodelonly 166 * @crossplatform 167 * @atomicservice 168 * @since 12 169 */ 170 off(type: 'abilityLifecycle', callbackId: number): Promise<void>; 171 172 /** 173 * Register environment callback. 174 * 175 * @param { 'environment' } type - environment. 176 * @param { EnvironmentCallback } callback - The environment callback. 177 * @returns { number } Returns the number code of the callback. 178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 179 * @syscap SystemCapability.Ability.AbilityRuntime.Core 180 * @stagemodelonly 181 * @since 9 182 */ 183 /** 184 * Register environment callback. 185 * 186 * @param { 'environment' } type - environment. 187 * @param { EnvironmentCallback } callback - The environment callback. 188 * @returns { number } Returns the number code of the callback. 189 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 190 * @syscap SystemCapability.Ability.AbilityRuntime.Core 191 * @stagemodelonly 192 * @atomicservice 193 * @since 11 194 */ 195 on(type: 'environment', callback: EnvironmentCallback): number; 196 197 /** 198 * Unregister environment callback. 199 * 200 * @param { 'environment' } type - environment. 201 * @param { number } callbackId - Indicates the number code of the callback. 202 * @param { AsyncCallback<void> } callback - The callback of unregisterEnvironmentCallback. 203 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 204 * @syscap SystemCapability.Ability.AbilityRuntime.Core 205 * @stagemodelonly 206 * @since 9 207 */ 208 /** 209 * Unregister environment callback. 210 * 211 * @param { 'environment' } type - environment. 212 * @param { number } callbackId - Indicates the number code of the callback. 213 * @param { AsyncCallback<void> } callback - The callback of unregisterEnvironmentCallback. 214 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 215 * @syscap SystemCapability.Ability.AbilityRuntime.Core 216 * @stagemodelonly 217 * @atomicservice 218 * @since 11 219 */ 220 off(type: 'environment', callbackId: number, callback: AsyncCallback<void>): void; 221 222 /** 223 * Unregister environment callback. 224 * 225 * @param { 'environment' } type - environment. 226 * @param { number } callbackId - Indicates the number code of the callback. 227 * @returns { Promise<void> } The promise returned by the function. 228 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 229 * @syscap SystemCapability.Ability.AbilityRuntime.Core 230 * @stagemodelonly 231 * @since 9 232 */ 233 /** 234 * Unregister environment callback. 235 * 236 * @param { 'environment' } type - environment. 237 * @param { number } callbackId - Indicates the number code of the callback. 238 * @returns { Promise<void> } The promise returned by the function. 239 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 240 * @syscap SystemCapability.Ability.AbilityRuntime.Core 241 * @stagemodelonly 242 * @atomicservice 243 * @since 11 244 */ 245 off(type: 'environment', callbackId: number): Promise<void>; 246 247 /** 248 * Register applicationStateChange callback. 249 * 250 * @param { 'applicationStateChange' } type - applicationStateChange. 251 * @param { ApplicationStateChangeCallback } callback - The applicationStateChange callback. 252 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 253 * @syscap SystemCapability.Ability.AbilityRuntime.Core 254 * @stagemodelonly 255 * @since 10 256 */ 257 /** 258 * Register applicationStateChange callback. 259 * 260 * @param { 'applicationStateChange' } type - applicationStateChange. 261 * @param { ApplicationStateChangeCallback } callback - The applicationStateChange callback. 262 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 263 * @syscap SystemCapability.Ability.AbilityRuntime.Core 264 * @stagemodelonly 265 * @atomicservice 266 * @since 11 267 */ 268 on(type: 'applicationStateChange', callback: ApplicationStateChangeCallback): void; 269 270 /** 271 * Unregister applicationStateChange callback. 272 * 273 * @param { 'applicationStateChange' } type - applicationStateChange. 274 * @param { ApplicationStateChangeCallback } [callback] - The applicationStateChange callback. 275 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 276 * @syscap SystemCapability.Ability.AbilityRuntime.Core 277 * @stagemodelonly 278 * @since 10 279 */ 280 /** 281 * Unregister applicationStateChange callback. 282 * 283 * @param { 'applicationStateChange' } type - applicationStateChange. 284 * @param { ApplicationStateChangeCallback } [callback] - The applicationStateChange callback. 285 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 286 * @syscap SystemCapability.Ability.AbilityRuntime.Core 287 * @stagemodelonly 288 * @atomicservice 289 * @since 11 290 */ 291 off(type: 'applicationStateChange', callback?: ApplicationStateChangeCallback): void; 292 293 /** 294 * Get information about running processes 295 * 296 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 297 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 298 * @throws { BusinessError } 16000011 - The context does not exist. 299 * @throws { BusinessError } 16000050 - Internal error. 300 * @syscap SystemCapability.Ability.AbilityRuntime.Core 301 * @stagemodelonly 302 * @since 9 303 */ 304 /** 305 * Get information about running processes 306 * 307 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 308 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 309 * @throws { BusinessError } 16000011 - The context does not exist. 310 * @throws { BusinessError } 16000050 - Internal error. 311 * @syscap SystemCapability.Ability.AbilityRuntime.Core 312 * @stagemodelonly 313 * @crossplatform 314 * @since 10 315 */ 316 /** 317 * Get information about running processes 318 * 319 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 320 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 321 * @throws { BusinessError } 16000011 - The context does not exist. 322 * @throws { BusinessError } 16000050 - Internal error. 323 * @syscap SystemCapability.Ability.AbilityRuntime.Core 324 * @stagemodelonly 325 * @crossplatform 326 * @atomicservice 327 * @since 11 328 */ 329 getRunningProcessInformation(): Promise<Array<ProcessInformation>>; 330 331 /** 332 * Get information about running processes 333 * 334 * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}. 335 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 336 * @throws { BusinessError } 16000011 - The context does not exist. 337 * @throws { BusinessError } 16000050 - Internal error. 338 * @syscap SystemCapability.Ability.AbilityRuntime.Core 339 * @stagemodelonly 340 * @since 9 341 */ 342 /** 343 * Get information about running processes 344 * 345 * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}. 346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 347 * @throws { BusinessError } 16000011 - The context does not exist. 348 * @throws { BusinessError } 16000050 - Internal error. 349 * @syscap SystemCapability.Ability.AbilityRuntime.Core 350 * @stagemodelonly 351 * @crossplatform 352 * @since 10 353 */ 354 /** 355 * Get information about running processes 356 * 357 * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}. 358 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 359 * @throws { BusinessError } 16000011 - The context does not exist. 360 * @throws { BusinessError } 16000050 - Internal error. 361 * @syscap SystemCapability.Ability.AbilityRuntime.Core 362 * @stagemodelonly 363 * @crossplatform 364 * @atomicservice 365 * @since 11 366 */ 367 getRunningProcessInformation(callback: AsyncCallback<Array<ProcessInformation>>): void; 368 369 /** 370 * Kill all processes of the application 371 * 372 * @returns { Promise<void> } The promise returned by the function. 373 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 374 * @throws { BusinessError } 16000011 - The context does not exist. 375 * @syscap SystemCapability.Ability.AbilityRuntime.Core 376 * @stagemodelonly 377 * @since 9 378 */ 379 /** 380 * Kill all processes of the application 381 * 382 * @returns { Promise<void> } The promise returned by the function. 383 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 384 * @throws { BusinessError } 16000011 - The context does not exist. 385 * @syscap SystemCapability.Ability.AbilityRuntime.Core 386 * @stagemodelonly 387 * @atomicservice 388 * @since 11 389 */ 390 killAllProcesses(): Promise<void>; 391 392 /** 393 * Kill all processes of the application 394 * 395 * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared. 396 * @returns { Promise<void> } The promise returned by the function. 397 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 398 * @throws { BusinessError } 16000011 - The context does not exist. 399 * @syscap SystemCapability.Ability.AbilityRuntime.Core 400 * @stagemodelonly 401 * @atomicservice 402 * @since 14 403 */ 404 killAllProcesses(clearPageStack: boolean): Promise<void>; 405 406 /** 407 * Kill all processes of the application 408 * 409 * @param { AsyncCallback<void> } callback - The callback of killAllProcesses. 410 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 411 * @throws { BusinessError } 16000011 - The context does not exist. 412 * @syscap SystemCapability.Ability.AbilityRuntime.Core 413 * @stagemodelonly 414 * @since 9 415 */ 416 /** 417 * Kill all processes of the application 418 * 419 * @param { AsyncCallback<void> } callback - The callback of killAllProcesses. 420 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 421 * @throws { BusinessError } 16000011 - The context does not exist. 422 * @syscap SystemCapability.Ability.AbilityRuntime.Core 423 * @stagemodelonly 424 * @atomicservice 425 * @since 11 426 */ 427 killAllProcesses(callback: AsyncCallback<void>); 428 429 /** 430 * Set colorMode of the application 431 * 432 * @param { ConfigurationConstant.ColorMode } colorMode - Color mode. 433 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 434 * @throws { BusinessError } 16000011 - The context does not exist. 435 * @syscap SystemCapability.Ability.AbilityRuntime.Core 436 * @stagemodelonly 437 * @atomicservice 438 * @since 11 439 */ 440 setColorMode(colorMode: ConfigurationConstant.ColorMode): void; 441 442 /** 443 * Set language of the application 444 * 445 * @param { string } language - Language. 446 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 447 * @throws { BusinessError } 16000011 - The context does not exist. 448 * @syscap SystemCapability.Ability.AbilityRuntime.Core 449 * @stagemodelonly 450 * @atomicservice 451 * @since 11 452 */ 453 setLanguage(language: string): void; 454 455 /** 456 * Clear up application data by app self 457 * 458 * @returns { Promise<void> } The promise returned by the function. 459 * @throws { BusinessError } 16000011 - The context does not exist. 460 * @throws { BusinessError } 16000050 - Internal error. 461 * @syscap SystemCapability.Ability.AbilityRuntime.Core 462 * @stagemodelonly 463 * @since 11 464 */ 465 clearUpApplicationData(): Promise<void>; 466 467 /** 468 * Clear up application data by app self 469 * 470 * @param { AsyncCallback<void> } callback - The callback of clearUpApplicationData. 471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 472 * @throws { BusinessError } 16000011 - The context does not exist. 473 * @throws { BusinessError } 16000050 - Internal error. 474 * @syscap SystemCapability.Ability.AbilityRuntime.Core 475 * @stagemodelonly 476 * @since 11 477 */ 478 clearUpApplicationData(callback: AsyncCallback<void>): void; 479 480 /** 481 * Kill the application and does not call back the onDestroy method, then start UIAbility. 482 * 483 * @param { Want } want - Indicates the want name of the current app, and the ability name is UIAbility. 484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 485 * @throws { BusinessError } 16000050 - Internal error. 486 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 487 * @throws { BusinessError } 16000063 - The target to restart does not belong to the current application or is not a UIAbility. 488 * @throws { BusinessError } 16000064 - Restart too frequently. Try again at least 3s later. 489 * @syscap SystemCapability.Ability.AbilityRuntime.Core 490 * @stagemodelonly 491 * @atomicservice 492 * @since 12 493 */ 494 restartApp(want: Want): void; 495 496 /** 497 * Preload UIExtensionAbility. 498 * 499 * @permission ohos.permission.PRELOAD_UI_EXTENSION_ABILITY 500 * @param { Want } want - Indicates the want of target UIExtensionAbility. 501 * @returns { Promise<void> } The promise returned by the function. 502 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 503 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 504 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 505 * @throws { BusinessError } 16000001 - The specified ability does not exist. 506 * @throws { BusinessError } 16000002 - Incorrect ability type. 507 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 508 * @throws { BusinessError } 16000011 - The context does not exist. 509 * @throws { BusinessError } 16000050 - Internal error. 510 * @syscap SystemCapability.Ability.AbilityRuntime.Core 511 * @systemapi 512 * @stagemodelonly 513 * @since 12 514 */ 515 preloadUIExtensionAbility(want: Want): Promise<void>; 516 517 /** 518 * Set the state about whether the application supports process cache or not. 519 * 520 * @param { boolean } isSupported - Indicates the process cache support state. 521 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 522 * @throws { BusinessError } 801 - Capability not supported. 523 * @throws { BusinessError } 16000011 - The context does not exist. 524 * @throws { BusinessError } 16000050 - Internal error. 525 * @syscap SystemCapability.Ability.AbilityRuntime.Core 526 * @stagemodelonly 527 * @since 12 528 */ 529 setSupportedProcessCache(isSupported : boolean): void; 530 531 /** 532 * Set font of the application 533 * 534 * @param { string } font - Font. 535 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 536 * @throws { BusinessError } 16000011 - The context does not exist. 537 * @throws { BusinessError } 16000050 - Internal error. 538 * @syscap SystemCapability.Ability.AbilityRuntime.Core 539 * @stagemodelonly 540 * @since 12 541 */ 542 setFont(font: string): void; 543 544 /** 545 * Get current app clone index. 546 * 547 * @returns { number } Returns the app clone index for current app. 548 * @throws { BusinessError } 16000011 - The context does not exist. 549 * @throws { BusinessError } 16000071 - The MultiAppMode is not {@link APP_CLONE}. 550 * @syscap SystemCapability.Ability.AbilityRuntime.Core 551 * @stagemodelonly 552 * @atomicservice 553 * @since 12 554 */ 555 getCurrentAppCloneIndex(): number; 556 557 /** 558 * Set font size scale. 559 * @param {number} fontSizeScale - Font size scale. 560 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 561 * @syscap SystemCapability.Ability.AbilityRuntime.Core 562 * @stagemodelonly 563 * @atomicservice 564 * @since 13 565 */ 566 setFontSizeScale(fontSizeScale: number): void; 567 568 /** 569 * Get current app key of current running app instance. 570 * 571 * @returns { string } Returns the key of current running app instance. 572 * @throws { BusinessError } 16000011 - The context does not exist. 573 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 574 * @syscap SystemCapability.Ability.AbilityRuntime.Core 575 * @stagemodelonly 576 * @since 14 577 */ 578 getCurrentInstanceKey(): string; 579 580 /** 581 * Get all running app instance key for current bundle 582 * 583 * @returns { Promise<Array<string>> } Returns the array of all running app instance keys. 584 * @throws { BusinessError } 16000011 - The context does not exist. 585 * @throws { BusinessError } 16000050 - Internal error. 586 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 587 * @syscap SystemCapability.Ability.AbilityRuntime.Core 588 * @stagemodelonly 589 * @since 14 590 */ 591 getAllRunningInstanceKeys(): Promise<Array<string>>; 592} 593