CN111666167A - Input event reading processing optimization method, nonvolatile memory and terminal equipment - Google Patents

Input event reading processing optimization method, nonvolatile memory and terminal equipment Download PDF

Info

Publication number
CN111666167A
CN111666167A CN202010507496.7A CN202010507496A CN111666167A CN 111666167 A CN111666167 A CN 111666167A CN 202010507496 A CN202010507496 A CN 202010507496A CN 111666167 A CN111666167 A CN 111666167A
Authority
CN
China
Prior art keywords
application
input
input event
window manager
preset application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010507496.7A
Other languages
Chinese (zh)
Inventor
周世鹏
张明明
邹仕洪
朱睿
李翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yuanxin Science and Technology Co Ltd
Original Assignee
Beijing Yuanxin Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Yuanxin Science and Technology Co Ltd filed Critical Beijing Yuanxin Science and Technology Co Ltd
Priority to CN202010507496.7A priority Critical patent/CN111666167A/en
Publication of CN111666167A publication Critical patent/CN111666167A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Abstract

The invention provides an input event reading processing optimization method, a nonvolatile memory and a terminal device, wherein the method comprises the following steps: reading an input event; judging whether the currently started application is a preset application or not; when the application is the preset application, the control right of the input device node is given to the current preset application, the preset application directly obtains the input event from the input device node, and when the preset application is closed, the control right of the input device node is released. The technical scheme has the advantages that the inter-process communication frequency of a user is reduced to two times in an uninterrupted complete operation process; the transmission of the input event uses the inter-thread communication to replace the inter-process communication, thereby greatly reducing the consumption of system resources and the execution overhead; the response speed of the App application to the input event can be greatly improved.

Description

Input event reading processing optimization method, nonvolatile memory and terminal equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method for optimizing input event reading processing, a nonvolatile memory, and a terminal device.
Background
In the input event processing process of the existing mobile device, input events are read in a single process, then a turnstile is used for a distribution thread, the currently received input events are distributed to corresponding windows, and inter-process communication generally exists in the process of distributing the input events to the windows.
For example, an input event of Android is read and distributed in an input event management service named InputManagerService, the service reads the input event and then distributes the input event to a window management service named WindowsManagerService, the WindowsManagerService is transmitted to a focus App application, and the App application receives the input event and then performs corresponding processing in the App application. The distribution and transmission of input events in the process on the Android system goes through at least one interprocess communication (from windows manager service to App application). In some applications with fast response and processing requirements for input events, this significantly degrades the performance and user experience of the application program.
Disclosure of Invention
Aiming at the problems of the application with quick response and processing requirements on the input event in the prior art, the method for optimizing the reading processing of the input event, the nonvolatile memory and the terminal device are provided, which aim at improving the performance and the user experience of the application program.
The specific technical scheme is as follows:
a method for optimizing input event reading processing, comprising the steps of:
reading an input event;
judging whether the currently started application is a preset application or not;
and when the application is the preset application, giving the control right of the input equipment node to the current preset application, wherein the preset application directly acquires the input event from the input equipment node, and when the preset application is closed, releasing the control right of the input equipment node.
Preferably, a window manager process in the operating system provides an input worker thread for reading input events.
Preferably, the window manager in the operating system determines whether the current application is the preset application according to the configuration identifier of the currently started application.
Preferably, when the window manager in the operating system determines that the current application is the preset application, the window manager gives the control right of the input device node to the preset application.
Preferably, the method for releasing the control right of the input device node specifically includes:
the preset application sends information to a window manager in the operating system through Socket communication;
and the window manager in the operating system grasps the control right of the input equipment node again according to the information.
Preferably, when the special application fails, the window manager in the operating system actively withdraws the control right of the input device node according to the failure information.
Preferably, the input event includes a user operation obtained through an input device or a simulation input device, and the input device includes a touch screen or a stylus or a mouse keyboard.
Preferably, when the application is not the preset application, a window manager process in the operating system provides a scheduling thread, and the input event is distributed to the application through the scheduling thread.
The system also comprises a nonvolatile memory, wherein software is stored in the nonvolatile memory, and the software is used for realizing the optimization method for the input event reading processing.
Also included is a terminal device comprising one or more processors and one or more memories coupled thereto, wherein the one or more memories are configured to store computer program code comprising computer instructions;
the one or more processors are configured to execute the computer instructions and implement the method for optimizing the input event reading process described above.
The technical scheme has the following advantages or beneficial effects:
the inter-process communication times of a user in an uninterrupted complete operation process are reduced to two times;
the transmission of the input event uses the inter-thread communication to replace the inter-process communication, thereby greatly reducing the consumption of system resources and the execution overhead; therefore, the response speed of the App application to the input event can be greatly improved;
and the window manager configures the specific application correspondingly to start or stop the control right of the specific application to the input device.
The input device event is read through the application thread, the inter-process communication replaces the previous window manager and is transmitted to the application inter-process communication through a protocol, and the response speed of the input event is improved.
The reading and writing processing efficiency of the input data is improved through the resource sharing of the input device reading and the input data processing in the same process, and therefore the response speed of the input event is improved.
Drawings
Embodiments of the present invention will now be described more fully hereinafter with reference to the accompanying drawings. The drawings are, however, to be regarded as illustrative and explanatory only and are not restrictive of the scope of the invention.
FIG. 1 is a flow chart of an embodiment of a method for optimizing input event read processing according to the present invention;
FIG. 2 is a flowchart illustrating a method for optimizing the read processing of an input event according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for optimizing the read processing of input events according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of an embodiment of a terminal device according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
The invention is further described with reference to the following drawings and specific examples, which are not intended to be limiting.
The invention comprises a method for optimizing the reading processing of input events.
A method for optimizing the reading processing of input events is suitable for an operating system taking Linux as a kernel, and comprises the following steps:
reading an input event;
judging whether the currently started application is a preset application or not;
when the application is the preset application, the control right of the input device node is given to the current preset application, the preset application directly obtains the input event from the input device node, and when the preset application is closed, the control right of the input device node is released.
Specifically, as shown in fig. 1:
step S1, reading an input event;
step S2, judging whether the currently started application is a preset application;
and step S3, when the application is the preset application, giving the control right of the input device node to the current preset application, and the preset application directly acquires the input event from the input device node, wherein when the preset application is closed, the control right of the input device node is released.
The method for optimizing the reading processing of the input event in the technical scheme is suitable for operating systems based on Linux as a kernel, such as domestic customized operating systems taking wayland as a display service protocol. Generally, the reading of the input event is in one thread of a display server, the event processing is distributed in another thread of a window manager named system-main, the system-main distributes the input event to a top application window for processing through the WAYLAND protocol after the input event is monitored, and the top application window performs internal distribution and processing after receiving the event. The distribution of incoming events on the operating system in the process is passed through at least one interprocess communication (from system-main to the top-level application window). This significantly reduces the performance of the application program, preventing the user from being able to get a better experience when some input events are quickly responded to and handled requiring in-application or high frequency of input event generation.
In addition, the Android system is characterized in that an input event of the Android is read and distributed in an input event management service named InputManagerservice, the input event is read by the input event management service and then distributed to a window management service named WindowsManagerservice, the WindowsManagerservice is transmitted to a focus App application, and the App application performs corresponding processing in the App application after receiving the input event. The distribution of input events in the process on the Android system is passed through at least one interprocess communication (from the windows manager service to the App application). In some applications with fast response and processing requirements for input events, this significantly degrades the performance and user experience of the application program.
In the technical scheme of the invention, the linux window manager can enable the application to have the capability of directly reading the input event through a mechanism of the linux window manager, the input event only needs to be in interprocess communication with the linux window manager twice (one byte of command control type information: on, off and a head and tail information specific to a communication protocol of a plurality of bytes) when the user operation starts and ends in the distribution and transmission process, and the interprocess communication with the system-main is not required to be carried out at all in the intermediate operation process, but the interprocess communication is replaced by the interprocess communication, so that the response speed to the input event is greatly improved, and the state before optimization is not required: an input event generated by each touch screen of the user operation needs one inter-process communication to be transmitted to the corresponding App application.
In a preferred embodiment, a window manager process in the operating system provides an input worker thread for reading input events.
In the above technical solution, the domestic operating system (i.e. the meta-operating system) is taken as an example for explanation, and an input work thread (InputHandlerThread) exists in a window manager process (system-main) on the meta-operating system, and is specifically used for reading a specific input event, such as the above input event.
In a preferred embodiment, a window manager in the operating system determines whether the current application is a preset application according to the configuration identifier of the currently started application.
In the above technical solution, for a preset application, that is, a special application, corresponding configuration information needs to be added to sopconfig.xml according to an application (App) development mechanism of a metacentric operating system during development: InputSpecEnable ═ true. When the system-main reads the InputSpecEnable value in the configuration information of the started application, the current application is judged to be the preset application, and the preset application represents the application with quick response and processing requirements on the input event.
In a preferred embodiment, when the window manager in the operating system determines that the current application is the preset application, the window manager gives the control right of the input device node to the preset application.
In a preferred embodiment, the method for releasing the control right of the input device node specifically includes:
the preset application sends information to a window manager in an operating system through Socket communication;
and the window manager in the operating system grasps the control right of the input equipment node again according to the information.
In a preferred embodiment, when a particular application fails, a window manager in the operating system actively regains control of the input device node based on the failure information.
In the above technical solution, in order to prevent the preset application from occurring unexpectedly (for example, due to a jam, a false death, etc., an input event of the system cannot be used by other applications), there is also an application passive returning mechanism for ensuring normal operation of the input event on the meta-core operating system, where the passive mechanism is that the system-main judges whether an accident occurs to the special application of the stylus pen through an existing mechanism of the meta-core operating system, and if an accident occurs, the system-main actively withdraws the control right to the input device node/dev/input/event.
In a preferred embodiment, the input event comprises a user action obtained through an input device or an analog input device, wherein the input device may comprise a touch screen, a stylus, a mouse, a keyboard, or the like
In a preferred embodiment, when the application is a non-default application, the window manager process in the operating system provides a scheduling thread, and distributes the input event to the application through the scheduling thread.
In a preferred embodiment, after the application or the default application acquires the input event, the corresponding processing operation is executed.
The following description will be made by taking an operating system as a home-made meta-system as an example, as shown in fig. 2:
step S11, acquiring input devices such as a touch screen, a stylus, a mouse, a keyboard and the like or simulating the input devices to generate input events for the meta-core operating system;
step S12, an InputHandlerThread thread exists in system-main (window manager process) on the meta-operation system and is specially used for reading a specific input event;
step S13, determining whether the currently started application is a preset application (when a similar specific application such as a stylus pen is started or a special area is clicked);
if yes, go to step S14;
if not, go to step S16;
step S14, system-main temporarily gives the control right of the input device node/dev/input/event to the current preset application, and the application can directly obtain the information of the input event from the input device node/dev/input/event and then distribute and process the information in the application;
step S15, when the similar special application of the current stylus is closed (the input device is no longer needed to be used continuously), sending a message to the system-main in a Socket mode, actively returning the control right of the input device node/dev/input/event to the system-main, and then recovering the control right of the input device node/dev/input/event by the system-main, and returning to the step S11;
step S16, the KeyDispatch thread in the system-main transmits the input event to the corresponding App application according to the window focus and the hierarchy strategy; and the App application receives the input event and then performs corresponding processing in the App application.
The system also comprises an operating system based on the LINUX kernel, wherein the operating system adopts the method for reading, processing and optimizing the input events.
The following description takes an operating system as an android operating system as an example, as shown in fig. 3:
step S21, acquiring an input event generated by an input device such as a touch screen, a stylus, a mouse, a keyboard and the like or a simulation input device on the linux system;
step S22, a special thread (the main thread of Xorg, the linux System including desktop monitors input events using special thread for the most basic user interaction means of input events, such as Xorg, XFree86, etc., to quickly correspond to user operations) is provided in the window manager process on the linux System (for example, Xorg in the ubuntu System based on the X Windows System, general gnome, KDE, etc. desktop environments basically implement the window manager using the XServer protocols of Xorg, XFree, etc.) for reading the specific input events;
step S23, the window manager of the linux system determines whether the currently started application is a preset application (when starting a similar specific application such as a stylus or clicking a special area), where the application on the linux system needs to add a configuration file according to the architectural feature of the current APP application itself or set an InputSpecEnable value as true value using a linux environment variable, and only this special information needs to be transferred to the program, and certainly, the APP may be made to support the InputSpecEnable value as default;
if yes, go to step 24;
if not, go to step 26;
step S24, the Linux system window manager (for example: Xorg) temporarily gives the control right of the input device node/dev/input/event to the current special APP application, and the APP application can directly obtain the information of the input event from the input device node/dev/input/event and then carries out distribution and processing in the APP application;
step S25, when the special application like the current stylus is closed (no longer needs to continue to monopolize the input device), a message is sent to the linux window manager (for example: Xorg) through an inter-process communication mode (for example: Socket mode under linux), and the linux window manager (for example: Xorg) is actively handed back the control right of the input device node/dev/input/event, at which time the linux window manager (for example: Xorg) restores the control right of the input device node/dev/input/event.
Note that: the above-mentioned "prevent this special application from happening" mechanism of the metacentric system is also applicable to the linux system window manager (e.g. Xorg), and returns to step S21;
step S26, the KeyDispatch thread in the linux window manager (such as Xorg) transmits the input event to the corresponding App application according to the window focus and the hierarchy policy; and the App application receives the input event and then performs corresponding processing in the App application.
The technical scheme of the invention also comprises a nonvolatile memory.
A non-volatile memory having software stored therein, wherein the software is used to implement the method for optimizing the reading process of the input event.
The technical scheme of the invention also comprises a terminal device.
As shown in fig. 4, an embodiment of a terminal device comprises one or more processors B and one or more memories a coupled thereto, wherein the one or more memories are configured to store computer program code comprising computer instructions;
one or more processors are configured to execute computer instructions and implement the method for optimizing the input event reading process described above.
In the above technical solution, all or part of the steps of implementing the method embodiments may be implemented by hardware related to program instructions, the program may be stored in a computer-readable storage medium, and when executed, the program performs the steps including the method embodiments: and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks. The terminal device can comprise a smart watch, a smart phone, a tablet device and the like.
According to the technical scheme, the control right of the specific application to the input equipment is started or stopped by the window manager to perform corresponding configuration on the specific application. The input device event is read through the application thread, the inter-process communication replaces the previous window manager and is transmitted to the application inter-process communication through a protocol, and the response speed of the input event is improved. The reading and writing processing efficiency of the input data is improved through the resource sharing of the input device reading and the input data processing in the same process, and therefore the response speed of the input event is improved.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention.

Claims (10)

1. A method for optimizing input event read processing, comprising the steps of:
reading an input event;
judging whether the currently started application is a preset application or not;
and when the application is the preset application, giving the control right of the input equipment node to the current preset application, wherein the preset application directly acquires the input event from the input equipment node, and when the preset application is closed, the control right of the input equipment node is released.
2. A method for optimizing a read process for an input event according to claim 1 wherein a window manager process in the operating system provides an input worker thread for reading input events.
3. The method according to claim 1, wherein a window manager in the operating system determines whether the current application is the preset application according to a configuration identifier of the currently started application.
4. The method according to claim 1, wherein when a window manager in the operating system determines that the current application is the preset application, the window manager gives the control right of the input device node to the preset application.
5. The method for optimizing input event reading processing according to claim 1, wherein the method of releasing the control right of the input device node specifically comprises:
the preset application sends information to a window manager in the operating system through Socket communication;
and the window manager in the operating system grasps the control right of the input equipment node again according to the information.
6. The method of claim 1, wherein when the special application fails, a window manager in the operating system actively regains control of the input device node according to the failure information.
7. The method for optimizing an input event reading process according to claim 1,
the input event comprises user operation acquired through input equipment or simulated input equipment, and the input equipment comprises a touch screen, a stylus pen and a mouse keyboard.
8. The method according to claim 1, wherein when the application is not the predetermined application, a window manager process in the operating system provides a scheduling thread through which the input event is distributed to the application.
9. A non-volatile memory having software stored therein, wherein the software is configured to implement the method for optimizing a read process of an input event as claimed in any one of claims 1 to 8.
10. A terminal device comprising one or more processors and one or more memories coupled thereto, wherein the one or more memories are configured to store computer program code comprising computer instructions;
the one or more processors are configured to execute the computer instructions and implement the method for optimizing the input event reading process of any of claims 1-8.
CN202010507496.7A 2020-06-05 2020-06-05 Input event reading processing optimization method, nonvolatile memory and terminal equipment Pending CN111666167A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010507496.7A CN111666167A (en) 2020-06-05 2020-06-05 Input event reading processing optimization method, nonvolatile memory and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010507496.7A CN111666167A (en) 2020-06-05 2020-06-05 Input event reading processing optimization method, nonvolatile memory and terminal equipment

Publications (1)

Publication Number Publication Date
CN111666167A true CN111666167A (en) 2020-09-15

Family

ID=72386898

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010507496.7A Pending CN111666167A (en) 2020-06-05 2020-06-05 Input event reading processing optimization method, nonvolatile memory and terminal equipment

Country Status (1)

Country Link
CN (1) CN111666167A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835788A (en) * 2021-11-25 2021-12-24 广州朗国电子科技股份有限公司 Method for quickly acquiring input event and method for quickly responding to input event
CN115113775A (en) * 2022-06-28 2022-09-27 展讯通信(天津)有限公司 Input device selection method and device, storage medium and terminal device
WO2023137996A1 (en) * 2022-01-24 2023-07-27 中国第一汽车股份有限公司 Application control method, gesture processing apparatus, intelligent terminal, and vehicle

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101465903A (en) * 2007-12-21 2009-06-24 希姆通信息技术(上海)有限公司 Method for processing foreign event during mobile phone GPS navigation process
CN107145401A (en) * 2017-06-01 2017-09-08 努比亚技术有限公司 Incoming event distribution method, terminal and computer-readable recording medium
CN108235759A (en) * 2017-12-20 2018-06-29 深圳前海达闼云端智能科技有限公司 Input processing method, device and electronic equipment based on multiple operating system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101465903A (en) * 2007-12-21 2009-06-24 希姆通信息技术(上海)有限公司 Method for processing foreign event during mobile phone GPS navigation process
CN107145401A (en) * 2017-06-01 2017-09-08 努比亚技术有限公司 Incoming event distribution method, terminal and computer-readable recording medium
CN108235759A (en) * 2017-12-20 2018-06-29 深圳前海达闼云端智能科技有限公司 Input processing method, device and electronic equipment based on multiple operating system
WO2019119315A1 (en) * 2017-12-20 2019-06-27 深圳前海达闼云端智能科技有限公司 Input processing method and apparatus based on multiple operating systems, and electronic device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835788A (en) * 2021-11-25 2021-12-24 广州朗国电子科技股份有限公司 Method for quickly acquiring input event and method for quickly responding to input event
WO2023137996A1 (en) * 2022-01-24 2023-07-27 中国第一汽车股份有限公司 Application control method, gesture processing apparatus, intelligent terminal, and vehicle
CN115113775A (en) * 2022-06-28 2022-09-27 展讯通信(天津)有限公司 Input device selection method and device, storage medium and terminal device
CN115113775B (en) * 2022-06-28 2023-09-12 展讯通信(天津)有限公司 Input device selection method and device, storage medium and terminal device

Similar Documents

Publication Publication Date Title
CN111666167A (en) Input event reading processing optimization method, nonvolatile memory and terminal equipment
US8214687B2 (en) Disaster recovery based on journaling events prioritization in information technology environments
CN103136073A (en) Application consistent snapshots of a shared volume
US11263000B2 (en) Upgrading an execution environment for event-driven functions
CN107682460B (en) Distributed storage cluster data communication method and system
CN103152390A (en) Method and device and nodes and system for node configuration of distributed storage system
CN102420805A (en) Method, system and device for communication by virtue of socket connection
US9298765B2 (en) Apparatus and method for handling partially inconsistent states among members of a cluster in an erratic storage network
CN114363144B (en) Fault information association reporting method and related equipment for distributed system
JP4634058B2 (en) Real-time remote backup system and backup method thereof
US8751560B2 (en) Method and device arrangement for managing a client/server environment
CN111541762A (en) Data processing method, management server, device and storage medium
CN112965806B (en) Method and device for determining resources
CN114185734A (en) Cluster monitoring method and device and electronic equipment
CN111770176B (en) Traffic scheduling method and device
US6952829B1 (en) Dynamically adapting between pessimistic and optimistic notifications to replicated objects
US20170206263A1 (en) Early thread return with secondary event writes
WO2022022442A1 (en) Data processing method and apparatus, and intelligent network card and server
CN112491810B (en) Data connection method and mobile terminal
CN113868184A (en) Configuration method and system of master-slave architecture cache-based configuration center
CN110968257B (en) Method, apparatus and computer program product for storage management
CN106484536B (en) IO scheduling method, device and equipment
CN111611068A (en) Data writing method in distributed system, server and client
CN113271229B (en) Equipment control method and device, storage equipment, safety equipment, switch, router and server
US20230054058A1 (en) Determining data copy resources

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination