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