• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 */
20import type { Callback, AsyncCallback } from './@ohos.base';
21import type { ElementName } from './bundleManager/ElementName';
22import InputMethodSubtype from './@ohos.InputMethodSubtype';
23import type { PanelInfo } from './@ohos.inputMethod.Panel';
24
25/**
26 * Input method
27 *
28 * @namespace inputMethod
29 * @syscap SystemCapability.MiscServices.InputMethodFramework
30 * @since 6
31 */
32declare namespace inputMethod {
33  /**
34   * Keyboard max number
35   *
36   * @syscap SystemCapability.MiscServices.InputMethodFramework
37   * @since 8
38   */
39  const MAX_TYPE_NUM: number;
40
41  /**
42   * Input method setting
43   *
44   * @returns { InputMethodSetting } the object of InputMethodSetting
45   * @syscap SystemCapability.MiscServices.InputMethodFramework
46   * @since 8
47   * @deprecated since 9
48   * @useinstead inputMethod#getSetting
49   */
50  function getInputMethodSetting(): InputMethodSetting;
51
52  /**
53   * Input method controller
54   *
55   * @returns { InputMethodController } the object of InputMethodController.
56   * @syscap SystemCapability.MiscServices.InputMethodFramework
57   * @since 6
58   * @deprecated since 9
59   * @useinstead inputMethod#getController
60   */
61  function getInputMethodController(): InputMethodController;
62
63  /**
64   * Input method setting
65   *
66   * @returns { InputMethodSetting } the object of InputMethodSetting.
67   * @throws { BusinessError } 12800007 - setter error.
68   * @syscap SystemCapability.MiscServices.InputMethodFramework
69   * @since 9
70   */
71  function getSetting(): InputMethodSetting;
72
73  /**
74   * Input method controller
75   *
76   * @returns { InputMethodController } the object of InputMethodController.
77   * @throws { BusinessError } 12800006 - input method controller error.
78   * @syscap SystemCapability.MiscServices.InputMethodFramework
79   * @since 9
80   */
81  function getController(): InputMethodController;
82
83  /**
84   * Get default input method
85   *
86   * @returns { InputMethodProperty } property of the default input method.
87   * @throws { BusinessError } 12800008 - input method manager service error.
88   * @syscap SystemCapability.MiscServices.InputMethodFramework
89   * @since 11
90   */
91  function getDefaultInputMethod(): InputMethodProperty;
92
93  /**
94   * Get system input method config ability
95   *
96   * @returns { ElementName } the information of system input method config ability.
97   * @throws { BusinessError } 12800008 - input method manager service error.
98   * @syscap SystemCapability.MiscServices.InputMethodFramework
99   * @since 11
100   */
101  function getSystemInputMethodConfigAbility(): ElementName;
102
103  /**
104   * Switch input method
105   *
106   * @permission ohos.permission.CONNECT_IME_ABILITY
107   * @param { InputMethodProperty } target - indicates the input method which will replace the current one.
108   * @param { AsyncCallback<boolean> } callback - the callback of switchInputMethod.
109   * @throws { BusinessError } 201 - permissions check fails.
110   * @throws { BusinessError } 401 - parameter error. Possible causes:
111   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
112   * @throws { BusinessError } 12800005 - configuration persistence error.
113   * @throws { BusinessError } 12800008 - input method manager service error.
114   * @syscap SystemCapability.MiscServices.InputMethodFramework
115   * @since 9
116   */
117  /**
118   * Switch input method. The caller must be the current inputmethod.
119   *
120   * @param { InputMethodProperty } target - indicates the target input method.
121   * @param { AsyncCallback<boolean> } callback - the callback of switchInputMethod.
122   * @throws { BusinessError } 401 - parameter error. Possible causes:
123   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
124   * @throws { BusinessError } 12800005 - configuration persistence error.
125   * @throws { BusinessError } 12800008 - input method manager service error.
126   * @syscap SystemCapability.MiscServices.InputMethodFramework
127   * @since 11
128   */
129  function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolean>): void;
130
131  /**
132   * Switch input method
133   *
134   * @permission ohos.permission.CONNECT_IME_ABILITY
135   * @param { InputMethodProperty } target - Indicates the input method which will replace the current one.
136   * @returns { Promise<boolean> } the promise returned by the function.
137   * @throws { BusinessError } 201 - permissions check fails.
138   * @throws { BusinessError } 401 - parameter error. Possible causes:
139   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
140   * @throws { BusinessError } 12800005 - configuration persistence error.
141   * @throws { BusinessError } 12800008 - input method manager service error.
142   * @syscap SystemCapability.MiscServices.InputMethodFramework
143   * @since 9
144   */
145  /**
146   * Switch input method. The caller must be the current inputmethod.
147   *
148   * @param { InputMethodProperty } target - indicates the target input method.
149   * @returns { Promise<boolean> } the promise returned by the function.
150   * @throws { BusinessError } 401 - parameter error. Possible causes:
151   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
152   * @throws { BusinessError } 12800005 - configuration persistence error.
153   * @throws { BusinessError } 12800008 - input method manager service error.
154   * @syscap SystemCapability.MiscServices.InputMethodFramework
155   * @since 11
156   */
157  function switchInputMethod(target: InputMethodProperty): Promise<boolean>;
158
159  /**
160   * Get current input method
161   *
162   * @returns { InputMethodProperty } the property of current inputmethod.
163   * @syscap SystemCapability.MiscServices.InputMethodFramework
164   * @since 9
165   */
166  function getCurrentInputMethod(): InputMethodProperty;
167
168  /**
169   * Switch current input method subtype
170   *
171   * @permission ohos.permission.CONNECT_IME_ABILITY
172   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
173   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
174   * @throws { BusinessError } 201 - permissions check fails.
175   * @throws { BusinessError } 401 - parameter error. Possible causes:
176   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
177   * @throws { BusinessError } 12800005 - configuration persistence error.
178   * @throws { BusinessError } 12800008 - input method manager service error.
179   * @syscap SystemCapability.MiscServices.InputMethodFramework
180   * @since 9
181   */
182  /**
183   * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
184   *
185   * @permission ohos.permission.CONNECT_IME_ABILITY
186   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
187   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
188   * @throws { BusinessError } 201 - permissions check fails.
189   * @throws { BusinessError } 401 - parameter error. Possible causes:
190   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
191   * @throws { BusinessError } 12800005 - configuration persistence error.
192   * @throws { BusinessError } 12800008 - input method manager service error.
193   * @syscap SystemCapability.MiscServices.InputMethodFramework
194   * @since 10
195   */
196  /**
197   * Switch current input method subtype. The caller must be the current inputmethod.
198   *
199   * @param { InputMethodSubtype } target - indicates the target input method subtype.
200   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
201   * @throws { BusinessError } 401 - parameter error. Possible causes:
202   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
203   * @throws { BusinessError } 12800005 - configuration persistence error.
204   * @throws { BusinessError } 12800008 - input method manager service error.
205   * @syscap SystemCapability.MiscServices.InputMethodFramework
206   * @since 11
207   */
208  function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback<boolean>): void;
209
210  /**
211   * Switch current input method subtype
212   *
213   * @permission ohos.permission.CONNECT_IME_ABILITY
214   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
215   * @returns { Promise<boolean> } the promise returned by the function.
216   * @throws { BusinessError } 201 - permissions check fails.
217   * @throws { BusinessError } 401 - parameter error. Possible causes:
218   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
219   * @throws { BusinessError } 12800005 - configuration persistence error.
220   * @throws { BusinessError } 12800008 - input method manager service error.
221   * @syscap SystemCapability.MiscServices.InputMethodFramework
222   * @since 9
223   */
224  /**
225   * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
226   *
227   * @permission ohos.permission.CONNECT_IME_ABILITY
228   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
229   * @returns { Promise<boolean> } the promise returned by the function.
230   * @throws { BusinessError } 201 - permissions check fails.
231   * @throws { BusinessError } 401 - parameter error. Possible causes:
232   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
233   * @throws { BusinessError } 12800005 - configuration persistence error.
234   * @throws { BusinessError } 12800008 - input method manager service error.
235   * @syscap SystemCapability.MiscServices.InputMethodFramework
236   * @since 10
237   */
238  /**
239   * Switch current input method subtype. The caller must be the current inputmethod.
240   *
241   * @param { InputMethodSubtype } target - indicates the target input method subtype.
242   * @returns { Promise<boolean> } the promise returned by the function.
243   * @throws { BusinessError } 401 - parameter error. Possible causes:
244   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
245   * @throws { BusinessError } 12800005 - configuration persistence error.
246   * @throws { BusinessError } 12800008 - input method manager service error.
247   * @syscap SystemCapability.MiscServices.InputMethodFramework
248   * @since 11
249   */
250  function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean>;
251
252  /**
253   * Get the current input method subtype
254   *
255   * @returns { InputMethodSubtype } the subtype of the current input method.
256   * @syscap SystemCapability.MiscServices.InputMethodFramework
257   * @since 9
258   */
259  function getCurrentInputMethodSubtype(): InputMethodSubtype;
260
261  /**
262   * Switch input method and subtype. If the caller is an input method, it must be the current inputmethod.
263   *
264   * @permission ohos.permission.CONNECT_IME_ABILITY
265   * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
266   * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
267   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodAndSubtype.
268   * @throws { BusinessError } 201 - permissions check fails.
269   * @throws { BusinessError } 401 - parameter error. Possible causes:
270   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
271   * @throws { BusinessError } 12800005 - configuration persistence error.
272   * @throws { BusinessError } 12800008 - input method manager service error.
273   * @syscap SystemCapability.MiscServices.InputMethodFramework
274   * @since 9
275   */
276  /**
277   * Switch input method and subtype. The caller must be the current inputmethod.
278   *
279   * @param { InputMethodProperty } inputMethodProperty - indicates the target input method.
280   * @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype.
281   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodAndSubtype.
282   * @throws { BusinessError } 401 - parameter error. Possible causes:
283   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
284   * @throws { BusinessError } 12800005 - configuration persistence error.
285   * @throws { BusinessError } 12800008 - input method manager service error.
286   * @syscap SystemCapability.MiscServices.InputMethodFramework
287   * @since 11
288   */
289  function switchCurrentInputMethodAndSubtype(
290    inputMethodProperty: InputMethodProperty,
291    inputMethodSubtype: InputMethodSubtype,
292    callback: AsyncCallback<boolean>
293  ): void;
294
295  /**
296   * Switch input method and subtype. If the caller is an input method, it must be the current inputmethod.
297   *
298   * @permission ohos.permission.CONNECT_IME_ABILITY
299   * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
300   * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
301   * @returns { Promise<boolean> } the promise returned by the function.
302   * @throws { BusinessError } 201 - permissions check fails.
303   * @throws { BusinessError } 401 - parameter error. Possible causes:
304   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
305   * @throws { BusinessError } 12800005 - configuration persistence error.
306   * @throws { BusinessError } 12800008 - input method manager service error.
307   * @syscap SystemCapability.MiscServices.InputMethodFramework
308   * @since 9
309   */
310  /**
311   * Switch input method and subtype. The caller must be the current inputmethod.
312   *
313   * @param { InputMethodProperty } inputMethodProperty - indicates the target input method.
314   * @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype.
315   * @returns { Promise<boolean> } the promise returned by the function.
316   * @throws { BusinessError } 401 - parameter error. Possible causes:
317   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
318   * @throws { BusinessError } 12800005 - configuration persistence error.
319   * @throws { BusinessError } 12800008 - input method manager service error.
320   * @syscap SystemCapability.MiscServices.InputMethodFramework
321   * @since 11
322   */
323  function switchCurrentInputMethodAndSubtype(
324    inputMethodProperty: InputMethodProperty,
325    inputMethodSubtype: InputMethodSubtype
326  ): Promise<boolean>;
327
328  /**
329   * Switch input method and subtype
330   *
331   * @permission ohos.permission.CONNECT_IME_ABILITY
332   * @param { string } bundleName - indicates the bundleName of target input method.
333   * @param { string } [subtypeId] - indicates the id of the input method subtype.
334   *     If the param is not set, switch to the target input method with a default subtype.
335   * @returns { Promise<void> } the promise returned by the function.
336   * @throws { BusinessError } 201 - permissions check fails.
337   * @throws { BusinessError } 202 - not system application.
338   * @throws { BusinessError } 401 - parameter error. Possible causes:
339   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
340   * @throws { BusinessError } 12800005 - configuration persistence error.
341   * @throws { BusinessError } 12800008 - input method manager service error.
342   * @syscap SystemCapability.MiscServices.InputMethodFramework
343   * @systemapi
344   * @since 11
345   */
346  function switchInputMethod(bundleName: string, subtypeId?: string): Promise<void>;
347
348  /**
349   * @interface InputMethodSetting
350   * @syscap SystemCapability.MiscServices.InputMethodFramework
351   * @since 8
352   */
353  interface InputMethodSetting {
354    /**
355     * Subscribe input method or subtype change.
356     *
357     * @param { 'imeChange' } type - Indicates the event type.
358     * @param { function } callback - the callback of 'imeChange'
359     * @syscap SystemCapability.MiscServices.InputMethodFramework
360     * @since 9
361     */
362    on(
363      type: 'imeChange',
364      callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
365    ): void;
366
367    /**
368     * Unsubscribe input method or subtype change.
369     *
370     * @param { 'imeChange' } type - Indicates the event type.
371     * @param { function } [callback] - the callback of 'imeChange',
372     *        when subscriber unsubscribes all callback functions of event 'imeChange', this parameter can be left blank.
373     * @syscap SystemCapability.MiscServices.InputMethodFramework
374     * @since 9
375     */
376    off(
377      type: 'imeChange',
378      callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
379    ): void;
380
381    /**
382     * Subscribes to input window show events.
383     *
384     * @param { 'imeShow' } type - Indicates the event type.
385     * @param { function } callback - the callback of 'imeShow'.
386     * @throws { BusinessError } 202 - not system application.
387     * @syscap SystemCapability.MiscServices.InputMethodFramework
388     * @systemapi
389     * @since 10
390     */
391    on(type: 'imeShow', callback: (info: Array<InputWindowInfo>) => void): void;
392
393    /**
394     * Unsubscribe input window show event.
395     *
396     * @param { 'imeShow' } type - Indicates the event type.
397     * @param { function } [callback] - the callback of 'imeShow',
398     *        when subscriber unsubscribes all callback functions of event 'imeShow', this parameter can be left blank.
399     * @syscap SystemCapability.MiscServices.InputMethodFramework
400     * @systemapi
401     * @since 10
402     */
403    off(type: 'imeShow', callback?: (info: Array<InputWindowInfo>) => void): void;
404
405    /**
406     * Subscribes to input window hidden events.
407     *
408     * @param { 'imeHide' } type - Indicates the event type.
409     * @param { function } callback - the callback of 'imeHide'.
410     * @throws { BusinessError } 202 - not system application.
411     * @syscap SystemCapability.MiscServices.InputMethodFramework
412     * @systemapi
413     * @since 10
414     */
415    on(type: 'imeHide', callback: (info: Array<InputWindowInfo>) => void): void;
416
417    /**
418     * Unsubscribe input window hide event.
419     *
420     * @param { 'imeHide' } type - Indicates the event type.
421     * @param { function } [callback] - the callback of 'imeHide',
422     *        when subscriber unsubscribes all callback functions of event 'imeHide', this parameter can be left blank.
423     * @syscap SystemCapability.MiscServices.InputMethodFramework
424     * @systemapi
425     * @since 10
426     */
427    off(type: 'imeHide', callback?: (info: Array<InputWindowInfo>) => void): void;
428
429    /**
430     * Query whether a panel with specified information is shown.
431     *
432     * @param { PanelInfo } panelInfo - the information of panel which is queried.
433     * @returns { boolean }
434     *     If true, the panel being queried is shown.
435     *     If false, the panel being queried is hidden.
436     * @throws { BusinessError } 202 - not system application.
437     * @throws { BusinessError } 401 - parameter error. Possible causes:
438     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
439     * @throws { BusinessError } 12800008 - input method manager service error.
440     * @syscap SystemCapability.MiscServices.InputMethodFramework
441     * @systemapi
442     * @since 11
443     */
444    isPanelShown(panelInfo: PanelInfo): boolean;
445
446    /**
447     * List subtype of the specified input method.
448     *
449     * @param { InputMethodProperty } inputMethodProperty - the property of the specified inputmethod.
450     * @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listInputMethodSubtype.
451     * @throws { BusinessError } 401 - parameter error. Possible causes:
452     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
453     * @throws { BusinessError } 12800001 - bundle manager error.
454     * @throws { BusinessError } 12800008 - input method manager service error.
455     * @syscap SystemCapability.MiscServices.InputMethodFramework
456     * @since 9
457     */
458    listInputMethodSubtype(
459      inputMethodProperty: InputMethodProperty,
460      callback: AsyncCallback<Array<InputMethodSubtype>>
461    ): void;
462
463    /**
464     * List subtype of the specified input method.
465     *
466     * @param { InputMethodProperty } inputMethodProperty - Indicates the specified input method.
467     * @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
468     * @throws { BusinessError } 401 - parameter error. Possible causes:
469     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
470     * @throws { BusinessError } 12800001 - bundle manager error.
471     * @throws { BusinessError } 12800008 - input method manager service error.
472     * @syscap SystemCapability.MiscServices.InputMethodFramework
473     * @since 9
474     */
475    listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Array<InputMethodSubtype>>;
476
477    /**
478     * List subtype of current input method
479     *
480     * @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listCurrentInputMethodSubtype.
481     * @throws { BusinessError } 12800001 - bundle manager error.
482     * @throws { BusinessError } 12800008 - input method manager service error.
483     * @syscap SystemCapability.MiscServices.InputMethodFramework
484     * @since 9
485     */
486    listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSubtype>>): void;
487
488    /**
489     * List subtype of current input method
490     *
491     * @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
492     * @throws { BusinessError } 12800001 - bundle manager error.
493     * @throws { BusinessError } 12800008 - input method manager service error.
494     * @syscap SystemCapability.MiscServices.InputMethodFramework
495     * @since 9
496     */
497    listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>;
498
499    /**
500     * List input methods
501     *
502     * @param { boolean } enable -
503     *     If true, collect enabled input methods.
504     *     If false, collect disabled input methods.
505     * @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of getInputMethods.
506     * @throws { BusinessError } 401 - parameter error. Possible causes:
507     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
508     * @throws { BusinessError } 12800001 - bundle manager error.
509     * @throws { BusinessError } 12800008 - input method manager service error.
510     * @syscap SystemCapability.MiscServices.InputMethodFramework
511     * @since 9
512     */
513    getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
514
515    /**
516     * List input methods
517     *
518     * @param { boolean } enable -
519     *     If true, collect enabled input methods.
520     *     If false, collect disabled input methods.
521     * @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
522     * @throws { BusinessError } 401 - parameter error. Possible causes:
523     *      1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
524     * @throws { BusinessError } 12800001 - bundle manager error.
525     * @throws { BusinessError } 12800008 - input method manager service error.
526     * @syscap SystemCapability.MiscServices.InputMethodFramework
527     * @since 9
528     */
529    getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
530
531    /**
532     * List enabled or disabled input methods sync
533     *
534     * @param { boolean } enable -
535     *     If true, collect enabled input methods.
536     *     If false, collect disabled input methods.
537     * @returns { Array<InputMethodProperty> } the list of inputmethod.
538     * @throws { BusinessError } 401 - parameter error. Possible causes:
539     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
540     * @throws { BusinessError } 12800001 - bundle manager error.
541     * @throws { BusinessError } 12800008 - input method manager service error.
542     * @syscap SystemCapability.MiscServices.InputMethodFramework
543     * @since 11
544     */
545    getInputMethodsSync(enable: boolean): Array<InputMethodProperty>;
546
547    /**
548     * List all input methods
549     *
550     * @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of getInputMethods.
551     * @throws { BusinessError } 12800001 - bundle manager error.
552     * @throws { BusinessError } 12800008 - input method manager service error.
553     * @syscap SystemCapability.MiscServices.InputMethodFramework
554     * @since 11
555     */
556    getAllInputMethods(callback: AsyncCallback<Array<InputMethodProperty>>): void;
557
558    /**
559     * List all input methods
560     *
561     * @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
562     * @throws { BusinessError } 12800001 - bundle manager error.
563     * @throws { BusinessError } 12800008 - input method manager service error.
564     * @syscap SystemCapability.MiscServices.InputMethodFramework
565     * @since 11
566     */
567    getAllInputMethods(): Promise<Array<InputMethodProperty>>;
568
569    /**
570     * List all input methods sync
571     *
572     * @returns { Array<InputMethodProperty> } the list of all inputmethod.
573     * @throws { BusinessError } 12800001 - bundle manager error.
574     * @throws { BusinessError } 12800008 - input method manager service error.
575     * @syscap SystemCapability.MiscServices.InputMethodFramework
576     * @since 11
577     */
578    getAllInputMethodsSync(): Array<InputMethodProperty>;
579
580    /**
581     * @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of listInputMethod.
582     * @syscap SystemCapability.MiscServices.InputMethodFramework
583     * @since 8
584     * @deprecated since 9
585     * @useinstead inputMethod.InputMethodSetting#getInputMethods
586     */
587    listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>): void;
588
589    /**
590     * @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
591     * @syscap SystemCapability.MiscServices.InputMethodFramework
592     * @since 8
593     * @deprecated since 9
594     * @useinstead inputMethod.InputMethodSetting#getInputMethods
595     */
596    listInputMethod(): Promise<Array<InputMethodProperty>>;
597
598    /**
599     * Show input method setting extension dialog
600     *
601     * @param { AsyncCallback<boolean> } callback - the callback of showOptionalInputMethods.
602     * @throws { BusinessError } 12800008 - input method manager service error.
603     * @syscap SystemCapability.MiscServices.InputMethodFramework
604     * @since 9
605     */
606    showOptionalInputMethods(callback: AsyncCallback<boolean>): void;
607
608    /**
609     * Show input method setting extension dialog
610     *
611     * @returns { Promise<boolean> } the promise returned by the function.
612     * @throws { BusinessError } 12800008 - input method manager service error.
613     * @syscap SystemCapability.MiscServices.InputMethodFramework
614     * @since 9
615     */
616    showOptionalInputMethods(): Promise<boolean>;
617
618    /**
619     * @param { AsyncCallback<void> } callback - the callback of displayOptionalInputMethod.
620     * @syscap SystemCapability.MiscServices.InputMethodFramework
621     * @since 8
622     * @deprecated since 9
623     * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
624     */
625    displayOptionalInputMethod(callback: AsyncCallback<void>): void;
626
627    /**
628     * @returns { Promise<void> } the promise returned by the function.
629     * @syscap SystemCapability.MiscServices.InputMethodFramework
630     * @since 8
631     * @deprecated since 9
632     * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
633     */
634    displayOptionalInputMethod(): Promise<void>;
635
636    /**
637     * The input method application calls this interface to obtain its own enabled state.
638     *
639     * @returns { Promise<EnabledState> } the promise returned by the function.
640     * @throws { BusinessError } 12800004 - not an input method application.
641     * @throws { BusinessError } 12800008 - input method manager service error.
642     * @syscap SystemCapability.MiscServices.InputMethodFramework
643     * @since 15
644     */
645    getInputMethodState(): Promise<EnabledState>;
646  }
647
648  /**
649   * @interface InputMethodController
650   * @syscap SystemCapability.MiscServices.InputMethodFramework
651   * @since 6
652   */
653  interface InputMethodController {
654    /**
655     * Attach application to the input method service.
656     *
657     * @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
658     * @param { TextConfig } textConfig - indicates the config of the textInput.
659     * @param { AsyncCallback<void> } callback - the callback of attach.
660     * @throws { BusinessError } 401 - parameter error. Possible causes:
661     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
662     * @throws { BusinessError } 12800003 - input method client error.
663     * @throws { BusinessError } 12800008 - input method manager service error.
664     * @syscap SystemCapability.MiscServices.InputMethodFramework
665     * @since 10
666     */
667    attach(showKeyboard: boolean, textConfig: TextConfig, callback: AsyncCallback<void>): void;
668    /**
669     * Attach application to the input method service.
670     *
671     * @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
672     * @param { TextConfig } textConfig - indicates the config of the textInput.
673     * @returns { Promise<void> } the promise returned by the function.
674     * @throws { BusinessError } 401 - parameter error. Possible causes:
675     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
676     * @throws { BusinessError } 12800003 - input method client error.
677     * @throws { BusinessError } 12800008 - input method manager service error.
678     * @syscap SystemCapability.MiscServices.InputMethodFramework
679     * @since 10
680     */
681    attach(showKeyboard: boolean, textConfig: TextConfig): Promise<void>;
682    /**
683     * Attach application to the input method service.
684     *
685     * @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
686     * @param { TextConfig } textConfig - indicates the config of the textInput.
687     * @param { RequestKeyboardReason } requestKeyboardReason - requestKeyboardReason of show the keyboard .
688     * @returns { Promise<void> } the promise returned by the function.
689     * @throws { BusinessError } 401 - parameter error. Possible causes:
690     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
691     * @throws { BusinessError } 12800003 - input method client error.
692     * @throws { BusinessError } 12800008 - input method manager service error.
693     * @syscap SystemCapability.MiscServices.InputMethodFramework
694     * @since 15
695     */
696    attach(showKeyboard: boolean, textConfig: TextConfig, requestKeyboardReason: RequestKeyboardReason): Promise<void>;
697    /**
698     * Show the text input and start typing.
699     *
700     * @param { AsyncCallback<void> } callback - the callback of showTextInput.
701     * @throws { BusinessError } 12800003 - input method client error.
702     * @throws { BusinessError } 12800008 - input method manager service error.
703     * @throws { BusinessError } 12800009 - input method client detached.
704     * @syscap SystemCapability.MiscServices.InputMethodFramework
705     * @since 10
706     */
707    showTextInput(callback: AsyncCallback<void>): void;
708    /**
709     * Show the text input and start typing.
710     *
711     * @returns { Promise<void> } the promise returned by the function.
712     * @throws { BusinessError } 12800003 - input method client error.
713     * @throws { BusinessError } 12800008 - input method manager service error.
714     * @throws { BusinessError } 12800009 - input method client detached.
715     * @syscap SystemCapability.MiscServices.InputMethodFramework
716     * @since 10
717     */
718    showTextInput(): Promise<void>;
719    /**
720     * Show the text input and start typing.
721     *
722     * @param { RequestKeyboardReason } requestKeyboardReason - requestKeyboardReason of show the keyboard .
723     * @returns { Promise<void> } the promise returned by the function.
724     * @throws { BusinessError } 12800003 - input method client error.
725     * @throws { BusinessError } 12800008 - input method manager service error.
726     * @throws { BusinessError } 12800009 - input method client detached.
727     * @syscap SystemCapability.MiscServices.InputMethodFramework
728     * @since 15
729     */
730    showTextInput(requestKeyboardReason: RequestKeyboardReason): Promise<void>;
731    /**
732     * Hide the text input and stop typing.
733     *
734     * @param { AsyncCallback<void> } callback - the callback of hideTextInput.
735     * @throws { BusinessError } 12800003 - input method client error.
736     * @throws { BusinessError } 12800008 - input method manager service error.
737     * @throws { BusinessError } 12800009 - input method client detached.
738     * @syscap SystemCapability.MiscServices.InputMethodFramework
739     * @since 10
740     */
741    hideTextInput(callback: AsyncCallback<void>): void;
742
743    /**
744     * Hide the text input and stop typing.
745     *
746     * @returns { Promise<void> } the promise returned by the function.
747     * @throws { BusinessError } 12800003 - input method client error.
748     * @throws { BusinessError } 12800008 - input method manager service error.
749     * @throws { BusinessError } 12800009 - input method client detached.
750     * @syscap SystemCapability.MiscServices.InputMethodFramework
751     * @since 10
752     */
753    hideTextInput(): Promise<void>;
754
755    /**
756     * Detach the applications from the input method manager service.
757     *
758     * @param { AsyncCallback<void> } callback - the callback of detach.
759     * @throws { BusinessError } 12800003 - input method client error.
760     * @throws { BusinessError } 12800008 - input method manager service error.
761     * @syscap SystemCapability.MiscServices.InputMethodFramework
762     * @since 10
763     */
764    detach(callback: AsyncCallback<void>): void;
765
766    /**
767     * Detach the applications from the input method manager service.
768     *
769     * @returns { Promise<void> } the promise returned by the function.
770     * @throws { BusinessError } 12800003 - input method client error.
771     * @throws { BusinessError } 12800008 - input method manager service error.
772     * @syscap SystemCapability.MiscServices.InputMethodFramework
773     * @since 10
774     */
775    detach(): Promise<void>;
776
777    /**
778     * Inform the system of the window ID of the application currently bound to the input method.
779     * After the correct setting, the window where the client is located can avoid the input method window.
780     *
781     * @param { number } windowId - the window ID of the application currently bound to the input method.
782     * @param { AsyncCallback<void> } callback - the callback of setCallingWindow.
783     * @throws { BusinessError } 401 - parameter error. Possible causes:
784     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
785     * @throws { BusinessError } 12800003 - input method client error.
786     * @throws { BusinessError } 12800008 - input method manager service error.
787     * @throws { BusinessError } 12800009 - input method client detached.
788     * @syscap SystemCapability.MiscServices.InputMethodFramework
789     * @since 10
790     */
791    setCallingWindow(windowId: number, callback: AsyncCallback<void>): void;
792
793    /**
794     * Inform the system of the window ID of the application currently bound to the input method.
795     * After the correct setting, the window where the client is located can avoid the input method window.
796     *
797     * @param { number } windowId - the window ID of the application currently bound to the input method.
798     * @returns { Promise<void> } the promise returned by the function.
799     * @throws { BusinessError } 401 - parameter error. Possible causes:
800     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
801     * @throws { BusinessError } 12800003 - input method client error.
802     * @throws { BusinessError } 12800008 - input method manager service error.
803     * @throws { BusinessError } 12800009 - input method client detached.
804     * @syscap SystemCapability.MiscServices.InputMethodFramework
805     * @since 10
806     */
807    setCallingWindow(windowId: number): Promise<void>;
808
809    /**
810     * Update Cursor and notify the input method that the current application cursor has changed.
811     *
812     * @param { CursorInfo } cursorInfo - the CursorInfo object.
813     * @param { AsyncCallback<void> } callback - the callback of updateCursor.
814     * @throws { BusinessError } 401 - parameter error. Possible causes:
815     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
816     * @throws { BusinessError } 12800003 - input method client error.
817     * @throws { BusinessError } 12800008 - input method manager service error.
818     * @throws { BusinessError } 12800009 - input method client detached.
819     * @syscap SystemCapability.MiscServices.InputMethodFramework
820     * @since 10
821     */
822    updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback<void>): void;
823
824    /**
825     * Update Cursor and notify the input method that the current application cursor has changed.
826     *
827     * @param { CursorInfo } cursorInfo - the CursorInfo object.
828     * @returns { Promise<void> } the promise returned by the function.
829     * @throws { BusinessError } 401 - parameter error. Possible causes:
830     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
831     * @throws { BusinessError } 12800003 - input method client error.
832     * @throws { BusinessError } 12800008 - input method manager service error.
833     * @throws { BusinessError } 12800009 - input method client detached.
834     * @syscap SystemCapability.MiscServices.InputMethodFramework
835     * @since 10
836     */
837    updateCursor(cursorInfo: CursorInfo): Promise<void>;
838
839    /**
840     * Notify the input method the selected text and the selection range of the current application text has changed.
841     *
842     * @param { string } text - the whole input text.
843     * @param { number } start - start position of selected text.
844     * @param { number } end - end position of selected text.
845     * @param { AsyncCallback<void> } callback - the callback of changeSelection.
846     * @throws { BusinessError } 401 - parameter error. Possible causes:
847     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
848     * @throws { BusinessError } 12800003 - input method client error.
849     * @throws { BusinessError } 12800008 - input method manager service error.
850     * @throws { BusinessError } 12800009 - input method client detached.
851     * @syscap SystemCapability.MiscServices.InputMethodFramework
852     * @since 10
853     */
854    changeSelection(text: string, start: number, end: number, callback: AsyncCallback<void>): void;
855
856    /**
857     * Notify the input method the selected text and the selection range of the current application text has changed.
858     *
859     * @param { string } text - the selected text.
860     * @param { number } start - start position of selected text.
861     * @param { number } end - end position of selected text.
862     * @returns { Promise<void> } the promise returned by the function.
863     * @throws { BusinessError } 401 - parameter error. Possible causes:
864     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
865     * @throws { BusinessError } 12800003 - input method client error.
866     * @throws { BusinessError } 12800008 - input method manager service error.
867     * @throws { BusinessError } 12800009 - input method client detached.
868     * @syscap SystemCapability.MiscServices.InputMethodFramework
869     * @since 10
870     */
871    changeSelection(text: string, start: number, end: number): Promise<void>;
872
873    /**
874     * Update InputAttribute information of input text.
875     *
876     * @param { InputAttribute } attribute - the InputAttribute object.
877     * @param { AsyncCallback<void> } callback - the callback of updateAttribute.
878     * @throws { BusinessError } 401 - parameter error. Possible causes:
879     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
880     * @throws { BusinessError } 12800003 - input method client error.
881     * @throws { BusinessError } 12800008 - input method manager service error.
882     * @throws { BusinessError } 12800009 - input method client detached.
883     * @syscap SystemCapability.MiscServices.InputMethodFramework
884     * @since 10
885     */
886    updateAttribute(attribute: InputAttribute, callback: AsyncCallback<void>): void;
887
888    /**
889     * Update InputAttribute information of input text.
890     *
891     * @param { InputAttribute } attribute - the InputAttribute object.
892     * @returns { Promise<void> } the promise returned by the function.
893     * @throws { BusinessError } 401 - parameter error. Possible causes:
894     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
895     * @throws { BusinessError } 12800003 - input method client error.
896     * @throws { BusinessError } 12800008 - input method manager service error.
897     * @throws { BusinessError } 12800009 - input method client detached.
898     * @syscap SystemCapability.MiscServices.InputMethodFramework
899     * @since 10
900     */
901    updateAttribute(attribute: InputAttribute): Promise<void>;
902    /**
903     * Stop input session
904     *
905     * @param { AsyncCallback<boolean> } callback - the callback of stopInputSession.
906     * @throws { BusinessError } 12800003 - input method client error.
907     * @throws { BusinessError } 12800008 - input method manager service error.
908     * @syscap SystemCapability.MiscServices.InputMethodFramework
909     * @since 9
910     */
911    stopInputSession(callback: AsyncCallback<boolean>): void;
912
913    /**
914     * Stop input session
915     *
916     * @returns { Promise<boolean> } the promise returned by the function.
917     * @throws { BusinessError } 12800003 - input method client error.
918     * @throws { BusinessError } 12800008 - input method manager service error.
919     * @syscap SystemCapability.MiscServices.InputMethodFramework
920     * @since 9
921     */
922    stopInputSession(): Promise<boolean>;
923
924    /**
925     * Stop input
926     *
927     * @param { AsyncCallback<boolean> } callback - the callback of stopInput.
928     * @syscap SystemCapability.MiscServices.InputMethodFramework
929     * @since 6
930     * @deprecated since 9
931     * @useinstead inputMethod.InputMethodController#stopInputSession
932     */
933    stopInput(callback: AsyncCallback<boolean>): void;
934
935    /**
936     * Stop input
937     *
938     * @returns { Promise<boolean> } the promise returned by the function.
939     * @syscap SystemCapability.MiscServices.InputMethodFramework
940     * @since 6
941     * @deprecated since 9
942     * @useinstead inputMethod.InputMethodController#stopInputSession
943     */
944    stopInput(): Promise<boolean>;
945
946    /**
947     * Show soft keyboard.
948     * This API can be called only by system applications.
949     *
950     * @permission ohos.permission.CONNECT_IME_ABILITY
951     * @param { AsyncCallback<void> } callback - the callback of showSoftKeyboard.
952     * @throws { BusinessError } 201 - permissions check fails.
953     * @throws { BusinessError } 12800003 - input method client error.
954     * @throws { BusinessError } 12800008 - input method manager service error.
955     * @syscap SystemCapability.MiscServices.InputMethodFramework
956     * @since 9
957     */
958    showSoftKeyboard(callback: AsyncCallback<void>): void;
959
960    /**
961     * Show soft keyboard.
962     * This API can be called only by system applications.
963     *
964     * @permission ohos.permission.CONNECT_IME_ABILITY
965     * @returns { Promise<void> } the promise returned by the function.
966     * @throws { BusinessError } 201 - permissions check fails.
967     * @throws { BusinessError } 12800003 - input method client error.
968     * @throws { BusinessError } 12800008 - input method manager service error.
969     * @syscap SystemCapability.MiscServices.InputMethodFramework
970     * @since 9
971     */
972    showSoftKeyboard(): Promise<void>;
973
974    /**
975     * Hide soft keyboard.
976     * This API can be called only by system applications.
977     *
978     * @permission ohos.permission.CONNECT_IME_ABILITY
979     * @param { AsyncCallback<void> } callback - the callback of hideSoftKeyboard.
980     * @throws { BusinessError } 201 - permissions check fails.
981     * @throws { BusinessError } 12800003 - input method client error.
982     * @throws { BusinessError } 12800008 - input method manager service error.
983     * @syscap SystemCapability.MiscServices.InputMethodFramework
984     * @since 9
985     */
986    hideSoftKeyboard(callback: AsyncCallback<void>): void;
987
988    /**
989     * Hide soft keyboard.
990     * This API can be called only by system applications.
991     *
992     * @permission ohos.permission.CONNECT_IME_ABILITY
993     * @returns { Promise<void> } the promise returned by the function.
994     * @throws { BusinessError } 201 - permissions check fails.
995     * @throws { BusinessError } 12800003 - input method client error.
996     * @throws { BusinessError } 12800008 - input method manager service error.
997     * @syscap SystemCapability.MiscServices.InputMethodFramework
998     * @since 9
999     */
1000    hideSoftKeyboard(): Promise<void>;
1001
1002    /**
1003     * Send message to input method.
1004     *
1005     * @param { string } msgId - the identifier of the message. Max size is 256B.
1006     * @param { ?ArrayBuffer } [msgParam] - the param of the custom message. Max size is 128KB.
1007     * @returns { Promise<void> } the promise returned by the function.
1008     * @throws { BusinessError } 401 - parameter error. Possible causes:
1009     *     1. Incorrect parameter types. 2. Incorrect parameter length.
1010     * @throws { BusinessError } 12800003 - input method client error.
1011     * @throws { BusinessError } 12800009 - input method client detached.
1012     * @throws { BusinessError } 12800014 - the input method is in basic mode.
1013     * @throws { BusinessError } 12800015 - the other side does not accept the request.
1014     * @throws { BusinessError } 12800016 - input method client is not editable.
1015     * @syscap SystemCapability.MiscServices.InputMethodFramework
1016     * @since 15
1017     */
1018    sendMessage(msgId: string, msgParam?: ArrayBuffer): Promise<void>;
1019
1020    /**
1021     * Start receiving message from input method.
1022     *
1023     * @param { ?MessageHandler } [msgHandler] - optional, the handler of the custom message.
1024     * @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter types.
1025     * @syscap SystemCapability.MiscServices.InputMethodFramework
1026     * @since 15
1027     */
1028    recvMessage(msgHandler?: MessageHandler): void;
1029
1030    /**
1031     * Register a callback and when IME sends select event with range of selection,
1032     * the callback will be invoked.
1033     *
1034     * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
1035     * @param { Callback<Range> } callback - processes selectByRange command. The range of selection is provided for
1036     *        this callback, and subscribers are expected to select corresponding text in callback according to
1037     *        the range.
1038     * @throws { BusinessError } 401 - parameter error. Possible causes:
1039     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1040     * @syscap SystemCapability.MiscServices.InputMethodFramework
1041     * @since 10
1042     */
1043    on(type: 'selectByRange', callback: Callback<Range>): void;
1044
1045    /**
1046     * Unregister the callback of selectedByRange.
1047     *
1048     * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
1049     * @param { Callback<Range> } [callback] - the callback of 'selectByRange',
1050     *        when subscriber unsubscribes all callback functions of event 'selectByRange', this parameter can be left blank.
1051     * @syscap SystemCapability.MiscServices.InputMethodFramework
1052     * @since 10
1053     */
1054    off(type: 'selectByRange', callback?: Callback<Range>): void;
1055
1056    /**
1057     * Register a callback and when IME sends select event witch movement of cursor,
1058     * the callback will be invoked.
1059     *
1060     * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
1061     * @param { Callback<Movement> } callback - processes selectByMovement command. The movement of cursor is provided
1062     *        for this callback, and subscribers are expected to select corresponding text in callback according to
1063     *        the movement.
1064     * @throws { BusinessError } 401 - parameter error. Possible causes:
1065     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1066     * @syscap SystemCapability.MiscServices.InputMethodFramework
1067     * @since 10
1068     */
1069    on(type: 'selectByMovement', callback: Callback<Movement>): void;
1070
1071    /**
1072     * Unregister the callback of selectedByMovement.
1073     *
1074     * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
1075     * @param { Callback<Movement> } [callback] - the callback of 'selectByMovement',
1076     *        when subscriber unsubscribes all callback functions of event 'selectByMovement', this parameter can be left blank.
1077     * @syscap SystemCapability.MiscServices.InputMethodFramework
1078     * @since 10
1079     */
1080    off(type: 'selectByMovement', callback?: Callback<Movement>): void;
1081
1082    /**
1083     * Register a callback and when IME sends insert text event, the callback will be invoked.
1084     *
1085     * @param { 'insertText' } type - event type, fixed as 'insertText'.
1086     * @param { function } callback - processes insertText command. The text of insert is provided for this callback.
1087     *        Subscribers are expected to process the inserted text and update changes in editor by changeSelection and updateCursor as needed.
1088     * @throws { BusinessError } 401 - parameter error. Possible causes:
1089     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1090     * @throws { BusinessError } 12800009 - input method client detached.
1091     * @syscap SystemCapability.MiscServices.InputMethodFramework
1092     * @since 10
1093     */
1094    on(type: 'insertText', callback: (text: string) => void): void;
1095
1096    /**
1097     * Unregister the callback of insertText.
1098     *
1099     * @param { 'insertText' } type - event type, fixed as 'insertText'.
1100     * @param { function } [callback] - the callback of 'insertText',
1101     *        when subscriber unsubscribes all callback functions of event 'insertText', this parameter can be left blank.
1102     * @syscap SystemCapability.MiscServices.InputMethodFramework
1103     * @since 10
1104     */
1105    off(type: 'insertText', callback?: (text: string) => void): void;
1106
1107    /**
1108     * Register a callback and when IME sends delete left event with length,
1109     * the callback will be invoked.
1110     *
1111     * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
1112     * @param { function } callback - processes deleteLeft command. The length of
1113     *     delete is provided for this callback. Subscribers are expected to delete specified length of text
1114     *     to the left of the cursor and update changes in editor by changeSelection and updateCursor as needed.
1115     * @throws { BusinessError } 401 - parameter error. Possible causes:
1116     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1117     * @throws { BusinessError } 12800009 - input method client detached.
1118     * @syscap SystemCapability.MiscServices.InputMethodFramework
1119     * @since 10
1120     */
1121    on(type: 'deleteLeft', callback: (length: number) => void): void;
1122
1123    /**
1124     * Unregister the callback of deleteLeft.
1125     *
1126     * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
1127     * @param { function } [callback] - the callback of 'deleteLeft',
1128     *        when subscriber unsubscribes all callback functions of event 'deleteLeft', this parameter can be left blank.
1129     * @syscap SystemCapability.MiscServices.InputMethodFramework
1130     * @since 10
1131     */
1132    off(type: 'deleteLeft', callback?: (length: number) => void): void;
1133
1134    /**
1135     * Register a callback and when IME sends delete right event with length,
1136     * the callback will be invoked.
1137     *
1138     * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
1139     * @param { function } callback - processes deleteRight command. The length of
1140     *     delete is provided for this callback. Subscribers are expected to delete specified length of text
1141     *     to the right of the cursor and update changes in editor by changeSelection and updateCursor as needed.
1142     * @throws { BusinessError } 401 - parameter error. Possible causes:
1143     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1144     * @throws { BusinessError } 12800009 - input method client detached.
1145     * @syscap SystemCapability.MiscServices.InputMethodFramework
1146     * @since 10
1147     */
1148    on(type: 'deleteRight', callback: (length: number) => void): void;
1149
1150    /**
1151     * Unregister the callback of deleteRight.
1152     *
1153     * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
1154     * @param { function } [callback] - the callback of 'deleteRight',
1155     *        when subscriber unsubscribes all callback functions of event 'deleteRight', this parameter can be left blank.
1156     * @syscap SystemCapability.MiscServices.InputMethodFramework
1157     * @since 10
1158     */
1159    off(type: 'deleteRight', callback?: (length: number) => void): void;
1160
1161    /**
1162     * Register a callback and when IME sends keyboard status, the callback will be invoked.
1163     *
1164     * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
1165     * @param { function } callback - processes sendKeyboardStatus command.
1166     *     The keyboardStatus is provided for this callback.
1167     * @throws { BusinessError } 401 - parameter error. Possible causes:
1168     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1169     * @throws { BusinessError } 12800009 - input method client detached.
1170     * @syscap SystemCapability.MiscServices.InputMethodFramework
1171     * @since 10
1172     */
1173    on(type: 'sendKeyboardStatus', callback: (keyboardStatus: KeyboardStatus) => void): void;
1174
1175    /**
1176     * Unregister the callback of sendKeyboardStatus.
1177     *
1178     * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
1179     * @param { function } [callback] - the callback of 'sendKeyboardStatus',
1180     *        when subscriber unsubscribes all callback functions of event 'sendKeyboardStatus', this parameter can be left blank.
1181     * @syscap SystemCapability.MiscServices.InputMethodFramework
1182     * @since 10
1183     */
1184    off(type: 'sendKeyboardStatus', callback?: (keyboardStatus: KeyboardStatus) => void): void;
1185
1186    /**
1187     * Register a callback and when IME sends functionKey, the callback will be invoked.
1188     *
1189     * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
1190     * @param { function } callback - processes sendFunctionKey command.
1191     *     The functionKey is provided for this callback.Subscribers are expected to complete the
1192     *     corresponding task based on the value of functionKey.
1193     * @throws { BusinessError } 401 - parameter error. Possible causes:
1194     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1195     * @throws { BusinessError } 12800009 - input method client detached.
1196     * @syscap SystemCapability.MiscServices.InputMethodFramework
1197     * @since 10
1198     */
1199    on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void;
1200
1201    /**
1202     * Unregister the callback of sendFunctionKey.
1203     *
1204     * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
1205     * @param { function } [callback] - the callback of 'sendFunctionKey',
1206     *        when subscriber unsubscribes all callback functions of event 'sendFunctionKey', this parameter can be left blank.
1207     * @syscap SystemCapability.MiscServices.InputMethodFramework
1208     * @since 10
1209     */
1210    off(type: 'sendFunctionKey', callback?: (functionKey: FunctionKey) => void): void;
1211
1212    /**
1213     * Register a callback and when IME sends move cursor, the callback will be invoked.
1214     *
1215     * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
1216     * @param { function } callback - processes moveCursor command. The direction of
1217     *     cursor is provided for this callback. Subscribers are expected to move the cursor and update changes
1218     *     in editor by changeSelection and updateCursor.
1219     * @throws { BusinessError } 401 - parameter error. Possible causes:
1220     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1221     * @throws { BusinessError } 12800009 - input method client detached.
1222     * @syscap SystemCapability.MiscServices.InputMethodFramework
1223     * @since 10
1224     */
1225    on(type: 'moveCursor', callback: (direction: Direction) => void): void;
1226
1227    /**
1228     * Unregister the callback of moveCursor.
1229     *
1230     * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
1231     * @param { function } [callback] - the callback of 'moveCursor',
1232     *        when subscriber unsubscribes all callback functions of event 'moveCursor', this parameter can be left blank.
1233     * @syscap SystemCapability.MiscServices.InputMethodFramework
1234     * @since 10
1235     */
1236    off(type: 'moveCursor', callback?: (direction: Direction) => void): void;
1237
1238    /**
1239     * Register a callback and when IME sends extend action code, the callback will be invoked.
1240     *
1241     * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
1242     * @param { function } callback - processes handleExtendAction command. The action code
1243     *     is provided for this callback.
1244     * @throws { BusinessError } 401 - parameter error. Possible causes:
1245     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1246     * @throws { BusinessError } 12800009 - input method client detached.
1247     * @syscap SystemCapability.MiscServices.InputMethodFramework
1248     * @since 10
1249     */
1250    on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void;
1251
1252    /**
1253     * Unregister the callback of handleExtendAction.
1254     *
1255     * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
1256     * @param { function } [callback] - the callback of 'handleExtendAction',
1257     *        when subscriber unsubscribes all callback functions of event 'handleExtendAction', this parameter can be left blank.
1258     * @syscap SystemCapability.MiscServices.InputMethodFramework
1259     * @since 10
1260     */
1261    off(type: 'handleExtendAction', callback?: (action: ExtendAction) => void): void;
1262
1263    /**
1264     * Register a callback and when input method ability gets left text of cursor, the callback will be invoked.
1265     *
1266     * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
1267     * @param { function } callback - processes getLeftTextOfCursor command. The callback
1268     *     must be a synchronization method and will block the input method application.
1269     * @throws { BusinessError } 401 - parameter error. Possible causes:
1270     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1271     * @throws { BusinessError } 12800009 - input method client detached.
1272     * @syscap SystemCapability.MiscServices.InputMethodFramework
1273     * @since 10
1274     */
1275    on(type: 'getLeftTextOfCursor', callback: (length: number) => string): void;
1276
1277    /**
1278     * Unregister the callback of getLeftTextOfCursor event.
1279     *
1280     * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
1281     * @param { function } [callback] - the callback of 'getLeftTextOfCursor',
1282     *     when subscriber unsubscribes all callback functions of event 'getLeftTextOfCursor', this parameter can be left blank.
1283     * @syscap SystemCapability.MiscServices.InputMethodFramework
1284     * @since 10
1285     */
1286    off(type: 'getLeftTextOfCursor', callback?: (length: number) => string): void;
1287
1288    /**
1289     * Register a callback and when input method ability gets right text of cursor, the callback will be invoked.
1290     *
1291     * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
1292     * @param { function } callback - processes getRightTextOfCursor command. The callback
1293     *     must be a synchronization method and will block the input method application.
1294     * @throws { BusinessError } 401 - parameter error. Possible causes:
1295     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1296     * @throws { BusinessError } 12800009 - input method client detached.
1297     * @syscap SystemCapability.MiscServices.InputMethodFramework
1298     * @since 10
1299     */
1300    on(type: 'getRightTextOfCursor', callback: (length: number) => string): void;
1301
1302    /**
1303     * Unregister the callback of getRightTextOfCursor event.
1304     *
1305     * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
1306     * @param { function } [callback] - the callback of 'getRightTextOfCursor',
1307     *     when subscriber unsubscribes all callback functions of event 'getRightTextOfCursor', this parameter can be left blank.
1308     * @syscap SystemCapability.MiscServices.InputMethodFramework
1309     * @since 10
1310     */
1311    off(type: 'getRightTextOfCursor', callback?: (length: number) => string): void;
1312
1313    /**
1314     * Register a callback and when input method ability gets the text index at cursor, the callback will be invoked.
1315     *
1316     * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
1317     * @param { function } callback - processes getTextIndexAtCursor command. The callback
1318     *     must be a synchronization method, and should return the text index at the cursor.
1319     * @throws { BusinessError } 401 - parameter error. Possible causes:
1320     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1321     * @throws { BusinessError } 12800009 - input method client detached.
1322     * @syscap SystemCapability.MiscServices.InputMethodFramework
1323     * @since 10
1324     */
1325    on(type: 'getTextIndexAtCursor', callback: () => number): void;
1326
1327    /**
1328     * Unregister the callback of getTextIndexAtCursor.
1329     *
1330     * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
1331     * @param { function } [callback] - the callback of 'getTextIndexAtCursor',
1332     *     when subscriber unsubscribes all callback functions of event 'getTextIndexAtCursor', this parameter can be left blank.
1333     * @syscap SystemCapability.MiscServices.InputMethodFramework
1334     * @since 10
1335     */
1336    off(type: 'getTextIndexAtCursor', callback?: () => number): void;
1337  }
1338
1339  /**
1340   * input method property
1341   *
1342   * @interface InputMethodProperty
1343   * @syscap SystemCapability.MiscServices.InputMethodFramework
1344   * @since 8
1345   */
1346  interface InputMethodProperty {
1347    /**
1348     * The name of input method
1349     *
1350     * @type { string }
1351     * @syscap SystemCapability.MiscServices.InputMethodFramework
1352     * @since 8
1353     * @deprecated since 9
1354     * @useinstead inputMethod.InputMethodProperty#name
1355     */
1356    readonly packageName: string;
1357
1358    /**
1359     * The id of input method
1360     *
1361     * @type { string }
1362     * @syscap SystemCapability.MiscServices.InputMethodFramework
1363     * @since 8
1364     * @deprecated since 9
1365     * @useinstead inputMethod.InputMethodProperty#id
1366     */
1367    readonly methodId: string;
1368
1369    /**
1370     * The name of input method
1371     *
1372     * @type { string }
1373     * @readonly
1374     * @syscap SystemCapability.MiscServices.InputMethodFramework
1375     * @since 9
1376     */
1377    readonly name: string;
1378
1379    /**
1380     * The id of input method
1381     *
1382     * @type { string }
1383     * @readonly
1384     * @syscap SystemCapability.MiscServices.InputMethodFramework
1385     * @since 9
1386     */
1387    readonly id: string;
1388
1389    /**
1390     * The label of input method
1391     *
1392     * @type { ?string }
1393     * @readonly
1394     * @syscap SystemCapability.MiscServices.InputMethodFramework
1395     * @since 9
1396     */
1397    readonly label?: string;
1398
1399    /**
1400     * The label id of input method
1401     *
1402     * @type { ?number }
1403     * @readonly
1404     * @syscap SystemCapability.MiscServices.InputMethodFramework
1405     * @since 10
1406     */
1407    readonly labelId?: number;
1408
1409    /**
1410     * The icon of input method
1411     *
1412     * @type { ?string }
1413     * @readonly
1414     * @syscap SystemCapability.MiscServices.InputMethodFramework
1415     * @since 9
1416     */
1417    readonly icon?: string;
1418
1419    /**
1420     * The icon id of input method
1421     *
1422     * @type { ?number }
1423     * @readonly
1424     * @syscap SystemCapability.MiscServices.InputMethodFramework
1425     * @since 9
1426     */
1427    readonly iconId?: number;
1428
1429    /**
1430     * The extra info of input method
1431     *
1432     * @type { object }
1433     * @syscap SystemCapability.MiscServices.InputMethodFramework
1434     * @since 9
1435     */
1436    /**
1437     * The extra info of input method
1438     *
1439     * @type { ?object }
1440     * @syscap SystemCapability.MiscServices.InputMethodFramework
1441     * @since 10
1442     */
1443    extra?: object;
1444  }
1445
1446  /**
1447   * Enumerates the moving direction of cursor
1448   *
1449   * @enum { number }
1450   * @syscap SystemCapability.MiscServices.InputMethodFramework
1451   * @since 10
1452   */
1453  export enum Direction {
1454    /**
1455     * Cursor moves up
1456     *
1457     * @syscap SystemCapability.MiscServices.InputMethodFramework
1458     * @since 10
1459     */
1460    CURSOR_UP = 1,
1461
1462    /**
1463     * Cursor moves down
1464     *
1465     * @syscap SystemCapability.MiscServices.InputMethodFramework
1466     * @since 10
1467     */
1468    CURSOR_DOWN,
1469
1470    /**
1471     * Cursor moves left
1472     *
1473     * @syscap SystemCapability.MiscServices.InputMethodFramework
1474     * @since 10
1475     */
1476    CURSOR_LEFT,
1477
1478    /**
1479     * Cursor moves right
1480     *
1481     * @syscap SystemCapability.MiscServices.InputMethodFramework
1482     * @since 10
1483     */
1484    CURSOR_RIGHT
1485  }
1486
1487  /**
1488   * Range of selected text.
1489   *
1490   * @typedef Range
1491   * @syscap SystemCapability.MiscServices.InputMethodFramework
1492   * @since 10
1493   */
1494  export interface Range {
1495    /**
1496     * Indicates the index of the first character of the selected text.
1497     *
1498     * @type { number }
1499     * @syscap SystemCapability.MiscServices.InputMethodFramework
1500     * @since 10
1501     */
1502    start: number;
1503
1504    /**
1505     * Indicates the index of the last character of the selected text.
1506     *
1507     * @type { number }
1508     * @syscap SystemCapability.MiscServices.InputMethodFramework
1509     * @since 10
1510     */
1511    end: number;
1512  }
1513
1514  /**
1515   * Movement of cursor.
1516   *
1517   * @typedef Movement
1518   * @syscap SystemCapability.MiscServices.InputMethodFramework
1519   * @since 10
1520   */
1521  export interface Movement {
1522    /**
1523     * Indicates the direction of cursor movement
1524     *
1525     * @type { Direction }
1526     * @syscap SystemCapability.MiscServices.InputMethodFramework
1527     * @since 10
1528     */
1529    direction: Direction;
1530  }
1531
1532  /**
1533   * Enumerates the text input type.
1534   *
1535   * @enum { number }
1536   * @syscap SystemCapability.MiscServices.InputMethodFramework
1537   * @since 10
1538   */
1539  export enum TextInputType {
1540    /**
1541     * The text input type is NONE.
1542     *
1543     * @syscap SystemCapability.MiscServices.InputMethodFramework
1544     * @since 10
1545     */
1546    NONE = -1,
1547
1548    /**
1549     * The text input type is TEXT.
1550     *
1551     * @syscap SystemCapability.MiscServices.InputMethodFramework
1552     * @since 10
1553     */
1554    TEXT = 0,
1555
1556    /**
1557     * The text input type is MULTILINE.
1558     *
1559     * @syscap SystemCapability.MiscServices.InputMethodFramework
1560     * @since 10
1561     */
1562    MULTILINE,
1563
1564    /**
1565     * The text input type is NUMBER.
1566     *
1567     * @syscap SystemCapability.MiscServices.InputMethodFramework
1568     * @since 10
1569     */
1570    NUMBER,
1571
1572    /**
1573     * The text input type is PHONE.
1574     *
1575     * @syscap SystemCapability.MiscServices.InputMethodFramework
1576     * @since 10
1577     */
1578    PHONE,
1579
1580    /**
1581     * The text input type is DATETIME.
1582     *
1583     * @syscap SystemCapability.MiscServices.InputMethodFramework
1584     * @since 10
1585     */
1586    DATETIME,
1587
1588    /**
1589     * The text input type is EMAIL_ADDRESS.
1590     *
1591     * @syscap SystemCapability.MiscServices.InputMethodFramework
1592     * @since 10
1593     */
1594    EMAIL_ADDRESS,
1595
1596    /**
1597     * The text input type is URL.
1598     *
1599     * @syscap SystemCapability.MiscServices.InputMethodFramework
1600     * @since 10
1601     */
1602    URL,
1603
1604    /**
1605     * The text input type is VISIBLE_PASSWORD.
1606     *
1607     * @syscap SystemCapability.MiscServices.InputMethodFramework
1608     * @since 10
1609     */
1610    VISIBLE_PASSWORD,
1611
1612    /**
1613     * The text input type is NUMBER_PASSWORD.
1614     *
1615     * @syscap SystemCapability.MiscServices.InputMethodFramework
1616     * @since 11
1617     */
1618    NUMBER_PASSWORD
1619  }
1620
1621  /**
1622   * Enumerates the enter key type.
1623   *
1624   * @enum { number }
1625   * @syscap SystemCapability.MiscServices.InputMethodFramework
1626   * @since 10
1627   */
1628  export enum EnterKeyType {
1629    /**
1630     * The enter key type is UNSPECIFIED.
1631     *
1632     * @syscap SystemCapability.MiscServices.InputMethodFramework
1633     * @since 10
1634     */
1635    UNSPECIFIED = 0,
1636
1637    /**
1638     * The enter key type is NONE.
1639     *
1640     * @syscap SystemCapability.MiscServices.InputMethodFramework
1641     * @since 10
1642     */
1643    NONE,
1644
1645    /**
1646     * The enter key type is GO.
1647     *
1648     * @syscap SystemCapability.MiscServices.InputMethodFramework
1649     * @since 10
1650     */
1651    GO,
1652
1653    /**
1654     * The enter key type is SEARCH.
1655     *
1656     * @syscap SystemCapability.MiscServices.InputMethodFramework
1657     * @since 10
1658     */
1659    SEARCH,
1660
1661    /**
1662     * The enter key type is SEND.
1663     *
1664     * @syscap SystemCapability.MiscServices.InputMethodFramework
1665     * @since 10
1666     */
1667    SEND,
1668
1669    /**
1670     * The enter key type is NEXT.
1671     *
1672     * @syscap SystemCapability.MiscServices.InputMethodFramework
1673     * @since 10
1674     */
1675    NEXT,
1676
1677    /**
1678     * The enter key type is DONE.
1679     *
1680     * @syscap SystemCapability.MiscServices.InputMethodFramework
1681     * @since 10
1682     */
1683    DONE,
1684
1685    /**
1686     * The enter key type is PREVIOUS.
1687     *
1688     * @syscap SystemCapability.MiscServices.InputMethodFramework
1689     * @since 10
1690     */
1691    PREVIOUS,
1692
1693    /**
1694   * The enter key type is NEWLINE.
1695   *
1696   * @syscap SystemCapability.MiscServices.InputMethodFramework
1697   * @since 12
1698   */
1699    NEWLINE
1700  }
1701
1702  /**
1703   * Enumerates the keyboard status.
1704   *
1705   * @enum { number }
1706   * @syscap SystemCapability.MiscServices.InputMethodFramework
1707   * @since 10
1708   */
1709  export enum KeyboardStatus {
1710    /**
1711     * The keyboard status is none.
1712     *
1713     * @syscap SystemCapability.MiscServices.InputMethodFramework
1714     * @since 10
1715     */
1716    NONE = 0,
1717
1718    /**
1719     * The keyboard status is hide.
1720     *
1721     * @syscap SystemCapability.MiscServices.InputMethodFramework
1722     * @since 10
1723     */
1724    HIDE = 1,
1725
1726    /**
1727     * The keyboard status is show.
1728     *
1729     * @syscap SystemCapability.MiscServices.InputMethodFramework
1730     * @since 10
1731     */
1732    SHOW = 2
1733  }
1734
1735  /**
1736   * Attribute of Input.
1737   *
1738   * @typedef InputAttribute
1739   * @syscap SystemCapability.MiscServices.InputMethodFramework
1740   * @since 10
1741   */
1742  export interface InputAttribute {
1743    /**
1744     * Indicates the text input type of the input method.
1745     *
1746     * @type { TextInputType }
1747     * @syscap SystemCapability.MiscServices.InputMethodFramework
1748     * @since 10
1749     */
1750    textInputType: TextInputType;
1751
1752    /**
1753     * Indicates the enter key type of the input method.
1754     *
1755     * @type { EnterKeyType }
1756     * @syscap SystemCapability.MiscServices.InputMethodFramework
1757     * @since 10
1758     */
1759    enterKeyType: EnterKeyType;
1760  }
1761
1762  /**
1763   * FunctionKey of Input.
1764   *
1765   * @typedef FunctionKey
1766   * @syscap SystemCapability.MiscServices.InputMethodFramework
1767   * @since 10
1768   */
1769  export interface FunctionKey {
1770    /**
1771     * Indicates the enter key type of the input method.
1772     *
1773     * @type { EnterKeyType }
1774     * @syscap SystemCapability.MiscServices.InputMethodFramework
1775     * @since 10
1776     */
1777    enterKeyType: EnterKeyType;
1778  }
1779
1780  /**
1781   * Information of Cursor.
1782   *
1783   * @typedef CursorInfo
1784   * @syscap SystemCapability.MiscServices.InputMethodFramework
1785   * @since 10
1786   */
1787  export interface CursorInfo {
1788    /**
1789     * Indicates the left point of the cursor info and must be absolute coordinate of the physical screen.
1790     *
1791     * @type { number }
1792     * @syscap SystemCapability.MiscServices.InputMethodFramework
1793     * @since 10
1794     */
1795    left: number;
1796
1797    /**
1798     * Indicates the top point of the cursor info and must be absolute coordinate of the physical screen.
1799     *
1800     * @type { number }
1801     * @syscap SystemCapability.MiscServices.InputMethodFramework
1802     * @since 10
1803     */
1804    top: number;
1805
1806    /**
1807     * Indicates the width point of the cursor info.
1808     *
1809     * @type { number }
1810     * @syscap SystemCapability.MiscServices.InputMethodFramework
1811     * @since 10
1812     */
1813    width: number;
1814
1815    /**
1816     * Indicates the height point of the cursor info.
1817     *
1818     * @type { number }
1819     * @syscap SystemCapability.MiscServices.InputMethodFramework
1820     * @since 10
1821     */
1822    height: number;
1823  }
1824
1825  /**
1826   * Config of editor.
1827   *
1828   * @typedef TextConfig
1829   * @syscap SystemCapability.MiscServices.InputMethodFramework
1830   * @since 10
1831   */
1832  export interface TextConfig {
1833    /**
1834     * Attribute of Input.
1835     *
1836     * @type { InputAttribute }
1837     * @syscap SystemCapability.MiscServices.InputMethodFramework
1838     * @since 10
1839     */
1840    inputAttribute: InputAttribute;
1841
1842    /**
1843     * Cursor information.
1844     *
1845     * @type { ?CursorInfo }
1846     * @syscap SystemCapability.MiscServices.InputMethodFramework
1847     * @since 10
1848     */
1849    cursorInfo?: CursorInfo;
1850
1851    /**
1852     * Selection information.
1853     *
1854     * @type { ?Range }
1855     * @syscap SystemCapability.MiscServices.InputMethodFramework
1856     * @since 10
1857     */
1858    selection?: Range;
1859
1860    /**
1861     * The window ID of the application currently bound to the input method.
1862     *
1863     * @type { ?number }
1864     * @syscap SystemCapability.MiscServices.InputMethodFramework
1865     * @since 10
1866     */
1867    windowId?: number;
1868  }
1869
1870  /**
1871   * Enumerates the extend action.
1872   *
1873   * @enum { number }
1874   * @syscap SystemCapability.MiscServices.InputMethodFramework
1875   * @since 10
1876   */
1877  export enum ExtendAction {
1878    /**
1879     * Select all text.
1880     *
1881     * @syscap SystemCapability.MiscServices.InputMethodFramework
1882     * @since 10
1883     */
1884    SELECT_ALL = 0,
1885
1886    /**
1887     * Cut selecting text.
1888     *
1889     * @syscap SystemCapability.MiscServices.InputMethodFramework
1890     * @since 10
1891     */
1892    CUT = 3,
1893
1894    /**
1895     * Copy selecting text.
1896     *
1897     * @syscap SystemCapability.MiscServices.InputMethodFramework
1898     * @since 10
1899     */
1900    COPY = 4,
1901
1902    /**
1903     * Paste from paste board.
1904     *
1905     * @syscap SystemCapability.MiscServices.InputMethodFramework
1906     * @since 10
1907     */
1908    PASTE = 5
1909  }
1910
1911  /**
1912   * Information of input window.
1913   *
1914   * @typedef InputWindowInfo
1915   * @syscap SystemCapability.MiscServices.InputMethodFramework
1916   * @since 10
1917   */
1918  export interface InputWindowInfo {
1919    /**
1920     * Indicates name of the input window.
1921     *
1922     * @type { string }
1923     * @syscap SystemCapability.MiscServices.InputMethodFramework
1924     * @since 10
1925     */
1926    name: string;
1927
1928    /**
1929     * Indicates the abscissa of the upper-left vertex of input window.
1930     *
1931     * @type { number }
1932     * @syscap SystemCapability.MiscServices.InputMethodFramework
1933     * @since 10
1934     */
1935    left: number;
1936
1937    /**
1938     * Indicates the ordinate of the upper-left vertex of input window.
1939     *
1940     * @type { number }
1941     * @syscap SystemCapability.MiscServices.InputMethodFramework
1942     * @since 10
1943     */
1944    top: number;
1945
1946    /**
1947     * Indicates the width of the input window.
1948     *
1949     * @type { number }
1950     * @syscap SystemCapability.MiscServices.InputMethodFramework
1951     * @since 10
1952     */
1953    width: number;
1954
1955    /**
1956     * Indicates the height of the input window.
1957     *
1958     * @type { number }
1959     * @syscap SystemCapability.MiscServices.InputMethodFramework
1960     * @since 10
1961     */
1962    height: number;
1963  }
1964
1965  /**
1966   * Enumerates the enabled state.
1967   *
1968   * @enum { number }
1969   * @syscap SystemCapability.MiscServices.InputMethodFramework
1970   * @since 15
1971   */
1972  export enum EnabledState {
1973    /**
1974     * Disabled state.
1975     *
1976     * @syscap SystemCapability.MiscServices.InputMethodFramework
1977     * @since 15
1978     */
1979    DISABLED = 0,
1980
1981    /**
1982     * Enabled state with basic mode.
1983     *
1984     * @syscap SystemCapability.MiscServices.InputMethodFramework
1985     * @since 15
1986     */
1987    BASIC_MODE,
1988
1989    /**
1990     * Enabled state with full experience mode.
1991     *
1992     * @syscap SystemCapability.MiscServices.InputMethodFramework
1993     * @since 15
1994     */
1995    FULL_EXPERIENCE_MODE
1996  }
1997
1998  /**
1999   * <p>Custom message handler.</p>
2000   * <p>Implement this interface to respond to custem messages.</p>
2001   *
2002   * @interface MessageHandler
2003   * @syscap SystemCapability.MiscServices.InputMethodFramework
2004   * @since 15
2005   */
2006  interface MessageHandler {
2007    /**
2008     * This method is called when a custom message is received.
2009     *
2010     * @param { string } msgId - the identifier of the message.
2011     * @param { ?ArrayBuffer } [msgParam] - the parameter of the custom message.
2012     * @syscap SystemCapability.MiscServices.InputMethodFramework
2013     * @since 15
2014     */
2015    onMessage(msgId: string, msgParam?: ArrayBuffer): void;
2016
2017    /**
2018     * This method is called when a new message handler is set.
2019     *
2020     * @syscap SystemCapability.MiscServices.InputMethodFramework
2021     * @since 15
2022     */
2023    onTerminated(): void;
2024  }
2025
2026  /**
2027   *  requestKeyboardReason of input click
2028   *
2029   * @enum { number }
2030   * @syscap SystemCapability.MiscServices.InputMethodFramework
2031   * @since 15
2032   */
2033  export enum RequestKeyboardReason {
2034    /**
2035      * The request keyboard reason is NONE.
2036      * @syscap SystemCapability.MiscServices.InputMethodFramework
2037      * @since 15
2038      */
2039    NONE = 0,
2040    /**
2041     * The request keyboard reason is MOUSE.
2042     * @syscap SystemCapability.MiscServices.InputMethodFramework
2043     * @since 15
2044     */
2045    MOUSE = 1,
2046    /**
2047     * The request keyboard reason is TOUCH.
2048     * @syscap SystemCapability.MiscServices.InputMethodFramework
2049     * @since 15
2050     */
2051    TOUCH = 2,
2052    /**
2053     * The request keyboard reason is OTHER.
2054     * @syscap SystemCapability.MiscServices.InputMethodFramework
2055     * @since 15
2056     */
2057    OTHER = 20
2058  }
2059}
2060
2061export default inputMethod;