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 IMEKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22import Want from './@ohos.app.ability.Want'; 23import ExtensionContext from './application/ExtensionContext'; 24 25/** 26 * The extension context class of input method. 27 * 28 * @extends ExtensionContext 29 * @syscap SystemCapability.MiscServices.InputMethodFramework 30 * @StageModelOnly 31 * @since 9 32 */ 33export default class InputMethodExtensionContext extends ExtensionContext { 34 /** 35 * Destroy the input method extension. 36 * 37 * @param { AsyncCallback<void> } callback - the callback of destroy. 38 * @syscap SystemCapability.MiscServices.InputMethodFramework 39 * @StageModelOnly 40 * @since 9 41 */ 42 destroy(callback: AsyncCallback<void>): void; 43 44 /** 45 * Destroy the input method extension. 46 * 47 * @returns { Promise<void> } the promise returned by the function. 48 * @syscap SystemCapability.MiscServices.InputMethodFramework 49 * @StageModelOnly 50 * @since 9 51 */ 52 destroy(): Promise<void>; 53 54 /** 55 * Inputmethod extension uses this method to start a specific ability. 56 * 57 * @param { Want } want - Indicates the ability to start. 58 * @returns { Promise<void> } The promise returned by the function. 59 * @throws { BusinessError } 401 - parameter error. Possible causes: 60 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 61 * @throws { BusinessError } 16000001 - The specified ability does not exist. 62 * @throws { BusinessError } 16000002 - Incorrect ability type. 63 * @throws { BusinessError } 16000004 - Can not start invisible component. 64 * @throws { BusinessError } 16000005 - The specified process does not have the permission. 65 * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 66 * @throws { BusinessError } 16000008 - The crowdtesting application expires. 67 * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 68 * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 69 * @throws { BusinessError } 16000011 - The context does not exist. 70 * @throws { BusinessError } 16000012 - The application is controlled. 71 * @throws { BusinessError } 16000013 - The application is controlled by EDM. 72 * @throws { BusinessError } 16000019 - Can not match any component. 73 * @throws { BusinessError } 16000050 - Internal error. 74 * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 75 * @throws { BusinessError } 16000055 - Installation-free timed out. 76 * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle. 77 * @throws { BusinessError } 16000069 - The extension cannot start the third party application. 78 * @throws { BusinessError } 16000070 - The extension cannot start the service. 79 * @throws { BusinessError } 16200001 - The caller has been released. 80 * @syscap SystemCapability.MiscServices.InputMethodFramework 81 * @StageModelOnly 82 * @since 12 83 */ 84 startAbility(want: Want): Promise<void>; 85} 86