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 arkts {'1.1':'11', '1.2':'20'} 31 * @arkts 1.1&1.2 32 */ 33declare class InsightIntentContext { 34 /** 35 * Starts a new ability. 36 * This interface only allows you to start abilities within the same bundle and specify the bundleName. 37 * This interface only allows called in UIAbility insight intent execute mode. 38 * 39 * @param { Want } want - Indicates the ability to start. 40 * @param { AsyncCallback<void> } callback - The callback of startAbility. 41 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 42 * 2. Incorrect parameter types. 43 * @throws { BusinessError } 16000001 - The specified ability does not exist. 44 * @throws { BusinessError } 16000004 - Cannot start an invisible component. 45 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 46 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 47 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 48 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 49 * @throws { BusinessError } 16000011 - The context does not exist. 50 * @throws { BusinessError } 16000012 - The application is controlled. 51 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 52 * @throws { BusinessError } 16000050 - Internal error. 53 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 54 * @throws { BusinessError } 16000055 - Installation-free timed out. 55 * @throws { BusinessError } 16000061 - Operation not supported. 56 * @throws { BusinessError } 16200001 - The caller has been released. 57 * @syscap SystemCapability.Ability.AbilityRuntime.Core 58 * @StageModelOnly 59 * @atomicservice 60 * @since 11 61 */ 62 startAbility(want: Want, callback: AsyncCallback<void>): void; 63 64 /** 65 * Starts a new ability. 66 * This interface only allows you to start abilities within the same bundle and specify the bundleName. 67 * This interface only allows called in UIAbility insight intent execute mode. 68 * 69 * @param { Want } want - Indicates the ability to start. 70 * @returns { Promise<void> } The promise returned by the function. 71 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 72 * 2. Incorrect parameter types. 73 * @throws { BusinessError } 16000001 - The specified ability does not exist. 74 * @throws { BusinessError } 16000004 - Cannot start an invisible component. 75 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 76 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 77 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 78 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 79 * @throws { BusinessError } 16000011 - The context does not exist. 80 * @throws { BusinessError } 16000012 - The application is controlled. 81 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 82 * @throws { BusinessError } 16000050 - Internal error. 83 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 84 * @throws { BusinessError } 16000055 - Installation-free timed out. 85 * @throws { BusinessError } 16000061 - Operation not supported. 86 * @throws { BusinessError } 16200001 - The caller has been released. 87 * @syscap SystemCapability.Ability.AbilityRuntime.Core 88 * @StageModelOnly 89 * @atomicservice 90 * @since 11 91 */ 92 startAbility(want: Want): Promise<void>; 93} 94 95export default InsightIntentContext;