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 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 startAbility(want: Want, callback: AsyncCallback<void>): void; 134 135 /** 136 * Service extension uses this method to start a specific ability. 137 * 138 * @param { Want } want - Indicates the ability to start. 139 * @param { StartOptions } options - Indicates the start options. 140 * @param { AsyncCallback<void> } callback - The callback of startAbility. 141 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 142 * 2. Incorrect parameter types; 3. Parameter verification failed. 143 * @throws { BusinessError } 16000001 - The specified ability does not exist. 144 * @throws { BusinessError } 16000002 - Incorrect ability type. 145 * @throws { BusinessError } 16000004 - Can not start invisible component. 146 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 147 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 148 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 149 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 150 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 151 * @throws { BusinessError } 16000011 - The context does not exist. 152 * @throws { BusinessError } 16000050 - Internal error. 153 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 154 * @throws { BusinessError } 16000055 - Installation-free timed out. 155 * @throws { BusinessError } 16200001 - The caller has been released. 156 * @syscap SystemCapability.Ability.AbilityRuntime.Core 157 * @systemapi 158 * @stagemodelonly 159 * @since 9 160 */ 161 /** 162 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 163 * you can use this method to start ability; If the caller application is in the background, 164 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 165 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 166 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 167 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 168 * 169 * @param { Want } want - Indicates the ability to start. 170 * @param { StartOptions } options - Indicates the start options. 171 * @param { AsyncCallback<void> } callback - The callback of startAbility. 172 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 173 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 174 * 2. Incorrect parameter types; 3. Parameter verification failed. 175 * @throws { BusinessError } 16000001 - The specified ability does not exist. 176 * @throws { BusinessError } 16000004 - Can not start invisible component. 177 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 178 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 179 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 180 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 181 * @throws { BusinessError } 16000011 - The context does not exist. 182 * @throws { BusinessError } 16000012 - The application is controlled. 183 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 184 * @throws { BusinessError } 16000050 - Internal error. 185 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 186 * @throws { BusinessError } 16000055 - Installation-free timed out. 187 * @throws { BusinessError } 16200001 - The caller has been released. 188 * @syscap SystemCapability.Ability.AbilityRuntime.Core 189 * @systemapi 190 * @stagemodelonly 191 * @since 10 192 */ 193 /** 194 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 195 * you can use this method to start ability; If the caller application is in the background, 196 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 197 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 198 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 199 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 200 * 201 * @param { Want } want - Indicates the ability to start. 202 * @param { StartOptions } options - Indicates the start options. 203 * @param { AsyncCallback<void> } callback - The callback of startAbility. 204 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 205 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 206 * 2. Incorrect parameter types; 3. Parameter verification failed. 207 * @throws { BusinessError } 16000001 - The specified ability does not exist. 208 * @throws { BusinessError } 16000004 - Can not start invisible component. 209 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 210 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 211 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 212 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 213 * @throws { BusinessError } 16000011 - The context does not exist. 214 * @throws { BusinessError } 16000012 - The application is controlled. 215 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 216 * @throws { BusinessError } 16000019 - Can not match any component. 217 * @throws { BusinessError } 16000050 - Internal error. 218 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 219 * @throws { BusinessError } 16000055 - Installation-free timed out. 220 * @throws { BusinessError } 16200001 - The caller has been released. 221 * @throws { BusinessError } 16000073 - The app clone index is invalid. 222 * @syscap SystemCapability.Ability.AbilityRuntime.Core 223 * @systemapi 224 * @stagemodelonly 225 * @since 12 226 */ 227 startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 228 229 /** 230 * Service extension uses this method to start a specific ability. 231 * 232 * @param { Want } want - Indicates the ability to start. 233 * @param { StartOptions } options - Indicates the start options. 234 * @returns { Promise<void> } The promise returned by the function. 235 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 236 * 2. Incorrect parameter types; 3. Parameter verification failed. 237 * @throws { BusinessError } 16000001 - The specified ability does not exist. 238 * @throws { BusinessError } 16000002 - Incorrect ability type. 239 * @throws { BusinessError } 16000004 - Can not start invisible component. 240 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 241 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 242 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 243 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 244 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 245 * @throws { BusinessError } 16000011 - The context does not exist. 246 * @throws { BusinessError } 16000050 - Internal error. 247 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 248 * @throws { BusinessError } 16000055 - Installation-free timed out. 249 * @throws { BusinessError } 16200001 - The caller has been released. 250 * @syscap SystemCapability.Ability.AbilityRuntime.Core 251 * @systemapi 252 * @stagemodelonly 253 * @since 9 254 */ 255 /** 256 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 257 * you can use this method to start ability; If the caller application is in the background, 258 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 259 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 260 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 261 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 262 * 263 * @param { Want } want - Indicates the ability to start. 264 * @param { StartOptions } [options] - Indicates the start options. 265 * @returns { Promise<void> } The promise returned by the function. 266 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 268 * 2. Incorrect parameter types; 3. Parameter verification failed. 269 * @throws { BusinessError } 16000001 - The specified ability does not exist. 270 * @throws { BusinessError } 16000002 - Incorrect ability type. 271 * @throws { BusinessError } 16000004 - Can not start invisible component. 272 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 273 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 274 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 275 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 276 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 277 * @throws { BusinessError } 16000011 - The context does not exist. 278 * @throws { BusinessError } 16000012 - The application is controlled. 279 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 280 * @throws { BusinessError } 16000050 - Internal error. 281 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 282 * @throws { BusinessError } 16000055 - Installation-free timed out. 283 * @throws { BusinessError } 16200001 - The caller has been released. 284 * @syscap SystemCapability.Ability.AbilityRuntime.Core 285 * @systemapi 286 * @stagemodelonly 287 * @since 10 288 */ 289 /** 290 * Service extension uses this method to start a specific ability. If the caller application is in foreground, 291 * you can use this method to start ability; If the caller application is in the background, 292 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 293 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 294 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 295 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 296 * 297 * @param { Want } want - Indicates the ability to start. 298 * @param { StartOptions } [options] - Indicates the start options. 299 * @returns { Promise<void> } The promise returned by the function. 300 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 301 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 302 * 2. Incorrect parameter types; 3. Parameter verification failed. 303 * @throws { BusinessError } 16000001 - The specified ability does not exist. 304 * @throws { BusinessError } 16000002 - Incorrect ability type. 305 * @throws { BusinessError } 16000004 - Can not start invisible component. 306 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 307 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 308 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 309 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 310 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 311 * @throws { BusinessError } 16000011 - The context does not exist. 312 * @throws { BusinessError } 16000012 - The application is controlled. 313 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 314 * @throws { BusinessError } 16000019 - Can not match any component. 315 * @throws { BusinessError } 16000050 - Internal error. 316 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 317 * @throws { BusinessError } 16000055 - Installation-free timed out. 318 * @throws { BusinessError } 16200001 - The caller has been released. 319 * @throws { BusinessError } 16000073 - The app clone index is invalid. 320 * @syscap SystemCapability.Ability.AbilityRuntime.Core 321 * @systemapi 322 * @stagemodelonly 323 * @since 12 324 */ 325 startAbility(want: Want, options?: StartOptions): Promise<void>; 326 327 /** 328 * Service extension uses this method to start a specific ability by implicit want. If the caller application is in foreground, 329 * you can use this method to start ability; If the caller application is in the background, 330 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 331 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 332 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 333 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 334 * 335 * @param { string } link - Indicates the ability to start. 336 * @param { OpenLinkOptions } [options] - Indicates the open link options. 337 * @returns { Promise<void> } The promise returned by the function. 338 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 339 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 340 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 341 * 2. Incorrect parameter types; 3. Parameter verification failed. 342 * @throws { BusinessError } 16000001 - The specified ability does not exist. 343 * @throws { BusinessError } 16000002 - Incorrect ability type. 344 * @throws { BusinessError } 16000004 - Can not start invisible component. 345 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 346 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 347 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 348 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 349 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 350 * @throws { BusinessError } 16000011 - The context does not exist. 351 * @throws { BusinessError } 16000012 - The application is controlled. 352 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 353 * @throws { BusinessError } 16000019 - Can not match any component. 354 * @throws { BusinessError } 16200001 - The caller has been released. 355 * @syscap SystemCapability.Ability.AbilityRuntime.Core 356 * @systemapi 357 * @stagemodelonly 358 * @since 12 359 */ 360 openLink(link: string, options?: OpenLinkOptions): Promise<void>; 361 362 /** 363 * Service extension start an ability using the original caller information. If the caller application is in 364 * foreground, you can use this method to start ability; If the caller application is in the background, 365 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 366 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 367 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 368 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 369 * 370 * @param { Want } want - Indicates the ability to start. 371 * @param { AsyncCallback<void> } callback - The callback of startAbility. 372 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 373 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 374 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 375 * 2. Incorrect parameter types; 3. Parameter verification failed. 376 * @throws { BusinessError } 16000001 - The specified ability does not exist. 377 * @throws { BusinessError } 16000002 - Incorrect ability type. 378 * @throws { BusinessError } 16000004 - Can not start invisible component. 379 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 380 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 381 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 382 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 383 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 384 * @throws { BusinessError } 16000011 - The context does not exist. 385 * @throws { BusinessError } 16000012 - The application is controlled. 386 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 387 * @throws { BusinessError } 16000050 - Internal error. 388 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 389 * @throws { BusinessError } 16000055 - Installation-free timed out. 390 * @throws { BusinessError } 16200001 - The caller has been released. 391 * @syscap SystemCapability.Ability.AbilityRuntime.Core 392 * @systemapi 393 * @stagemodelonly 394 * @since 10 395 */ 396 /** 397 * Service extension start an ability using the original caller information. If the caller application is in 398 * foreground, you can use this method to start ability; If the caller application is in the background, 399 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 400 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 401 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 402 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 403 * 404 * @param { Want } want - Indicates the ability to start. 405 * @param { AsyncCallback<void> } callback - The callback of startAbility. 406 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 407 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 408 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 409 * 2. Incorrect parameter types; 3. Parameter verification failed. 410 * @throws { BusinessError } 16000001 - The specified ability does not exist. 411 * @throws { BusinessError } 16000002 - Incorrect ability type. 412 * @throws { BusinessError } 16000004 - Can not start invisible component. 413 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 414 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 415 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 416 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 417 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 418 * @throws { BusinessError } 16000011 - The context does not exist. 419 * @throws { BusinessError } 16000012 - The application is controlled. 420 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 421 * @throws { BusinessError } 16000050 - Internal error. 422 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 423 * @throws { BusinessError } 16000055 - Installation-free timed out. 424 * @throws { BusinessError } 16200001 - The caller has been released. 425 * @throws { BusinessError } 16000073 - The app clone index is invalid. 426 * @syscap SystemCapability.Ability.AbilityRuntime.Core 427 * @systemapi 428 * @stagemodelonly 429 * @since 12 430 */ 431 startAbilityAsCaller(want: Want, callback: AsyncCallback<void>): void; 432 433 /** 434 * Service extension start an ability using the original caller information. If the caller application is in 435 * foreground, you can use this method to start ability; If the caller application is in the background, 436 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 437 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 438 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 439 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 440 * 441 * @param { Want } want - Indicates the ability to start. 442 * @param { StartOptions } options - Indicates the start options. 443 * @param { AsyncCallback<void> } callback - The callback of startAbility. 444 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 445 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 446 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 447 * 2. Incorrect parameter types; 3. Parameter verification failed. 448 * @throws { BusinessError } 16000001 - The specified ability does not exist. 449 * @throws { BusinessError } 16000004 - Can not start invisible component. 450 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 451 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 452 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 453 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 454 * @throws { BusinessError } 16000011 - The context does not exist. 455 * @throws { BusinessError } 16000012 - The application is controlled. 456 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 457 * @throws { BusinessError } 16000050 - Internal error. 458 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 459 * @throws { BusinessError } 16000055 - Installation-free timed out. 460 * @throws { BusinessError } 16200001 - The caller has been released. 461 * @syscap SystemCapability.Ability.AbilityRuntime.Core 462 * @systemapi 463 * @stagemodelonly 464 * @since 10 465 */ 466 /** 467 * Service extension start an ability using the original caller information. If the caller application is in 468 * foreground, you can use this method to start ability; If the caller application is in the background, 469 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 470 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 471 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 472 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 473 * 474 * @param { Want } want - Indicates the ability to start. 475 * @param { StartOptions } options - Indicates the start options. 476 * @param { AsyncCallback<void> } callback - The callback of startAbility. 477 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 478 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 479 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 480 * 2. Incorrect parameter types; 3. Parameter verification failed. 481 * @throws { BusinessError } 16000001 - The specified ability does not exist. 482 * @throws { BusinessError } 16000004 - Can not start invisible component. 483 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 484 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 485 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 486 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 487 * @throws { BusinessError } 16000011 - The context does not exist. 488 * @throws { BusinessError } 16000012 - The application is controlled. 489 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 490 * @throws { BusinessError } 16000050 - Internal error. 491 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 492 * @throws { BusinessError } 16000055 - Installation-free timed out. 493 * @throws { BusinessError } 16200001 - The caller has been released. 494 * @throws { BusinessError } 16000073 - The app clone index is invalid. 495 * @syscap SystemCapability.Ability.AbilityRuntime.Core 496 * @systemapi 497 * @stagemodelonly 498 * @since 12 499 */ 500 startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 501 502 /** 503 * Service extension start an ability using the original caller information. If the caller application is in 504 * foreground, you can use this method to start ability; If the caller application is in the background, 505 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 506 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 507 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 508 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 509 * 510 * @param { Want } want - Indicates the ability to start. 511 * @param { StartOptions } options - Indicates the start options. 512 * @returns { Promise<void> } The promise returned by the function. 513 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 514 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 515 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 516 * 2. Incorrect parameter types; 3. Parameter verification failed. 517 * @throws { BusinessError } 16000001 - The specified ability does not exist. 518 * @throws { BusinessError } 16000002 - Incorrect ability type. 519 * @throws { BusinessError } 16000004 - Can not start invisible component. 520 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 521 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 522 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 523 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 524 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 525 * @throws { BusinessError } 16000011 - The context does not exist. 526 * @throws { BusinessError } 16000012 - The application is controlled. 527 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 528 * @throws { BusinessError } 16000050 - Internal error. 529 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 530 * @throws { BusinessError } 16000055 - Installation-free timed out. 531 * @throws { BusinessError } 16200001 - The caller has been released. 532 * @syscap SystemCapability.Ability.AbilityRuntime.Core 533 * @systemapi 534 * @stagemodelonly 535 * @since 10 536 */ 537 /** 538 * Service extension start an ability using the original caller information. If the caller application is in 539 * foreground, you can use this method to start ability; If the caller application is in the background, 540 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 541 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 542 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 543 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 544 * 545 * @param { Want } want - Indicates the ability to start. 546 * @param { StartOptions } options - Indicates the start options. 547 * @returns { Promise<void> } The promise returned by the function. 548 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 549 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 550 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 551 * 2. Incorrect parameter types; 3. Parameter verification failed. 552 * @throws { BusinessError } 16000001 - The specified ability does not exist. 553 * @throws { BusinessError } 16000002 - Incorrect ability type. 554 * @throws { BusinessError } 16000004 - Can not start invisible component. 555 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 556 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 557 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 558 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 559 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 560 * @throws { BusinessError } 16000011 - The context does not exist. 561 * @throws { BusinessError } 16000012 - The application is controlled. 562 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 563 * @throws { BusinessError } 16000050 - Internal error. 564 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 565 * @throws { BusinessError } 16000055 - Installation-free timed out. 566 * @throws { BusinessError } 16200001 - The caller has been released. 567 * @throws { BusinessError } 16000073 - The app clone index is invalid. 568 * @syscap SystemCapability.Ability.AbilityRuntime.Core 569 * @systemapi 570 * @stagemodelonly 571 * @since 12 572 */ 573 startAbilityAsCaller(want: Want, options?: StartOptions): Promise<void>; 574 575 /** 576 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 577 * you can use this method to start ability; If the caller application is in the background, 578 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 579 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 580 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 581 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 582 * 583 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 584 * @param { Want } want - Indicates the ability to start. 585 * @param { number } accountId - Indicates the accountId to start. 586 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 587 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 588 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 589 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 590 * 2. Incorrect parameter types; 3. Parameter verification failed. 591 * @throws { BusinessError } 16000001 - The specified ability does not exist. 592 * @throws { BusinessError } 16000002 - Incorrect ability type. 593 * @throws { BusinessError } 16000004 - Can not start invisible component. 594 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 595 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 596 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 597 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 598 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 599 * @throws { BusinessError } 16000011 - The context does not exist. 600 * @throws { BusinessError } 16000012 - The application is controlled. 601 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 602 * @throws { BusinessError } 16000050 - Internal error. 603 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 604 * @throws { BusinessError } 16000055 - Installation-free timed out. 605 * @throws { BusinessError } 16200001 - The caller has been released. 606 * @syscap SystemCapability.Ability.AbilityRuntime.Core 607 * @systemapi 608 * @stagemodelonly 609 * @since 9 610 */ 611 /** 612 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 613 * you can use this method to start ability; If the caller application is in the background, 614 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 615 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 616 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 617 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 618 * 619 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 620 * @param { Want } want - Indicates the ability to start. 621 * @param { number } accountId - Indicates the accountId to start. 622 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 623 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 624 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 625 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 626 * 2. Incorrect parameter types; 3. Parameter verification failed. 627 * @throws { BusinessError } 16000001 - The specified ability does not exist. 628 * @throws { BusinessError } 16000002 - Incorrect ability type. 629 * @throws { BusinessError } 16000004 - Can not start invisible component. 630 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 631 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 632 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 633 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 634 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 635 * @throws { BusinessError } 16000011 - The context does not exist. 636 * @throws { BusinessError } 16000012 - The application is controlled. 637 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 638 * @throws { BusinessError } 16000019 - Can not match any component. 639 * @throws { BusinessError } 16000050 - Internal error. 640 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 641 * @throws { BusinessError } 16000055 - Installation-free timed out. 642 * @throws { BusinessError } 16200001 - The caller has been released. 643 * @throws { BusinessError } 16000073 - The app clone index is invalid. 644 * @syscap SystemCapability.Ability.AbilityRuntime.Core 645 * @systemapi 646 * @stagemodelonly 647 * @since 12 648 */ 649 startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 650 651 /** 652 * Service extension uses this method to start a specific ability with account. 653 * 654 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 655 * @param { Want } want - Indicates the ability to start. 656 * @param { number } accountId - Indicates the accountId to start. 657 * @param { StartOptions } options - Indicates the start options. 658 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 659 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 660 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 661 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 662 * 2. Incorrect parameter types; 3. Parameter verification failed. 663 * @throws { BusinessError } 16000001 - The specified ability does not exist. 664 * @throws { BusinessError } 16000002 - Incorrect ability type. 665 * @throws { BusinessError } 16000004 - Can not start invisible component. 666 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 667 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 668 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 669 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 670 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 671 * @throws { BusinessError } 16000011 - The context does not exist. 672 * @throws { BusinessError } 16000050 - Internal error. 673 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 674 * @throws { BusinessError } 16000055 - Installation-free timed out. 675 * @throws { BusinessError } 16200001 - The caller has been released. 676 * @syscap SystemCapability.Ability.AbilityRuntime.Core 677 * @systemapi 678 * @stagemodelonly 679 * @since 9 680 */ 681 /** 682 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 683 * you can use this method to start ability; If the caller application is in the background, 684 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 685 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 686 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 687 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 688 * 689 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 690 * @param { Want } want - Indicates the ability to start. 691 * @param { number } accountId - Indicates the accountId to start. 692 * @param { StartOptions } options - Indicates the start options. 693 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 694 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 695 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 696 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 697 * 2. Incorrect parameter types; 3. Parameter verification failed. 698 * @throws { BusinessError } 16000001 - The specified ability does not exist. 699 * @throws { BusinessError } 16000004 - Can not start invisible component. 700 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 701 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 702 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 703 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 704 * @throws { BusinessError } 16000011 - The context does not exist. 705 * @throws { BusinessError } 16000012 - The application is controlled. 706 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 707 * @throws { BusinessError } 16000050 - Internal error. 708 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 709 * @throws { BusinessError } 16000055 - Installation-free timed out. 710 * @throws { BusinessError } 16200001 - The caller has been released. 711 * @syscap SystemCapability.Ability.AbilityRuntime.Core 712 * @systemapi 713 * @stagemodelonly 714 * @since 10 715 */ 716 /** 717 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 718 * you can use this method to start ability; If the caller application is in the background, 719 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 720 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 721 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 722 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 723 * 724 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 725 * @param { Want } want - Indicates the ability to start. 726 * @param { number } accountId - Indicates the accountId to start. 727 * @param { StartOptions } options - Indicates the start options. 728 * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount. 729 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 730 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 731 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 732 * 2. Incorrect parameter types; 3. Parameter verification failed. 733 * @throws { BusinessError } 16000001 - The specified ability does not exist. 734 * @throws { BusinessError } 16000004 - Can not start invisible component. 735 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 736 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 737 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 738 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 739 * @throws { BusinessError } 16000011 - The context does not exist. 740 * @throws { BusinessError } 16000012 - The application is controlled. 741 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 742 * @throws { BusinessError } 16000019 - Can not match any component. 743 * @throws { BusinessError } 16000050 - Internal error. 744 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 745 * @throws { BusinessError } 16000055 - Installation-free timed out. 746 * @throws { BusinessError } 16200001 - The caller has been released. 747 * @throws { BusinessError } 16000073 - The app clone index is invalid. 748 * @syscap SystemCapability.Ability.AbilityRuntime.Core 749 * @systemapi 750 * @stagemodelonly 751 * @since 12 752 */ 753 startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void; 754 755 /** 756 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 757 * you can use this method to start ability; If the caller application is in the background, 758 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 759 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 760 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 761 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 762 * 763 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 764 * @param { Want } want - Indicates the ability to start. 765 * @param { number } accountId - Indicates the accountId to start. 766 * @param { StartOptions } [options] - Indicates the start options. 767 * @returns { Promise<void> } The promise returned by the function. 768 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 769 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 770 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 771 * 2. Incorrect parameter types; 3. Parameter verification failed. 772 * @throws { BusinessError } 16000001 - The specified ability does not exist. 773 * @throws { BusinessError } 16000002 - Incorrect ability type. 774 * @throws { BusinessError } 16000004 - Can not start invisible component. 775 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 776 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 777 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 778 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 779 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 780 * @throws { BusinessError } 16000011 - The context does not exist. 781 * @throws { BusinessError } 16000012 - The application is controlled. 782 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 783 * @throws { BusinessError } 16000050 - Internal error. 784 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 785 * @throws { BusinessError } 16000055 - Installation-free timed out. 786 * @throws { BusinessError } 16200001 - The caller has been released. 787 * @syscap SystemCapability.Ability.AbilityRuntime.Core 788 * @systemapi 789 * @stagemodelonly 790 * @since 9 791 */ 792 /** 793 * Service extension uses this method to start a specific ability with account. If the caller application is in foreground, 794 * you can use this method to start ability; If the caller application is in the background, 795 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 796 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 797 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 798 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 799 * 800 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 801 * @param { Want } want - Indicates the ability to start. 802 * @param { number } accountId - Indicates the accountId to start. 803 * @param { StartOptions } [options] - Indicates the start options. 804 * @returns { Promise<void> } The promise returned by the function. 805 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 806 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 807 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 808 * 2. Incorrect parameter types; 3. Parameter verification failed. 809 * @throws { BusinessError } 16000001 - The specified ability does not exist. 810 * @throws { BusinessError } 16000002 - Incorrect ability type. 811 * @throws { BusinessError } 16000004 - Can not start invisible component. 812 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 813 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 814 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 815 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 816 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 817 * @throws { BusinessError } 16000011 - The context does not exist. 818 * @throws { BusinessError } 16000012 - The application is controlled. 819 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 820 * @throws { BusinessError } 16000019 - Can not match any component. 821 * @throws { BusinessError } 16000050 - Internal error. 822 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 823 * @throws { BusinessError } 16000055 - Installation-free timed out. 824 * @throws { BusinessError } 16200001 - The caller has been released. 825 * @throws { BusinessError } 16000073 - The app clone index is invalid. 826 * @syscap SystemCapability.Ability.AbilityRuntime.Core 827 * @systemapi 828 * @stagemodelonly 829 * @since 12 830 */ 831 startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>; 832 833 /** 834 * Starts a new service extension ability. 835 * 836 * @param { Want } want - Indicates the want info to start. 837 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 838 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 839 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 840 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 841 * 2. Incorrect parameter types; 3. Parameter verification failed. 842 * @throws { BusinessError } 16000001 - The specified ability does not exist. 843 * @throws { BusinessError } 16000002 - Incorrect ability type. 844 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 845 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 846 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 847 * @throws { BusinessError } 16000011 - The context does not exist. 848 * @throws { BusinessError } 16000050 - Internal error. 849 * @throws { BusinessError } 16200001 - The caller has been released. 850 * @syscap SystemCapability.Ability.AbilityRuntime.Core 851 * @systemapi 852 * @stagemodelonly 853 * @since 9 854 */ 855 /** 856 * Starts a new service extension ability. 857 * If the target service extension ability is visible, you can start the target service extension ability; 858 * If the target service extension ability is invisible, 859 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 860 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 861 * 862 * @param { Want } want - Indicates the want info to start. 863 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 864 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 865 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 866 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 867 * 2. Incorrect parameter types; 3. Parameter verification failed. 868 * @throws { BusinessError } 16000001 - The specified ability does not exist. 869 * @throws { BusinessError } 16000002 - Incorrect ability type. 870 * @throws { BusinessError } 16000004 - Can not start invisible component. 871 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 872 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 873 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 874 * @throws { BusinessError } 16000011 - The context does not exist. 875 * @throws { BusinessError } 16000012 - The application is controlled. 876 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 877 * @throws { BusinessError } 16000050 - Internal error. 878 * @throws { BusinessError } 16200001 - The caller has been released. 879 * @syscap SystemCapability.Ability.AbilityRuntime.Core 880 * @systemapi 881 * @stagemodelonly 882 * @since 10 883 */ 884 /** 885 * Starts a new service extension ability. 886 * If the target service extension ability is visible, you can start the target service extension ability; 887 * If the target service extension ability is invisible, 888 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 889 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 890 * 891 * @param { Want } want - Indicates the want info to start. 892 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility. 893 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 894 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 895 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 896 * 2. Incorrect parameter types; 3. Parameter verification failed. 897 * @throws { BusinessError } 16000001 - The specified ability does not exist. 898 * @throws { BusinessError } 16000002 - Incorrect ability type. 899 * @throws { BusinessError } 16000004 - Can not start invisible component. 900 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 901 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 902 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 903 * @throws { BusinessError } 16000011 - The context does not exist. 904 * @throws { BusinessError } 16000012 - The application is controlled. 905 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 906 * @throws { BusinessError } 16000019 - Can not match any component. 907 * @throws { BusinessError } 16000050 - Internal error. 908 * @throws { BusinessError } 16200001 - The caller has been released. 909 * @syscap SystemCapability.Ability.AbilityRuntime.Core 910 * @systemapi 911 * @stagemodelonly 912 * @since 12 913 */ 914 startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 915 916 /** 917 * Starts a new service extension ability. 918 * 919 * @param { Want } want - Indicates the want info to start. 920 * @returns { Promise<void> } The promise returned by the function. 921 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 922 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 923 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 924 * 2. Incorrect parameter types; 3. Parameter verification failed. 925 * @throws { BusinessError } 16000001 - The specified ability does not exist. 926 * @throws { BusinessError } 16000002 - Incorrect ability type. 927 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 928 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 929 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 930 * @throws { BusinessError } 16000011 - The context does not exist. 931 * @throws { BusinessError } 16000050 - Internal error. 932 * @throws { BusinessError } 16200001 - The caller has been released. 933 * @syscap SystemCapability.Ability.AbilityRuntime.Core 934 * @systemapi 935 * @stagemodelonly 936 * @since 9 937 */ 938 /** 939 * Starts a new service extension ability. 940 * If the target service extension ability is visible, you can start the target service extension ability; 941 * If the target service extension ability is invisible, 942 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 943 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 944 * 945 * @param { Want } want - Indicates the want info to start. 946 * @returns { Promise<void> } The promise returned by the function. 947 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 948 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 949 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 950 * 2. Incorrect parameter types; 3. Parameter verification failed. 951 * @throws { BusinessError } 16000001 - The specified ability does not exist. 952 * @throws { BusinessError } 16000002 - Incorrect ability type. 953 * @throws { BusinessError } 16000004 - Can not start invisible component. 954 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 955 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 956 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 957 * @throws { BusinessError } 16000011 - The context does not exist. 958 * @throws { BusinessError } 16000012 - The application is controlled. 959 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 960 * @throws { BusinessError } 16000050 - Internal error. 961 * @throws { BusinessError } 16200001 - The caller has been released. 962 * @syscap SystemCapability.Ability.AbilityRuntime.Core 963 * @systemapi 964 * @stagemodelonly 965 * @since 10 966 */ 967 /** 968 * Starts a new service extension ability. 969 * If the target service extension ability is visible, you can start the target service extension ability; 970 * If the target service extension ability is invisible, 971 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 972 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 973 * 974 * @param { Want } want - Indicates the want info to start. 975 * @returns { Promise<void> } The promise returned by the function. 976 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 977 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 978 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 979 * 2. Incorrect parameter types; 3. Parameter verification failed. 980 * @throws { BusinessError } 16000001 - The specified ability does not exist. 981 * @throws { BusinessError } 16000002 - Incorrect ability type. 982 * @throws { BusinessError } 16000004 - Can not start invisible component. 983 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 984 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 985 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 986 * @throws { BusinessError } 16000011 - The context does not exist. 987 * @throws { BusinessError } 16000012 - The application is controlled. 988 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 989 * @throws { BusinessError } 16000019 - Can not match any component. 990 * @throws { BusinessError } 16000050 - Internal error. 991 * @throws { BusinessError } 16200001 - The caller has been released. 992 * @syscap SystemCapability.Ability.AbilityRuntime.Core 993 * @systemapi 994 * @stagemodelonly 995 * @since 12 996 */ 997 startServiceExtensionAbility(want: Want): Promise<void>; 998 999 /** 1000 * Starts a new service extension ability with account. 1001 * 1002 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1003 * @param { Want } want - Indicates the want info to start. 1004 * @param { number } accountId - Indicates the account to start. 1005 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1006 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1007 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1008 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1009 * 2. Incorrect parameter types; 3. Parameter verification failed. 1010 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1011 * @throws { BusinessError } 16000002 - Incorrect ability type. 1012 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1013 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1014 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1015 * @throws { BusinessError } 16000011 - The context does not exist. 1016 * @throws { BusinessError } 16000050 - Internal error. 1017 * @throws { BusinessError } 16200001 - The caller has been released. 1018 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1019 * @systemapi 1020 * @stagemodelonly 1021 * @since 9 1022 */ 1023 /** 1024 * Starts a new service extension ability with account. 1025 * If the target service extension ability is visible, you can start the target service extension ability; 1026 * If the target service extension ability is invisible, 1027 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1028 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1029 * 1030 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1031 * @param { Want } want - Indicates the want info to start. 1032 * @param { number } accountId - Indicates the account to start. 1033 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1034 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1035 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1036 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1037 * 2. Incorrect parameter types; 3. Parameter verification failed. 1038 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1039 * @throws { BusinessError } 16000002 - Incorrect ability type. 1040 * @throws { BusinessError } 16000004 - Can not start invisible component. 1041 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1042 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1043 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1044 * @throws { BusinessError } 16000011 - The context does not exist. 1045 * @throws { BusinessError } 16000012 - The application is controlled. 1046 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1047 * @throws { BusinessError } 16000050 - Internal error. 1048 * @throws { BusinessError } 16200001 - The caller has been released. 1049 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1050 * @systemapi 1051 * @stagemodelonly 1052 * @since 10 1053 */ 1054 /** 1055 * Starts a new service extension ability with account. 1056 * If the target service extension ability is visible, you can start the target service extension ability; 1057 * If the target service extension ability is invisible, 1058 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1059 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1060 * 1061 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1062 * @param { Want } want - Indicates the want info to start. 1063 * @param { number } accountId - Indicates the account to start. 1064 * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount. 1065 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1066 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1067 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1068 * 2. Incorrect parameter types; 3. Parameter verification failed. 1069 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1070 * @throws { BusinessError } 16000002 - Incorrect ability type. 1071 * @throws { BusinessError } 16000004 - Can not start invisible component. 1072 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1073 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1074 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1075 * @throws { BusinessError } 16000011 - The context does not exist. 1076 * @throws { BusinessError } 16000012 - The application is controlled. 1077 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1078 * @throws { BusinessError } 16000019 - Can not match any component. 1079 * @throws { BusinessError } 16000050 - Internal error. 1080 * @throws { BusinessError } 16200001 - The caller has been released. 1081 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1082 * @systemapi 1083 * @stagemodelonly 1084 * @since 12 1085 */ 1086 startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1087 1088 /** 1089 * Starts a new service extension ability with account. 1090 * 1091 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1092 * @param { Want } want - Indicates the want info to start. 1093 * @param { number } accountId - Indicates the account to start. 1094 * @returns { Promise<void> } The promise returned by the function. 1095 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1096 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1097 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1098 * 2. Incorrect parameter types; 3. Parameter verification failed. 1099 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1100 * @throws { BusinessError } 16000002 - Incorrect ability type. 1101 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1102 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1103 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1104 * @throws { BusinessError } 16000011 - The context does not exist. 1105 * @throws { BusinessError } 16000050 - Internal error. 1106 * @throws { BusinessError } 16200001 - The caller has been released. 1107 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1108 * @systemapi 1109 * @stagemodelonly 1110 * @since 9 1111 */ 1112 /** 1113 * Starts a new service extension ability with account. 1114 * If the target service extension ability is visible, you can start the target service extension ability; 1115 * If the target service extension ability is invisible, 1116 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1117 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1118 * 1119 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1120 * @param { Want } want - Indicates the want info to start. 1121 * @param { number } accountId - Indicates the account to start. 1122 * @returns { Promise<void> } The promise returned by the function. 1123 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1124 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1125 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1126 * 2. Incorrect parameter types; 3. Parameter verification failed. 1127 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1128 * @throws { BusinessError } 16000002 - Incorrect ability type. 1129 * @throws { BusinessError } 16000004 - Can not start invisible component. 1130 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1131 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1132 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1133 * @throws { BusinessError } 16000011 - The context does not exist. 1134 * @throws { BusinessError } 16000012 - The application is controlled. 1135 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1136 * @throws { BusinessError } 16000050 - Internal error. 1137 * @throws { BusinessError } 16200001 - The caller has been released. 1138 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1139 * @systemapi 1140 * @stagemodelonly 1141 * @since 10 1142 */ 1143 /** 1144 * Starts a new service extension ability with account. 1145 * If the target service extension ability is visible, you can start the target service extension ability; 1146 * If the target service extension ability is invisible, 1147 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. 1148 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1149 * 1150 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1151 * @param { Want } want - Indicates the want info to start. 1152 * @param { number } accountId - Indicates the account to start. 1153 * @returns { Promise<void> } The promise returned by the function. 1154 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1155 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1156 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1157 * 2. Incorrect parameter types; 3. Parameter verification failed. 1158 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1159 * @throws { BusinessError } 16000002 - Incorrect ability type. 1160 * @throws { BusinessError } 16000004 - Can not start invisible component. 1161 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1162 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1163 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1164 * @throws { BusinessError } 16000011 - The context does not exist. 1165 * @throws { BusinessError } 16000012 - The application is controlled. 1166 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1167 * @throws { BusinessError } 16000019 - Can not match any component. 1168 * @throws { BusinessError } 16000050 - Internal error. 1169 * @throws { BusinessError } 16200001 - The caller has been released. 1170 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1171 * @systemapi 1172 * @stagemodelonly 1173 * @since 12 1174 */ 1175 startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1176 1177 /** 1178 * Stops a service within the same application. 1179 * 1180 * @param { Want } want - Indicates the want info to start. 1181 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1182 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1183 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1184 * 2. Incorrect parameter types; 3. Parameter verification failed. 1185 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1186 * @throws { BusinessError } 16000002 - Incorrect ability type. 1187 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1188 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1189 * @throws { BusinessError } 16000011 - The context does not exist. 1190 * @throws { BusinessError } 16000050 - Internal error. 1191 * @throws { BusinessError } 16200001 - The caller has been released. 1192 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1193 * @systemapi 1194 * @stagemodelonly 1195 * @since 9 1196 */ 1197 /** 1198 * Stops other service extension ability. 1199 * If the target service extension ability is visible, you can stop the target service extension ability; 1200 * If the target service extension ability is invisible, 1201 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1202 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1203 * 1204 * @param { Want } want - Indicates the want info to start. 1205 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility. 1206 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1207 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1208 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1209 * 2. Incorrect parameter types; 3. Parameter verification failed. 1210 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1211 * @throws { BusinessError } 16000002 - Incorrect ability type. 1212 * @throws { BusinessError } 16000004 - Can not start invisible component. 1213 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1214 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1215 * @throws { BusinessError } 16000011 - The context does not exist. 1216 * @throws { BusinessError } 16000050 - Internal error. 1217 * @throws { BusinessError } 16200001 - The caller has been released. 1218 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1219 * @systemapi 1220 * @stagemodelonly 1221 * @since 10 1222 */ 1223 stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void; 1224 1225 /** 1226 * Stops a service within the same application. 1227 * 1228 * @param { Want } want - Indicates the want info to start. 1229 * @returns { Promise<void> } The promise returned by the function. 1230 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1231 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1232 * 2. Incorrect parameter types; 3. Parameter verification failed. 1233 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1234 * @throws { BusinessError } 16000002 - Incorrect ability type. 1235 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1236 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1237 * @throws { BusinessError } 16000011 - The context does not exist. 1238 * @throws { BusinessError } 16000050 - Internal error. 1239 * @throws { BusinessError } 16200001 - The caller has been released. 1240 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1241 * @systemapi 1242 * @stagemodelonly 1243 * @since 9 1244 */ 1245 /** 1246 * Stops other service extension ability. 1247 * If the target service extension ability is visible, you can stop the target service extension ability; 1248 * If the target service extension ability is invisible, 1249 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1250 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1251 * 1252 * @param { Want } want - Indicates the want info to start. 1253 * @returns { Promise<void> } The promise returned by the function. 1254 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1255 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1256 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1257 * 2. Incorrect parameter types; 3. Parameter verification failed. 1258 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1259 * @throws { BusinessError } 16000002 - Incorrect ability type. 1260 * @throws { BusinessError } 16000004 - Can not start invisible component. 1261 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1262 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1263 * @throws { BusinessError } 16000011 - The context does not exist. 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 stopServiceExtensionAbility(want: Want): Promise<void>; 1272 1273 /** 1274 * Stops a service within the same application with account. 1275 * 1276 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1277 * @param { Want } want - Indicates the want info to start. 1278 * @param { number } accountId - Indicates the accountId to start. 1279 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 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 } 16000005 - The specified process does not have the permission. 1287 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1288 * @throws { BusinessError } 16000011 - The context does not exist. 1289 * @throws { BusinessError } 16000050 - Internal error. 1290 * @throws { BusinessError } 16200001 - The caller has been released. 1291 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1292 * @systemapi 1293 * @stagemodelonly 1294 * @since 9 1295 */ 1296 /** 1297 * Stops other service extension ability with account. 1298 * If the target service extension ability is visible, you can stop the target service extension ability; 1299 * If the target service extension ability is invisible, 1300 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1301 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1302 * 1303 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1304 * @param { Want } want - Indicates the want info to start. 1305 * @param { number } accountId - Indicates the accountId to start. 1306 * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount. 1307 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1308 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1309 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1310 * 2. Incorrect parameter types; 3. Parameter verification failed. 1311 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1312 * @throws { BusinessError } 16000002 - Incorrect ability type. 1313 * @throws { BusinessError } 16000004 - Can not start invisible component. 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 } 16000011 - The context does not exist. 1317 * @throws { BusinessError } 16000050 - Internal error. 1318 * @throws { BusinessError } 16200001 - The caller has been released. 1319 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1320 * @systemapi 1321 * @stagemodelonly 1322 * @since 10 1323 */ 1324 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void; 1325 1326 /** 1327 * Stops a service within the same application with account. 1328 * 1329 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1330 * @param { Want } want - Indicates the want info to start. 1331 * @param { number } accountId - Indicates the accountId to start. 1332 * @returns { Promise<void> } The promise returned by the function. 1333 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1334 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1335 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1336 * 2. Incorrect parameter types; 3. Parameter verification failed. 1337 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1338 * @throws { BusinessError } 16000002 - Incorrect ability type. 1339 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1340 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1341 * @throws { BusinessError } 16000011 - The context does not exist. 1342 * @throws { BusinessError } 16000050 - Internal error. 1343 * @throws { BusinessError } 16200001 - The caller has been released. 1344 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1345 * @systemapi 1346 * @stagemodelonly 1347 * @since 9 1348 */ 1349 /** 1350 * Stops other service extension ability with account. 1351 * If the target service extension ability is visible, you can stop the target service extension ability; 1352 * If the target service extension ability is invisible, 1353 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability. 1354 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1355 * 1356 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1357 * @param { Want } want - Indicates the want info to start. 1358 * @param { number } accountId - Indicates the accountId to start. 1359 * @returns { Promise<void> } The promise returned by the function. 1360 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1361 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1362 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1363 * 2. Incorrect parameter types; 3. Parameter verification failed. 1364 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1365 * @throws { BusinessError } 16000002 - Incorrect ability type. 1366 * @throws { BusinessError } 16000004 - Can not start invisible component. 1367 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1368 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1369 * @throws { BusinessError } 16000011 - The context does not exist. 1370 * @throws { BusinessError } 16000050 - Internal error. 1371 * @throws { BusinessError } 16200001 - The caller has been released. 1372 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1373 * @systemapi 1374 * @stagemodelonly 1375 * @since 10 1376 */ 1377 stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>; 1378 1379 /** 1380 * Destroys this service extension. 1381 * 1382 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1383 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1384 * 2. Incorrect parameter types; 3. Parameter verification failed. 1385 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1386 * @throws { BusinessError } 16000004 - Can not start invisible component. 1387 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1388 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1389 * @throws { BusinessError } 16000011 - The context does not exist. 1390 * @throws { BusinessError } 16000050 - Internal error. 1391 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1392 * @systemapi 1393 * @stagemodelonly 1394 * @since 9 1395 */ 1396 /** 1397 * Destroys this service extension. 1398 * 1399 * @param { AsyncCallback<void> } callback - The callback of terminateSelf. 1400 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1401 * 2. Incorrect parameter types; 3. Parameter verification failed. 1402 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1403 * @throws { BusinessError } 16000011 - The context does not exist. 1404 * @throws { BusinessError } 16000050 - Internal error. 1405 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1406 * @systemapi 1407 * @stagemodelonly 1408 * @since 10 1409 */ 1410 terminateSelf(callback: AsyncCallback<void>): void; 1411 1412 /** 1413 * Destroys this service extension. 1414 * 1415 * @returns { Promise<void> } The promise returned by the function. 1416 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1417 * @throws { BusinessError } 16000004 - Can not start invisible component. 1418 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1419 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1420 * @throws { BusinessError } 16000011 - The context does not exist. 1421 * @throws { BusinessError } 16000050 - Internal error. 1422 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1423 * @systemapi 1424 * @stagemodelonly 1425 * @since 9 1426 */ 1427 /** 1428 * Destroys this service extension. 1429 * 1430 * @returns { Promise<void> } The promise returned by the function. 1431 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1432 * @throws { BusinessError } 16000011 - The context does not exist. 1433 * @throws { BusinessError } 16000050 - Internal error. 1434 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1435 * @systemapi 1436 * @stagemodelonly 1437 * @since 10 1438 */ 1439 terminateSelf(): Promise<void>; 1440 1441 /** 1442 * Connects an ability to a Service extension. 1443 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1444 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1445 * service extension when the Service extension is connected.</p> 1446 * 1447 * @param { Want } want - Indicates the service extension to connect. 1448 * @param { ConnectOptions } options - Indicates the callback of connection. 1449 * @returns { number } Returns the connection id. 1450 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1451 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1452 * 2. Incorrect parameter types; 3. Parameter verification failed. 1453 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1454 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1455 * @throws { BusinessError } 16000011 - The context does not exist. 1456 * @throws { BusinessError } 16000050 - Internal error. 1457 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1458 * @systemapi 1459 * @stagemodelonly 1460 * @since 9 1461 */ 1462 /** 1463 * Connects an ability to a service extension ability. 1464 * If the target service extension ability is visible, you can connect the target service extension ability; 1465 * If the target service extension ability is invisible, 1466 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1467 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1468 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1469 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1470 * service extension when the Service extension is connected.</p> 1471 * 1472 * @param { Want } want - Indicates the service extension to connect. 1473 * @param { ConnectOptions } options - Indicates the callback of connection. 1474 * @returns { number } Returns the connection id. 1475 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1476 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1477 * 2. Incorrect parameter types; 3. Parameter verification failed. 1478 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1479 * @throws { BusinessError } 16000002 - Incorrect ability type. 1480 * @throws { BusinessError } 16000004 - Can not start invisible component. 1481 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1482 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1483 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1484 * @throws { BusinessError } 16000011 - The context does not exist. 1485 * @throws { BusinessError } 16000050 - Internal error. 1486 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1487 * @throws { BusinessError } 16000055 - Installation-free timed out. 1488 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1489 * @systemapi 1490 * @stagemodelonly 1491 * @since 10 1492 */ 1493 connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; 1494 1495 /** 1496 * Connects an ability to a Service extension with account. 1497 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1498 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1499 * service extension when the Service extension is connected.</p> 1500 * 1501 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1502 * @param { Want } want - Indicates the service extension to connect. 1503 * @param { number } accountId - Indicates the account to connect. 1504 * @param { ConnectOptions } options - Indicates the callback of connection. 1505 * @returns { number } Returns the connection id. 1506 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1507 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1508 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1509 * 2. Incorrect parameter types; 3. Parameter verification failed. 1510 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1511 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1512 * @throws { BusinessError } 16000011 - The context does not exist. 1513 * @throws { BusinessError } 16000050 - Internal error. 1514 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1515 * @systemapi 1516 * @stagemodelonly 1517 * @since 9 1518 */ 1519 /** 1520 * Connects an ability to a service extension ability with account. 1521 * If the target service extension ability is visible, you can connect the target service extension ability; 1522 * If the target service extension ability is invisible, 1523 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability. 1524 * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1525 * <p>This method can be called by an ability or service extension, but the destination of the connection must be a 1526 * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target 1527 * service extension when the Service extension is connected.</p> 1528 * 1529 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1530 * @param { Want } want - Indicates the service extension to connect. 1531 * @param { number } accountId - Indicates the account to connect. 1532 * @param { ConnectOptions } options - Indicates the callback of connection. 1533 * @returns { number } Returns the connection id. 1534 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1535 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1537 * 2. Incorrect parameter types; 3. Parameter verification failed. 1538 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1539 * @throws { BusinessError } 16000002 - Incorrect ability type. 1540 * @throws { BusinessError } 16000004 - Can not start invisible component. 1541 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1542 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1543 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1544 * @throws { BusinessError } 16000011 - The context does not exist. 1545 * @throws { BusinessError } 16000050 - Internal error. 1546 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1547 * @throws { BusinessError } 16000055 - Installation-free timed out. 1548 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1549 * @systemapi 1550 * @stagemodelonly 1551 * @since 10 1552 */ 1553 connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; 1554 1555 /** 1556 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1557 * 1558 * @param { number } connection - the connection id returned from connectAbility api. 1559 * @param { AsyncCallback<void> } callback - The callback of disconnectAbility. 1560 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1561 * 2. Incorrect parameter types; 3. Parameter verification failed. 1562 * @throws { BusinessError } 16000011 - The context does not exist. 1563 * @throws { BusinessError } 16000050 - Internal error. 1564 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1565 * @systemapi 1566 * @stagemodelonly 1567 * @since 9 1568 */ 1569 disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void; 1570 1571 /** 1572 * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. 1573 * 1574 * @param { number } connection - the connection id returned from connectAbility api. 1575 * @returns { Promise<void> } The promise returned by the function. 1576 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1577 * 2. Incorrect parameter types; 3. Parameter verification failed. 1578 * @throws { BusinessError } 16000011 - The context does not exist. 1579 * @throws { BusinessError } 16000050 - Internal error. 1580 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1581 * @systemapi 1582 * @stagemodelonly 1583 * @since 9 1584 */ 1585 disconnectServiceExtensionAbility(connection: number): Promise<void>; 1586 1587 /** 1588 * Get the caller object of the startup capability. 1589 * 1590 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 1591 * @param { Want } want - Indicates the ability to start. 1592 * @returns { Promise<Caller> } Returns the Caller interface. 1593 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1594 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1595 * 2. Incorrect parameter types; 3. Parameter verification failed. 1596 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1597 * @throws { BusinessError } 16000002 - Incorrect ability type. 1598 * @throws { BusinessError } 16000004 - Can not start invisible component. 1599 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1600 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1601 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 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 9 1609 */ 1610 /** 1611 * Get the caller object of the startup capability. 1612 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION to use this method. 1613 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 1614 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1615 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1616 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1617 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1618 * 1619 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 1620 * @param { Want } want - Indicates the ability to start. 1621 * @returns { Promise<Caller> } Returns the Caller interface. 1622 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1623 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1624 * 2. Incorrect parameter types; 3. Parameter verification failed. 1625 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1626 * @throws { BusinessError } 16000002 - Incorrect ability type. 1627 * @throws { BusinessError } 16000004 - Can not start invisible component. 1628 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1629 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1630 * @throws { BusinessError } 16000011 - The context does not exist. 1631 * @throws { BusinessError } 16000050 - Internal error. 1632 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1633 * @systemapi 1634 * @stagemodelonly 1635 * @since 10 1636 */ 1637 startAbilityByCall(want: Want): Promise<Caller>; 1638 1639 /** 1640 * Get the caller object that specifies the accountId startup capability 1641 * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION 1642 * and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS to use this method. 1643 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 1644 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1645 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1646 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1647 * 1648 * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1649 * @param { Want } want - Indicates the ability to start. 1650 * @param { number } accountId - Indicates the account to start. 1651 * @returns { Promise<Caller> } Returns the Caller interface. 1652 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1653 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1654 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1655 * 2. Incorrect parameter types; 3. Parameter verification failed. 1656 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1657 * @throws { BusinessError } 16000002 - Incorrect ability type. 1658 * @throws { BusinessError } 16000004 - Can not start invisible component. 1659 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1660 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1661 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1662 * @throws { BusinessError } 16000011 - The context does not exist. 1663 * @throws { BusinessError } 16000012 - The application is controlled. 1664 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 1665 * @throws { BusinessError } 16000050 - Internal error. 1666 * @throws { BusinessError } 16200001 - The caller has been released. 1667 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1668 * @systemapi 1669 * @stagemodelonly 1670 * @since 10 1671 */ 1672 startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller>; 1673 1674 /** 1675 * Service extension uses this method to start a specific ability, 1676 * if ability is multi instance, will start a recent instance. 1677 * 1678 * @param { Want } want - Indicates the ability to start. 1679 * @param { AsyncCallback<void> } callback - The callback of startAbility. 1680 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1681 * 2. Incorrect parameter types; 3. Parameter verification failed. 1682 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1683 * @throws { BusinessError } 16000002 - Incorrect ability type. 1684 * @throws { BusinessError } 16000004 - Can not start invisible component. 1685 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1686 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1687 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1688 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1689 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1690 * @throws { BusinessError } 16000011 - The context does not exist. 1691 * @throws { BusinessError } 16000050 - Internal error. 1692 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1693 * @throws { BusinessError } 16000055 - Installation-free timed out. 1694 * @throws { BusinessError } 16200001 - The caller has been released. 1695 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1696 * @systemapi 1697 * @stagemodelonly 1698 * @since 9 1699 */ 1700 /** 1701 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 1702 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 1703 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1704 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1705 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1706 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1707 * 1708 * @param { Want } want - Indicates the ability to start. 1709 * @param { AsyncCallback<void> } callback - The callback of startAbility. 1710 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1711 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1712 * 2. Incorrect parameter types; 3. Parameter verification failed. 1713 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1714 * @throws { BusinessError } 16000002 - Incorrect ability type. 1715 * @throws { BusinessError } 16000004 - Can not start invisible component. 1716 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1717 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1718 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1719 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1720 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1721 * @throws { BusinessError } 16000011 - The context does not exist. 1722 * @throws { BusinessError } 16000050 - Internal error. 1723 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1724 * @throws { BusinessError } 16000055 - Installation-free timed out. 1725 * @throws { BusinessError } 16200001 - The caller has been released. 1726 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1727 * @systemapi 1728 * @stagemodelonly 1729 * @since 10 1730 */ 1731 startRecentAbility(want: Want, callback: AsyncCallback<void>): void; 1732 1733 /** 1734 * Service extension uses this method to start a specific ability, 1735 * if ability is multi instance, will start a recent instance. 1736 * 1737 * @param { Want } want - Indicates the ability to start. 1738 * @param { StartOptions } options - Indicates the start options. 1739 * @param { AsyncCallback<void> } callback - The callback of startAbility. 1740 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1741 * 2. Incorrect parameter types; 3. Parameter verification failed. 1742 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1743 * @throws { BusinessError } 16000002 - Incorrect ability type. 1744 * @throws { BusinessError } 16000004 - Can not start invisible component. 1745 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1746 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1747 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1748 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1749 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1750 * @throws { BusinessError } 16000011 - The context does not exist. 1751 * @throws { BusinessError } 16000050 - Internal error. 1752 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1753 * @throws { BusinessError } 16000055 - Installation-free timed out. 1754 * @throws { BusinessError } 16200001 - The caller has been released. 1755 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1756 * @systemapi 1757 * @stagemodelonly 1758 * @since 9 1759 */ 1760 /** 1761 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 1762 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 1763 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1764 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1765 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1766 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1767 * 1768 * @param { Want } want - Indicates the ability to start. 1769 * @param { StartOptions } options - Indicates the start options. 1770 * @param { AsyncCallback<void> } callback - The callback of startAbility. 1771 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1772 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1773 * 2. Incorrect parameter types; 3. Parameter verification failed. 1774 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1775 * @throws { BusinessError } 16000004 - Can not start invisible component. 1776 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1777 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1778 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1779 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1780 * @throws { BusinessError } 16000011 - The context does not exist. 1781 * @throws { BusinessError } 16000050 - Internal error. 1782 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1783 * @throws { BusinessError } 16000055 - Installation-free timed out. 1784 * @throws { BusinessError } 16200001 - The caller has been released. 1785 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1786 * @systemapi 1787 * @stagemodelonly 1788 * @since 10 1789 */ 1790 startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 1791 1792 /** 1793 * Service extension uses this method to start a specific ability, 1794 * if ability is multi instance, will start a recent instance. 1795 * 1796 * @param { Want } want - Indicates the ability to start. 1797 * @param { StartOptions } [options] - Indicates the start options. 1798 * @returns { Promise<void> } The promise returned by the function. 1799 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1800 * 2. Incorrect parameter types; 3. Parameter verification failed. 1801 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1802 * @throws { BusinessError } 16000002 - Incorrect ability type. 1803 * @throws { BusinessError } 16000004 - Can not start invisible component. 1804 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1805 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1806 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1807 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1808 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1809 * @throws { BusinessError } 16000011 - The context does not exist. 1810 * @throws { BusinessError } 16000050 - Internal error. 1811 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1812 * @throws { BusinessError } 16000055 - Installation-free timed out. 1813 * @throws { BusinessError } 16200001 - The caller has been released. 1814 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1815 * @systemapi 1816 * @stagemodelonly 1817 * @since 9 1818 */ 1819 /** 1820 * Service extension uses this method to start a specific ability, if ability is multi instance, will start a recent instance. 1821 * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, 1822 * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. 1823 * If the target ability is visible, you can start the target ability; If the target ability is invisible, 1824 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. 1825 * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. 1826 * 1827 * @param { Want } want - Indicates the ability to start. 1828 * @param { StartOptions } [options] - Indicates the start options. 1829 * @returns { Promise<void> } The promise returned by the function. 1830 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1831 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1832 * 2. Incorrect parameter types; 3. Parameter verification failed. 1833 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1834 * @throws { BusinessError } 16000002 - Incorrect ability type. 1835 * @throws { BusinessError } 16000004 - Can not start invisible component. 1836 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 1837 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 1838 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 1839 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 1840 * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. 1841 * @throws { BusinessError } 16000011 - The context does not exist. 1842 * @throws { BusinessError } 16000050 - Internal error. 1843 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 1844 * @throws { BusinessError } 16000055 - Installation-free timed out. 1845 * @throws { BusinessError } 16200001 - The caller has been released. 1846 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1847 * @systemapi 1848 * @stagemodelonly 1849 * @since 10 1850 */ 1851 startRecentAbility(want: Want, options?: StartOptions): Promise<void>; 1852 1853 /** 1854 * Requests the Modal UIExtensionAbility. 1855 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 1856 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 1857 * 1858 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 1859 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 1860 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1861 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1862 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1863 * 2. Incorrect parameter types; 3. Parameter verification failed. 1864 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1865 * @throws { BusinessError } 16000002 - Incorrect ability type. 1866 * @throws { BusinessError } 16000004 - Can not start invisible component. 1867 * @throws { BusinessError } 16000050 - Internal error. 1868 * @throws { BusinessError } 16200001 - The caller has been released. 1869 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1870 * @systemapi 1871 * @stagemodelonly 1872 * @since 11 1873 */ 1874 /** 1875 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 1876 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 1877 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 1878 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 1879 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 1880 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 1881 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 1882 * 1883 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 1884 * @param { AsyncCallback<void> } callback - The callback of requestModalUIExtension. 1885 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1886 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1887 * 2. Incorrect parameter types; 3. Parameter verification failed. 1888 * @throws { BusinessError } 16000050 - Internal error. 1889 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1890 * @systemapi 1891 * @stagemodelonly 1892 * @since 12 1893 */ 1894 requestModalUIExtension(pickerWant: Want, callback: AsyncCallback<void>): void; 1895 1896 /** 1897 * Requests the Modal UIExtensionAbility. 1898 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 1899 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 1900 * 1901 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 1902 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 1903 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1904 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1905 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1906 * 2. Incorrect parameter types; 3. Parameter verification failed. 1907 * @throws { BusinessError } 16000001 - The specified ability does not exist. 1908 * @throws { BusinessError } 16000002 - Incorrect ability type. 1909 * @throws { BusinessError } 16000004 - Can not start invisible component. 1910 * @throws { BusinessError } 16000050 - Internal error. 1911 * @throws { BusinessError } 16200001 - The caller has been released. 1912 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1913 * @systemapi 1914 * @stagemodelonly 1915 * @since 11 1916 */ 1917 /** 1918 * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground 1919 * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application 1920 * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started 1921 * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, 1922 * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. 1923 * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, 1924 * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. 1925 * 1926 * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. 1927 * @returns { Promise<void> } The promise returned by the requestModalUIExtension. 1928 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1929 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1930 * 2. Incorrect parameter types; 3. Parameter verification failed. 1931 * @throws { BusinessError } 16000050 - Internal error. 1932 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1933 * @systemapi 1934 * @stagemodelonly 1935 * @since 12 1936 */ 1937 requestModalUIExtension(pickerWant: Want): Promise<void>; 1938 1939 /** 1940 * preStartMission opens an atomic service window without popping up a loading window 1941 * 1942 * @permission ohos.permission.PRE_START_ATOMIC_SERVICE 1943 * @param { string } bundleName - The bundle name of the atomic service. 1944 * @param { string } moduleName - The module name of the atomic service. 1945 * @param { string } abilityName - The ability name of the atomic service. 1946 * @param { string } startTime - The start time of the atomic service. 1947 * @returns { Promise<void> } The promise returned by the function. 1948 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1949 * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 1950 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1951 * 2. Incorrect parameter types; 3. Parameter verification failed. 1952 * @throws { BusinessError } 16300007 - The target free install task does not exist. 1953 * @throws { BusinessError } 16000011 - The context does not exist. 1954 * @throws { BusinessError } 16000050 - Internal error. 1955 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1956 * @systemapi 1957 * @stagemodelonly 1958 * @since 12 1959 */ 1960 preStartMission(bundleName: string, moduleName: string, abilityName: string, startTime: string): Promise<void>; 1961} 1962