1/* 2 * Copyright (c) 2021-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 16import { AsyncCallback } from '../@ohos.base'; 17import UIAbility from '../@ohos.app.ability.UIAbility'; 18import AbilityStage from '../@ohos.app.ability.AbilityStage'; 19import { AbilityMonitor } from './AbilityMonitor'; 20import { AbilityStageMonitor } from './AbilityStageMonitor'; 21import Context from './Context'; 22import Want from '../@ohos.app.ability.Want'; 23import { ShellCmdResult } from './shellCmdResult'; 24 25/** 26 * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. 27 * 28 * @interface AbilityDelegator 29 * @syscap SystemCapability.Ability.AbilityRuntime.Core 30 * @since 9 31 */ 32/** 33 * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. 34 * 35 * @interface AbilityDelegator 36 * @syscap SystemCapability.Ability.AbilityRuntime.Core 37 * @crossplatform 38 * @since 10 39 */ 40/** 41 * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. 42 * 43 * @interface AbilityDelegator 44 * @syscap SystemCapability.Ability.AbilityRuntime.Core 45 * @crossplatform 46 * @atomicservice 47 * @since 11 48 */ 49export interface AbilityDelegator { 50 /** 51 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 52 * 53 * @param { AbilityMonitor } monitor - AbilityMonitor object 54 * @param { AsyncCallback<void> } callback - The callback of addAbilityMonitor. 55 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 56 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 57 * @syscap SystemCapability.Ability.AbilityRuntime.Core 58 * @since 9 59 */ 60 /** 61 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 62 * 63 * @param { AbilityMonitor } monitor - AbilityMonitor object 64 * @param { AsyncCallback<void> } callback - The callback of addAbilityMonitor. 65 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 66 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 67 * @syscap SystemCapability.Ability.AbilityRuntime.Core 68 * @crossplatform 69 * @since 10 70 */ 71 /** 72 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 73 * 74 * @param { AbilityMonitor } monitor - AbilityMonitor object 75 * @param { AsyncCallback<void> } callback - The callback of addAbilityMonitor. 76 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 77 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 78 * @syscap SystemCapability.Ability.AbilityRuntime.Core 79 * @crossplatform 80 * @atomicservice 81 * @since 11 82 */ 83 addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void; 84 85 /** 86 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 87 * 88 * @param { AbilityMonitor } monitor - AbilityMonitor object 89 * @returns { Promise<void> } The promise returned by the function. 90 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 91 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 92 * @syscap SystemCapability.Ability.AbilityRuntime.Core 93 * @since 9 94 */ 95 /** 96 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 97 * 98 * @param { AbilityMonitor } monitor - AbilityMonitor object 99 * @returns { Promise<void> } The promise returned by the function. 100 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 101 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 102 * @syscap SystemCapability.Ability.AbilityRuntime.Core 103 * @crossplatform 104 * @since 10 105 */ 106 /** 107 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 108 * 109 * @param { AbilityMonitor } monitor - AbilityMonitor object 110 * @returns { Promise<void> } The promise returned by the function. 111 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 112 * @throws { BusinessError } 16000100 - AddAbilityMonitor failed. 113 * @syscap SystemCapability.Ability.AbilityRuntime.Core 114 * @crossplatform 115 * @atomicservice 116 * @since 11 117 */ 118 addAbilityMonitor(monitor: AbilityMonitor): Promise<void>; 119 120 /** 121 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 122 * 123 * @param { AbilityMonitor } monitor - AbilityMonitor object. 124 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 125 * @throws { BusinessError } 16000100 - AddAbilityMonitorSync failed. 126 * @syscap SystemCapability.Ability.AbilityRuntime.Core 127 * @crossplatform 128 * @since 10 129 */ 130 /** 131 * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. 132 * 133 * @param { AbilityMonitor } monitor - AbilityMonitor object. 134 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 135 * @throws { BusinessError } 16000100 - AddAbilityMonitorSync failed. 136 * @syscap SystemCapability.Ability.AbilityRuntime.Core 137 * @crossplatform 138 * @atomicservice 139 * @since 11 140 */ 141 addAbilityMonitorSync(monitor: AbilityMonitor): void; 142 143 /** 144 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 145 * 146 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 147 * @param { AsyncCallback<void> } callback - The callback of addAbilityStageMonitor. 148 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 149 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 150 * @syscap SystemCapability.Ability.AbilityRuntime.Core 151 * @since 9 152 */ 153 /** 154 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 155 * 156 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 157 * @param { AsyncCallback<void> } callback - The callback of addAbilityStageMonitor. 158 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 159 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 160 * @syscap SystemCapability.Ability.AbilityRuntime.Core 161 * @crossplatform 162 * @since 10 163 */ 164 /** 165 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 166 * 167 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 168 * @param { AsyncCallback<void> } callback - The callback of addAbilityStageMonitor. 169 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 170 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 171 * @syscap SystemCapability.Ability.AbilityRuntime.Core 172 * @crossplatform 173 * @atomicservice 174 * @since 11 175 */ 176 addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback<void>): void; 177 178 /** 179 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 180 * 181 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 182 * @returns { Promise<void> } The promise returned by the function. 183 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 184 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 185 * @syscap SystemCapability.Ability.AbilityRuntime.Core 186 * @since 9 187 */ 188 /** 189 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 190 * 191 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 192 * @returns { Promise<void> } The promise returned by the function. 193 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 194 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 195 * @syscap SystemCapability.Ability.AbilityRuntime.Core 196 * @crossplatform 197 * @since 10 198 */ 199 /** 200 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 201 * 202 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 203 * @returns { Promise<void> } The promise returned by the function. 204 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 205 * @throws { BusinessError } 16000100 - AddAbilityStageMonitor failed. 206 * @syscap SystemCapability.Ability.AbilityRuntime.Core 207 * @crossplatform 208 * @atomicservice 209 * @since 11 210 */ 211 addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise<void>; 212 213 /** 214 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 215 * 216 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 217 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 218 * @throws { BusinessError } 16000100 - AddAbilityStageMonitorSync failed. 219 * @syscap SystemCapability.Ability.AbilityRuntime.Core 220 * @crossplatform 221 * @since 10 222 */ 223 /** 224 * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. 225 * 226 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 227 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 228 * @throws { BusinessError } 16000100 - AddAbilityStageMonitorSync failed. 229 * @syscap SystemCapability.Ability.AbilityRuntime.Core 230 * @crossplatform 231 * @atomicservice 232 * @since 11 233 */ 234 addAbilityStageMonitorSync(monitor: AbilityStageMonitor): void; 235 236 /** 237 * Remove a specified AbilityMonitor object from the application memory. 238 * 239 * @param { AbilityMonitor } monitor - AbilityMonitor object. 240 * @param { AsyncCallback<void> } callback - The callback of removeAbilityMonitor. 241 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 242 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 243 * @syscap SystemCapability.Ability.AbilityRuntime.Core 244 * @since 9 245 */ 246 /** 247 * Remove a specified AbilityMonitor object from the application memory. 248 * 249 * @param { AbilityMonitor } monitor - AbilityMonitor object. 250 * @param { AsyncCallback<void> } callback - The callback of removeAbilityMonitor. 251 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 252 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 253 * @syscap SystemCapability.Ability.AbilityRuntime.Core 254 * @crossplatform 255 * @since 10 256 */ 257 /** 258 * Remove a specified AbilityMonitor object from the application memory. 259 * 260 * @param { AbilityMonitor } monitor - AbilityMonitor object. 261 * @param { AsyncCallback<void> } callback - The callback of removeAbilityMonitor. 262 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 263 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 264 * @syscap SystemCapability.Ability.AbilityRuntime.Core 265 * @crossplatform 266 * @atomicservice 267 * @since 11 268 */ 269 removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<void>): void; 270 271 /** 272 * Remove a specified AbilityMonitor object from the application memory. 273 * 274 * @param { AbilityMonitor } monitor - AbilityMonitor object. 275 * @returns { Promise<void> } The promise returned by the function. 276 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 277 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 278 * @syscap SystemCapability.Ability.AbilityRuntime.Core 279 * @since 9 280 */ 281 /** 282 * Remove a specified AbilityMonitor object from the application memory. 283 * 284 * @param { AbilityMonitor } monitor - AbilityMonitor object. 285 * @returns { Promise<void> } The promise returned by the function. 286 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 287 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 288 * @syscap SystemCapability.Ability.AbilityRuntime.Core 289 * @crossplatform 290 * @since 10 291 */ 292 /** 293 * Remove a specified AbilityMonitor object from the application memory. 294 * 295 * @param { AbilityMonitor } monitor - AbilityMonitor object. 296 * @returns { Promise<void> } The promise returned by the function. 297 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 298 * @throws { BusinessError } 16000100 - RemoveAbilityMonitor failed. 299 * @syscap SystemCapability.Ability.AbilityRuntime.Core 300 * @crossplatform 301 * @atomicservice 302 * @since 11 303 */ 304 removeAbilityMonitor(monitor: AbilityMonitor): Promise<void>; 305 306 /** 307 * Remove a specified AbilityMonitor object from the application memory. 308 * 309 * @param { AbilityMonitor } monitor - AbilityMonitor object. 310 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 311 * @throws { BusinessError } 16000100 - RemoveAbilityMonitorSync failed. 312 * @syscap SystemCapability.Ability.AbilityRuntime.Core 313 * @crossplatform 314 * @since 10 315 */ 316 /** 317 * Remove a specified AbilityMonitor object from the application memory. 318 * 319 * @param { AbilityMonitor } monitor - AbilityMonitor object. 320 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 321 * @throws { BusinessError } 16000100 - RemoveAbilityMonitorSync failed. 322 * @syscap SystemCapability.Ability.AbilityRuntime.Core 323 * @crossplatform 324 * @atomicservice 325 * @since 11 326 */ 327 removeAbilityMonitorSync(monitor: AbilityMonitor): void; 328 329 /** 330 * Remove a specified AbilityStageMonitor object from the application memory. 331 * 332 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 333 * @param { AsyncCallback<void> } callback - The callback of removeAbilityStageMonitor. 334 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 335 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 336 * @syscap SystemCapability.Ability.AbilityRuntime.Core 337 * @since 9 338 */ 339 /** 340 * Remove a specified AbilityStageMonitor object from the application memory. 341 * 342 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 343 * @param { AsyncCallback<void> } callback - The callback of removeAbilityStageMonitor. 344 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 345 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 346 * @syscap SystemCapability.Ability.AbilityRuntime.Core 347 * @crossplatform 348 * @since 10 349 */ 350 /** 351 * Remove a specified AbilityStageMonitor object from the application memory. 352 * 353 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 354 * @param { AsyncCallback<void> } callback - The callback of removeAbilityStageMonitor. 355 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 356 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 357 * @syscap SystemCapability.Ability.AbilityRuntime.Core 358 * @crossplatform 359 * @atomicservice 360 * @since 11 361 */ 362 removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback<void>): void; 363 364 /** 365 * Remove a specified AbilityStageMonitor object from the application memory. 366 * 367 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 368 * @returns { Promise<void> } The promise returned by the function. 369 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 370 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 371 * @syscap SystemCapability.Ability.AbilityRuntime.Core 372 * @since 9 373 */ 374 /** 375 * Remove a specified AbilityStageMonitor object from the application memory. 376 * 377 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 378 * @returns { Promise<void> } The promise returned by the function. 379 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 380 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 381 * @syscap SystemCapability.Ability.AbilityRuntime.Core 382 * @crossplatform 383 * @since 10 384 */ 385 /** 386 * Remove a specified AbilityStageMonitor object from the application memory. 387 * 388 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 389 * @returns { Promise<void> } The promise returned by the function. 390 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 391 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitor failed. 392 * @syscap SystemCapability.Ability.AbilityRuntime.Core 393 * @crossplatform 394 * @atomicservice 395 * @since 11 396 */ 397 removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise<void>; 398 399 /** 400 * Remove a specified AbilityStageMonitor object from the application memory. 401 * 402 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 403 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 404 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitorSync failed. 405 * @syscap SystemCapability.Ability.AbilityRuntime.Core 406 * @crossplatform 407 * @since 10 408 */ 409 /** 410 * Remove a specified AbilityStageMonitor object from the application memory. 411 * 412 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 413 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 414 * @throws { BusinessError } 16000100 - RemoveAbilityStageMonitorSync failed. 415 * @syscap SystemCapability.Ability.AbilityRuntime.Core 416 * @crossplatform 417 * @atomicservice 418 * @since 11 419 */ 420 removeAbilityStageMonitorSync(monitor: AbilityStageMonitor): void; 421 422 /** 423 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 424 * 425 * @param { AbilityMonitor } monitor - AbilityMonitor object. 426 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 427 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 428 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 429 * @syscap SystemCapability.Ability.AbilityRuntime.Core 430 * @since 9 431 */ 432 /** 433 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 434 * 435 * @param { AbilityMonitor } monitor - AbilityMonitor object. 436 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 437 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 438 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 439 * @syscap SystemCapability.Ability.AbilityRuntime.Core 440 * @crossplatform 441 * @since 10 442 */ 443 /** 444 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 445 * 446 * @param { AbilityMonitor } monitor - AbilityMonitor object. 447 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 448 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 449 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 450 * @syscap SystemCapability.Ability.AbilityRuntime.Core 451 * @crossplatform 452 * @atomicservice 453 * @since 11 454 */ 455 waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback<UIAbility>): void; 456 457 /** 458 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 459 * 460 * @param { AbilityMonitor } monitor - AbilityMonitor object. 461 * @param { number } timeout - Maximum wait time, in milliseconds. 462 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 463 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 464 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 465 * @syscap SystemCapability.Ability.AbilityRuntime.Core 466 * @since 9 467 */ 468 /** 469 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 470 * 471 * @param { AbilityMonitor } monitor - AbilityMonitor object. 472 * @param { number } timeout - Maximum wait time, in milliseconds. 473 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 474 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 475 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 476 * @syscap SystemCapability.Ability.AbilityRuntime.Core 477 * @crossplatform 478 * @since 10 479 */ 480 /** 481 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 482 * 483 * @param { AbilityMonitor } monitor - AbilityMonitor object. 484 * @param { number } timeout - Maximum wait time, in milliseconds. 485 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 486 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 487 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 488 * @syscap SystemCapability.Ability.AbilityRuntime.Core 489 * @crossplatform 490 * @atomicservice 491 * @since 11 492 */ 493 waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback<UIAbility>): void; 494 495 /** 496 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 497 * 498 * @param { AbilityMonitor } monitor - AbilityMonitor object. 499 * @param { number } [timeout] - Maximum wait time, in milliseconds. 500 * @returns { Promise<UIAbility> } Returns the Ability object. 501 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 502 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 503 * @syscap SystemCapability.Ability.AbilityRuntime.Core 504 * @since 9 505 */ 506 /** 507 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 508 * 509 * @param { AbilityMonitor } monitor - AbilityMonitor object. 510 * @param { number } [timeout] - Maximum wait time, in milliseconds. 511 * @returns { Promise<UIAbility> } Returns the Ability object. 512 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 513 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 514 * @syscap SystemCapability.Ability.AbilityRuntime.Core 515 * @crossplatform 516 * @since 10 517 */ 518 /** 519 * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. 520 * 521 * @param { AbilityMonitor } monitor - AbilityMonitor object. 522 * @param { number } [timeout] - Maximum wait time, in milliseconds. 523 * @returns { Promise<UIAbility> } Returns the Ability object. 524 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 525 * @throws { BusinessError } 16000100 - WaitAbilityMonitor failed. 526 * @syscap SystemCapability.Ability.AbilityRuntime.Core 527 * @crossplatform 528 * @atomicservice 529 * @since 11 530 */ 531 waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise<UIAbility>; 532 533 /** 534 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 535 * 536 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 537 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 538 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 539 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 540 * @syscap SystemCapability.Ability.AbilityRuntime.Core 541 * @since 9 542 */ 543 /** 544 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 545 * 546 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 547 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 548 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 549 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 550 * @syscap SystemCapability.Ability.AbilityRuntime.Core 551 * @crossplatform 552 * @since 10 553 */ 554 /** 555 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 556 * 557 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 558 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 559 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 560 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 561 * @syscap SystemCapability.Ability.AbilityRuntime.Core 562 * @crossplatform 563 * @atomicservice 564 * @since 11 565 */ 566 waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback<AbilityStage>): void; 567 568 /** 569 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 570 * 571 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 572 * @param { number } timeout - Maximum wait time, in milliseconds. 573 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 574 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 575 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 576 * @syscap SystemCapability.Ability.AbilityRuntime.Core 577 * @since 9 578 */ 579 /** 580 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 581 * 582 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 583 * @param { number } timeout - Maximum wait time, in milliseconds. 584 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 585 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 586 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 587 * @syscap SystemCapability.Ability.AbilityRuntime.Core 588 * @crossplatform 589 * @since 10 590 */ 591 /** 592 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 593 * 594 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 595 * @param { number } timeout - Maximum wait time, in milliseconds. 596 * @param { AsyncCallback<AbilityStage> } callback - The callback is used to return the AbilityStage object. 597 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 598 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 599 * @syscap SystemCapability.Ability.AbilityRuntime.Core 600 * @crossplatform 601 * @atomicservice 602 * @since 11 603 */ 604 waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback<AbilityStage>): void; 605 606 /** 607 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 608 * 609 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 610 * @param { number } [timeout] - Maximum wait time, in milliseconds. 611 * @returns { Promise<AbilityStage> } Returns the AbilityStage object. 612 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 613 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 614 * @syscap SystemCapability.Ability.AbilityRuntime.Core 615 * @since 9 616 */ 617 /** 618 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 619 * 620 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 621 * @param { number } [timeout] - Maximum wait time, in milliseconds. 622 * @returns { Promise<AbilityStage> } Returns the AbilityStage object. 623 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 624 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 625 * @syscap SystemCapability.Ability.AbilityRuntime.Core 626 * @crossplatform 627 * @since 10 628 */ 629 /** 630 * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. 631 * 632 * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. 633 * @param { number } [timeout] - Maximum wait time, in milliseconds. 634 * @returns { Promise<AbilityStage> } Returns the AbilityStage object. 635 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 636 * @throws { BusinessError } 16000100 - WaitAbilityStageMonitor failed. 637 * @syscap SystemCapability.Ability.AbilityRuntime.Core 638 * @crossplatform 639 * @atomicservice 640 * @since 11 641 */ 642 waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise<AbilityStage>; 643 644 /** 645 * Obtain the application context. 646 * 647 * @returns { Context } Returns the app Context. 648 * @syscap SystemCapability.Ability.AbilityRuntime.Core 649 * @since 9 650 */ 651 /** 652 * Obtain the application context. 653 * 654 * @returns { Context } Returns the app Context. 655 * @syscap SystemCapability.Ability.AbilityRuntime.Core 656 * @crossplatform 657 * @since 10 658 */ 659 /** 660 * Obtain the application context. 661 * 662 * @returns { Context } Returns the app Context. 663 * @syscap SystemCapability.Ability.AbilityRuntime.Core 664 * @crossplatform 665 * @atomicservice 666 * @since 11 667 */ 668 getAppContext(): Context; 669 670 /** 671 * Obtain the lifecycle state of a specified ability. 672 * 673 * @param { UIAbility } ability - The Ability object. 674 * @returns { number } Returns the state of the Ability object. 675 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 676 * @syscap SystemCapability.Ability.AbilityRuntime.Core 677 * @since 9 678 */ 679 /** 680 * Obtain the lifecycle state of a specified ability. 681 * 682 * @param { UIAbility } ability - The Ability object. 683 * @returns { number } Returns the state of the Ability object. 684 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 685 * @syscap SystemCapability.Ability.AbilityRuntime.Core 686 * @crossplatform 687 * @since 10 688 */ 689 /** 690 * Obtain the lifecycle state of a specified ability. 691 * 692 * @param { UIAbility } ability - The Ability object. 693 * @returns { number } Returns the state of the Ability object. 694 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 695 * @syscap SystemCapability.Ability.AbilityRuntime.Core 696 * @crossplatform 697 * @atomicservice 698 * @since 11 699 */ 700 getAbilityState(ability: UIAbility): number; 701 702 /** 703 * Obtain the ability that is currently being displayed in this process. 704 * 705 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 706 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 707 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 708 * @syscap SystemCapability.Ability.AbilityRuntime.Core 709 * @since 9 710 */ 711 /** 712 * Obtain the ability that is currently being displayed in this process. 713 * 714 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 715 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 716 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 717 * @syscap SystemCapability.Ability.AbilityRuntime.Core 718 * @crossplatform 719 * @since 10 720 */ 721 /** 722 * Obtain the ability that is currently being displayed in this process. 723 * 724 * @param { AsyncCallback<UIAbility> } callback - The callback is used to return the Ability object. 725 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 726 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 727 * @syscap SystemCapability.Ability.AbilityRuntime.Core 728 * @crossplatform 729 * @atomicservice 730 * @since 11 731 */ 732 getCurrentTopAbility(callback: AsyncCallback<UIAbility>): void; 733 734 /** 735 * Obtain the ability that is currently being displayed in this process. 736 * 737 * @returns { Promise<UIAbility> } Returns the Ability object. 738 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 739 * @syscap SystemCapability.Ability.AbilityRuntime.Core 740 * @since 9 741 */ 742 /** 743 * Obtain the ability that is currently being displayed in this process. 744 * 745 * @returns { Promise<UIAbility> } Returns the Ability object. 746 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 747 * @syscap SystemCapability.Ability.AbilityRuntime.Core 748 * @crossplatform 749 * @since 10 750 */ 751 /** 752 * Obtain the ability that is currently being displayed in this process. 753 * 754 * @returns { Promise<UIAbility> } Returns the Ability object. 755 * @throws { BusinessError } 16000100 - GetCurrentTopAbility failed. 756 * @syscap SystemCapability.Ability.AbilityRuntime.Core 757 * @crossplatform 758 * @atomicservice 759 * @since 11 760 */ 761 getCurrentTopAbility(): Promise<UIAbility>; 762 763 /** 764 * Start a new ability. 765 * 766 * @param { Want } want - Indicates the ability to start 767 * @param { AsyncCallback<void> } callback - The callback of startAbility. 768 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 769 * @throws { BusinessError } 16000001 - The specified ability does not exist. 770 * @throws { BusinessError } 16000002 - Incorrect ability type. 771 * @throws { BusinessError } 16000004 - Can not start invisible component. 772 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 773 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 774 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 775 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 776 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 777 * @throws { BusinessError } 16000011 - The context does not exist. 778 * @throws { BusinessError } 16000050 - Internal error. 779 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 780 * @throws { BusinessError } 16000055 - Installation-free timed out. 781 * @throws { BusinessError } 16200001 - The caller has been released. 782 * @syscap SystemCapability.Ability.AbilityRuntime.Core 783 * @since 9 784 */ 785 /** 786 * Start a new ability. 787 * 788 * @param { Want } want - Indicates the ability to start 789 * @param { AsyncCallback<void> } callback - The callback of startAbility. 790 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 791 * @throws { BusinessError } 16000001 - The specified ability does not exist. 792 * @throws { BusinessError } 16000002 - Incorrect ability type. 793 * @throws { BusinessError } 16000004 - Can not start invisible component. 794 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 795 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 796 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 797 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 798 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 799 * @throws { BusinessError } 16000011 - The context does not exist. 800 * @throws { BusinessError } 16000012 - The application is controlled. 801 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 802 * @throws { BusinessError } 16000050 - Internal error. 803 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 804 * @throws { BusinessError } 16000055 - Installation-free timed out. 805 * @throws { BusinessError } 16200001 - The caller has been released. 806 * @syscap SystemCapability.Ability.AbilityRuntime.Core 807 * @crossplatform 808 * @since 10 809 */ 810 /** 811 * Start a new ability. 812 * 813 * @param { Want } want - Indicates the ability to start 814 * @param { AsyncCallback<void> } callback - The callback of startAbility. 815 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 816 * @throws { BusinessError } 16000001 - The specified ability does not exist. 817 * @throws { BusinessError } 16000002 - Incorrect ability type. 818 * @throws { BusinessError } 16000004 - Can not start invisible component. 819 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 820 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 821 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 822 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 823 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 824 * @throws { BusinessError } 16000011 - The context does not exist. 825 * @throws { BusinessError } 16000012 - The application is controlled. 826 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 827 * @throws { BusinessError } 16000050 - Internal error. 828 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 829 * @throws { BusinessError } 16000055 - Installation-free timed out. 830 * @throws { BusinessError } 16200001 - The caller has been released. 831 * @syscap SystemCapability.Ability.AbilityRuntime.Core 832 * @crossplatform 833 * @atomicservice 834 * @since 11 835 */ 836 startAbility(want: Want, callback: AsyncCallback<void>): void; 837 838 /** 839 * Start a new ability. 840 * 841 * @param { Want } want - Indicates the ability to start 842 * @returns { Promise<void> } The promise returned by the function. 843 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 844 * @throws { BusinessError } 16000001 - The specified ability does not exist. 845 * @throws { BusinessError } 16000002 - Incorrect ability type. 846 * @throws { BusinessError } 16000004 - Can not start invisible component. 847 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 848 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 849 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 850 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 851 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 852 * @throws { BusinessError } 16000011 - The context does not exist. 853 * @throws { BusinessError } 16000050 - Internal error. 854 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 855 * @throws { BusinessError } 16000055 - Installation-free timed out. 856 * @throws { BusinessError } 16200001 - The caller has been released. 857 * @syscap SystemCapability.Ability.AbilityRuntime.Core 858 * @since 9 859 */ 860 /** 861 * Start a new ability. 862 * 863 * @param { Want } want - Indicates the ability to start 864 * @returns { Promise<void> } The promise returned by the function. 865 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 866 * @throws { BusinessError } 16000001 - The specified ability does not exist. 867 * @throws { BusinessError } 16000002 - Incorrect ability type. 868 * @throws { BusinessError } 16000004 - Can not start invisible component. 869 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 870 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 871 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 872 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 873 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 874 * @throws { BusinessError } 16000011 - The context does not exist. 875 * @throws { BusinessError } 16000012 - The application is controlled. 876 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 877 * @throws { BusinessError } 16000050 - Internal error. 878 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 879 * @throws { BusinessError } 16000055 - Installation-free timed out. 880 * @throws { BusinessError } 16200001 - The caller has been released. 881 * @syscap SystemCapability.Ability.AbilityRuntime.Core 882 * @crossplatform 883 * @since 10 884 */ 885 /** 886 * Start a new ability. 887 * 888 * @param { Want } want - Indicates the ability to start 889 * @returns { Promise<void> } The promise returned by the function. 890 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 891 * @throws { BusinessError } 16000001 - The specified ability does not exist. 892 * @throws { BusinessError } 16000002 - Incorrect ability type. 893 * @throws { BusinessError } 16000004 - Can not start invisible component. 894 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 895 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 896 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 897 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 898 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 899 * @throws { BusinessError } 16000011 - The context does not exist. 900 * @throws { BusinessError } 16000012 - The application is controlled. 901 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 902 * @throws { BusinessError } 16000050 - Internal error. 903 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 904 * @throws { BusinessError } 16000055 - Installation-free timed out. 905 * @throws { BusinessError } 16200001 - The caller has been released. 906 * @syscap SystemCapability.Ability.AbilityRuntime.Core 907 * @crossplatform 908 * @atomicservice 909 * @since 11 910 */ 911 startAbility(want: Want): Promise<void>; 912 913 /** 914 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 915 * 916 * @param { UIAbility } ability - The ability object. 917 * @param { AsyncCallback<void> } callback - The callback of doAbilityForeground. 918 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 919 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 920 * @syscap SystemCapability.Ability.AbilityRuntime.Core 921 * @since 9 922 */ 923 /** 924 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 925 * 926 * @param { UIAbility } ability - The ability object. 927 * @param { AsyncCallback<void> } callback - The callback of doAbilityForeground. 928 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 929 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 930 * @syscap SystemCapability.Ability.AbilityRuntime.Core 931 * @crossplatform 932 * @since 10 933 */ 934 /** 935 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 936 * 937 * @param { UIAbility } ability - The ability object. 938 * @param { AsyncCallback<void> } callback - The callback of doAbilityForeground. 939 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 940 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 941 * @syscap SystemCapability.Ability.AbilityRuntime.Core 942 * @crossplatform 943 * @atomicservice 944 * @since 11 945 */ 946 doAbilityForeground(ability: UIAbility, callback: AsyncCallback<void>): void; 947 948 /** 949 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 950 * 951 * @param { UIAbility } ability - The ability object. 952 * @returns { Promise<void> } The promise returned by the function. 953 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 954 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 955 * @syscap SystemCapability.Ability.AbilityRuntime.Core 956 * @since 9 957 */ 958 /** 959 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 960 * 961 * @param { UIAbility } ability - The ability object. 962 * @returns { Promise<void> } The promise returned by the function. 963 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 964 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 965 * @syscap SystemCapability.Ability.AbilityRuntime.Core 966 * @crossplatform 967 * @since 10 968 */ 969 /** 970 * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. 971 * 972 * @param { UIAbility } ability - The ability object. 973 * @returns { Promise<void> } The promise returned by the function. 974 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 975 * @throws { BusinessError } 16000100 - DoAbilityForeground failed. 976 * @syscap SystemCapability.Ability.AbilityRuntime.Core 977 * @crossplatform 978 * @atomicservice 979 * @since 11 980 */ 981 doAbilityForeground(ability: UIAbility): Promise<void>; 982 983 /** 984 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 985 * 986 * @param { UIAbility } ability - The ability object. 987 * @param { AsyncCallback<void> } callback - The callback of doAbilityBackground. 988 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 989 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 990 * @syscap SystemCapability.Ability.AbilityRuntime.Core 991 * @since 9 992 */ 993 /** 994 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 995 * 996 * @param { UIAbility } ability - The ability object. 997 * @param { AsyncCallback<void> } callback - The callback of doAbilityBackground. 998 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 999 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 1000 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1001 * @crossplatform 1002 * @since 10 1003 */ 1004 /** 1005 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 1006 * 1007 * @param { UIAbility } ability - The ability object. 1008 * @param { AsyncCallback<void> } callback - The callback of doAbilityBackground. 1009 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1010 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 1011 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1012 * @crossplatform 1013 * @atomicservice 1014 * @since 11 1015 */ 1016 doAbilityBackground(ability: UIAbility, callback: AsyncCallback<void>): void; 1017 1018 /** 1019 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 1020 * 1021 * @param { UIAbility } ability - The ability object. 1022 * @returns { Promise<void> } The promise returned by the function. 1023 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1024 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 1025 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1026 * @since 9 1027 */ 1028 /** 1029 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 1030 * 1031 * @param { UIAbility } ability - The ability object. 1032 * @returns { Promise<void> } The promise returned by the function. 1033 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1034 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 1035 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1036 * @crossplatform 1037 * @since 10 1038 */ 1039 /** 1040 * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. 1041 * 1042 * @param { UIAbility } ability - The ability object. 1043 * @returns { Promise<void> } The promise returned by the function. 1044 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1045 * @throws { BusinessError } 16000100 - DoAbilityBackground failed. 1046 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1047 * @crossplatform 1048 * @atomicservice 1049 * @since 11 1050 */ 1051 doAbilityBackground(ability: UIAbility): Promise<void>; 1052 1053 /** 1054 * Prints log information to the unit testing console. 1055 * The total length of the log information to be printed cannot exceed 1000 characters. 1056 * 1057 * @param { string } msg - Log information 1058 * @param { AsyncCallback<void> } callback - The callback of print. 1059 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1060 * @since 8 1061 */ 1062 /** 1063 * Prints log information to the unit testing console. 1064 * The total length of the log information to be printed cannot exceed 1000 characters. 1065 * 1066 * @param { string } msg - Log information 1067 * @param { AsyncCallback<void> } callback - The callback of print. 1068 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1069 * @crossplatform 1070 * @since 10 1071 */ 1072 /** 1073 * Prints log information to the unit testing console. 1074 * The total length of the log information to be printed cannot exceed 1000 characters. 1075 * 1076 * @param { string } msg - Log information 1077 * @param { AsyncCallback<void> } callback - The callback of print. 1078 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1079 * @crossplatform 1080 * @atomicservice 1081 * @since 11 1082 */ 1083 print(msg: string, callback: AsyncCallback<void>): void; 1084 1085 /** 1086 * Prints log information to the unit testing console. 1087 * The total length of the log information to be printed cannot exceed 1000 characters. 1088 * 1089 * @param { string } msg - Log information 1090 * @returns { Promise<void> } the promise returned by the function. 1091 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1092 * @since 8 1093 */ 1094 /** 1095 * Prints log information to the unit testing console. 1096 * The total length of the log information to be printed cannot exceed 1000 characters. 1097 * 1098 * @param { string } msg - Log information 1099 * @returns { Promise<void> } the promise returned by the function. 1100 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1101 * @crossplatform 1102 * @since 10 1103 */ 1104 /** 1105 * Prints log information to the unit testing console. 1106 * The total length of the log information to be printed cannot exceed 1000 characters. 1107 * 1108 * @param { string } msg - Log information 1109 * @returns { Promise<void> } the promise returned by the function. 1110 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1111 * @crossplatform 1112 * @atomicservice 1113 * @since 11 1114 */ 1115 print(msg: string): Promise<void>; 1116 1117 /** 1118 * Prints log information to the unit testing console. 1119 * The total length of the log information to be printed cannot exceed 1000 characters. 1120 * 1121 * @param { string } msg - Log information. 1122 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1123 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1124 * @since 9 1125 */ 1126 /** 1127 * Prints log information to the unit testing console. 1128 * The total length of the log information to be printed cannot exceed 1000 characters. 1129 * 1130 * @param { string } msg - Log information. 1131 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1132 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1133 * @crossplatform 1134 * @since 10 1135 */ 1136 /** 1137 * Prints log information to the unit testing console. 1138 * The total length of the log information to be printed cannot exceed 1000 characters. 1139 * 1140 * @param { string } msg - Log information. 1141 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1142 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1143 * @crossplatform 1144 * @atomicservice 1145 * @since 11 1146 */ 1147 printSync(msg: string): void; 1148 1149 /** 1150 * Execute the given command in the aa tools side. 1151 * 1152 * @param { string } cmd - Shell command 1153 * @param { AsyncCallback<ShellCmdResult> } callback - The callback of executeShellCommand. 1154 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1155 * @since 8 1156 */ 1157 /** 1158 * Execute the given command in the aa tools side. 1159 * 1160 * @param { string } cmd - Shell command 1161 * @param { AsyncCallback<ShellCmdResult> } callback - The callback of executeShellCommand. 1162 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1163 * @atomicservice 1164 * @since 11 1165 */ 1166 executeShellCommand(cmd: string, callback: AsyncCallback<ShellCmdResult>): void; 1167 1168 /** 1169 * Execute the given command in the aa tools side. 1170 * 1171 * @param { string } cmd - Shell command 1172 * @param { number } timeoutSecs - Timeout, in seconds 1173 * @param { AsyncCallback<ShellCmdResult> } callback - The callback of executeShellCommand. 1174 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1175 * @since 8 1176 */ 1177 /** 1178 * Execute the given command in the aa tools side. 1179 * 1180 * @param { string } cmd - Shell command 1181 * @param { number } timeoutSecs - Timeout, in seconds 1182 * @param { AsyncCallback<ShellCmdResult> } callback - The callback of executeShellCommand. 1183 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1184 * @atomicservice 1185 * @since 11 1186 */ 1187 executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback<ShellCmdResult>): void; 1188 1189 /** 1190 * Execute the given command in the aa tools side. 1191 * 1192 * @param { string } cmd - Shell command 1193 * @param { number } [timeoutSecs] - Timeout, in seconds 1194 * @returns { Promise<ShellCmdResult> } the promise returned by the function. 1195 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1196 * @since 8 1197 */ 1198 /** 1199 * Execute the given command in the aa tools side. 1200 * 1201 * @param { string } cmd - Shell command 1202 * @param { number } [timeoutSecs] - Timeout, in seconds 1203 * @returns { Promise<ShellCmdResult> } the promise returned by the function. 1204 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1205 * @atomicservice 1206 * @since 11 1207 */ 1208 executeShellCommand(cmd: string, timeoutSecs?: number): Promise<ShellCmdResult>; 1209 1210 /** 1211 * Finish the test and print log information to the unit testing console. 1212 * The total length of the log information to be printed cannot exceed 1000 characters. 1213 * 1214 * @param { string } msg - Log information. 1215 * @param { number } code - Result code. 1216 * @param { AsyncCallback<void> } callback - The callback of finishTest. 1217 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1218 * @throws { BusinessError } 16000100 - FinishTest failed. 1219 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1220 * @since 9 1221 */ 1222 /** 1223 * Finish the test and print log information to the unit testing console. 1224 * The total length of the log information to be printed cannot exceed 1000 characters. 1225 * 1226 * @param { string } msg - Log information. 1227 * @param { number } code - Result code. 1228 * @param { AsyncCallback<void> } callback - The callback of finishTest. 1229 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1230 * @throws { BusinessError } 16000100 - FinishTest failed. 1231 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1232 * @crossplatform 1233 * @since 10 1234 */ 1235 /** 1236 * Finish the test and print log information to the unit testing console. 1237 * The total length of the log information to be printed cannot exceed 1000 characters. 1238 * 1239 * @param { string } msg - Log information. 1240 * @param { number } code - Result code. 1241 * @param { AsyncCallback<void> } callback - The callback of finishTest. 1242 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1243 * @throws { BusinessError } 16000100 - FinishTest failed. 1244 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1245 * @crossplatform 1246 * @atomicservice 1247 * @since 11 1248 */ 1249 finishTest(msg: string, code: number, callback: AsyncCallback<void>): void; 1250 1251 /** 1252 * Finish the test and print log information to the unit testing console. 1253 * The total length of the log information to be printed cannot exceed 1000 characters. 1254 * 1255 * @param { string } msg - Log information. 1256 * @param { number } code - Result code. 1257 * @returns { Promise<void> } The promise returned by the function. 1258 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1259 * @throws { BusinessError } 16000100 - FinishTest failed. 1260 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1261 * @since 9 1262 */ 1263 /** 1264 * Finish the test and print log information to the unit testing console. 1265 * The total length of the log information to be printed cannot exceed 1000 characters. 1266 * 1267 * @param { string } msg - Log information. 1268 * @param { number } code - Result code. 1269 * @returns { Promise<void> } The promise returned by the function. 1270 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1271 * @throws { BusinessError } 16000100 - FinishTest failed. 1272 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1273 * @crossplatform 1274 * @since 10 1275 */ 1276 /** 1277 * Finish the test and print log information to the unit testing console. 1278 * The total length of the log information to be printed cannot exceed 1000 characters. 1279 * 1280 * @param { string } msg - Log information. 1281 * @param { number } code - Result code. 1282 * @returns { Promise<void> } The promise returned by the function. 1283 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1284 * @throws { BusinessError } 16000100 - FinishTest failed. 1285 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1286 * @crossplatform 1287 * @atomicservice 1288 * @since 11 1289 */ 1290 finishTest(msg: string, code: number): Promise<void>; 1291 1292 /** 1293 * Used to set a list of mock data. 1294 * @param { Record<string, string> } mockList - An object with string keys and string values. The keys represent the 1295 * target path to be replaced and the values represent the path of the 1296 * mock implementation to be used for the replacement. 1297 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 1298 * @throws { BusinessError } 16000050 - Internal error. 1299 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1300 * @atomicservice 1301 * @since 11 1302 */ 1303 setMockList(mockList: Record<string, string>): void; 1304} 1305 1306export default AbilityDelegator; 1307