1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22import type Want from './@ohos.app.ability.Want'; 23 24/** 25 * The context of insight intent executor. 26 * 27 * @syscap SystemCapability.Ability.AbilityRuntime.Core 28 * @StageModelOnly 29 * @atomicservice 30 * @since 11 31 */ 32export default class InsightIntentContext { 33 /** 34 * Starts a new ability. 35 * This interface only allows you to start abilities within the same bundle and specify the bundleName. 36 * This interface only allows called in UIAbility insight intent execute mode. 37 * 38 * @param { Want } want - Indicates the ability to start. 39 * @param { AsyncCallback<void> } callback - The callback of startAbility. 40 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 41 * 2. Incorrect parameter types. 42 * @throws { BusinessError } 16000001 - The specified ability does not exist. 43 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 44 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 45 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 46 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 47 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 48 * @throws { BusinessError } 16000011 - The context does not exist. 49 * @throws { BusinessError } 16000012 - The application is controlled. 50 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 51 * @throws { BusinessError } 16000050 - Internal error. 52 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 53 * @throws { BusinessError } 16000055 - Installation-free timed out. 54 * @throws { BusinessError } 16000061 - Operation not supported. 55 * @throws { BusinessError } 16200001 - The caller has been released. 56 * @syscap SystemCapability.Ability.AbilityRuntime.Core 57 * @StageModelOnly 58 * @atomicservice 59 * @since 11 60 */ 61 startAbility(want: Want, callback: AsyncCallback<void>): void; 62 63 /** 64 * Starts a new ability. 65 * This interface only allows you to start abilities within the same bundle and specify the bundleName. 66 * This interface only allows called in UIAbility insight intent execute mode. 67 * 68 * @param { Want } want - Indicates the ability to start. 69 * @returns { Promise<void> } The promise returned by the function. 70 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 71 * 2. Incorrect parameter types. 72 * @throws { BusinessError } 16000001 - The specified ability does not exist. 73 * @throws { BusinessError } 16000004 - Failed to start the invisible ability. 74 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 75 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 76 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 77 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 78 * @throws { BusinessError } 16000011 - The context does not exist. 79 * @throws { BusinessError } 16000012 - The application is controlled. 80 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 81 * @throws { BusinessError } 16000050 - Internal error. 82 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 83 * @throws { BusinessError } 16000055 - Installation-free timed out. 84 * @throws { BusinessError } 16000061 - Operation not supported. 85 * @throws { BusinessError } 16200001 - The caller has been released. 86 * @syscap SystemCapability.Ability.AbilityRuntime.Core 87 * @StageModelOnly 88 * @atomicservice 89 * @since 11 90 */ 91 startAbility(want: Want): Promise<void>; 92} 93