161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2024 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 IMEKit 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 * The extension context class of input method. 2761847f8eSopenharmony_ci * 2861847f8eSopenharmony_ci * @extends ExtensionContext 2961847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 3061847f8eSopenharmony_ci * @StageModelOnly 3161847f8eSopenharmony_ci * @since 9 3261847f8eSopenharmony_ci */ 3361847f8eSopenharmony_ciexport default class InputMethodExtensionContext extends ExtensionContext { 3461847f8eSopenharmony_ci /** 3561847f8eSopenharmony_ci * Destroy the input method extension. 3661847f8eSopenharmony_ci * 3761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of destroy. 3861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 3961847f8eSopenharmony_ci * @StageModelOnly 4061847f8eSopenharmony_ci * @since 9 4161847f8eSopenharmony_ci */ 4261847f8eSopenharmony_ci destroy(callback: AsyncCallback<void>): void; 4361847f8eSopenharmony_ci 4461847f8eSopenharmony_ci /** 4561847f8eSopenharmony_ci * Destroy the input method extension. 4661847f8eSopenharmony_ci * 4761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 4861847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 4961847f8eSopenharmony_ci * @StageModelOnly 5061847f8eSopenharmony_ci * @since 9 5161847f8eSopenharmony_ci */ 5261847f8eSopenharmony_ci destroy(): Promise<void>; 5361847f8eSopenharmony_ci 5461847f8eSopenharmony_ci /** 5561847f8eSopenharmony_ci * Inputmethod extension uses this method to start a specific ability. 5661847f8eSopenharmony_ci * 5761847f8eSopenharmony_ci * @param { Want } want - Indicates the ability to start. 5861847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 5961847f8eSopenharmony_ci * @throws { BusinessError } 401 - parameter error. Possible causes: 6061847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 6161847f8eSopenharmony_ci * @throws { BusinessError } 16000001 - The specified ability does not exist. 6261847f8eSopenharmony_ci * @throws { BusinessError } 16000002 - Incorrect ability type. 6361847f8eSopenharmony_ci * @throws { BusinessError } 16000004 - Can not start invisible component. 6461847f8eSopenharmony_ci * @throws { BusinessError } 16000005 - The specified process does not have the permission. 6561847f8eSopenharmony_ci * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. 6661847f8eSopenharmony_ci * @throws { BusinessError } 16000008 - The crowdtesting application expires. 6761847f8eSopenharmony_ci * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. 6861847f8eSopenharmony_ci * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. 6961847f8eSopenharmony_ci * @throws { BusinessError } 16000011 - The context does not exist. 7061847f8eSopenharmony_ci * @throws { BusinessError } 16000012 - The application is controlled. 7161847f8eSopenharmony_ci * @throws { BusinessError } 16000013 - The application is controlled by EDM. 7261847f8eSopenharmony_ci * @throws { BusinessError } 16000019 - Can not match any component. 7361847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 7461847f8eSopenharmony_ci * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. 7561847f8eSopenharmony_ci * @throws { BusinessError } 16000055 - Installation-free timed out. 7661847f8eSopenharmony_ci * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle. 7761847f8eSopenharmony_ci * @throws { BusinessError } 16000069 - The extension cannot start the third party application. 7861847f8eSopenharmony_ci * @throws { BusinessError } 16000070 - The extension cannot start the service. 7961847f8eSopenharmony_ci * @throws { BusinessError } 16200001 - The caller has been released. 8061847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 8161847f8eSopenharmony_ci * @StageModelOnly 8261847f8eSopenharmony_ci * @since 12 8361847f8eSopenharmony_ci */ 8461847f8eSopenharmony_ci startAbility(want: Want): Promise<void>; 8561847f8eSopenharmony_ci} 86