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