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