• Home
Name Date Size #Lines LOC

..--

common/12-May-2024-626479

examples/mmi/12-May-2024-7954

figures/12-May-2024-

frameworks/12-May-2024-17,62414,342

interfaces/native/innerkits/12-May-2024-4,1581,822

patch/12-May-2024-319,538220,956

sa_profile/12-May-2024-4628

service/12-May-2024-12,6989,082

test/moduletest/12-May-2024-346248

tools/12-May-2024-10,4618,162

uinput/12-May-2024-861553

.gitattributesD12-May-2024631 1615

BUILD.gnD12-May-20244.2 KiB148129

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-20241.1 KiB3011

README.mdD12-May-20244.4 KiB8561

README_zh.mdD12-May-20244.1 KiB8561

bundle.jsonD12-May-20242.8 KiB9796

mmi_uinput.rcD12-May-2024818 2219

multimodalinput.cfgD12-May-20241.1 KiB3534

multimodalinput.rcD12-May-2024336 1412

multimodalinput_mini.gniD12-May-2024872 2118

README.md

1# multimodalinput\_input<a name="EN-US_TOPIC_0000001147497185"></a>
2
3-   [Introduction](#section11660541593)
4-   [Directory Structure](#section14408467105)
5-   [Usage](#section18111235161011)
6    -   [Available APIs](#section86358081116)
7    -   [Usage Guidelines](#section789634518111)
8
9-   [Repositories Involved](#section135327891219)
10
11## Introduction<a name="section11660541593"></a>
12
13The module of this repository is applied on the basis of standard systems to provide devices with single-touch input capabilities. This module reports touch events to the JS UI framework or application framework, which then encapsulates the events and provides APIs for apps.
14
15## Directory Structure<a name="section14408467105"></a>
16
17```
18/foundation/multimodalinput/input
19├── common                       # Common code
20├── interfaces                   # External APIs
21│   └── native                   # Native APIs
22│       └── innerkits            # Native APIs provided for internal subsystems
23├── service                      # Service framework code
24├── sa_profile                   # Service startup configuration file
25├── uinput                       # Input event injection module
26```
27
28## Usage<a name="section18111235161011"></a>
29
30### Available APIs<a name="section86358081116"></a>
31
32Available APIs of Multimodal Input are event injection ones, which are open only to system apps currently.
33
34-   The  **InJectEventHandler**  class provides methods for processing injection events.
35
36    **Table  1**  Major APIs in InJectEventHandler
37
38    <a name="t49c6a8df29a143a98ef6f66f43c7eac8"></a>
39    <table><thead align="left"><tr id="rf815506c67654ad4ac014b339ee3292d"><th class="cellrowborder" valign="top" width="15.031503150315032%" id="mcps1.2.4.1.1"><p id="a59bc0498281e498289e11d5e584eb293"><a name="a59bc0498281e498289e11d5e584eb293"></a><a name="a59bc0498281e498289e11d5e584eb293"></a>Category</p>
40    </th>
41    <th class="cellrowborder" valign="top" width="23.152315231523154%" id="mcps1.2.4.1.2"><p id="aa1226795522e4609b6b1d210255beeff"><a name="aa1226795522e4609b6b1d210255beeff"></a><a name="aa1226795522e4609b6b1d210255beeff"></a>API</p>
42    </th>
43    <th class="cellrowborder" valign="top" width="61.816181618161814%" id="mcps1.2.4.1.3"><p id="a34777ce8d3174036ba45b9fd51dc4848"><a name="a34777ce8d3174036ba45b9fd51dc4848"></a><a name="a34777ce8d3174036ba45b9fd51dc4848"></a>Description</p>
44    </th>
45    </tr>
46    </thead>
47    <tbody><tr id="ra7599f41f04548858a77e2062aad2cf5"><td class="cellrowborder" valign="top" width="15.031503150315032%" headers="mcps1.2.4.1.1 "><p id="a63ab1186072d4bcdb32d4e11b9243b57"><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a>Event injection</p>
48    </td>
49    <td class="cellrowborder" valign="top" width="23.152315231523154%" headers="mcps1.2.4.1.2 "><p id="a3d9b89df15074475a45ed26503e22c21"><a name="a3d9b89df15074475a45ed26503e22c21"></a><a name="a3d9b89df15074475a45ed26503e22c21"></a>function injectEventSync(keyEvent: KeyEvent): number;</p>
50    </td>
51    <td class="cellrowborder" valign="top" width="61.816181618161814%" headers="mcps1.2.4.1.3 "><p id="a33c82952289f40a09773ce2fed14f6aa"><a name="a33c82952289f40a09773ce2fed14f6aa"></a><a name="a33c82952289f40a09773ce2fed14f6aa"></a>Injects events.</p>
52    </td>
53    </tr>
54    </tbody>
55    </table>
56
57
58### Usage Guidelines<a name="section789634518111"></a>
59
60Currently, only the  **BACK**  key event can be injected.
61
62When a system app needs to return to the previous directory, you can call the API to inject the  **BACK**  key event to Multimodal Input, which then transfers this event to the system app, thereby achieving the return effect. The example code is as follows:
63
64```
65// Import the required JavaScript API library.
66import input from '@ohos.injectEventHandler'
67
68// Call the API for injecting events.
69var res = input.injectEventSync({
70    isPressed:true,           // Action type of the key event. true indicates that the key is being pressed down, and false indicates that the key is being released.
71    code:2,                   // Keycode for the key, for example, 2 for the BACK key.
72    keyDownDuration:10,       // Duration in which the current key is pressed down before it is released, in milliseconds.
73});
74```
75
76>![](figures/icon-note.gif) **NOTE:**
77>The new APIs must be compatible with the original capabilities.
78
79## Repositories Involved<a name="section135327891219"></a>
80
81Multimodal input subsystem
82
83**multimodalinput\_input**
84
85

README_zh.md

1# 多模输入标准系统组件<a name="ZH-CN_TOPIC_0000001147497185"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section14408467105)
5-   [使用](#section18111235161011)
6    -   [接口说明](#section86358081116)
7    -   [使用说明](#section789634518111)
8
9-   [相关仓](#section135327891219)
10
11## 简介<a name="section11660541593"></a>
12
13本组件应用于标准系统之上,为设备提供单指触控输入能力。本组件将触屏输入产生的事件上报到JS UI框架或用户程序框架,JS UI框架根据上报的事件再次封装,对应用提供接口。
14
15## 目录<a name="section14408467105"></a>
16
17```
18/foundation/multimodalinput/input
19├── common                       # 公共代码
20├── interfaces                   # 对外接口存放目录
21│   └── native                   # 对外native层接口存放目录
22│       └── innerkits            # 对系统内部子系统提供native层接口存放目录
23├── service                      # 服务框架代码
24├── sa_profile                   # 服务启动配置文件
25├── uinput                       # 输入事件注入模块
26```
27
28## 使用<a name="section18111235161011"></a>
29
30### 接口说明<a name="section86358081116"></a>
31
32多模输入目前提供的接口为事件注入接口,该接口目前仅对系统应用开放。
33
34-   InJectEventHandler是处理注入事件类。
35
36    **表 1**  InJectEventHandler的主要接口
37
38    <a name="t49c6a8df29a143a98ef6f66f43c7eac8"></a>
39    <table><thead align="left"><tr id="rf815506c67654ad4ac014b339ee3292d"><th class="cellrowborder" valign="top" width="15.031503150315032%" id="mcps1.2.4.1.1"><p id="a59bc0498281e498289e11d5e584eb293"><a name="a59bc0498281e498289e11d5e584eb293"></a><a name="a59bc0498281e498289e11d5e584eb293"></a>功能分类</p>
40    </th>
41    <th class="cellrowborder" valign="top" width="23.152315231523154%" id="mcps1.2.4.1.2"><p id="aa1226795522e4609b6b1d210255beeff"><a name="aa1226795522e4609b6b1d210255beeff"></a><a name="aa1226795522e4609b6b1d210255beeff"></a>接口名</p>
42    </th>
43    <th class="cellrowborder" valign="top" width="61.816181618161814%" id="mcps1.2.4.1.3"><p id="a34777ce8d3174036ba45b9fd51dc4848"><a name="a34777ce8d3174036ba45b9fd51dc4848"></a><a name="a34777ce8d3174036ba45b9fd51dc4848"></a>描述</p>
44    </th>
45    </tr>
46    </thead>
47    <tbody><tr id="ra7599f41f04548858a77e2062aad2cf5"><td class="cellrowborder" valign="top" width="15.031503150315032%" headers="mcps1.2.4.1.1 "><p id="a63ab1186072d4bcdb32d4e11b9243b57"><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a>事件注入接口</p>
48    </td>
49    <td class="cellrowborder" valign="top" width="23.152315231523154%" headers="mcps1.2.4.1.2 "><p id="a3d9b89df15074475a45ed26503e22c21"><a name="a3d9b89df15074475a45ed26503e22c21"></a><a name="a3d9b89df15074475a45ed26503e22c21"></a>function injectEventSync(keyEvent: KeyEvent): number;</p>
50    </td>
51    <td class="cellrowborder" valign="top" width="61.816181618161814%" headers="mcps1.2.4.1.3 "><p id="a33c82952289f40a09773ce2fed14f6aa"><a name="a33c82952289f40a09773ce2fed14f6aa"></a><a name="a33c82952289f40a09773ce2fed14f6aa"></a>注入按键事件的接口</p>
52    </td>
53    </tr>
54    </tbody>
55    </table>
56
57
58### 使用说明<a name="section789634518111"></a>
59
60当前仅提供了BACK按键的事件注入。
61
62当系统应用需要返回上一层时,通过注入接口将BACK键注入到多模服务,多模服务再上传到应用,以实现返回到上一层级目录的效果。使用方式如下所示:
63
64```
65// 引入提供的js接口库
66import input from '@ohos.injectEventHandler'
67
68// 调用注入事件接口
69var res = input.injectEventSync({
70    isPressed:true,           // 按键事件的按键类型:true:down false:up
71    code:2,                   // 按键对应的keycode, 例如back键的值为2
72    keyDownDuration:10,       // 按键按下到抬起的时长,单位ms
73});
74```
75
76>![](figures/icon-note.gif) **说明:**
77>新增的接口能力需要兼容原有的能力。
78
79## 相关仓<a name="section135327891219"></a>
80
81多模输入子系统
82
83**multimodalinput\_input**
84
85