Touch event processing method, terminal and storage medium

By identifying the view scene of the terminal's display area and using corresponding touch data processing algorithms, the problem of incorrect touch event recognition in different scenarios is solved, improving the accuracy and smoothness of touch events and enhancing the user experience.

CN121807176APending Publication Date: 2026-04-07HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, terminals are prone to recognition errors when processing touch events due to different scenarios, which reduces the user experience.

Method used

By identifying the target touch scene corresponding to the view in the terminal display area, and using the corresponding touch data processing algorithm to process the user's touch data, for example, different algorithms are used to process button clicks, swipes, multi-touch and other scenarios.

Benefits of technology

It improves the accuracy and smoothness of touch event processing, thus enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807176A_ABST
    Figure CN121807176A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a touch event processing method, a terminal and a storage medium, and relates to the technical field of touch event processing, the method comprises the following steps: identifying a target touch scene corresponding to a view displayed by each display area of the terminal; for each view, after touch data of a user for the view is obtained, determining a touch data processing algorithm corresponding to a target touch scene of the view as a target algorithm; different touch scenes correspond to different touch data processing algorithms; and loading a target algorithm to process the touch data of the user for the view to obtain a touch event of the user for the view, and performing targeted processing on the touch data of the user for the view by using the touch data processing algorithms corresponding to the target touch scenes of different views in response to the touch event. The accuracy of processing the touch event can be improved, the smoothness of responding to the user operation is improved, and then the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of touch event processing technology, and in particular to a touch event processing method, terminal and storage medium. Background Technology

[0002] Capacitive touch panels (TPs) are widely used in various terminals, such as mobile phones and tablets. When users use applications on the terminal, they can directly operate on the touch screen. The terminal determines the touch event based on the touch data detected by the touch screen and responds to the touch event. For example, if a click event is detected, a click event is responded to; if a swipe event is detected, a swipe event is responded to.

[0003] However, using the same method to determine touch events for different scenarios may lead to recognition errors, such as misidentifying a click event as a swipe event, thus degrading the user experience. Summary of the Invention

[0004] The purpose of this application is to provide a touch event processing method, terminal, and storage medium to improve the accuracy of touch event processing, enhance the smoothness of responding to user operations, and thus improve the user experience. The specific technical solution is as follows:

[0005] Firstly, in order to achieve the above objectives, embodiments of this application provide a touch event processing method, which is applied to a terminal, and the method includes:

[0006] Identify the touch scene corresponding to the view displayed in each display area of ​​the terminal, and use it as the target touch scene;

[0007] For each view, after obtaining the user's touch data for that view, the touch data processing algorithm corresponding to the target touch scene of that view is determined as the target algorithm; different touch scenes correspond to different touch data processing algorithms.

[0008] The target algorithm is loaded to process the user's touch data for the view, obtain the user's touch events for the view, and respond to the touch events.

[0009] As can be seen from the above, the technical solution provided in this embodiment first identifies the target touch scene corresponding to each view displayed on the terminal, and different touch scenes correspond to different touch data processing algorithms. Accordingly, the touch data processing algorithm corresponding to the target touch scene of different views is used to process the user's touch data for that view in a targeted manner, rather than using the same method to process different scenes. This can improve the accuracy of touch event processing, improve the smoothness of responding to user operations, and thus improve the user experience.

[0010] In one embodiment of this application, identifying the touch scene corresponding to the view displayed in each display area of ​​the terminal as the target touch scene includes:

[0011] Traverse the View tree containing the views displayed in each display area of ​​the terminal to obtain the view type of the views displayed in each display area of ​​the terminal;

[0012] For each view, if the view does not call the specified class, the touch scene corresponding to the view type is determined as the touch scene corresponding to the view, and is used as the target touch scene; wherein, the specified class is used to respond to the specified touch event;

[0013] If the view calls a specified class, then the touch scene corresponding to the specified class is determined as the touch scene corresponding to the view, and is used as the target touch scene.

[0014] As can be seen from the above, the technical solution provided in this embodiment can identify the view type of each view displayed on the terminal by traversing the View tree, and obtain the corresponding target touch scene based on the view type, that is, obtain the target touch scene of each view by combining user preferences. Furthermore, different touch scenes correspond to different touch data processing algorithms. Subsequently, the touch data processing algorithms corresponding to the target touch scenes of different views can be used to perform targeted processing of the user's touch data for that view, which can improve the accuracy of touch event processing, improve the smoothness of responding to user operations, and thus improve the user experience.

[0015] In one embodiment of this application, when the specified class is the Scroller class, the touch scenario corresponding to the Scroller class is a sliding operation scenario;

[0016] When the specified class is the VelocityTracker class, the touch scenario corresponding to the VelocityTracker class is a multi-touch scenario;

[0017] When the specified class is the GestureDetector class, the touch scenario corresponding to the GestureDetector class is a gesture operation scenario.

[0018] In one embodiment of this application, when the target touch scenario is a button click scenario, the target algorithm is a click detection algorithm; the touch data includes the position of the touch point, as well as the press time and release time of the touch point;

[0019] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0020] Calculate the time difference between the press-down time and the release time of the touch point;

[0021] If the calculated time difference is less than the first threshold, the user's touch event on the view is determined to be a click event;

[0022] The click event is responded to according to the position of the touch point.

[0023] As can be seen from the above, the technical solution provided in this embodiment can load a click detection algorithm for targeted processing in button click scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0024] In one embodiment of this application, when the target touch scenario is a long press operation scenario, the target algorithm is a long press detection algorithm; the touch data includes the position of the touch point and the duration of the touch point being pressed.

[0025] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0026] If the duration of the touch point is greater than the second threshold, the user's touch event on the view is determined to be a long press event;

[0027] The long press event is responded to according to the position of the touch point.

[0028] As can be seen from the above, the technical solution provided in this embodiment can load a long press detection algorithm for targeted processing in long press operation scenarios, thereby improving the smoothness of responding to user operations and thus improving the user experience.

[0029] In one embodiment of this application, when the target touch scenario is a sliding operation scenario, the target algorithm is a sliding detection algorithm; the touch data includes the start position and end position of the touch point;

[0030] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0031] The Scroller class is used to calculate the distance and direction of movement from the start position to the end position of the touch point.

[0032] If the movement distance of the touch point is greater than the third threshold, the user's touch event on the view is determined to be a swipe event;

[0033] Based on the moving distance and direction of the touch point, interpolation is performed between the starting and ending positions of the touch point to obtain multiple intermediate positions;

[0034] The sliding event is responded to based on the start, middle, and end positions of the touch point.

[0035] As can be seen from the above, the technical solution provided in this embodiment can load a sliding detection algorithm for targeted processing in sliding operation scenarios, thereby improving the smoothness of responding to user operations and thus improving the user experience.

[0036] In one embodiment of this application, when the target touch scenario is a multi-touch scenario, the target algorithm is a touch point tracking algorithm; the touch data includes the start position and end position of each touch point;

[0037] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0038] The VelocityTracker class calculates the distance and direction of movement from the starting position to the ending position of each touch point.

[0039] If the movement distance of the touch point is less than the fourth threshold, determine that the user's touch event on the view at the touch point is a click event, and respond to the user's click event on the view at the touch point;

[0040] If the movement distance of the touch point is greater than the third threshold, the user's touch event on the view at the touch point is determined to be a swipe event. According to the movement distance and direction of the touch point, interpolation is performed between the start position and the end position of the touch point to obtain multiple intermediate positions. Based on the start position, intermediate position and end position of the touch point, the user's swipe event on the view at the touch point is responded to.

[0041] As can be seen from the above, the technical solution provided in this embodiment can load a touch point tracking algorithm for targeted processing in multi-touch scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0042] In one embodiment of this application, when the target touch scenario is a gesture operation scenario, the target algorithm is a gesture recognition algorithm; the touch data includes the start position and end position of the touch point;

[0043] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0044] The GestureDetector class is used to determine the movement trajectory of the touch point based on its start and end positions.

[0045] When the movement trajectory of the touch point is a preset trajectory, the user's touch event on the view is determined to be a gesture operation event;

[0046] Respond to the gesture operation event.

[0047] As can be seen from the above, the technical solution provided in this embodiment can load a gesture recognition algorithm for targeted processing in gesture operation scenarios, improve the smoothness of responding to user operations, and thus improve the user experience.

[0048] In one embodiment of this application, when the target touch scenario is a precise click scenario, the target algorithm is a jitter filtering algorithm; the touch data includes the start position and end position of the touch point;

[0049] The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including:

[0050] Calculate the distance traveled from the starting position to the ending position of the touch point;

[0051] If the movement distance of the touch point is less than the fourth threshold, the user's touch event on the view is determined to be a precise click event;

[0052] Respond to the precise click event.

[0053] As can be seen from the above, the technical solution provided in this embodiment can load a jitter filtering algorithm for targeted processing in precise click scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0054] Secondly, embodiments of this application also provide a terminal, including:

[0055] One or more processors and memory;

[0056] The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, which the one or more processors call to cause the terminal to execute any of the above-described touch event handling methods.

[0057] Thirdly, embodiments of this application also provide a computer-readable storage medium including a computer program that, when the computer program is run on a terminal, causes the terminal to execute any of the touch event processing methods described above.

[0058] Fourthly, embodiments of this application also provide a computer program product, the computer program product comprising executable instructions, which, when executed on a terminal, cause the terminal to execute any of the touch event processing methods described above.

[0059] Fifthly, embodiments of this application also provide a chip system applied to a terminal. The chip system includes one or more processors, which are used to invoke computer instructions to cause the terminal to input data into the chip system and execute any of the touch event processing methods described above to process the data and output the processing result.

[0060] The beneficial effects of the solutions provided in the embodiments of the second, third, fourth and fifth aspects above can be found in the beneficial effects of the solutions provided in the embodiments of the first aspect above. Attached Figure Description

[0061] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0062] Figure 1 A structural diagram of a terminal provided in an embodiment of this application;

[0063] Figure 2 A software structure block diagram of a terminal provided in an embodiment of this application;

[0064] Figure 3 A schematic diagram of the display interface of the first setting application provided in the embodiments of this application;

[0065] Figure 4 Provided for the embodiments of this application Figure 3 The diagram shown illustrates a sliding operation within the displayed interface.

[0066] Figure 5 A schematic diagram of the display interface of a second type of settings application provided in an embodiment of this application;

[0067] Figure 6 A flowchart illustrating the first touch event handling method provided in this application embodiment;

[0068] Figure 7 Provided for the embodiments of this application Figure 3 A schematic diagram of the views in the displayed interface;

[0069] Figure 8A schematic diagram of a view in an information editing interface provided in an embodiment of this application;

[0070] Figure 9 Flowcharts of two touch event handling methods provided in the embodiments of this application;

[0071] Figure 10 A structural diagram of a view system provided in an embodiment of this application;

[0072] Figure 11 Provided for the embodiments of this application Figure 5 The diagram shows a click operation in the displayed interface;

[0073] Figure 12 A schematic diagram of the display interface of a third setting application provided in an embodiment of this application;

[0074] Figure 13 A schematic diagram of the display interface of the fourth setting application provided in the embodiments of this application;

[0075] Figure 14 Provided for the embodiments of this application Figure 13 The diagram shown illustrates the long-press and drag operation on the display interface.

[0076] Figure 15 A schematic diagram of the display interface of the fifth setting application provided in the embodiments of this application;

[0077] Figure 16 This is a schematic diagram illustrating multi-touch operation on a display interface, provided as an embodiment of this application.

[0078] Figure 17 This is a schematic diagram illustrating a gesture touch operation in a display interface, provided as an embodiment of this application.

[0079] Figure 18 This is a schematic diagram of a display interface after a multi-touch operation, provided as an embodiment of this application.

[0080] Figure 19 This is a schematic diagram illustrating a precise click operation in a display interface, provided as an embodiment of this application.

[0081] Figure 20 Flowcharts of three touch event handling methods provided in the embodiments of this application;

[0082] Figure 21 This is a structural diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0083] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0084] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, "first instruction" and "second instruction" are used to distinguish different user instructions and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.

[0085] It should be noted that, in this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.

[0086] The touch event processing method provided in this application is applied to a terminal. The terminal can be a mobile phone, tablet computer, personal digital assistant (PDA), smartwatch, wearable electronic device, augmented reality (AR) device, virtual reality (VR) device, robot, smart glasses, or other terminal equipped with a touchscreen. In this way, the terminal can respond to user touch events according to the method provided in this application, thereby improving the user experience.

[0087] For example, Figure 1 A structural diagram of terminal 100 is shown. Terminal 100 may include a processor 110, a display screen 120, a camera 130, internal memory 140, a Subscriber Identification Module (SIM) card interface 150, a Universal Serial Bus (USB) interface 160, a charging management module 170, a battery management module 171, a battery 172 with battery cells and battery protection devices, a sensor module 180, a mobile communication module 190, a wireless communication module 200, antenna 1, and antenna 2, etc. The sensor module 180 may include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, etc.

[0088] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal 100. In other embodiments of this application, the terminal 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0089] Processor 110 may include one or more processing units, such as a Central Processing Unit (CPU), an Application Processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent components or integrated into one or more processors. In some embodiments, terminal 100 may also include one or more processors 110. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. In other embodiments, processor 110 may also include a memory for storing instructions and data. For example, the memory in processor 110 may be a cache memory. This memory can store instructions or data that processor 110 has just used or is repeatedly used. If processor 110 needs to reuse the instruction or data, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the terminal 100 in processing data or executing instructions.

[0090] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, a General-Purpose Input / Output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. The USB interface 160 is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface 160 can be used to connect a charger to charge the terminal 100, and can also be used for data transfer between the terminal 100 and peripheral devices. The USB interface 160 can also be used to connect headphones for audio playback.

[0091] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are for illustrative purposes only and do not constitute a structural limitation on the terminal 100. In other embodiments of this application, the terminal 100 may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.

[0092] The wireless communication function of terminal 100 can be implemented through antenna 1, antenna 2, mobile communication module 190, wireless communication module 200, modem processor and baseband processor.

[0093] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0094] Terminal 100 implements display functions through a GPU, display screen 120, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 120 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0095] The display screen 120 is used to display images, videos, etc. The display screen 120 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal 100 may include one or more display screens 120.

[0096] In some embodiments of this application, when the display panel uses materials such as OLED, AMOLED, and FLED, the above-mentioned Figure 1 The display screen 120 can be bent. Here, "the display screen 120 can be bent" means that the display screen can be bent to any angle at any part and can maintain that angle. For example, the display screen 120 can be folded from the middle left to right. It can also be folded from the middle up and down.

[0097] The display screen 120 of terminal 100 can be a flexible screen. Currently, flexible screens are attracting much attention due to their unique characteristics and enormous potential. Compared to traditional screens, flexible screens are highly flexible and bendable, providing users with new interaction methods based on their bendability and meeting more user needs for terminals. For terminals equipped with foldable displays, the foldable display can switch between a small screen in folded mode and a large screen in unfolded mode at any time. Therefore, users are increasingly using split-screen functionality on terminals equipped with foldable displays.

[0098] Terminal 100 can perform shooting functions through ISP, camera 130, video codec, GPU, display 120 and application processor, wherein camera 130 includes a front camera and a rear camera.

[0099] The ISP is used to process data fed back from the camera 130. For example, during shooting, when the shutter is opened, light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can perform algorithmic optimization of image noise, brightness, and color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 130.

[0100] Camera 130 is used to capture photos or videos. An object is projected onto a photosensitive element through a lens, generating an optical image. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into standard red-green-blue (RGB), YUV, or other image signals. In some embodiments, terminal 100 may include one or N cameras 130, where N is a positive integer greater than 1.

[0101] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when terminal 100 selects a frequency point, the DSP can perform Fourier transforms on the frequency energy.

[0102] Video codecs are used to compress or decompress digital video. Terminal 100 may support one or more video codecs. Thus, terminal 100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.

[0103] NPU stands for Neural Network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs can enable intelligent cognitive applications in terminals, such as image recognition, facial recognition, speech recognition, and text understanding.

[0104] The internal memory 140 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the aforementioned instructions stored in the internal memory 140, thereby causing the terminal 100 to perform the touch event processing method provided in some embodiments of this application, as well as various applications and data processing. The internal memory 140 may include a program storage area and a data storage area. The program storage area may store the operating system; it may also store one or more applications (such as a gallery, contacts, etc.). The data storage area may store data created by the terminal 100 during use (such as photos, contacts, etc.). Furthermore, the internal memory 140 may include high-speed random access memory and non-volatile memory, such as one or more disk storage components, flash memory components, Universal Flash Storage (UFS), etc. In some embodiments, the processor 110 can execute instructions stored in the internal memory 140 and / or instructions stored in memory disposed in the processor 110, thereby causing the terminal 100 to perform the touch event processing method provided in the embodiments of this application, as well as other applications and data processing.

[0105] The internal memory 140 can be used to store the relevant program of the touch event processing method provided in the embodiments of this application. The processor 110 can be used to call the relevant program of the touch event processing method stored in the internal memory 140 when displaying information, and execute the touch event processing method of the embodiments of this application.

[0106] The sensor module 180 may include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, etc.

[0107] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 120. Pressure sensor 180A can be of many types, such as resistive pressure sensor, inductive pressure sensor, or capacitive pressure sensor. A capacitive pressure sensor can include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes, and terminal 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 120, terminal 100 detects the touch operation based on pressure sensor 180A. Terminal 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed; when a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0108] The fingerprint sensor 180B is used to collect fingerprints. The terminal 100 can use the collected fingerprint characteristics to perform functions such as unlocking, accessing the app lock, taking photos, and answering calls.

[0109] Touch sensor 180C, also known as a touch device, can be disposed on display screen 120. The touch sensor 180C and display screen 120 together form a touchscreen, also known as a touch display. Touch sensor 180C is used to detect touch operations applied to or near it. Touch sensor 180C can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 120. In other embodiments, touch sensor 180C may also be disposed on the surface of terminal 100, and in a different location from display screen 120.

[0110] The ambient light sensor 180D is used to sense the ambient light intensity. The terminal 100 can adaptively adjust the brightness of the display screen 120 based on the sensed ambient light intensity. The ambient light sensor 180D can also be used to automatically adjust the white balance during shooting. The ambient light sensor 180D can also transmit environmental information about the device's location to the GPU.

[0111] The ambient light sensor 180D is also used to acquire the brightness, light ratio, color temperature, and other parameters of the environment in which the camera 130 captures images.

[0112] Figure 2This is a software architecture block diagram for a terminal to which this application's embodiments apply. The terminal's software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. A layered architecture divides the terminal's software system into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into four layers: Applications, Application Framework, Libraries, and Kernel.

[0113] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. For example... Figure 2 As shown, an application package can include multiple applications, such as the home screen, contacts, phone, and browser. Understandably, the port of each of these applications can be used to receive data.

[0114] The application framework layer provides APIs and a programming framework for applications within the application layer. The application framework layer includes predefined functions. For example... Figure 2 As shown, the application framework layer may include: ActivityManager, Windows Manager, Content provider, View System, Notification Manager, Package Manager, Telephony Manager, Resource Manager, LocationManager, and Extensible Messaging and Attendance Protocol Service (XMPP service), etc.

[0115] In order to implement the touch event handling method provided in the embodiments of this application, Figure 2The view system is improved to identify the target touch scene corresponding to the view displayed in each display area of ​​the terminal, and loads the touch data processing algorithm corresponding to the target touch scene. This algorithm processes the user's touch data for different views to obtain the user's touch events for those views. Then, the touch events and touch data determined by the view system are synchronized to the currently running target application in the application layer, allowing the target application to respond to the touch events.

[0116] The system runtime library layer contains various class libraries. For example... Figure 2 As shown, the system runtime library layer may include: Surface Manager, Media Framework, lightweight database (SQLite), open-source graphics library (OpenGL ES), open-source font engine (FreeType), browser engine (Webkit), and runtime environment (Android Runtime) that enables the pre-compilation process at application runtime. Android Runtime includes: core libraries and network virtual machine (Dalvik VM).

[0117] The kernel layer is the layer between hardware and software, used to drive the hardware and make it work. Multiple drivers can be installed in the kernel layer to operate the hardware. These include, for example, display drivers, camera drivers, Bluetooth drivers, flash drivers, Binder (IPC) drivers, USB drivers, keyboard drivers, WiFi drivers, audio drivers, and power management drivers.

[0118] In addition, the terminal also includes a hardware layer, which may include a camera, speaker, display screen and battery, etc. The hardware layer is connected to the kernel layer.

[0119] The following combination Figures 3 to 5 The application scenarios of the embodiments of this application will be described. The terminal is a mobile phone. Figure 3 The settings app on a mobile phone displays different views. Users can perform touch operations on different views, and the phone responds to the user's touch events for each view to configure various phone functions.

[0120] For example, users can follow Figure 4 As shown in Figure 3 You can perform a sliding operation in the displayed interface. Figure 4 The curve with arrows represents the trajectory of the user's swipe gesture. Correspondingly, after the phone's touchscreen detects the user's touch data, it reports the data to the phone's processor (such as the CPU). The processor processes the touch data, obtains the user's swipe event on the settings interface, and responds to the user's swipe event on the settings interface, displaying... Figure 5 The interface shown.

[0121] The reporting rate of touch data from the touchscreen to the processor affects the smoothness of application response to user actions. The reporting rate refers to the number of times the touchscreen reports touch data per second. For example, Figure 4 In the scenario shown, the user's swipe speed is relatively slow, so the touchscreen's reporting rate can be low. For applications where users perform fast-paced operations (such as games), the user's operation speed is relatively fast, so the touchscreen's reporting rate needs to be high.

[0122] In related technologies, touchscreens report touch data at a high reporting rate for different scenarios, which increases the consumption of system resources in the terminal. Furthermore, after the processor receives the touch data, it processes the touch data using the same method, which can lead to recognition errors. For example, a quick click event in a game scene may be identified as a swipe event, thereby reducing the smoothness of the application's response to user operations and degrading the user experience.

[0123] The touch event processing method provided in this application can set the reporting rate of touch data from the touchscreen to the processor to a lower value, thereby reducing the system resource consumption of the terminal. Then, it first identifies the target touch scene corresponding to each view displayed on the terminal, and different touch scenes correspond to different touch data processing algorithms. Accordingly, the touch data processing algorithm corresponding to the target touch scene of different views is used to process the user's touch data for that view specifically, rather than using the same method for different scenes. This improves the accuracy of touch event processing, enhances the smoothness of responding to user operations, and thus improves the user experience. In other words, it can reduce the system resource consumption of the terminal, reduce system load, and not affect the user experience. Different algorithms can be used to process different scenes according to requirements, accurately matching user scenarios, optimizing the user experience, and better improving the user experience.

[0124] The touch event handling method provided in this application will now be described in detail through specific embodiments.

[0125] In one embodiment of this application, see [link to embodiment]. Figure 6 , Figure 6This is a flowchart of a touch event handling method provided in an embodiment of this application. The method is applied to a terminal and may include the following steps:

[0126] S601: Identify the touch scene corresponding to the view displayed in each display area of ​​the terminal, and use it as the target touch scene.

[0127] S602: For each view, after obtaining the user's touch data for that view, determine the touch data processing algorithm corresponding to the target touch scene of that view, and use it as the target algorithm.

[0128] Different touch scenarios correspond to different touch data processing algorithms.

[0129] S603: Load the target algorithm to process the user's touch data for the view, obtain the user's touch events for the view, and respond to the touch events.

[0130] As can be seen from the above, the technical solution provided in this embodiment first identifies the target touch scene corresponding to each view displayed on the terminal, and different touch scenes correspond to different touch data processing algorithms. Accordingly, the touch data processing algorithm corresponding to the target touch scene of different views is used to process the user's touch data for that view in a targeted manner, rather than using the same method to process different scenes. This can improve the accuracy of touch event processing, improve the smoothness of responding to user operations, and thus improve the user experience.

[0131] Regarding step S601, the terminal's display interface comprises multiple display areas, each capable of displaying a different view. The views displayed in each display area of ​​the terminal are those provided by the target application currently running on the terminal. A view refers to a control used to define the content displayed in a display area; different types of views display different content in their respective display areas. For example, different types of views include: TextView, EditText, Button, ImageView, ProgressBar, etc.

[0132] TextView is a control used to display strings, corresponding to the text display area in the interface. EditText is a control used to receive text input from the user, corresponding to the text input display area in the interface. Button is a control used to respond to user clicks, corresponding to the button display area in the interface. ImageView is a control used to display images, corresponding to the image display area in the interface. ProgressBar is a control used to display task progress or loading status, corresponding to the progress bar display area in the interface.

[0133] For example, let's take a mobile phone as an example to illustrate this. Figure 7 As shown, the view in display area 701 is text (i.e., "Settings"). The view in display area 702 is a text box (i.e., "Search Settings"), which is used to receive text input by the user. The view in display area 703 is a clickable area, where the user can log in to their account by clicking.

[0134] See Figure 8 The view in display area 801 is the drawing area. The view in display area 802 is a text box, which is used to receive text input by the user. The view in display area 803 is a button, which is a button for click operation. The view in display area 804 is also a button, which is a button for long-press operation. The circular pattern 805 is a graphic drawn by the user in the drawing area.

[0135] Users may perform different operations in different display areas. For example, a user might click in display area 703 and draw in display area 801. Accordingly, the touch scene (i.e., the target touch scene) corresponding to the view displayed in each display area of ​​the terminal is identified to determine the touch operation the user might perform in that view's display area. Different types of views correspond to different touch scenes, and each view's touch scene corresponds to the user's touch operation in that view's display area. For example, the touch scene corresponding to the view in display area 703 is a button click scene; the touch scene corresponding to the view in display area 804 is a long press operation scene.

[0136] In some embodiments, step S601 may include the following steps: traversing the view tree containing the views displayed in each display area of ​​the terminal to obtain the view type of the view displayed in each display area of ​​the terminal; for each view, if the view does not call a specified class, then determining the touch scene corresponding to the view type of the view as the touch scene corresponding to the view, as the target touch scene; wherein, the specified class is used to respond to a specified touch event; if the view calls a specified class, then determining the touch scene corresponding to the specified class as the touch scene corresponding to the view, as the target touch scene.

[0137] The content displayed on the terminal's screen is created based on Views and ViewGroups. Views and ViewGroups are combined in the form of a View tree, meaning the View tree contains the views displayed in each display area of ​​the terminal. Traversing the View tree allows you to obtain the view type of each view displayed in each display area of ​​the terminal. The view type represents the possible touch operations that the user may perform on that view, and based on the view type, you can determine the target touch scenario corresponding to the view.

[0138] Furthermore, the terminal needs to invoke a specific class when processing a specified touch event. Therefore, for each view, if the view invokes a specific class, the touch scene corresponding to that specific class is determined to be the target touch scene for that view. If the view does not invoke a specific class, the touch scene corresponding to the view type is determined to be the target touch scene for that view.

[0139] For example, when the terminal handles events related to a swipe gesture, it calls the Scroller class. The Scroller class is an auxiliary class used to implement smooth scrolling of a View. Accordingly, if a view calls the Scroller class, the touch scene (i.e., the swipe gesture scene) corresponding to the Scroller class is determined to be the target touch scene for that view.

[0140] When a terminal processes events in a multi-touch scenario, it calls the VelocityTracker class. VelocityTracker is a utility class used to track the speed of touch events. Accordingly, if a view calls the VelocityTracker class, the touch scenario (i.e., the multi-touch scenario) corresponding to the VelocityTracker class is determined to be the target touch scenario for that view.

[0141] When the terminal processes events related to gesture operations, it calls the GestureDetector class. The GestureDetector class is an auxiliary class used to identify user gesture operations and perform corresponding processing. Accordingly, if a view calls the GestureDetector class, the touch scene (i.e., the gesture operation scene) corresponding to the GestureDetector class is determined to be the target touch scene for that view.

[0142] In some embodiments, the touch scenario includes at least one of the following:

[0143] 1. Button click scenario: Suitable for functions that require button clicks. Examples include buttons in game applications or menu items in other applications.

[0144] 2. Long press operation scenario, suitable for functions that require long press operation, such as context menu or drag operation;

[0145] 3. Sliding operation scenarios, suitable for functions that require sliding operations, such as image browsing, list scrolling, etc.

[0146] 4. Multi-touch scenarios, suitable for applications that require multi-touch, such as drawing applications and game applications;

[0147] 5. Gesture operation scenarios, suitable for applications that require complex gesture operations, such as map zooming, image rotation, etc.

[0148] 6. Precise click scenario: Suitable for scenarios that require precise clicks, reducing accidental touches by users, such as scenarios in game applications that require rapid click operations.

[0149] As can be seen from the above, the technical solution provided in this embodiment can identify the view type of each view displayed on the terminal by traversing the View tree, and obtain the corresponding target touch scene based on the view type, that is, obtain the target touch scene of each view by combining user preferences. Furthermore, different touch scenes correspond to different touch data processing algorithms. Subsequently, the touch data processing algorithms corresponding to the target touch scenes of different views can be used to perform targeted processing of the user's touch data for that view, which can improve the accuracy of touch event processing, improve the smoothness of responding to user operations, and thus improve the user experience.

[0150] In some embodiments, such as Figure 9 As shown, the process of identifying the target touch scene corresponding to the view displayed in each display area of ​​the terminal is implemented through the view system of the terminal's application framework layer.

[0151] like Figure 10 As shown, the view system in the application framework layer includes the ViewRootlmp module and the Accelerated Graphics Port Service (AGPservice). ViewRootlmp traverses the View tree to obtain the characteristics of the View, that is, to identify whether the View is a bottom-level view (TextureView) or a surface view (SurfaceView). TextureView is a control that displays content and allows for complex view transformations such as scaling and rotation, suitable for scenarios requiring frame rate control (i.e., scenarios with low view refresh rates). SurfaceView provides a method to draw content directly onto the screen, primarily used for efficiently displaying frequently updated content, such as video playback and game graphics rendering, suitable for scenarios requiring high frame rates (i.e., scenarios with high view refresh rates). Furthermore, ViewRootlmp identifies the characteristics of the View, that is, it determines the View's view type based on the View's characteristics. AGPservice is used for frame rate decision-making, where frame rate refers to the view's refresh rate.

[0152] The touch data reported by the touchscreen differs depending on the target touch scenario. For example, in a button click scenario, only the position of the target touch point, the press time, and the release time of the touch point need to be reported. In a multi-touch scenario, the start and end positions of multiple touch points need to be reported.

[0153] Accordingly, after determining the target touch scene corresponding to each view through the view system, the target touch scene corresponding to the view is synchronized to the touch screen. Furthermore, for each view, if the target trigger scene for that view is a first specified touch scene, when the touch screen detects a user touching the display area where that view is located, it acquires touch data for a touch point and reports the touch data of that touch point to the view system. The first specified touch scene includes: button click scene, long press operation scene, and precise click scene.

[0154] For each view, if the target triggering scenario of the view is the second specified touch scenario, when the touch screen detects that the user is performing a touch operation in the display area where the view is located, it acquires touch data of multiple touch points and reports the touch data of multiple touch points to the view system; the second specified touch scenario includes: swipe operation scenario, multi-touch scenario and gesture operation scenario.

[0155] For steps S602 and S603, after determining the target touch scene corresponding to each view, if a user touch operation on that view is detected, the user touch data on that view is obtained, and the touch data processing algorithm (i.e., the target algorithm) corresponding to the target touch scene of that view is determined.

[0156] Different touch data processing algorithms are used to process touch data in different touch scenarios and determine the user's touch events on the view. Correspondingly, the target algorithm processes the user's touch data on that view, obtains the user's touch events on that view, and responds to the determined touch events.

[0157] In some embodiments, such as Figure 9 As shown, the process of the above-described target loading algorithm processing user touch data on the view is implemented through the view system of the terminal's application framework layer. Touch events require a response from the target application currently running on the terminal. Accordingly, after determining the user's touch event on the view through the view system, the determined touch event is synchronized to the target application currently running on the terminal. Then, the target application responds to the touch event.

[0158] A terminal's view framework typically includes an event propagation system. For precise user interaction with views within a scene—that is, when a user performs touch operations on a view—the event propagation system ensures that the user's touch operations are correctly transmitted to the corresponding view. This, combined with the appropriate touch event algorithm, allows for accurate matching of the user's context, eliminating the need for trade-offs between different user-context algorithms. This improves the user experience and reduces the terminal's system load.

[0159] In some embodiments, when the target touch scenario is a button click scenario, the target algorithm is a click detection algorithm. Touch data includes the position of the touch point, as well as the press time and release time of the touch point.

[0160] Accordingly, step S603 may include the following steps: calculating the time difference between the press time and the release time of the touch point; if the calculated time difference is less than a first threshold, determining that the user's touch event on the view is a click event; and responding to the click event according to the position of the touch point.

[0161] When the target touch scenario is a button click, the touch data reported by the touchscreen includes the location of the touch point, as well as the press and release times. Accordingly, a click detection algorithm is loaded to calculate the time difference between the press and release times of the touch point; this time difference represents the duration of the user's operation at the touch point. If the calculated time difference is less than a first threshold, it indicates that the user's touch time at the touch point is short and not a long press, thus confirming the user's touch event on that view as a click event. Furthermore, based on the location of the touch point, the user's click event at that touch point is responded to.

[0162] For example, see Figure 11 Users Figure 5 When the user clicks on the "Accessibility" section of the displayed interface, the terminal responds to the user's click event. Figure 12 The interface shown.

[0163] As can be seen from the above, the technical solution provided in this embodiment can load a click detection algorithm for targeted processing in button click scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0164] In some embodiments, when the target touch scenario is a long press operation scenario, the target algorithm is a long press detection algorithm. Touch data includes the position of the touch point and the duration of the touch point press.

[0165] Accordingly, step S603 may include the following steps: if the duration of the touch point is greater than the second threshold, determine that the user's touch event on the view is a long press event; respond to the long press event according to the position of the touch point.

[0166] When the target touch scenario is a long press operation, the touch data reported by the touchscreen includes the location of the touch point and the duration of the press. Accordingly, a long press detection algorithm is loaded to detect whether the duration of the press exceeds a second threshold. If the duration exceeds the second threshold, it indicates that the user's touch at the touch point is prolonged and not a click operation, thus confirming the user's touch event on that view as a long press event. Furthermore, based on the location of the touch point, the system responds to the user's long press event at that touch point.

[0167] Long press events include events where the user only presses and does not drag, and events where the user presses and drags. When the long press event is a long press without dragging, the touch point position can include only the position of the touch point when the user presses down; when the long press event is a long press with dragging, the touch point position can include both the position of the touch point when the user presses down and the position of the touch point when the user releases the touch.

[0168] For example, see Figure 13 The added quick tasks, from left to right, are: "Scan - WeChat", "Receive / Pay - WeChat", and "Receive / Pay - Alipay". To adjust the order of the added quick tasks, such as... Figure 14 As shown, the user long-presses the "Payments - Alipay" icon and drags it in the direction of the arrow to move it to the far left. In response to the user's long-press event, the terminal... Figure 15 The interface shown is Figure 15 In the middle, the added quick tasks are arranged from left to right as follows: "Receive / Payment - Alipay", "Scan / QR Code - WeChat", and "Receive / Payment - WeChat".

[0169] As can be seen from the above, the technical solution provided in this embodiment can load a long press detection algorithm for targeted processing in long press operation scenarios, thereby improving the smoothness of responding to user operations and thus improving the user experience.

[0170] In some embodiments, when the target touch scenario is a swipe operation scenario, the target algorithm is a swipe detection algorithm; the touch data includes the start position and end position of the touch point.

[0171] Accordingly, step S603 may include the following steps: using the Scroller class, calculate the movement distance and direction from the start position to the end position of the touch point; if the movement distance of the touch point is greater than a third threshold, determine that the user's touch event on the view is a swipe event; according to the movement distance and direction of the touch point, interpolate between the start position and the end position of the touch point to obtain multiple intermediate positions; and respond to the swipe event based on the start position, intermediate positions, and end position of the touch point.

[0172] When the target touch scenario is a swipe operation, the touch data reported by the touchscreen includes the start and end positions of the touch point. Accordingly, a swipe detection algorithm is loaded to calculate the distance and direction of movement from the start to the end position of the touch point using the Scroller class. If the movement distance of the touch point is greater than a third threshold, it indicates that the user moved a large distance during the touch operation, i.e., the user performed a swipe operation, and the touch event on that view is determined to be a swipe event. Then, to achieve a smooth scrolling effect for the view, interpolation is performed between the start and end positions of the touch point according to the movement distance and direction to obtain multiple intermediate positions. These intermediate positions represent the positions traversed during the movement from the start to the end position. Finally, based on the start, intermediate, and end positions of the touch point, a swipe event is responded to.

[0173] For example, users in Figure 4 In the interface shown, slide in the direction indicated by the arrow to move the entire view upwards; the terminal will then display... Figure 5 The interface shown.

[0174] As can be seen from the above, the technical solution provided in this embodiment can load a sliding detection algorithm for targeted processing in sliding operation scenarios, thereby improving the smoothness of responding to user operations and thus improving the user experience.

[0175] In some embodiments, when the target touch scenario is a multi-touch scenario, the target algorithm is a touch point tracking algorithm; the touch data includes the start position and end position of each touch point.

[0176] Accordingly, step S603 may include the following steps: using the VelocityTracker class, for each touch point, calculate the movement distance and movement direction from the start position to the end position of the touch point; if the movement distance of the touch point is less than a fourth threshold, determine that the user's touch event on the view at the touch point is a click event, and respond to the user's click event on the view at the touch point; if the movement distance of the touch point is greater than a third threshold, determine that the user's touch event on the view at the touch point is a swipe event, interpolate between the start position and the end position of the touch point according to the movement distance and movement direction of the touch point to obtain multiple intermediate positions, and respond to the user's swipe event on the view at the touch point based on the start position, intermediate positions and end positions of the touch point.

[0177] When the target touch scenario is a multi-touch scenario, the touch data includes the start and end positions of each touch point. Accordingly, a touch point tracking algorithm is loaded to calculate the distance and direction of movement from the start to the end position for each touch point using the VelocityTracker class. If the movement distance of the touch point is less than a fourth threshold, it indicates that the user's touch operation involved a small movement distance, i.e., a click operation rather than a swipe. In this case, the touch event at that touch point on the view is determined to be a click event, and a click event response is initiated.

[0178] If the movement distance of the touch point exceeds the third threshold, it indicates that the user moved a large distance during the touch operation, i.e., the user performed a swipe operation. In this case, the touch event on the view at that touch point is determined to be a swipe event. Based on the movement distance and direction of the touch point, interpolation is performed between the start and end positions of the touch point to obtain multiple intermediate positions. These intermediate positions represent the positions traversed during the movement from the start to the end position of the touch point. Furthermore, based on the start, intermediate, and end positions of the touch point, a response is initiated to the user's swipe event on the view at that touch point.

[0179] The number of intermediate positions obtained by interpolation using the VelocityTracker class is greater than the number of intermediate positions obtained by interpolation using the Scroller class.

[0180] For example, Figure 16 The displayed interface includes buttons 1 to 5. When the user performs a touch operation with both hands, they can slide button 5 in direction 1 with one hand while simultaneously clicking button 4 with the other. The terminal will then respond to the user's slide event on button 5 and the user's click event on button 4. Alternatively, the user can slide button 5 in direction 2 with one hand while simultaneously clicking button 4 with the other. The terminal will then respond to the user's slide event on button 5 and the user's click event on button 4.

[0181] As can be seen from the above, the technical solution provided in this embodiment can load a touch point tracking algorithm for targeted processing in multi-touch scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0182] In some embodiments, when the target touch scenario is a gesture operation scenario, the target algorithm is a gesture recognition algorithm; the touch data includes the start position and end position of the touch point.

[0183] Accordingly, step S603 may include the following steps: using the GestureDetector class, determining the movement trajectory of the touch point based on the start and end positions of the touch point; when the movement trajectory of the touch point is a preset trajectory, determining that the user's touch event on the view is a gesture operation event; and responding to the gesture operation event.

[0184] When the target touch scenario is a gesture operation scenario, the touch data includes the start and end positions of the touch point. Accordingly, a gesture recognition algorithm is loaded to determine the movement trajectory of the touch point based on its start and end positions using the `GestureDetector` class. If the touch point's movement trajectory matches a preset trajectory, it can be determined that the user's touch event on that view is a gesture operation event corresponding to the preset trajectory, and the gesture operation event is responded to according to the preset trajectory.

[0185] The preset trajectories are as follows: Starting from two closely spaced touch points, moving to either side results in a zoom-in gesture. Starting from two widely spaced touch points, moving towards the center of the two starting points, and ending between the two starting points, results in a zoom-out gesture. Finally, starting from two touch points, rotating them in the same direction results in a rotation gesture.

[0186] For example, Figure 17 The images displayed are small, and users can... Figure 17 In the displayed interface, starting from point A, moving two fingers to the sides in the direction of the arrows zooms in on the image. Correspondingly, in response to the user's... Figure 17 The zoom-in gesture operation event in the terminal display Figure 18 The image is displayed in a magnified manner in the shown interface.

[0187] The above preset trajectories are provided as examples and do not limit the gesture operation events in the embodiments of this application to the gesture operation events corresponding to the three preset trajectories in the above examples.

[0188] As can be seen from the above, the technical solution provided in this embodiment can load a gesture recognition algorithm for targeted processing in gesture operation scenarios, improve the smoothness of responding to user operations, and thus improve the user experience.

[0189] In some embodiments, when the target touch scenario is a precise click scenario, the target algorithm is a jitter filtering algorithm; the touch data includes the start position and end position of the touch point.

[0190] Accordingly, step S603 may include the following steps: calculating the movement distance from the start position to the end position of the touch point; if the movement distance of the touch point is less than the fourth threshold, determining that the user's touch event on the view is a precise click event; and responding to the precise click event.

[0191] When the target touch scenario is a precise click scenario, the touch data includes the start and end positions of the touch point. Accordingly, a jitter filtering algorithm is loaded to calculate the distance traveled from the start to the end position of the touch point. If the travel distance is less than a fourth threshold, it indicates that the user's touch operation involves a small distance, meaning the user performed a click rather than a swipe. In this case, the touch event at that touch point on the view is determined to be a precise click event, and the precise click event is responded to according to the start and end positions of the touch point.

[0192] For example, Figure 19 When a user receives a red envelope from contact 1, they will... Figure 19 When quickly tapping the circular area containing the "open" symbol, the user's touch point will not exceed the circular area where the "open" symbol is located, meaning the touch point's movement distance is minimal. This responds to the user's... Figure 19 A precise click event on the circular area containing the "open" icon will cause the terminal to open the red envelope for contact 1.

[0193] As can be seen from the above, the technical solution provided in this embodiment can load a jitter filtering algorithm for targeted processing in precise click scenarios, thereby improving the smoothness of responding to user operations and thus enhancing the user experience.

[0194] See Figure 20 , Figure 20 A flowchart of a touch event handling method provided in this application embodiment, the method including the following steps:

[0195] S2001: Begin.

[0196] S2002: Scene recognition and classification (6 categories), and algorithm application principles, for recognition in the View system.

[0197] In this step, scene recognition and classification refers to identifying the target touch scene of the view displayed on the terminal, specifically including the six types of touch scenes in the aforementioned embodiments. The process of identifying the target touch scene of the view displayed on the terminal is implemented through the view system.

[0198] S2003: Override the onTouchEvent method to handle touch events after scene recognition.

[0199] In this step, the touch event (onTouchEvent) method refers to the touch data processing algorithm in the aforementioned embodiments. That is, after determining the target touch scene corresponding to the view, the touch data processing algorithm (i.e., the target algorithm) corresponding to the target touch scene is loaded to process the user's touch data on the view, thereby obtaining the user's touch event on the view.

[0200] S2004: Application drawing submission. When handling touch events, minimize unnecessary redraws and use invalidate only when necessary.

[0201] In this step, after receiving the user's touch event on the view, the touch event response is applied. For example, if the user's touch event is a drawing event, the touch event response is to send the data to the display according to the trajectory of the user's touch, which can reduce unnecessary redraws and ensure that the invalidate method is only called when necessary, thus reducing the number of times the user performs repetitive operations.

[0202] S2005: End.

[0203] As can be seen from the above, the technical solution provided in this embodiment first identifies the target touch scene corresponding to each view displayed on the terminal, and different touch scenes correspond to different touch data processing algorithms. Accordingly, the touch data processing algorithm corresponding to the target touch scene of different views is used to process the user's touch data for that view in a targeted manner, rather than using the same method to process different scenes. This can improve the accuracy of touch event processing, improve the smoothness of responding to user operations, and thus improve the user experience.

[0204] In a specific implementation, this application also provides a terminal, which includes one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, which includes computer instructions, and one or more processors call the computer instructions to cause the terminal to perform some or all of the steps in the above method embodiments.

[0205] This application also provides a computer-readable storage medium including a computer program that, when run on a terminal, causes the terminal to perform some or all of the steps described in the method embodiments. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0206] In a specific implementation, this application also provides a computer program product, which includes executable instructions. When the executable instructions are executed on a terminal, the terminal performs some or all of the steps in the above method embodiments.

[0207] like Figure 21 As shown, this application also provides a chip system applied to a terminal. The chip system includes one or more processors 2101. The processors 2101 are used to call computer instructions to cause the terminal to input data to be processed into the chip system. The chip system processes the data based on the touch event processing method provided in the embodiments of this application and outputs the processing result.

[0208] In one possible implementation, the chip system also includes input and output interfaces for inputting and outputting data.

[0209] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0210] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.

[0211] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0212] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact disc read-only memory (CD-ROMs), magneto-optical disks, read-only memory, random access memory, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0213] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0214] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0215] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0216] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.

Claims

1. A touch event handling method, characterized in that, The method is applied to a terminal, and the method includes: Identify the touch scene corresponding to the view displayed in each display area of ​​the terminal, and use it as the target touch scene; For each view, after obtaining the user's touch data for that view, the touch data processing algorithm corresponding to the target touch scene of that view is determined as the target algorithm; different touch scenes correspond to different touch data processing algorithms. The target algorithm is loaded to process the user's touch data for the view, obtain the user's touch events for the view, and respond to the touch events.

2. The method according to claim 1, characterized in that, The step of identifying the touch scene corresponding to the view displayed in each display area of ​​the terminal as the target touch scene includes: Traverse the View tree containing the views displayed in each display area of ​​the terminal to obtain the view type of the views displayed in each display area of ​​the terminal; For each view, if the view does not call the specified class, the touch scene corresponding to the view type is determined as the touch scene corresponding to the view, and is used as the target touch scene; wherein, the specified class is used to respond to the specified touch event; If the view calls a specified class, then the touch scene corresponding to the specified class is determined as the touch scene corresponding to the view, and is used as the target touch scene.

3. The method according to claim 2, characterized in that, When the specified class is the Scroller class, the touch scenario corresponding to the Scroller class is a swipe operation scenario; When the specified class is the VelocityTracker class, the touch scenario corresponding to the VelocityTracker class is a multi-touch scenario; When the specified class is the GestureDetector class, the touch scenario corresponding to the GestureDetector class is a gesture operation scenario.

4. The method according to claim 1, characterized in that, When the target touch scenario is a button click scenario, the target algorithm is a click detection algorithm; the touch data includes the position of the touch point, as well as the press time and release time of the touch point; The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: Calculate the time difference between the press-down time and the release time of the touch point; If the calculated time difference is less than the first threshold, the user's touch event on the view is determined to be a click event; The click event is responded to according to the position of the touch point.

5. The method according to claim 1, characterized in that, When the target touch scenario is a long press operation scenario, the target algorithm is a long press detection algorithm; the touch data includes the position of the touch point and the duration of the touch point press. The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: If the duration of the touch point is greater than the second threshold, the user's touch event on the view is determined to be a long press event; The long press event is responded to according to the position of the touch point.

6. The method according to claim 1, characterized in that, When the target touch scenario is a swipe operation scenario, the target algorithm is a swipe detection algorithm; the touch data includes the start and end positions of the touch point; The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: The Scroller class is used to calculate the distance and direction of movement from the start position to the end position of the touch point. If the movement distance of the touch point is greater than the third threshold, the user's touch event on the view is determined to be a swipe event; Based on the moving distance and direction of the touch point, interpolation is performed between the starting and ending positions of the touch point to obtain multiple intermediate positions; The sliding event is responded to based on the start, middle, and end positions of the touch point.

7. The method according to claim 1, characterized in that, When the target touch scenario is a multi-touch scenario, the target algorithm is a touch point tracking algorithm; the touch data includes the start and end positions of each touch point; The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: The VelocityTracker class calculates the distance and direction of movement from the starting position to the ending position of each touch point. If the movement distance of the touch point is less than the fourth threshold, determine that the user's touch event on the view at the touch point is a click event, and respond to the user's click event on the view at the touch point; If the movement distance of the touch point is greater than the third threshold, the user's touch event on the view at the touch point is determined to be a swipe event. According to the movement distance and direction of the touch point, interpolation is performed between the start position and the end position of the touch point to obtain multiple intermediate positions. Based on the start position, intermediate position and end position of the touch point, the user's swipe event on the view at the touch point is responded to.

8. The method according to claim 1, characterized in that, When the target touch scenario is a gesture operation scenario, the target algorithm is a gesture recognition algorithm; the touch data includes the start and end positions of the touch point; The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: The GestureDetector class is used to determine the movement trajectory of the touch point based on its start and end positions. When the movement trajectory of the touch point is a preset trajectory, the user's touch event on the view is determined to be a gesture operation event; Respond to the gesture operation event.

9. The method according to claim 1, characterized in that, When the target touch scenario is a precise click scenario, the target algorithm is a jitter filtering algorithm; the touch data includes the start and end positions of the touch point; The loading of the target algorithm processes the user's touch data on the view to obtain the user's touch events on the view, and responds to the touch events, including: Calculate the distance traveled from the starting position to the ending position of the touch point; If the movement distance of the touch point is less than the fourth threshold, the user's touch event on the view is determined to be a precise click event; Respond to the precise click event.

10. A terminal, characterized in that, include: One or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the terminal to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, Includes a computer program that, when run on a terminal, causes the terminal to perform the method of any one of claims 1-9.

12. A computer program product, characterized in that, The computer program product includes executable instructions that, when executed on a terminal, cause the terminal to perform the method of any one of claims 1-9.

13. A chip system, characterized in that, The chip system is applied to a terminal. The chip system includes one or more processors. The processors are used to call computer instructions to cause the terminal to input data into the chip system and execute the method described in any one of claims 1-9 to process the data and output the processing result.