1/* 2 * Copyright (c) 2025 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 BasicServicesKit 19 */ 20 21import ExtensionContext from './application/ExtensionContext'; 22import Want from './@ohos.app.ability.Want'; 23 24/** 25 * Defines the ExtensionContext for the word selection service. 26 * @extends ExtensionContext 27 * @syscap SystemCapability.SelectionInput.Selection 28 * @systemapi 29 * @since 20 30 */ 31export default class SelectionExtensionContext extends ExtensionContext { 32 33 /** 34 * Starts a specific ability. Only abilities with the same bundle name as the current application can be 35 * started. If the ability to start has a different bundle name, this operation fails and an error code is 36 * returned. 37 * 38 * @param { Want } want - Indicates the ability to start. 39 * @returns { Promise<void> } The promise returned by the function. 40 * @throws { BusinessError } 16000001 - The specified ability does not exist. 41 * @throws { BusinessError } 16000002 - Incorrect ability type. 42 * @throws { BusinessError } 16000004 - Cannot start an invisible component. 43 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 44 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 45 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 46 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 47 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is 48 * forbidden. 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 } 16000019 - No matching ability is found. 53 * @throws { BusinessError } 16000050 - Internal error. 54 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 55 * @throws { BusinessError } 16000055 - Installation-free timed out. 56 * @throws { BusinessError } 16000061 - Operation not supported. 57 * @throws { BusinessError } 16000069 - The extension cannot start the third party application. 58 * @throws { BusinessError } 16000070 - The extension cannot start the service. 59 * @throws { BusinessError } 16000083 The ExtensionAbility cannot start the ability due to system control. 60 * @throws { BusinessError } 16200001 - The caller has been released. 61 * @syscap SystemCapability.SelectionInput.Selection 62 * @systemapi 63 * @since 20 64 */ 65 startAbility(want: Want): Promise<void>; 66} 67