• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Input Method Framework
2
3## Introduction
4
5The input method framework is responsible for establishing a communication channel between the application in which the edit box is located and the input method application, to ensure that the two can jointly provide text input, and also enables system applications to manage the input method application.
6
7The input method framework has four modules:
8
91. Application
10
11   Path: /base/inputmethod/imf/frameworks/native/inputmethod_controller
12
13   Function: enables an application to request the use of and interaction with the input method application.
14
152. Input method application
16
17   Path: /base/inputmethod/imf/frameworks/native/inputmethod_ability
18
19   Function: provides an input method application implementation framework. Based on the framework, the input method application can be correctly started, and collaborates with the edit box application to complete text input.
20
213. Input method engine
22
23   Path: /base/inputmethod/imf/services
24
25   Function: responsible for establishing secure and reliable connections with the input method and providing features such as input method switching and query.
26
274. Input method JS API implementation
28
29   Path: /base/inputmethod/imf/frameworks/js
30
31   - JS API implementation provided for input method applications: /base/inputmethod/imf/frameworks/js/napi/inputmethodability
32
33   - JS API implementation provided for the self-drawing components: /base/inputmethod/imf/frameworks/js/napi/inputmethodclient.
34
35   Function: provides specific implementation for TS-related APIs.
36
37## System Architecture
38
39**Figure 1** Architecture
40
41
42![Input method framework](./figures/input-method-framework.PNG)
43
44## Directory Structure
45
46```
47/base/inputmethod/imf
48├── figures                                     # Architecture diagram
49├── frameworks
50│   └── js/napi                                 # Native APIs of the input method framework
51│       └──inputmethod_extention_ability        # InputMethodExtentionAbility related APIs for input method applications
52│       └──inputmethod_extention_context        # InputMethodExtentionContext related APIs for input method applications
53│       └──inputmethodability                   # APIs provided for input method applications
54│       └──inputmethodclient                    # APIs provided by the system applications and self-drawing components
55│   └── native
56│       └──inputmethod_ability                  # APIs provided for input method applications
57│       └──inputmethod_controller               # APIs provided for the application
58├── interfaces                                  # APIs provided by the components for external systems
59│   └── inner_api                               # Inner APIs
60├── profile                                     # Configuration files of system services and processes contained in the components
61├── services                                    # Input method engine
62├── test                                        # Tests
63│   └── fuzztest                                # Fuzz test of APIs
64│   └── unitest                                 # Unit test of APIs
65│       └──cpp_test                             # CPP unit test of APIs
66│       └──napi_test                            # JS unit test of APIs
67```
68
69## How to Use
70
71* [InputMethodExtentionAbility](../application-dev/application-models/inputmethodextentionability.md)
72* [@ohos.inputMethod (Input Method Framework)](../application-dev/reference/apis/js-apis-inputmethod.md)
73* [@ohos.inputMethodEngine (Input Method Service)](../application-dev/reference/apis/js-apis-inputmethodengine.md)
74
75## Repositories Involved
76
77Input method framework
78
79[inputmethod_imf](https://gitee.com/openharmony/inputmethod_imf)
80