161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"),
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit BasicServicesKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport Want from './@ohos.app.ability.Want';
2361847f8eSopenharmony_ciimport ExtensionContext from './application/ExtensionContext';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * class of static subscriber extension context.
2761847f8eSopenharmony_ci *
2861847f8eSopenharmony_ci * @extends ExtensionContext
2961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core
3061847f8eSopenharmony_ci * @systemapi
3161847f8eSopenharmony_ci * @StageModelOnly
3261847f8eSopenharmony_ci * @since 10
3361847f8eSopenharmony_ci */
3461847f8eSopenharmony_ciexport default class StaticSubscriberExtensionContext extends ExtensionContext {
3561847f8eSopenharmony_ci  /**
3661847f8eSopenharmony_ci   * Starts a new ability. If the caller application is in foreground, you can use this method to start ability;
3761847f8eSopenharmony_ci   * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
3861847f8eSopenharmony_ci   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
3961847f8eSopenharmony_ci   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
4061847f8eSopenharmony_ci   *
4161847f8eSopenharmony_ci   * @permission ohos.permission.START_ABILITIES_FROM_BACKGROUND
4261847f8eSopenharmony_ci   * @param { Want } want - Indicates the ability to start.
4361847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of startAbility.
4461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
4561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
4661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
4761847f8eSopenharmony_ci   * @throws { BusinessError } 16000001 - The specified ability does not exist.
4861847f8eSopenharmony_ci   * @throws { BusinessError } 16000002 - Incorrect ability type.
4961847f8eSopenharmony_ci   * @throws { BusinessError } 16000004 - Can not start invisible component.
5061847f8eSopenharmony_ci   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
5161847f8eSopenharmony_ci   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
5261847f8eSopenharmony_ci   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
5361847f8eSopenharmony_ci   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
5461847f8eSopenharmony_ci   * @throws { BusinessError } 16000011 - The context does not exist.
5561847f8eSopenharmony_ci   * @throws { BusinessError } 16000050 - Internal error.
5661847f8eSopenharmony_ci   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
5761847f8eSopenharmony_ci   * @throws { BusinessError } 16000055 - Installation-free timed out.
5861847f8eSopenharmony_ci   * @throws { BusinessError } 16200001 - The caller has been released.
5961847f8eSopenharmony_ci   * @throws { BusinessError } 16300003 - The target application is not self application.
6061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.Core
6161847f8eSopenharmony_ci   * @systemapi
6261847f8eSopenharmony_ci   * @StageModelOnly
6361847f8eSopenharmony_ci   * @since 10
6461847f8eSopenharmony_ci   */
6561847f8eSopenharmony_ci  startAbility(want: Want, callback: AsyncCallback<void>): void;
6661847f8eSopenharmony_ci
6761847f8eSopenharmony_ci  /**
6861847f8eSopenharmony_ci   * Starts a new ability. If the caller application is in foreground, you can use this method to start ability;
6961847f8eSopenharmony_ci   * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
7061847f8eSopenharmony_ci   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
7161847f8eSopenharmony_ci   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
7261847f8eSopenharmony_ci   *
7361847f8eSopenharmony_ci   * @permission ohos.permission.START_ABILITIES_FROM_BACKGROUND
7461847f8eSopenharmony_ci   * @param { Want } want - Indicates the ability to start.
7561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
7661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
7761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
7861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
7961847f8eSopenharmony_ci   * @throws { BusinessError } 16000001 - The specified ability does not exist.
8061847f8eSopenharmony_ci   * @throws { BusinessError } 16000002 - Incorrect ability type.
8161847f8eSopenharmony_ci   * @throws { BusinessError } 16000004 - Can not start invisible component.
8261847f8eSopenharmony_ci   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
8361847f8eSopenharmony_ci   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
8461847f8eSopenharmony_ci   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
8561847f8eSopenharmony_ci   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
8661847f8eSopenharmony_ci   * @throws { BusinessError } 16000011 - The context does not exist.
8761847f8eSopenharmony_ci   * @throws { BusinessError } 16000050 - Internal error.
8861847f8eSopenharmony_ci   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
8961847f8eSopenharmony_ci   * @throws { BusinessError } 16000055 - Installation-free timed out.
9061847f8eSopenharmony_ci   * @throws { BusinessError } 16200001 - The caller has been released.
9161847f8eSopenharmony_ci   * @throws { BusinessError } 16300003 - The target application is not self application.
9261847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.Core
9361847f8eSopenharmony_ci   * @systemapi
9461847f8eSopenharmony_ci   * @StageModelOnly
9561847f8eSopenharmony_ci   * @since 10
9661847f8eSopenharmony_ci   */
9761847f8eSopenharmony_ci  startAbility(want: Want): Promise<void>;
9861847f8eSopenharmony_ci}
99