1/* 2 * Copyright (c) 2022-2024 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 { ConnectOptions } from '../ability/connectOptions'; 23import { Caller } from '../@ohos.app.ability.UIAbility'; 24import ExtensionContext from './ExtensionContext'; 25import Want from '../@ohos.app.ability.Want'; 26import StartOptions from '../@ohos.app.ability.StartOptions'; 27import OpenLinkOptions from '../@ohos.app.ability.OpenLinkOptions'; 28 29/** 30 * The context of service extension. It allows access to 31 * serviceExtension-specific resources. 32 * 33 * @extends ExtensionContext 34 * @syscap SystemCapability.Ability.AbilityRuntime.Core 35 * @systemapi 36 * @stagemodelonly 37 * @since 9 38 */ 39export default class ServiceExtensionContext extends ExtensionContext { 40 /** 41 * Service extension uses this method to start a specific ability. 42 * 43 * @param { Want } want - Indicates the ability to start. 44 * @param { AsyncCallback<void> } callback - The callback of startAbility. 45 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 46 * 2. Incorrect parameter types; 3. Parameter verification failed. 47 * @throws { BusinessError } 16000001 - The specified ability does not exist. 48 * @throws { BusinessError } 16000002 - Incorrect ability type. 49 * @throws { BusinessError } 16000004 - Can not start invisible component. 50 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 51 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 52 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 53 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 54 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 55 * @throws { BusinessError } 16000011 - The context does not exist. 56 * @throws { BusinessError } 16000050 - Internal error. 57 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 58 * @throws { BusinessError } 16000055 - Installation-free timed out. 59 * @throws { BusinessError } 16200001 - The caller has been released. 60 * @syscap SystemCapability.Ability.AbilityRuntime.Core 61 * @systemapi 62 * @stagemodelonly 63 * @since 9 64 */ 65 /** 66 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 67 * you can use this method to start ability; If the caller application is in the background, 68 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 69 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 70 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 71 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 72 * 73 * @param { Want } want - Indicates the ability to start. 74 * @param { AsyncCallback<void> } callback - The callback of startAbility. 75 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 76 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 77 * 2. Incorrect parameter types; 3. Parameter verification failed. 78 * @throws { BusinessError } 16000001 - The specified ability does not exist. 79 * @throws { BusinessError } 16000002 - Incorrect ability type. 80 * @throws { BusinessError } 16000004 - Can not start invisible component. 81 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 82 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 83 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 84 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 85 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 86 * @throws { BusinessError } 16000011 - The context does not exist. 87 * @throws { BusinessError } 16000012 - The application is controlled. 88 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 89 * @throws { BusinessError } 16000050 - Internal error. 90 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 91 * @throws { BusinessError } 16000055 - Installation-free timed out. 92 * @throws { BusinessError } 16200001 - The caller has been released. 93 * @syscap SystemCapability.Ability.AbilityRuntime.Core 94 * @systemapi 95 * @stagemodelonly 96 * @since 10 97 */ 98 /** 99 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 100 * you can use this method to start ability; If the caller application is in the background, 101 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 102 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 103 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 104 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 105 * 106 * @param { Want } want - Indicates the ability to start. 107 * @param { AsyncCallback<void> } callback - The callback of startAbility. 108 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 109 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 110 * 2. Incorrect parameter types; 3. Parameter verification failed. 111 * @throws { BusinessError } 16000001 - The specified ability does not exist. 112 * @throws { BusinessError } 16000002 - Incorrect ability type. 113 * @throws { BusinessError } 16000004 - Can not start invisible component. 114 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 115 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 116 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 117 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 118 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 119 * @throws { BusinessError } 16000011 - The context does not exist. 120 * @throws { BusinessError } 16000012 - The application is controlled. 121 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 122 * @throws { BusinessError } 16000019 - Can not match any component. 123 * @throws { BusinessError } 16000050 - Internal error. 124 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 125 * @throws { BusinessError } 16000055 - Installation-free timed out. 126 * @throws { BusinessError } 16200001 - The caller has been released. 127 * @throws { BusinessError } 16000073 - The app clone index is invalid. 128 * @syscap SystemCapability.Ability.AbilityRuntime.Core 129 * @systemapi 130 * @stagemodelonly 131 * @since 12 132 */ 133 /** 134 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 135 * you can use this method to start ability; If the caller application is in the background, 136 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 137 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 138 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 139 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 140 * 141 * @param { Want } want - Indicates the ability to start. 142 * @param { AsyncCallback<void> } callback - The callback of startAbility. 143 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 144 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 145 * 2. Incorrect parameter types; 3. Parameter verification failed. 146 * @throws { BusinessError } 16000001 - The specified ability does not exist. 147 * @throws { BusinessError } 16000002 - Incorrect ability type. 148 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 149 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 150 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 151 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 152 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 153 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 154 * @throws { BusinessError } 16000011 - The context does not exist. 155 * @throws { BusinessError } 16000012 - The application is controlled. 156 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 157 * @throws { BusinessError } 16000019 - No matching ability is found. 158 * @throws { BusinessError } 16000050 - Internal error. 159 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 160 * @throws { BusinessError } 16000055 - Installation-free timed out. 161 * @throws { BusinessError } 16000071 - App clone is not supported. 162 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 163 * @throws { BusinessError } 16000073 - The app clone index is invalid. 164 * @throws { BusinessError } 16000076 - The app instance key is invalid. 165 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 166 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 167 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 168 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 169 * @throws { BusinessError } 16200001 - The caller has been released. 170 * @syscap SystemCapability.Ability.AbilityRuntime.Core 171 * @systemapi 172 * @stagemodelonly 173 * @since 14 174 */ 175 startAbility(want: Want, callback: AsyncCallback<void>): void; 176 177 /** 178 * Service extension uses this method to start a specific ability. 179 * 180 * @param { Want } want - Indicates the ability to start. 181 * @param { StartOptions } options - Indicates the start options. 182 * @param { AsyncCallback<void> } callback - The callback of startAbility. 183 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 184 * 2. Incorrect parameter types; 3. Parameter verification failed. 185 * @throws { BusinessError } 16000001 - The specified ability does not exist. 186 * @throws { BusinessError } 16000002 - Incorrect ability type. 187 * @throws { BusinessError } 16000004 - Can not start invisible component. 188 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 189 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 190 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 191 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 192 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 193 * @throws { BusinessError } 16000011 - The context does not exist. 194 * @throws { BusinessError } 16000050 - Internal error. 195 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 196 * @throws { BusinessError } 16000055 - Installation-free timed out. 197 * @throws { BusinessError } 16200001 - The caller has been released. 198 * @syscap SystemCapability.Ability.AbilityRuntime.Core 199 * @systemapi 200 * @stagemodelonly 201 * @since 9 202 */ 203 /** 204 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 205 * you can use this method to start ability; If the caller application is in the background, 206 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 207 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 208 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 209 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 210 * 211 * @param { Want } want - Indicates the ability to start. 212 * @param { StartOptions } options - Indicates the start options. 213 * @param { AsyncCallback<void> } callback - The callback of startAbility. 214 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 215 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 216 * 2. Incorrect parameter types; 3. Parameter verification failed. 217 * @throws { BusinessError } 16000001 - The specified ability does not exist. 218 * @throws { BusinessError } 16000004 - Can not start invisible component. 219 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 220 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 221 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 222 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 223 * @throws { BusinessError } 16000011 - The context does not exist. 224 * @throws { BusinessError } 16000012 - The application is controlled. 225 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 226 * @throws { BusinessError } 16000050 - Internal error. 227 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 228 * @throws { BusinessError } 16000055 - Installation-free timed out. 229 * @throws { BusinessError } 16200001 - The caller has been released. 230 * @syscap SystemCapability.Ability.AbilityRuntime.Core 231 * @systemapi 232 * @stagemodelonly 233 * @since 10 234 */ 235 /** 236 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 237 * you can use this method to start ability; If the caller application is in the background, 238 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 239 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 240 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 241 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 242 * 243 * @param { Want } want - Indicates the ability to start. 244 * @param { StartOptions } options - Indicates the start options. 245 * @param { AsyncCallback<void> } callback - The callback of startAbility. 246 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 247 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 248 * 2. Incorrect parameter types; 3. Parameter verification failed. 249 * @throws { BusinessError } 16000001 - The specified ability does not exist. 250 * @throws { BusinessError } 16000004 - Can not start invisible component. 251 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 252 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 253 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 254 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 255 * @throws { BusinessError } 16000011 - The context does not exist. 256 * @throws { BusinessError } 16000012 - The application is controlled. 257 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 258 * @throws { BusinessError } 16000019 - Can not match any component. 259 * @throws { BusinessError } 16000050 - Internal error. 260 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 261 * @throws { BusinessError } 16000055 - Installation-free timed out. 262 * @throws { BusinessError } 16200001 - The caller has been released. 263 * @throws { BusinessError } 16000073 - The app clone index is invalid. 264 * @syscap SystemCapability.Ability.AbilityRuntime.Core 265 * @systemapi 266 * @stagemodelonly 267 * @since 12 268 */ 269 /** 270 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 271 * you can use this method to start ability; If the caller application is in the background, 272 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 273 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 274 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 275 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 276 * 277 * @param { Want } want - Indicates the ability to start. 278 * @param { StartOptions } options - Indicates the start options. 279 * @param { AsyncCallback<void> } callback - The callback of startAbility. 280 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 281 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 282 * 2. Incorrect parameter types; 3. Parameter verification failed. 283 * @throws { BusinessError } 16000001 - The specified ability does not exist. 284 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 285 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 286 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 287 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 288 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 289 * @throws { BusinessError } 16000011 - The context does not exist. 290 * @throws { BusinessError } 16000012 - The application is controlled. 291 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 292 * @throws { BusinessError } 16000019 - No matching ability is found. 293 * @throws { BusinessError } 16000050 - Internal error. 294 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 295 * @throws { BusinessError } 16000055 - Installation-free timed out. 296 * @throws { BusinessError } 16000071 - App clone is not supported. 297 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 298 * @throws { BusinessError } 16000073 - The app clone index is invalid. 299 * @throws { BusinessError } 16000076 - The app instance key is invalid. 300 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 301 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 302 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 303 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 304 * @throws { BusinessError } 16200001 - The caller has been released. 305 * @syscap SystemCapability.Ability.AbilityRuntime.Core 306 * @systemapi 307 * @stagemodelonly 308 * @since 14 309 */ 310 startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 311 312 /** 313 * Service extension uses this method to start a specific ability. 314 * 315 * @param { Want } want - Indicates the ability to start. 316 * @param { StartOptions } options - Indicates the start options. 317 * @returns { Promise<void> } The promise returned by the function. 318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 319 * 2. Incorrect parameter types; 3. Parameter verification failed. 320 * @throws { BusinessError } 16000001 - The specified ability does not exist. 321 * @throws { BusinessError } 16000002 - Incorrect ability type. 322 * @throws { BusinessError } 16000004 - Can not start invisible component. 323 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 324 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 325 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 326 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 327 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 328 * @throws { BusinessError } 16000011 - The context does not exist. 329 * @throws { BusinessError } 16000050 - Internal error. 330 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 331 * @throws { BusinessError } 16000055 - Installation-free timed out. 332 * @throws { BusinessError } 16200001 - The caller has been released. 333 * @syscap SystemCapability.Ability.AbilityRuntime.Core 334 * @systemapi 335 * @stagemodelonly 336 * @since 9 337 */ 338 /** 339 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 340 * you can use this method to start ability; If the caller application is in the background, 341 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 342 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 343 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 344 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 345 * 346 * @param { Want } want - Indicates the ability to start. 347 * @param { StartOptions } [options] - Indicates the start options. 348 * @returns { Promise<void> } The promise returned by the function. 349 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 350 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 351 * 2. Incorrect parameter types; 3. Parameter verification failed. 352 * @throws { BusinessError } 16000001 - The specified ability does not exist. 353 * @throws { BusinessError } 16000002 - Incorrect ability type. 354 * @throws { BusinessError } 16000004 - Can not start invisible component. 355 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 356 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 357 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 358 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 359 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 360 * @throws { BusinessError } 16000011 - The context does not exist. 361 * @throws { BusinessError } 16000012 - The application is controlled. 362 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 363 * @throws { BusinessError } 16000050 - Internal error. 364 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 365 * @throws { BusinessError } 16000055 - Installation-free timed out. 366 * @throws { BusinessError } 16200001 - The caller has been released. 367 * @syscap SystemCapability.Ability.AbilityRuntime.Core 368 * @systemapi 369 * @stagemodelonly 370 * @since 10 371 */ 372 /** 373 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 374 * you can use this method to start ability; If the caller application is in the background, 375 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 376 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 377 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 378 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 379 * 380 * @param { Want } want - Indicates the ability to start. 381 * @param { StartOptions } [options] - Indicates the start options. 382 * @returns { Promise<void> } The promise returned by the function. 383 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 384 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 385 * 2. Incorrect parameter types; 3. Parameter verification failed. 386 * @throws { BusinessError } 16000001 - The specified ability does not exist. 387 * @throws { BusinessError } 16000002 - Incorrect ability type. 388 * @throws { BusinessError } 16000004 - Can not start invisible component. 389 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 390 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 391 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 392 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 393 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 394 * @throws { BusinessError } 16000011 - The context does not exist. 395 * @throws { BusinessError } 16000012 - The application is controlled. 396 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 397 * @throws { BusinessError } 16000019 - Can not match any component. 398 * @throws { BusinessError } 16000050 - Internal error. 399 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 400 * @throws { BusinessError } 16000055 - Installation-free timed out. 401 * @throws { BusinessError } 16200001 - The caller has been released. 402 * @throws { BusinessError } 16000073 - The app clone index is invalid. 403 * @syscap SystemCapability.Ability.AbilityRuntime.Core 404 * @systemapi 405 * @stagemodelonly 406 * @since 12 407 */ 408 /** 409 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 410 * you can use this method to start ability; If the caller application is in the background, 411 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 412 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 413 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 414 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 415 * 416 * @param { Want } want - Indicates the ability to start. 417 * @param { StartOptions } [options] - Indicates the start options. 418 * @returns { Promise<void> } The promise returned by the function. 419 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 420 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 421 * 2. Incorrect parameter types; 3. Parameter verification failed. 422 * @throws { BusinessError } 16000001 - The specified ability does not exist. 423 * @throws { BusinessError } 16000002 - Incorrect ability type. 424 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 425 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 426 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 427 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 428 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 429 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 430 * @throws { BusinessError } 16000011 - The context does not exist. 431 * @throws { BusinessError } 16000012 - The application is controlled. 432 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 433 * @throws { BusinessError } 16000019 - No matching ability is found. 434 * @throws { BusinessError } 16000050 - Internal error. 435 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 436 * @throws { BusinessError } 16000055 - Installation-free timed out. 437 * @throws { BusinessError } 16000071 - App clone is not supported. 438 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 439 * @throws { BusinessError } 16000073 - The app clone index is invalid. 440 * @throws { BusinessError } 16000076 - The app instance key is invalid. 441 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 442 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 443 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 444 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 445 * @throws { BusinessError } 16200001 - The caller has been released. 446 * @syscap SystemCapability.Ability.AbilityRuntime.Core 447 * @systemapi 448 * @stagemodelonly 449 * @since 14 450 */ 451 startAbility(want: Want, options?: StartOptions): Promise<void>; 452 453 /** 454 * Service extension uses this method to start a specific ability by implicit want. If the caller application is in foreground, 455 * you can use this method to start ability; If the caller application is in the background, 456 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 457 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 458 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 459 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 460 * 461 * @param { string } link - Indicates the ability to start. 462 * @param { OpenLinkOptions } [options] - Indicates the open link options. 463 * @returns { Promise<void> } The promise returned by the function. 464 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 465 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 466 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 467 * 2. Incorrect parameter types; 3. Parameter verification failed. 468 * @throws { BusinessError } 16000001 - The specified ability does not exist. 469 * @throws { BusinessError } 16000002 - Incorrect ability type. 470 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 471 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 472 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 473 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 474 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 475 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 476 * @throws { BusinessError } 16000011 - The context does not exist. 477 * @throws { BusinessError } 16000012 - The application is controlled. 478 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 479 * @throws { BusinessError } 16000019 - No matching ability is found. 480 * @throws { BusinessError } 16200001 - The caller has been released. 481 * @syscap SystemCapability.Ability.AbilityRuntime.Core 482 * @systemapi 483 * @stagemodelonly 484 * @since 12 485 */ 486 openLink(link: string, options?: OpenLinkOptions): Promise<void>; 487 488 /** 489 * Service extension start an ability using the original caller information. If the caller application is in 490 * foreground, you can use this method to start ability; If the caller application is in the background, 491 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 492 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 493 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 494 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 495 * 496 * @param { Want } want - Indicates the ability to start. 497 * @param { AsyncCallback<void> } callback - The callback of startAbility. 498 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 499 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 500 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 501 * 2. Incorrect parameter types; 3. Parameter verification failed. 502 * @throws { BusinessError } 16000001 - The specified ability does not exist. 503 * @throws { BusinessError } 16000002 - Incorrect ability type. 504 * @throws { BusinessError } 16000004 - Can not start invisible component. 505 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 506 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 507 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 508 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 509 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 510 * @throws { BusinessError } 16000011 - The context does not exist. 511 * @throws { BusinessError } 16000012 - The application is controlled. 512 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 513 * @throws { BusinessError } 16000050 - Internal error. 514 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 515 * @throws { BusinessError } 16000055 - Installation-free timed out. 516 * @throws { BusinessError } 16200001 - The caller has been released. 517 * @syscap SystemCapability.Ability.AbilityRuntime.Core 518 * @systemapi 519 * @stagemodelonly 520 * @since 10 521 */ 522 /** 523 * Service extension start an ability using the original caller information. If the caller application is in 524 * foreground, you can use this method to start ability; If the caller application is in the background, 525 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 526 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 527 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 528 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 529 * 530 * @param { Want } want - Indicates the ability to start. 531 * @param { AsyncCallback<void> } callback - The callback of startAbility. 532 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 533 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 534 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 535 * 2. Incorrect parameter types; 3. Parameter verification failed. 536 * @throws { BusinessError } 16000001 - The specified ability does not exist. 537 * @throws { BusinessError } 16000002 - Incorrect ability type. 538 * @throws { BusinessError } 16000004 - Can not start invisible component. 539 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 540 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 541 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 542 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 543 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 544 * @throws { BusinessError } 16000011 - The context does not exist. 545 * @throws { BusinessError } 16000012 - The application is controlled. 546 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 547 * @throws { BusinessError } 16000050 - Internal error. 548 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 549 * @throws { BusinessError } 16000055 - Installation-free timed out. 550 * @throws { BusinessError } 16200001 - The caller has been released. 551 * @throws { BusinessError } 16000073 - The app clone index is invalid. 552 * @syscap SystemCapability.Ability.AbilityRuntime.Core 553 * @systemapi 554 * @stagemodelonly 555 * @since 12 556 */ 557 /** 558 * Service extension start an ability using the original caller information. If the caller application is in 559 * foreground, you can use this method to start ability; If the caller application is in the background, 560 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 561 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 562 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 563 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 564 * 565 * @param { Want } want - Indicates the ability to start. 566 * @param { AsyncCallback<void> } callback - The callback of startAbility. 567 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 568 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 569 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 570 * 2. Incorrect parameter types; 3. Parameter verification failed. 571 * @throws { BusinessError } 16000001 - The specified ability does not exist. 572 * @throws { BusinessError } 16000002 - Incorrect ability type. 573 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 574 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 575 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 576 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 577 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 578 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 579 * @throws { BusinessError } 16000011 - The context does not exist. 580 * @throws { BusinessError } 16000012 - The application is controlled. 581 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 582 * @throws { BusinessError } 16000050 - Internal error. 583 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 584 * @throws { BusinessError } 16000055 - Installation-free timed out. 585 * @throws { BusinessError } 16000071 - App clone is not supported. 586 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 587 * @throws { BusinessError } 16000073 - The app clone index is invalid. 588 * @throws { BusinessError } 16000076 - The app instance key is invalid. 589 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 590 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 591 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 592 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 593 * @throws { BusinessError } 16200001 - The caller has been released. 594 * @syscap SystemCapability.Ability.AbilityRuntime.Core 595 * @systemapi 596 * @stagemodelonly 597 * @since 14 598 */ 599 startAbilityAsCaller(want: Want, callback: AsyncCallback<void>): void; 600 601 /** 602 * Service extension start an ability using the original caller information. If the caller application is in 603 * foreground, you can use this method to start ability; If the caller application is in the background, 604 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 605 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 606 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 607 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 608 * 609 * @param { Want } want - Indicates the ability to start. 610 * @param { StartOptions } options - Indicates the start options. 611 * @param { AsyncCallback<void> } callback - The callback of startAbility. 612 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 613 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 614 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 615 * 2. Incorrect parameter types; 3. Parameter verification failed. 616 * @throws { BusinessError } 16000001 - The specified ability does not exist. 617 * @throws { BusinessError } 16000004 - Can not start invisible component. 618 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 619 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 620 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 621 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 622 * @throws { BusinessError } 16000011 - The context does not exist. 623 * @throws { BusinessError } 16000012 - The application is controlled. 624 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 625 * @throws { BusinessError } 16000050 - Internal error. 626 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 627 * @throws { BusinessError } 16000055 - Installation-free timed out. 628 * @throws { BusinessError } 16200001 - The caller has been released. 629 * @syscap SystemCapability.Ability.AbilityRuntime.Core 630 * @systemapi 631 * @stagemodelonly 632 * @since 10 633 */ 634 /** 635 * Service extension start an ability using the original caller information. If the caller application is in 636 * foreground, you can use this method to start ability; If the caller application is in the background, 637 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 638 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 639 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 640 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 641 * 642 * @param { Want } want - Indicates the ability to start. 643 * @param { StartOptions } options - Indicates the start options. 644 * @param { AsyncCallback<void> } callback - The callback of startAbility. 645 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 646 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 647 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 648 * 2. Incorrect parameter types; 3. Parameter verification failed. 649 * @throws { BusinessError } 16000001 - The specified ability does not exist. 650 * @throws { BusinessError } 16000004 - Can not start invisible component. 651 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 652 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 653 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 654 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 655 * @throws { BusinessError } 16000011 - The context does not exist. 656 * @throws { BusinessError } 16000012 - The application is controlled. 657 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 658 * @throws { BusinessError } 16000050 - Internal error. 659 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 660 * @throws { BusinessError } 16000055 - Installation-free timed out. 661 * @throws { BusinessError } 16200001 - The caller has been released. 662 * @throws { BusinessError } 16000073 - The app clone index is invalid. 663 * @syscap SystemCapability.Ability.AbilityRuntime.Core 664 * @systemapi 665 * @stagemodelonly 666 * @since 12 667 */ 668 /** 669 * Service extension start an ability using the original caller information. If the caller application is in 670 * foreground, you can use this method to start ability; If the caller application is in the background, 671 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 672 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 673 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 674 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 675 * 676 * @param { Want } want - Indicates the ability to start. 677 * @param { StartOptions } options - Indicates the start options. 678 * @param { AsyncCallback<void> } callback - The callback of startAbility. 679 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 680 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 681 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 682 * 2. Incorrect parameter types; 3. Parameter verification failed. 683 * @throws { BusinessError } 16000001 - The specified ability does not exist. 684 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 685 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 686 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 687 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 688 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 689 * @throws { BusinessError } 16000011 - The context does not exist. 690 * @throws { BusinessError } 16000012 - The application is controlled. 691 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 692 * @throws { BusinessError } 16000050 - Internal error. 693 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 694 * @throws { BusinessError } 16000055 - Installation-free timed out. 695 * @throws { BusinessError } 16000071 - App clone is not supported. 696 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 697 * @throws { BusinessError } 16000073 - The app clone index is invalid. 698 * @throws { BusinessError } 16000076 - The app instance key is invalid. 699 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 700 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 701 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 702 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 703 * @throws { BusinessError } 16200001 - The caller has been released. 704 * @syscap SystemCapability.Ability.AbilityRuntime.Core 705 * @systemapi 706 * @stagemodelonly 707 * @since 14 708 */ 709 startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 710 711 /** 712 * Service extension start an ability using the original caller information. If the caller application is in 713 * foreground, you can use this method to start ability; If the caller application is in the background, 714 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 715 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 716 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 717 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 718 * 719 * @param { Want } want - Indicates the ability to start. 720 * @param { StartOptions } options - Indicates the start options. 721 * @returns { Promise<void> } The promise returned by the function. 722 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 723 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 724 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 725 * 2. Incorrect parameter types; 3. Parameter verification failed. 726 * @throws { BusinessError } 16000001 - The specified ability does not exist. 727 * @throws { BusinessError } 16000002 - Incorrect ability type. 728 * @throws { BusinessError } 16000004 - Can not start invisible component. 729 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 730 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 731 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 732 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 733 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 734 * @throws { BusinessError } 16000011 - The context does not exist. 735 * @throws { BusinessError } 16000012 - The application is controlled. 736 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 737 * @throws { BusinessError } 16000050 - Internal error. 738 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 739 * @throws { BusinessError } 16000055 - Installation-free timed out. 740 * @throws { BusinessError } 16200001 - The caller has been released. 741 * @syscap SystemCapability.Ability.AbilityRuntime.Core 742 * @systemapi 743 * @stagemodelonly 744 * @since 10 745 */ 746 /** 747 * Service extension start an ability using the original caller information. If the caller application is in 748 * foreground, you can use this method to start ability; If the caller application is in the background, 749 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 750 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 751 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 752 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 753 * 754 * @param { Want } want - Indicates the ability to start. 755 * @param { StartOptions } options - Indicates the start options. 756 * @returns { Promise<void> } The promise returned by the function. 757 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 758 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 759 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 760 * 2. Incorrect parameter types; 3. Parameter verification failed. 761 * @throws { BusinessError } 16000001 - The specified ability does not exist. 762 * @throws { BusinessError } 16000002 - Incorrect ability type. 763 * @throws { BusinessError } 16000004 - Can not start invisible component. 764 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 765 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 766 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 767 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 768 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 769 * @throws { BusinessError } 16000011 - The context does not exist. 770 * @throws { BusinessError } 16000012 - The application is controlled. 771 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 772 * @throws { BusinessError } 16000050 - Internal error. 773 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 774 * @throws { BusinessError } 16000055 - Installation-free timed out. 775 * @throws { BusinessError } 16200001 - The caller has been released. 776 * @throws { BusinessError } 16000073 - The app clone index is invalid. 777 * @syscap SystemCapability.Ability.AbilityRuntime.Core 778 * @systemapi 779 * @stagemodelonly 780 * @since 12 781 */ 782 /** 783 * Service extension start an ability using the original caller information. If the caller application is in 784 * foreground, you can use this method to start ability; If the caller application is in the background, 785 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 786 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 787 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 788 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 789 * 790 * @param { Want } want - Indicates the ability to start. 791 * @param { StartOptions } options - Indicates the start options. 792 * @returns { Promise<void> } The promise returned by the function. 793 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 794 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 795 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 796 * 2. Incorrect parameter types; 3. Parameter verification failed. 797 * @throws { BusinessError } 16000001 - The specified ability does not exist. 798 * @throws { BusinessError } 16000002 - Incorrect ability type. 799 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 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 } 16000012 - The application is controlled. 807 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 808 * @throws { BusinessError } 16000050 - Internal error. 809 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 810 * @throws { BusinessError } 16000055 - Installation-free timed out. 811 * @throws { BusinessError } 16000071 - App clone is not supported. 812 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 813 * @throws { BusinessError } 16000073 - The app clone index is invalid. 814 * @throws { BusinessError } 16000076 - The app instance key is invalid. 815 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 816 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 817 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 818 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 819 * @throws { BusinessError } 16200001 - The caller has been released. 820 * @syscap SystemCapability.Ability.AbilityRuntime.Core 821 * @systemapi 822 * @stagemodelonly 823 * @since 14 824 */ 825 startAbilityAsCaller(want: Want, options?: StartOptions): Promise<void>; 826 827 /** 828 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 829 * you can use this method to start ability; If the caller application is in the background, 830 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 831 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 832 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 833 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 834 * 835 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 836 * @param { Want } want - Indicates the ability to start. 837 * @param { number } accountId - Indicates the accountId to start. 838 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 839 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 840 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 841 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 842 * 2. Incorrect parameter types; 3. Parameter verification failed. 843 * @throws { BusinessError } 16000001 - The specified ability does not exist. 844 * @throws { BusinessError } 16000002 - Incorrect ability type. 845 * @throws { BusinessError } 16000004 - Can not start invisible component. 846 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 847 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 848 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 849 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 850 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 851 * @throws { BusinessError } 16000011 - The context does not exist. 852 * @throws { BusinessError } 16000012 - The application is controlled. 853 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 854 * @throws { BusinessError } 16000050 - Internal error. 855 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 856 * @throws { BusinessError } 16000055 - Installation-free timed out. 857 * @throws { BusinessError } 16200001 - The caller has been released. 858 * @syscap SystemCapability.Ability.AbilityRuntime.Core 859 * @systemapi 860 * @stagemodelonly 861 * @since 9 862 */ 863 /** 864 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 865 * you can use this method to start ability; If the caller application is in the background, 866 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 867 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 868 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 869 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 870 * 871 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 872 * @param { Want } want - Indicates the ability to start. 873 * @param { number } accountId - Indicates the accountId to start. 874 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 875 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 876 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 877 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 878 * 2. Incorrect parameter types; 3. Parameter verification failed. 879 * @throws { BusinessError } 16000001 - The specified ability does not exist. 880 * @throws { BusinessError } 16000002 - Incorrect ability type. 881 * @throws { BusinessError } 16000004 - Can not start invisible component. 882 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 883 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 884 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 885 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 886 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 887 * @throws { BusinessError } 16000011 - The context does not exist. 888 * @throws { BusinessError } 16000012 - The application is controlled. 889 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 890 * @throws { BusinessError } 16000019 - Can not match any component. 891 * @throws { BusinessError } 16000050 - Internal error. 892 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 893 * @throws { BusinessError } 16000055 - Installation-free timed out. 894 * @throws { BusinessError } 16200001 - The caller has been released. 895 * @throws { BusinessError } 16000073 - The app clone index is invalid. 896 * @syscap SystemCapability.Ability.AbilityRuntime.Core 897 * @systemapi 898 * @stagemodelonly 899 * @since 12 900 */ 901 /** 902 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 903 * you can use this method to start ability; If the caller application is in the background, 904 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 905 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 906 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 907 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 908 * 909 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 910 * @param { Want } want - Indicates the ability to start. 911 * @param { number } accountId - Indicates the accountId to start. 912 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 913 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 914 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 915 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 916 * 2. Incorrect parameter types; 3. Parameter verification failed. 917 * @throws { BusinessError } 16000001 - The specified ability does not exist. 918 * @throws { BusinessError } 16000002 - Incorrect ability type. 919 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 920 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 921 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 922 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 923 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 924 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 925 * @throws { BusinessError } 16000011 - The context does not exist. 926 * @throws { BusinessError } 16000012 - The application is controlled. 927 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 928 * @throws { BusinessError } 16000019 - No matching ability is found. 929 * @throws { BusinessError } 16000050 - Internal error. 930 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 931 * @throws { BusinessError } 16000055 - Installation-free timed out. 932 * @throws { BusinessError } 16000071 - App clone is not supported. 933 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 934 * @throws { BusinessError } 16000073 - The app clone index is invalid. 935 * @throws { BusinessError } 16000076 - The app instance key is invalid. 936 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 937 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 938 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 939 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 940 * @throws { BusinessError } 16200001 - The caller has been released. 941 * @syscap SystemCapability.Ability.AbilityRuntime.Core 942 * @systemapi 943 * @stagemodelonly 944 * @since 14 945 */ 946 startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 947 948 /** 949 * Service extension uses this method to start a specific ability with account. 950 * 951 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 952 * @param { Want } want - Indicates the ability to start. 953 * @param { number } accountId - Indicates the accountId to start. 954 * @param { StartOptions } options - Indicates the start options. 955 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 956 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 957 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 958 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 959 * 2. Incorrect parameter types; 3. Parameter verification failed. 960 * @throws { BusinessError } 16000001 - The specified ability does not exist. 961 * @throws { BusinessError } 16000002 - Incorrect ability type. 962 * @throws { BusinessError } 16000004 - Can not start invisible component. 963 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 964 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 965 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 966 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 967 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 968 * @throws { BusinessError } 16000011 - The context does not exist. 969 * @throws { BusinessError } 16000050 - Internal error. 970 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 971 * @throws { BusinessError } 16000055 - Installation-free timed out. 972 * @throws { BusinessError } 16200001 - The caller has been released. 973 * @syscap SystemCapability.Ability.AbilityRuntime.Core 974 * @systemapi 975 * @stagemodelonly 976 * @since 9 977 */ 978 /** 979 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 980 * you can use this method to start ability; If the caller application is in the background, 981 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 982 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 983 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 984 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 985 * 986 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 987 * @param { Want } want - Indicates the ability to start. 988 * @param { number } accountId - Indicates the accountId to start. 989 * @param { StartOptions } options - Indicates the start options. 990 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 991 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 992 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 993 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 994 * 2. Incorrect parameter types; 3. Parameter verification failed. 995 * @throws { BusinessError } 16000001 - The specified ability does not exist. 996 * @throws { BusinessError } 16000004 - Can not start invisible component. 997 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 998 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 999 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1000 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1001 * @throws { BusinessError } 16000011 - The context does not exist. 1002 * @throws { BusinessError } 16000012 - The application is controlled. 1003 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1004 * @throws { BusinessError } 16000050 - Internal error. 1005 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1006 * @throws { BusinessError } 16000055 - Installation-free timed out. 1007 * @throws { BusinessError } 16200001 - The caller has been released. 1008 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1009 * @systemapi 1010 * @stagemodelonly 1011 * @since 10 1012 */ 1013 /** 1014 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1015 * you can use this method to start ability; If the caller application is in the background, 1016 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1017 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1018 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1019 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1020 * 1021 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1022 * @param { Want } want - Indicates the ability to start. 1023 * @param { number } accountId - Indicates the accountId to start. 1024 * @param { StartOptions } options - Indicates the start options. 1025 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 1026 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1027 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1028 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1029 * 2. Incorrect parameter types; 3. Parameter verification failed. 1030 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1031 * @throws { BusinessError } 16000004 - Can not start invisible component. 1032 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1033 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1034 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1035 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1036 * @throws { BusinessError } 16000011 - The context does not exist. 1037 * @throws { BusinessError } 16000012 - The application is controlled. 1038 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1039 * @throws { BusinessError } 16000019 - Can not match any component. 1040 * @throws { BusinessError } 16000050 - Internal error. 1041 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1042 * @throws { BusinessError } 16000055 - Installation-free timed out. 1043 * @throws { BusinessError } 16200001 - The caller has been released. 1044 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1045 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1046 * @systemapi 1047 * @stagemodelonly 1048 * @since 12 1049 */ 1050 /** 1051 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1052 * you can use this method to start ability; If the caller application is in the background, 1053 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1054 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1055 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1056 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1057 * 1058 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1059 * @param { Want } want - Indicates the ability to start. 1060 * @param { number } accountId - Indicates the accountId to start. 1061 * @param { StartOptions } options - Indicates the start options. 1062 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 1063 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1064 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1065 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1066 * 2. Incorrect parameter types; 3. Parameter verification failed. 1067 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1068 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1069 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1070 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1071 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1072 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1073 * @throws { BusinessError } 16000011 - The context does not exist. 1074 * @throws { BusinessError } 16000012 - The application is controlled. 1075 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1076 * @throws { BusinessError } 16000019 - No matching ability is found. 1077 * @throws { BusinessError } 16000050 - Internal error. 1078 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1079 * @throws { BusinessError } 16000055 - Installation-free timed out. 1080 * @throws { BusinessError } 16000071 - App clone is not supported. 1081 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 1082 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1083 * @throws { BusinessError } 16000076 - The app instance key is invalid. 1084 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 1085 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 1086 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 1087 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 1088 * @throws { BusinessError } 16200001 - The caller has been released. 1089 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1090 * @systemapi 1091 * @stagemodelonly 1092 * @since 14 1093 */ 1094 startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void; 1095 1096 /** 1097 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1098 * you can use this method to start ability; If the caller application is in the background, 1099 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1100 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1101 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1102 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1103 * 1104 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1105 * @param { Want } want - Indicates the ability to start. 1106 * @param { number } accountId - Indicates the accountId to start. 1107 * @param { StartOptions } [options] - Indicates the start options. 1108 * @returns { Promise<void> } The promise returned by the function. 1109 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1110 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1111 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1112 * 2. Incorrect parameter types; 3. Parameter verification failed. 1113 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1114 * @throws { BusinessError } 16000002 - Incorrect ability type. 1115 * @throws { BusinessError } 16000004 - Can not start invisible component. 1116 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1117 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1118 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1119 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1120 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1121 * @throws { BusinessError } 16000011 - The context does not exist. 1122 * @throws { BusinessError } 16000012 - The application is controlled. 1123 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1124 * @throws { BusinessError } 16000050 - Internal error. 1125 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1126 * @throws { BusinessError } 16000055 - Installation-free timed out. 1127 * @throws { BusinessError } 16200001 - The caller has been released. 1128 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1129 * @systemapi 1130 * @stagemodelonly 1131 * @since 9 1132 */ 1133 /** 1134 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1135 * you can use this method to start ability; If the caller application is in the background, 1136 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1137 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1138 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1139 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1140 * 1141 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1142 * @param { Want } want - Indicates the ability to start. 1143 * @param { number } accountId - Indicates the accountId to start. 1144 * @param { StartOptions } [options] - Indicates the start options. 1145 * @returns { Promise<void> } The promise returned by the function. 1146 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1147 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1148 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1149 * 2. Incorrect parameter types; 3. Parameter verification failed. 1150 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1151 * @throws { BusinessError } 16000002 - Incorrect ability type. 1152 * @throws { BusinessError } 16000004 - Can not start invisible component. 1153 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1154 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1155 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1156 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1157 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 1158 * @throws { BusinessError } 16000011 - The context does not exist. 1159 * @throws { BusinessError } 16000012 - The application is controlled. 1160 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1161 * @throws { BusinessError } 16000019 - Can not match any component. 1162 * @throws { BusinessError } 16000050 - Internal error. 1163 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1164 * @throws { BusinessError } 16000055 - Installation-free timed out. 1165 * @throws { BusinessError } 16200001 - The caller has been released. 1166 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1167 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1168 * @systemapi 1169 * @stagemodelonly 1170 * @since 12 1171 */ 1172 /** 1173 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 1174 * you can use this method to start ability; If the caller application is in the background, 1175 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1176 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1177 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1178 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1179 * 1180 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1181 * @param { Want } want - Indicates the ability to start. 1182 * @param { number } accountId - Indicates the accountId to start. 1183 * @param { StartOptions } [options] - Indicates the start options. 1184 * @returns { Promise<void> } The promise returned by the function. 1185 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1186 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1187 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1188 * 2. Incorrect parameter types; 3. Parameter verification failed. 1189 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1190 * @throws { BusinessError } 16000002 - Incorrect ability type. 1191 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1192 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1193 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1194 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1195 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1196 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 1197 * @throws { BusinessError } 16000011 - The context does not exist. 1198 * @throws { BusinessError } 16000012 - The application is controlled. 1199 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1200 * @throws { BusinessError } 16000019 - No matching ability is found. 1201 * @throws { BusinessError } 16000050 - Internal error. 1202 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1203 * @throws { BusinessError } 16000055 - Installation-free timed out. 1204 * @throws { BusinessError } 16000071 - App clone is not supported. 1205 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 1206 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1207 * @throws { BusinessError } 16000076 - The app instance key is invalid. 1208 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 1209 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 1210 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 1211 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 1212 * @throws { BusinessError } 16200001 - The caller has been released. 1213 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1214 * @systemapi 1215 * @stagemodelonly 1216 * @since 14 1217 */ 1218 startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>; 1219 1220 /** 1221 * Starts a new service extension ability. 1222 * 1223 * @param { Want } want - Indicates the want info to start. 1224 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1225 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1226 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1227 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1228 * 2. Incorrect parameter types; 3. Parameter verification failed. 1229 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1230 * @throws { BusinessError } 16000002 - Incorrect ability type. 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 } 16000011 - The context does not exist. 1235 * @throws { BusinessError } 16000050 - Internal error. 1236 * @throws { BusinessError } 16200001 - The caller has been released. 1237 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1238 * @systemapi 1239 * @stagemodelonly 1240 * @since 9 1241 */ 1242 /** 1243 * Starts a new service extension ability. 1244 * If the target service extension ability is visible, you can start the target service extension ability; 1245 * If the target service extension ability is invisible, 1246 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1247 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1248 * 1249 * @param { Want } want - Indicates the want info to start. 1250 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1251 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1252 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1253 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1254 * 2. Incorrect parameter types; 3. Parameter verification failed. 1255 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1256 * @throws { BusinessError } 16000002 - Incorrect ability type. 1257 * @throws { BusinessError } 16000004 - Can not start invisible component. 1258 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1259 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1260 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1261 * @throws { BusinessError } 16000011 - The context does not exist. 1262 * @throws { BusinessError } 16000012 - The application is controlled. 1263 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1264 * @throws { BusinessError } 16000050 - Internal error. 1265 * @throws { BusinessError } 16200001 - The caller has been released. 1266 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1267 * @systemapi 1268 * @stagemodelonly 1269 * @since 10 1270 */ 1271 /** 1272 * Starts a new service extension ability. 1273 * If the target service extension ability is visible, you can start the target service extension ability; 1274 * If the target service extension ability is invisible, 1275 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1276 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1277 * 1278 * @param { Want } want - Indicates the want info to start. 1279 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 1280 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1281 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1283 * 2. Incorrect parameter types; 3. Parameter verification failed. 1284 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1285 * @throws { BusinessError } 16000002 - Incorrect ability type. 1286 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1287 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1288 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1289 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1290 * @throws { BusinessError } 16000011 - The context does not exist. 1291 * @throws { BusinessError } 16000012 - The application is controlled. 1292 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1293 * @throws { BusinessError } 16000019 - No matching ability is found. 1294 * @throws { BusinessError } 16000050 - Internal error. 1295 * @throws { BusinessError } 16200001 - The caller has been released. 1296 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1297 * @systemapi 1298 * @stagemodelonly 1299 * @since 12 1300 */ 1301 startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 1302 1303 /** 1304 * Starts a new service extension ability. 1305 * 1306 * @param { Want } want - Indicates the want info to start. 1307 * @returns { Promise<void> } The promise returned by the function. 1308 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1309 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1310 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1311 * 2. Incorrect parameter types; 3. Parameter verification failed. 1312 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1313 * @throws { BusinessError } 16000002 - Incorrect ability type. 1314 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1315 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1316 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1317 * @throws { BusinessError } 16000011 - The context does not exist. 1318 * @throws { BusinessError } 16000050 - Internal error. 1319 * @throws { BusinessError } 16200001 - The caller has been released. 1320 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1321 * @systemapi 1322 * @stagemodelonly 1323 * @since 9 1324 */ 1325 /** 1326 * Starts a new service extension ability. 1327 * If the target service extension ability is visible, you can start the target service extension ability; 1328 * If the target service extension ability is invisible, 1329 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1330 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1331 * 1332 * @param { Want } want - Indicates the want info to start. 1333 * @returns { Promise<void> } The promise returned by the function. 1334 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1335 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1336 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1337 * 2. Incorrect parameter types; 3. Parameter verification failed. 1338 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1339 * @throws { BusinessError } 16000002 - Incorrect ability type. 1340 * @throws { BusinessError } 16000004 - Can not start invisible component. 1341 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1342 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1343 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1344 * @throws { BusinessError } 16000011 - The context does not exist. 1345 * @throws { BusinessError } 16000012 - The application is controlled. 1346 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1347 * @throws { BusinessError } 16000050 - Internal error. 1348 * @throws { BusinessError } 16200001 - The caller has been released. 1349 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1350 * @systemapi 1351 * @stagemodelonly 1352 * @since 10 1353 */ 1354 /** 1355 * Starts a new service extension ability. 1356 * If the target service extension ability is visible, you can start the target service extension ability; 1357 * If the target service extension ability is invisible, 1358 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1359 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1360 * 1361 * @param { Want } want - Indicates the want info to start. 1362 * @returns { Promise<void> } The promise returned by the function. 1363 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1364 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1365 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1366 * 2. Incorrect parameter types; 3. Parameter verification failed. 1367 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1368 * @throws { BusinessError } 16000002 - Incorrect ability type. 1369 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1370 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1371 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1372 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1373 * @throws { BusinessError } 16000011 - The context does not exist. 1374 * @throws { BusinessError } 16000012 - The application is controlled. 1375 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1376 * @throws { BusinessError } 16000019 - No matching ability is found. 1377 * @throws { BusinessError } 16000050 - Internal error. 1378 * @throws { BusinessError } 16200001 - The caller has been released. 1379 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1380 * @systemapi 1381 * @stagemodelonly 1382 * @since 12 1383 */ 1384 startServiceExtensionAbility(want: Want): Promise<void>; 1385 1386 /** 1387 * Starts a new service extension ability with account. 1388 * 1389 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1390 * @param { Want } want - Indicates the want info to start. 1391 * @param { number } accountId - Indicates the account to start. 1392 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1393 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1394 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1395 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1396 * 2. Incorrect parameter types; 3. Parameter verification failed. 1397 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1398 * @throws { BusinessError } 16000002 - Incorrect ability type. 1399 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1400 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1401 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1402 * @throws { BusinessError } 16000011 - The context does not exist. 1403 * @throws { BusinessError } 16000050 - Internal error. 1404 * @throws { BusinessError } 16200001 - The caller has been released. 1405 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1406 * @systemapi 1407 * @stagemodelonly 1408 * @since 9 1409 */ 1410 /** 1411 * Starts a new service extension ability with account. 1412 * If the target service extension ability is visible, you can start the target service extension ability; 1413 * If the target service extension ability is invisible, 1414 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1415 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1416 * 1417 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1418 * @param { Want } want - Indicates the want info to start. 1419 * @param { number } accountId - Indicates the account to start. 1420 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1421 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1422 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1423 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1424 * 2. Incorrect parameter types; 3. Parameter verification failed. 1425 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1426 * @throws { BusinessError } 16000002 - Incorrect ability type. 1427 * @throws { BusinessError } 16000004 - Can not start invisible component. 1428 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1429 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1430 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1431 * @throws { BusinessError } 16000011 - The context does not exist. 1432 * @throws { BusinessError } 16000012 - The application is controlled. 1433 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1434 * @throws { BusinessError } 16000050 - Internal error. 1435 * @throws { BusinessError } 16200001 - The caller has been released. 1436 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1437 * @systemapi 1438 * @stagemodelonly 1439 * @since 10 1440 */ 1441 /** 1442 * Starts a new service extension ability with account. 1443 * If the target service extension ability is visible, you can start the target service extension ability; 1444 * If the target service extension ability is invisible, 1445 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1446 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1447 * 1448 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1449 * @param { Want } want - Indicates the want info to start. 1450 * @param { number } accountId - Indicates the account to start. 1451 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1452 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1453 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1454 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1455 * 2. Incorrect parameter types; 3. Parameter verification failed. 1456 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1457 * @throws { BusinessError } 16000002 - Incorrect ability type. 1458 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1459 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1460 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1461 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1462 * @throws { BusinessError } 16000011 - The context does not exist. 1463 * @throws { BusinessError } 16000012 - The application is controlled. 1464 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1465 * @throws { BusinessError } 16000019 - No matching ability is found. 1466 * @throws { BusinessError } 16000050 - Internal error. 1467 * @throws { BusinessError } 16200001 - The caller has been released. 1468 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1469 * @systemapi 1470 * @stagemodelonly 1471 * @since 12 1472 */ 1473 startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1474 1475 /** 1476 * Starts a new service extension ability with account. 1477 * 1478 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1479 * @param { Want } want - Indicates the want info to start. 1480 * @param { number } accountId - Indicates the account to start. 1481 * @returns { Promise<void> } The promise returned by the function. 1482 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1483 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1485 * 2. Incorrect parameter types; 3. Parameter verification failed. 1486 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1487 * @throws { BusinessError } 16000002 - Incorrect ability type. 1488 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1489 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1490 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1491 * @throws { BusinessError } 16000011 - The context does not exist. 1492 * @throws { BusinessError } 16000050 - Internal error. 1493 * @throws { BusinessError } 16200001 - The caller has been released. 1494 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1495 * @systemapi 1496 * @stagemodelonly 1497 * @since 9 1498 */ 1499 /** 1500 * Starts a new service extension ability with account. 1501 * If the target service extension ability is visible, you can start the target service extension ability; 1502 * If the target service extension ability is invisible, 1503 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1504 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1505 * 1506 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1507 * @param { Want } want - Indicates the want info to start. 1508 * @param { number } accountId - Indicates the account to start. 1509 * @returns { Promise<void> } The promise returned by the function. 1510 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1511 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1512 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1513 * 2. Incorrect parameter types; 3. Parameter verification failed. 1514 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1515 * @throws { BusinessError } 16000002 - Incorrect ability type. 1516 * @throws { BusinessError } 16000004 - Can not start invisible component. 1517 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1518 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1519 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1520 * @throws { BusinessError } 16000011 - The context does not exist. 1521 * @throws { BusinessError } 16000012 - The application is controlled. 1522 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1523 * @throws { BusinessError } 16000050 - Internal error. 1524 * @throws { BusinessError } 16200001 - The caller has been released. 1525 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1526 * @systemapi 1527 * @stagemodelonly 1528 * @since 10 1529 */ 1530 /** 1531 * Starts a new service extension ability with account. 1532 * If the target service extension ability is visible, you can start the target service extension ability; 1533 * If the target service extension ability is invisible, 1534 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1535 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1536 * 1537 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1538 * @param { Want } want - Indicates the want info to start. 1539 * @param { number } accountId - Indicates the account to start. 1540 * @returns { Promise<void> } The promise returned by the function. 1541 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1542 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1543 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1544 * 2. Incorrect parameter types; 3. Parameter verification failed. 1545 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1546 * @throws { BusinessError } 16000002 - Incorrect ability type. 1547 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1548 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1549 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1550 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1551 * @throws { BusinessError } 16000011 - The context does not exist. 1552 * @throws { BusinessError } 16000012 - The application is controlled. 1553 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1554 * @throws { BusinessError } 16000019 - No matching ability is found. 1555 * @throws { BusinessError } 16000050 - Internal error. 1556 * @throws { BusinessError } 16200001 - The caller has been released. 1557 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1558 * @systemapi 1559 * @stagemodelonly 1560 * @since 12 1561 */ 1562 startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1563 1564 /** 1565 * Stops a service within the same application. 1566 * 1567 * @param { Want } want - Indicates the want info to start. 1568 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1569 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1570 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1571 * 2. Incorrect parameter types; 3. Parameter verification failed. 1572 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1573 * @throws { BusinessError } 16000002 - Incorrect ability type. 1574 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1575 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1576 * @throws { BusinessError } 16000011 - The context does not exist. 1577 * @throws { BusinessError } 16000050 - Internal error. 1578 * @throws { BusinessError } 16200001 - The caller has been released. 1579 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1580 * @systemapi 1581 * @stagemodelonly 1582 * @since 9 1583 */ 1584 /** 1585 * Stops other service extension ability. 1586 * If the target service extension ability is visible, you can stop the target service extension ability; 1587 * If the target service extension ability is invisible, 1588 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1589 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1590 * 1591 * @param { Want } want - Indicates the want info to start. 1592 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1593 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1594 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1595 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1596 * 2. Incorrect parameter types; 3. Parameter verification failed. 1597 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1598 * @throws { BusinessError } 16000002 - Incorrect ability type. 1599 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1600 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1601 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1602 * @throws { BusinessError } 16000011 - The context does not exist. 1603 * @throws { BusinessError } 16000050 - Internal error. 1604 * @throws { BusinessError } 16200001 - The caller has been released. 1605 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1606 * @systemapi 1607 * @stagemodelonly 1608 * @since 10 1609 */ 1610 stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 1611 1612 /** 1613 * Stops a service within the same application. 1614 * 1615 * @param { Want } want - Indicates the want info to start. 1616 * @returns { Promise<void> } The promise returned by the function. 1617 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1618 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1619 * 2. Incorrect parameter types; 3. Parameter verification failed. 1620 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1621 * @throws { BusinessError } 16000002 - Incorrect ability type. 1622 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1623 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1624 * @throws { BusinessError } 16000011 - The context does not exist. 1625 * @throws { BusinessError } 16000050 - Internal error. 1626 * @throws { BusinessError } 16200001 - The caller has been released. 1627 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1628 * @systemapi 1629 * @stagemodelonly 1630 * @since 9 1631 */ 1632 /** 1633 * Stops other service extension ability. 1634 * If the target service extension ability is visible, you can stop the target service extension ability; 1635 * If the target service extension ability is invisible, 1636 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1637 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1638 * 1639 * @param { Want } want - Indicates the want info to start. 1640 * @returns { Promise<void> } The promise returned by the function. 1641 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1642 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1643 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1644 * 2. Incorrect parameter types; 3. Parameter verification failed. 1645 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1646 * @throws { BusinessError } 16000002 - Incorrect ability type. 1647 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1648 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1649 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1650 * @throws { BusinessError } 16000011 - The context does not exist. 1651 * @throws { BusinessError } 16000050 - Internal error. 1652 * @throws { BusinessError } 16200001 - The caller has been released. 1653 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1654 * @systemapi 1655 * @stagemodelonly 1656 * @since 10 1657 */ 1658 stopServiceExtensionAbility(want: Want): Promise<void>; 1659 1660 /** 1661 * Stops a service within the same application with account. 1662 * 1663 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1664 * @param { Want } want - Indicates the want info to start. 1665 * @param { number } accountId - Indicates the accountId to start. 1666 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 1667 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1668 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1669 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1670 * 2. Incorrect parameter types; 3. Parameter verification failed. 1671 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1672 * @throws { BusinessError } 16000002 - Incorrect ability type. 1673 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1674 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1675 * @throws { BusinessError } 16000011 - The context does not exist. 1676 * @throws { BusinessError } 16000050 - Internal error. 1677 * @throws { BusinessError } 16200001 - The caller has been released. 1678 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1679 * @systemapi 1680 * @stagemodelonly 1681 * @since 9 1682 */ 1683 /** 1684 * Stops other service extension ability with account. 1685 * If the target service extension ability is visible, you can stop the target service extension ability; 1686 * If the target service extension ability is invisible, 1687 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1688 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1689 * 1690 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1691 * @param { Want } want - Indicates the want info to start. 1692 * @param { number } accountId - Indicates the accountId to start. 1693 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 1694 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1695 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1696 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1697 * 2. Incorrect parameter types; 3. Parameter verification failed. 1698 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1699 * @throws { BusinessError } 16000002 - Incorrect ability type. 1700 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1701 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1702 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1703 * @throws { BusinessError } 16000011 - The context does not exist. 1704 * @throws { BusinessError } 16000050 - Internal error. 1705 * @throws { BusinessError } 16200001 - The caller has been released. 1706 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1707 * @systemapi 1708 * @stagemodelonly 1709 * @since 10 1710 */ 1711 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1712 1713 /** 1714 * Stops a service within the same application with account. 1715 * 1716 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1717 * @param { Want } want - Indicates the want info to start. 1718 * @param { number } accountId - Indicates the accountId to start. 1719 * @returns { Promise<void> } The promise returned by the function. 1720 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1721 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1723 * 2. Incorrect parameter types; 3. Parameter verification failed. 1724 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1725 * @throws { BusinessError } 16000002 - Incorrect ability type. 1726 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1727 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1728 * @throws { BusinessError } 16000011 - The context does not exist. 1729 * @throws { BusinessError } 16000050 - Internal error. 1730 * @throws { BusinessError } 16200001 - The caller has been released. 1731 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1732 * @systemapi 1733 * @stagemodelonly 1734 * @since 9 1735 */ 1736 /** 1737 * Stops other service extension ability with account. 1738 * If the target service extension ability is visible, you can stop the target service extension ability; 1739 * If the target service extension ability is invisible, 1740 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1741 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1742 * 1743 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1744 * @param { Want } want - Indicates the want info to start. 1745 * @param { number } accountId - Indicates the accountId to start. 1746 * @returns { Promise<void> } The promise returned by the function. 1747 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1748 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1749 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1750 * 2. Incorrect parameter types; 3. Parameter verification failed. 1751 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1752 * @throws { BusinessError } 16000002 - Incorrect ability type. 1753 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1754 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1755 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1756 * @throws { BusinessError } 16000011 - The context does not exist. 1757 * @throws { BusinessError } 16000050 - Internal error. 1758 * @throws { BusinessError } 16200001 - The caller has been released. 1759 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1760 * @systemapi 1761 * @stagemodelonly 1762 * @since 10 1763 */ 1764 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1765 1766 /** 1767 * Destroys this service extension. 1768 * 1769 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1771 * 2. Incorrect parameter types; 3. Parameter verification failed. 1772 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1773 * @throws { BusinessError } 16000004 - Can not start invisible component. 1774 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1775 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1776 * @throws { BusinessError } 16000011 - The context does not exist. 1777 * @throws { BusinessError } 16000050 - Internal error. 1778 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1779 * @systemapi 1780 * @stagemodelonly 1781 * @since 9 1782 */ 1783 /** 1784 * Destroys this service extension. 1785 * 1786 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1787 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1788 * 2. Incorrect parameter types; 3. Parameter verification failed. 1789 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1790 * @throws { BusinessError } 16000011 - The context does not exist. 1791 * @throws { BusinessError } 16000050 - Internal error. 1792 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1793 * @systemapi 1794 * @stagemodelonly 1795 * @since 10 1796 */ 1797 terminateSelf(callback: AsyncCallback<void>): void; 1798 1799 /** 1800 * Destroys this service extension. 1801 * 1802 * @returns { Promise<void> } The promise returned by the function. 1803 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1804 * @throws { BusinessError } 16000004 - Can not start invisible component. 1805 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1806 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1807 * @throws { BusinessError } 16000011 - The context does not exist. 1808 * @throws { BusinessError } 16000050 - Internal error. 1809 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1810 * @systemapi 1811 * @stagemodelonly 1812 * @since 9 1813 */ 1814 /** 1815 * Destroys this service extension. 1816 * 1817 * @returns { Promise<void> } The promise returned by the function. 1818 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1819 * @throws { BusinessError } 16000011 - The context does not exist. 1820 * @throws { BusinessError } 16000050 - Internal error. 1821 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1822 * @systemapi 1823 * @stagemodelonly 1824 * @since 10 1825 */ 1826 terminateSelf(): Promise<void>; 1827 1828 /** 1829 * Connects an ability to a Service extension. 1830 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1831 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1832 * service extension when the Service extension is connected.</p> 1833 * 1834 * @param { Want } want - Indicates the service extension to connect. 1835 * @param { ConnectOptions } options - Indicates the callback of connection. 1836 * @returns { number } Returns the connection id. 1837 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1838 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1839 * 2. Incorrect parameter types; 3. Parameter verification failed. 1840 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1841 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1842 * @throws { BusinessError } 16000011 - The context does not exist. 1843 * @throws { BusinessError } 16000050 - Internal error. 1844 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1845 * @systemapi 1846 * @stagemodelonly 1847 * @since 9 1848 */ 1849 /** 1850 * Connects an ability to a service extension ability. 1851 * If the target service extension ability is visible, you can connect the target service extension ability; 1852 * If the target service extension ability is invisible, 1853 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1854 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1855 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1856 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1857 * service extension when the Service extension is connected.</p> 1858 * 1859 * @param { Want } want - Indicates the service extension to connect. 1860 * @param { ConnectOptions } options - Indicates the callback of connection. 1861 * @returns { number } Returns the connection id. 1862 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1863 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1864 * 2. Incorrect parameter types; 3. Parameter verification failed. 1865 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1866 * @throws { BusinessError } 16000002 - Incorrect ability type. 1867 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1868 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1869 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1870 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1871 * @throws { BusinessError } 16000011 - The context does not exist. 1872 * @throws { BusinessError } 16000050 - Internal error. 1873 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1874 * @throws { BusinessError } 16000055 - Installation-free timed out. 1875 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1876 * @systemapi 1877 * @stagemodelonly 1878 * @since 10 1879 */ 1880 connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; 1881 1882 /** 1883 * Connects an ability to a Service extension with account. 1884 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1885 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1886 * service extension when the Service extension is connected.</p> 1887 * 1888 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1889 * @param { Want } want - Indicates the service extension to connect. 1890 * @param { number } accountId - Indicates the account to connect. 1891 * @param { ConnectOptions } options - Indicates the callback of connection. 1892 * @returns { number } Returns the connection id. 1893 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1894 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1895 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1896 * 2. Incorrect parameter types; 3. Parameter verification failed. 1897 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1898 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1899 * @throws { BusinessError } 16000011 - The context does not exist. 1900 * @throws { BusinessError } 16000050 - Internal error. 1901 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1902 * @systemapi 1903 * @stagemodelonly 1904 * @since 9 1905 */ 1906 /** 1907 * Connects an ability to a service extension ability with account. 1908 * If the target service extension ability is visible, you can connect the target service extension ability; 1909 * If the target service extension ability is invisible, 1910 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1911 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1912 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1913 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1914 * service extension when the Service extension is connected.</p> 1915 * 1916 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1917 * @param { Want } want - Indicates the service extension to connect. 1918 * @param { number } accountId - Indicates the account to connect. 1919 * @param { ConnectOptions } options - Indicates the callback of connection. 1920 * @returns { number } Returns the connection id. 1921 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1922 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1923 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1924 * 2. Incorrect parameter types; 3. Parameter verification failed. 1925 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1926 * @throws { BusinessError } 16000002 - Incorrect ability type. 1927 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 1928 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1929 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1930 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1931 * @throws { BusinessError } 16000011 - The context does not exist. 1932 * @throws { BusinessError } 16000050 - Internal error. 1933 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1934 * @throws { BusinessError } 16000055 - Installation-free timed out. 1935 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1936 * @systemapi 1937 * @stagemodelonly 1938 * @since 10 1939 */ 1940 connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; 1941 1942 /** 1943 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1944 * 1945 * @param { number } connection - the connection id returned from connectAbility api. 1946 * @param { AsyncCallback<void> } callback - The callback of disconnectAbility. 1947 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1948 * 2. Incorrect parameter types; 3. Parameter verification failed. 1949 * @throws { BusinessError } 16000011 - The context does not exist. 1950 * @throws { BusinessError } 16000050 - Internal error. 1951 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1952 * @systemapi 1953 * @stagemodelonly 1954 * @since 9 1955 */ 1956 disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void; 1957 1958 /** 1959 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1960 * 1961 * @param { number } connection - the connection id returned from connectAbility api. 1962 * @returns { Promise<void> } The promise returned by the function. 1963 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1964 * 2. Incorrect parameter types; 3. Parameter verification failed. 1965 * @throws { BusinessError } 16000011 - The context does not exist. 1966 * @throws { BusinessError } 16000050 - Internal error. 1967 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1968 * @systemapi 1969 * @stagemodelonly 1970 * @since 9 1971 */ 1972 disconnectServiceExtensionAbility(connection: number): Promise<void>; 1973 1974 /** 1975 * Get the caller object of the startup capability. 1976 * 1977 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 1978 * @param { Want } want - Indicates the ability to start. 1979 * @returns { Promise<Caller> } Returns the Caller interface. 1980 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1981 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1982 * 2. Incorrect parameter types; 3. Parameter verification failed. 1983 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1984 * @throws { BusinessError } 16000002 - Incorrect ability type. 1985 * @throws { BusinessError } 16000004 - Can not start invisible component. 1986 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1987 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1988 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1989 * @throws { BusinessError } 16000011 - The context does not exist. 1990 * @throws { BusinessError } 16000050 - Internal error. 1991 * @throws { BusinessError } 16200001 - The caller has been released. 1992 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1993 * @systemapi 1994 * @stagemodelonly 1995 * @since 9 1996 */ 1997 /** 1998 * Get the caller object of the startup capability. 1999 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION to use this method. 2000 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2001 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2002 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2003 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2004 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2005 * 2006 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 2007 * @param { Want } want - Indicates the ability to start. 2008 * @returns { Promise<Caller> } Returns the Caller interface. 2009 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2010 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2011 * 2. Incorrect parameter types; 3. Parameter verification failed. 2012 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2013 * @throws { BusinessError } 16000002 - Incorrect ability type. 2014 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2015 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2016 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2017 * @throws { BusinessError } 16000011 - The context does not exist. 2018 * @throws { BusinessError } 16000050 - Internal error. 2019 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2020 * @systemapi 2021 * @stagemodelonly 2022 * @since 10 2023 */ 2024 startAbilityByCall(want: Want): Promise<Caller>; 2025 2026 /** 2027 * Get the caller object that specifies the accountId startup capability 2028 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 2029 * and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS to use this method. 2030 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2031 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2032 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2033 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2034 * 2035 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 2036 * @param { Want } want - Indicates the ability to start. 2037 * @param { number } accountId - Indicates the account to start. 2038 * @returns { Promise<Caller> } Returns the Caller interface. 2039 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2040 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2041 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2042 * 2. Incorrect parameter types; 3. Parameter verification failed. 2043 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2044 * @throws { BusinessError } 16000002 - Incorrect ability type. 2045 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2046 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2047 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2048 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2049 * @throws { BusinessError } 16000011 - The context does not exist. 2050 * @throws { BusinessError } 16000012 - The application is controlled. 2051 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 2052 * @throws { BusinessError } 16000050 - Internal error. 2053 * @throws { BusinessError } 16200001 - The caller has been released. 2054 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2055 * @systemapi 2056 * @stagemodelonly 2057 * @since 10 2058 */ 2059 startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller>; 2060 2061 /** 2062 * Service extension uses this method to start a specific ability, 2063 * if ability is multi instance, will start a recent instance. 2064 * 2065 * @param { Want } want - Indicates the ability to start. 2066 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2067 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2068 * 2. Incorrect parameter types; 3. Parameter verification failed. 2069 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2070 * @throws { BusinessError } 16000002 - Incorrect ability type. 2071 * @throws { BusinessError } 16000004 - Can not start invisible component. 2072 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2073 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2074 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2075 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2076 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2077 * @throws { BusinessError } 16000011 - The context does not exist. 2078 * @throws { BusinessError } 16000050 - Internal error. 2079 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2080 * @throws { BusinessError } 16000055 - Installation-free timed out. 2081 * @throws { BusinessError } 16200001 - The caller has been released. 2082 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2083 * @systemapi 2084 * @stagemodelonly 2085 * @since 9 2086 */ 2087 /** 2088 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2089 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2090 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2091 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2092 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2093 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2094 * 2095 * @param { Want } want - Indicates the ability to start. 2096 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2097 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2098 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2099 * 2. Incorrect parameter types; 3. Parameter verification failed. 2100 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2101 * @throws { BusinessError } 16000002 - Incorrect ability type. 2102 * @throws { BusinessError } 16000004 - Can not start invisible component. 2103 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2104 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2105 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2106 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2107 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2108 * @throws { BusinessError } 16000011 - The context does not exist. 2109 * @throws { BusinessError } 16000050 - Internal error. 2110 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2111 * @throws { BusinessError } 16000055 - Installation-free timed out. 2112 * @throws { BusinessError } 16200001 - The caller has been released. 2113 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2114 * @systemapi 2115 * @stagemodelonly 2116 * @since 10 2117 */ 2118 /** 2119 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2120 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2121 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2122 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2123 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2124 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2125 * 2126 * @param { Want } want - Indicates the ability to start. 2127 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2128 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2129 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2130 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2131 * 2. Incorrect parameter types; 3. Parameter verification failed. 2132 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2133 * @throws { BusinessError } 16000002 - Incorrect ability type. 2134 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2135 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2136 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2137 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2138 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2139 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2140 * @throws { BusinessError } 16000011 - The context does not exist. 2141 * @throws { BusinessError } 16000050 - Internal error. 2142 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2143 * @throws { BusinessError } 16000055 - Installation-free timed out. 2144 * @throws { BusinessError } 16000071 - App clone is not supported. 2145 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2146 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2147 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2148 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2149 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2150 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2151 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2152 * @throws { BusinessError } 16200001 - The caller has been released. 2153 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2154 * @systemapi 2155 * @stagemodelonly 2156 * @since 14 2157 */ 2158 startRecentAbility(want: Want, callback: AsyncCallback<void>): void; 2159 2160 /** 2161 * Service extension uses this method to start a specific ability, 2162 * if ability is multi instance, will start a recent instance. 2163 * 2164 * @param { Want } want - Indicates the ability to start. 2165 * @param { StartOptions } options - Indicates the start options. 2166 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2168 * 2. Incorrect parameter types; 3. Parameter verification failed. 2169 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2170 * @throws { BusinessError } 16000002 - Incorrect ability type. 2171 * @throws { BusinessError } 16000004 - Can not start invisible component. 2172 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2173 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2174 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2175 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2176 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2177 * @throws { BusinessError } 16000011 - The context does not exist. 2178 * @throws { BusinessError } 16000050 - Internal error. 2179 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2180 * @throws { BusinessError } 16000055 - Installation-free timed out. 2181 * @throws { BusinessError } 16200001 - The caller has been released. 2182 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2183 * @systemapi 2184 * @stagemodelonly 2185 * @since 9 2186 */ 2187 /** 2188 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2189 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2190 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2191 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2192 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2193 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2194 * 2195 * @param { Want } want - Indicates the ability to start. 2196 * @param { StartOptions } options - Indicates the start options. 2197 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2198 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2199 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2200 * 2. Incorrect parameter types; 3. Parameter verification failed. 2201 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2202 * @throws { BusinessError } 16000004 - Can not start invisible component. 2203 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2204 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2205 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2206 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2207 * @throws { BusinessError } 16000011 - The context does not exist. 2208 * @throws { BusinessError } 16000050 - Internal error. 2209 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2210 * @throws { BusinessError } 16000055 - Installation-free timed out. 2211 * @throws { BusinessError } 16200001 - The caller has been released. 2212 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2213 * @systemapi 2214 * @stagemodelonly 2215 * @since 10 2216 */ 2217 /** 2218 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2219 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2220 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2221 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2222 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2223 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2224 * 2225 * @param { Want } want - Indicates the ability to start. 2226 * @param { StartOptions } options - Indicates the start options. 2227 * @param { AsyncCallback<void> } callback - The callback of startAbility. 2228 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2229 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2230 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2231 * 2. Incorrect parameter types; 3. Parameter verification failed. 2232 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2233 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2234 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2235 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2236 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2237 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2238 * @throws { BusinessError } 16000011 - The context does not exist. 2239 * @throws { BusinessError } 16000050 - Internal error. 2240 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2241 * @throws { BusinessError } 16000055 - Installation-free timed out. 2242 * @throws { BusinessError } 16000071 - App clone is not supported. 2243 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2244 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2245 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2246 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2247 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2248 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2249 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2250 * @throws { BusinessError } 16200001 - The caller has been released. 2251 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2252 * @systemapi 2253 * @stagemodelonly 2254 * @since 14 2255 */ 2256 startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 2257 2258 /** 2259 * Service extension uses this method to start a specific ability, 2260 * if ability is multi instance, will start a recent instance. 2261 * 2262 * @param { Want } want - Indicates the ability to start. 2263 * @param { StartOptions } [options] - Indicates the start options. 2264 * @returns { Promise<void> } The promise returned by the function. 2265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2266 * 2. Incorrect parameter types; 3. Parameter verification failed. 2267 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2268 * @throws { BusinessError } 16000002 - Incorrect ability type. 2269 * @throws { BusinessError } 16000004 - Can not start invisible component. 2270 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2271 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2272 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2273 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2274 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 2275 * @throws { BusinessError } 16000011 - The context does not exist. 2276 * @throws { BusinessError } 16000050 - Internal error. 2277 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2278 * @throws { BusinessError } 16000055 - Installation-free timed out. 2279 * @throws { BusinessError } 16200001 - The caller has been released. 2280 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2281 * @systemapi 2282 * @stagemodelonly 2283 * @since 9 2284 */ 2285 /** 2286 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2287 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2288 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2289 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2290 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2291 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2292 * 2293 * @param { Want } want - Indicates the ability to start. 2294 * @param { StartOptions } [options] - Indicates the start options. 2295 * @returns { Promise<void> } The promise returned by the function. 2296 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2297 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2298 * 2. Incorrect parameter types; 3. Parameter verification failed. 2299 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2300 * @throws { BusinessError } 16000002 - Incorrect ability type. 2301 * @throws { BusinessError } 16000004 - Can not start invisible component. 2302 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2303 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2304 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2305 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2306 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2307 * @throws { BusinessError } 16000011 - The context does not exist. 2308 * @throws { BusinessError } 16000050 - Internal error. 2309 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2310 * @throws { BusinessError } 16000055 - Installation-free timed out. 2311 * @throws { BusinessError } 16200001 - The caller has been released. 2312 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2313 * @systemapi 2314 * @stagemodelonly 2315 * @since 10 2316 */ 2317 /** 2318 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 2319 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 2320 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 2321 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 2322 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 2323 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 2324 * 2325 * @param { Want } want - Indicates the ability to start. 2326 * @param { StartOptions } [options] - Indicates the start options. 2327 * @returns { Promise<void> } The promise returned by the function. 2328 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2329 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2330 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2331 * 2. Incorrect parameter types; 3. Parameter verification failed. 2332 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2333 * @throws { BusinessError } 16000002 - Incorrect ability type. 2334 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2335 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2336 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 2337 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2338 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 2339 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 2340 * @throws { BusinessError } 16000011 - The context does not exist. 2341 * @throws { BusinessError } 16000050 - Internal error. 2342 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 2343 * @throws { BusinessError } 16000055 - Installation-free timed out. 2344 * @throws { BusinessError } 16000071 - App clone is not supported. 2345 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 2346 * @throws { BusinessError } 16000073 - The app clone index is invalid. 2347 * @throws { BusinessError } 16000076 - The app instance key is invalid. 2348 * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. 2349 * @throws { BusinessError } 16000078 - The multi-instance is not supported. 2350 * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. 2351 * @throws { BusinessError } 16000080 - Creating a new instance is not supported. 2352 * @throws { BusinessError } 16200001 - The caller has been released. 2353 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2354 * @systemapi 2355 * @stagemodelonly 2356 * @since 14 2357 */ 2358 startRecentAbility(want: Want, options?: StartOptions): Promise<void>; 2359 2360 /** 2361 * Requests the Modal UIExtensionAbility. 2362 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2363 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2364 * 2365 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2366 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 2367 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2368 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2369 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2370 * 2. Incorrect parameter types; 3. Parameter verification failed. 2371 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2372 * @throws { BusinessError } 16000002 - Incorrect ability type. 2373 * @throws { BusinessError } 16000004 - Can not start invisible component. 2374 * @throws { BusinessError } 16000050 - Internal error. 2375 * @throws { BusinessError } 16200001 - The caller has been released. 2376 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2377 * @systemapi 2378 * @stagemodelonly 2379 * @since 11 2380 */ 2381 /** 2382 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 2383 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 2384 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 2385 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 2386 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 2387 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2388 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2389 * 2390 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2391 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 2392 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2393 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2394 * 2. Incorrect parameter types; 3. Parameter verification failed. 2395 * @throws { BusinessError } 16000050 - Internal error. 2396 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2397 * @systemapi 2398 * @stagemodelonly 2399 * @since 12 2400 */ 2401 requestModalUIExtension(pickerWant: Want, callback: AsyncCallback<void>): void; 2402 2403 /** 2404 * Requests the Modal UIExtensionAbility. 2405 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2406 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2407 * 2408 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2409 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 2410 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2411 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2412 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2413 * 2. Incorrect parameter types; 3. Parameter verification failed. 2414 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2415 * @throws { BusinessError } 16000002 - Incorrect ability type. 2416 * @throws { BusinessError } 16000004 - Can not start invisible component. 2417 * @throws { BusinessError } 16000050 - Internal error. 2418 * @throws { BusinessError } 16200001 - The caller has been released. 2419 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2420 * @systemapi 2421 * @stagemodelonly 2422 * @since 11 2423 */ 2424 /** 2425 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 2426 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 2427 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 2428 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 2429 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 2430 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 2431 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 2432 * 2433 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 2434 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 2435 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2437 * 2. Incorrect parameter types; 3. Parameter verification failed. 2438 * @throws { BusinessError } 16000050 - Internal error. 2439 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2440 * @systemapi 2441 * @stagemodelonly 2442 * @since 12 2443 */ 2444 requestModalUIExtension(pickerWant: Want): Promise<void>; 2445 2446 /** 2447 * preStartMission opens an atomic service window without popping up a loading window 2448 * 2449 * @permission ohos.permission.PRE_START_ATOMIC_SERVICE 2450 * @param { string } bundleName - The bundle name of the atomic service. 2451 * @param { string } moduleName - The module name of the atomic service. 2452 * @param { string } abilityName - The ability name of the atomic service. 2453 * @param { string } startTime - The start time of the atomic service. 2454 * @returns { Promise<void> } The promise returned by the function. 2455 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2456 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2457 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2458 * 2. Incorrect parameter types; 3. Parameter verification failed. 2459 * @throws { BusinessError } 16300007 - The target free install task does not exist. 2460 * @throws { BusinessError } 16000011 - The context does not exist. 2461 * @throws { BusinessError } 16000050 - Internal error. 2462 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2463 * @systemapi 2464 * @stagemodelonly 2465 * @since 12 2466 */ 2467 preStartMission(bundleName: string, moduleName: string, abilityName: string, startTime: string): Promise<void>; 2468 2469 /** 2470 * Starts a UI service extension ability. 2471 * If the target UI service extension ability is visible, you can start the target UI service extension ability; 2472 * If the target UI service extension ability is invisible, 2473 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UI service extension ability. 2474 * 2475 * @param { Want } want - Indicates the want info to start. 2476 * @returns { Promise<void> } The promise returned by the function. 2477 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 2478 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 2479 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2480 * 2. Incorrect parameter types; 3. Parameter verification failed. 2481 * @throws { BusinessError } 801 - Capability not supported. 2482 * @throws { BusinessError } 16000001 - The specified ability does not exist. 2483 * @throws { BusinessError } 16000002 - Incorrect ability type. 2484 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 2485 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 2486 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 2487 * @throws { BusinessError } 16000011 - The context does not exist. 2488 * @throws { BusinessError } 16000012 - The application is controlled. 2489 * @throws { BusinessError } 16000013 - The EDM prohibits the application from launching. 2490 * @throws { BusinessError } 16000019 - No matching ability is found. 2491 * @throws { BusinessError } 16000050 - Internal error. 2492 * @throws { BusinessError } 16200001 - The caller has been released. 2493 * @syscap SystemCapability.Ability.AbilityRuntime.Core 2494 * @systemapi 2495 * @stagemodelonly 2496 * @since 14 2497 */ 2498 startUIServiceExtensionAbility(want: Want): Promise<void>; 2499} 2500