# multimodalinput_input **Repository Path**: for_master_code/multimodalinput_input ## Basic Information - **Project Name**: multimodalinput_input - **Description**: Providing traditional input methods, such as key, touch, keyboard, and mouse inputs | 提供传统的输入交互方式,例如按键、触控、键盘、鼠标等 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1205 - **Created**: 2022-01-15 - **Last Updated**: 2022-02-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # multimodalinput\_input - [Introduction](#section11660541593) - [Directory Structure](#section14408467105) - [Usage](#section18111235161011) - [Available APIs](#section86358081116) - [Usage Guidelines](#section789634518111) - [Repositories Involved](#section135327891219) ## Introduction The 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. ## Directory Structure ``` /foundation/multimodalinput/input ├── common # Common code ├── interfaces # External APIs │ └── native # Native APIs │ └── innerkits # Native APIs provided for internal subsystems ├── service # Service framework code ├── sa_profile # Service startup configuration file ├── uinput # Input event injection module ``` ## Usage ### Available APIs Available APIs of Multimodal Input are event injection ones, which are open only to system apps currently. - The **InJectEventHandler** class provides methods for processing injection events. **Table 1** Major APIs in InJectEventHandler

Category

API

Description

Event injection

function injectEventSync(keyEvent: KeyEvent): number;

Injects events.

### Usage Guidelines Currently, only the **BACK** key event can be injected. When 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: ``` // Import the required JavaScript API library. import input from '@ohos.injectEventHandler' // Call the API for injecting events. var res = input.injectEventSync({ 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. code:2, // Keycode for the key, for example, 2 for the BACK key. keyDownDuration:10, // Duration in which the current key is pressed down before it is released, in milliseconds. }); ``` >![](figures/icon-note.gif) **NOTE:** >The new APIs must be compatible with the original capabilities. ## Repositories Involved Multimodal input subsystem **multimodalinput\_input**