WO2018233636A1 - 加速界面绘制的方法、装置和终端 - Google Patents

加速界面绘制的方法、装置和终端 Download PDF

Info

Publication number
WO2018233636A1
WO2018233636A1 PCT/CN2018/092024 CN2018092024W WO2018233636A1 WO 2018233636 A1 WO2018233636 A1 WO 2018233636A1 CN 2018092024 W CN2018092024 W CN 2018092024W WO 2018233636 A1 WO2018233636 A1 WO 2018233636A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
touch operation
input event
vertical synchronization
input
Prior art date
Application number
PCT/CN2018/092024
Other languages
English (en)
French (fr)
Inventor
肖小欢
何琳
向林
Original Assignee
深圳市万普拉斯科技有限公司
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 深圳市万普拉斯科技有限公司 filed Critical 深圳市万普拉斯科技有限公司
Publication of WO2018233636A1 publication Critical patent/WO2018233636A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures

Definitions

  • the present invention relates to the field of intelligent terminal technologies, and in particular, to a method, an apparatus, and a terminal for accelerating interface rendering.
  • the hand-feeling of touch operations is crucial, which directly affects the user's experience of touch operations.
  • the input boost mechanism In order to improve the tracking of the touch operation, there are two main methods: one is to use the input boost mechanism, and when there is an input event, the CPU (Central Processing Unit) is processed. The unit frequency is used to improve the performance of the hand. The other is to use the pre-judgment mechanism. The mechanism is based on the input event sent by the touch screen firmware, and the input event is reported to the application in advance.
  • an object of the present invention is to provide a method, an apparatus, and a terminal for accelerating interface rendering, to speed up interface rendering triggered by a touch event, and improve the performance of the terminal.
  • the first technical solution adopted by the present invention is: a method for accelerating interface rendering, applied to an Android terminal supporting a Choreographer mechanism, the method comprising: recording an input event type when receiving an input event triggered by a touch operation When the type of the input event is pressed or slid, under the condition that the vertical synchronization function is disabled, whether the first drawing event of the touch operation occurs is monitored, and if so, the first drawing event is invoked. Drawing a process; enabling the vertical synchronization function to continue performing subsequent interface drawing of the touch operation.
  • the method further includes: setting a default state of the vertical synchronization function to a disabled state in advance; or setting a state of the vertical synchronization function to a disabled state when receiving a first input event triggered by a touch operation.
  • the vertical synchronization function is disabled and is implemented by setting the variable USE_VSYNC to be invalid.
  • the step of monitoring whether the first drawing event of the touch operation occurs comprises: when the input event triggers a call to the postCallback function of the Choreographer class, and the parameter type of the postCallback function is CALLBACK_TRAVERSAL for the first time, determining to appear The first draw event of the touch operation.
  • the step of recording the type of the input event includes: when the distance of the first input event of the touch operation corresponding to the movement of the finger center is greater than the first distance threshold, recording the type of the input event as sliding, and And setting the first distance threshold to a second distance threshold, where the second distance threshold is greater than the first distance threshold.
  • the method further includes: setting a priority of the Input thread task to a value between -8 and -16; the Input thread task includes an InputReader and an InputDispatcher thread task.
  • the method further includes: the Input kernel mode driving the thread to process the data in a serial manner.
  • the method further includes: applying an anti-shake filtering function to determine a finger center of the touch operation; wherein the anti-shake filtering function includes at least one of the following parameter settings: a duration of the touch screen idle time doze_mode is less than 20 ms, and is greater than 10ms; The jitter determination threshold of the touch screen is between 50 and 255; the false touch determination of the non-detection area is calculated as an invalid state, wherein the non-detection area is a preset area; the report rate is between 110 Hz and 120 Hz. .
  • the second technical solution adopted by the present invention is: an apparatus for accelerating interface rendering, applied to an Android terminal supporting a Choreographer mechanism, the device comprising: a type recording module, configured to record when an input event triggered by a touch operation is received The type of the input event; the first drawing module is configured to monitor whether the first drawing of the touch operation occurs under the condition that the vertical synchronization function is disabled when the type of the input event is pressing or sliding An event, if yes, invoking a drawing flow of the first drawing event; continuing to draw a module for enabling the vertical synchronization function to continue performing subsequent interface drawing of the touch operation.
  • the third technical solution adopted by the present invention is: a terminal, comprising: a processor and a memory for storing processor-executable instructions; the processor is configured to: when receiving an input event triggered by a touch operation, record a type of the input event; When the type of the input event is pressed or swiped, under the condition that the vertical synchronization function is disabled, the first drawing event of the touch operation is monitored, and if so, the drawing process of the first drawing event is called; the vertical synchronization function is enabled. , continue to perform the touch operation subsequent interface drawing.
  • the method, device and terminal for accelerating interface drawing provided by the embodiment, when the type of the input event is pressing or sliding, when the first drawing event of the touch operation is monitored, the first execution is performed under the condition that the vertical synchronization function is disabled.
  • the drawing process of the second drawing event, the subsequent interface drawing of the touch operation is performed under the condition that the vertical synchronization function is enabled, that is, the first drawing process does not need to wait for the synchronization signal to be directly drawn, thereby reducing the drawing waiting time of the touch operation, thereby Accelerate the interface drawing, improve the response speed of the UI (User Interface), and improve the performance of the terminal.
  • FIG. 1 is a flowchart of drawing an Android Choreographer according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of a first embodiment of a method for accelerating interface rendering according to the present invention
  • FIG. 3 is a schematic flowchart diagram of a second embodiment of a method for accelerating interface rendering according to the present invention
  • FIG. 4 is a schematic structural diagram of an embodiment of an apparatus for speeding up interface drawing according to the present invention.
  • FIG. 5 is a schematic structural diagram of another embodiment of an apparatus for speeding up interface drawing according to the present invention.
  • FIG. 6 is a schematic structural diagram of another embodiment of an apparatus for accelerating interface drawing according to the present invention.
  • FIG. 7 is a schematic structural diagram of another embodiment of an apparatus for speeding up interface drawing according to the present invention.
  • FIG. 8 is a schematic structural diagram of another embodiment of an apparatus for speeding up interface drawing according to the present invention.
  • FIG. 9 is a schematic structural diagram of a terminal provided by the present invention.
  • the performance of the hand-held hand mentioned in the embodiment of the present invention generally refers to the response performance of the terminal to the touch operation.
  • the embodiment of the present invention provides a schematic diagram of the drawing process of the Android Choreographer shown in FIG. 1.
  • the drawing process of the terminal is briefly introduced as follows: the Choreographer class in the Android system is used to control the synchronization processing input ( Input), Animation, and Draw are three UI operations.
  • the Choreographer mechanism in Android is used in conjunction with the Vsync mechanism to implement unified scheduling interface drawing.
  • Choreographer mainly registers three callback functions (CALLBACK_INPUT, CALLBACK_ANIMATION, CALLBACK_TRAVERSAL), and only CALLBACK_TRAVERSAL is directly related to drawing.
  • a callback function PostCallBack is started, and functions PostCallBackDelayed and PostCallBackDelayedInternal are sequentially executed; then it is determined whether the set execution time is after the current time, and if not (ie, “N in the figure”. "), send the MSG_DO_SCHEDULE_CALLBACK message to the main thread Frame Handler request to execute the callback function (callback), arrange the execution function doScheduleCallback, and then call the function scheduleFrameLocked in the main thread; if it is (ie "Y” in the figure), call the function scheduleFrameLocked in the main thread .
  • variable USE_VSYNC is used to indicate whether the system uses the Vsync mechanism, the value of the variable can be obtained by reading the system property debug.choreographer.vsync.
  • the Vsync mechanism ie, the "Y" identified in the figure
  • it is determined whether the current thread has a message loop ie, whether the current thread is a UI thread
  • the main thread calls scheduleVsyncLocked to request a vertical synchronization signal
  • the MSG_DO_SCHEDULE_VSYNC message is sent to request the Vsync signal
  • the function doScheduleVsync is executed.
  • the main thread calls scheduleVsyncLocked, after receiving the vertical synchronization signal, it sends the Runnable object to the main thread and requests to execute the function doFrame. Finally, the function doFrame is executed to render the next frame.
  • Vsync mechanism ie "N” identified in the figure. If the Vsync mechanism (ie "N" identified in the figure) is not used, send MSG_DO_FRAME to the Frame Handler and request to execute the function doFrame.
  • the touch screen (TP) firmware reports a lot of input events, and the input dispatcher thread of the user state finally reports the processed events to the App.
  • the APP changes the layout, visibility, etc., and then registers the postCallback whose parameter type is CALLBACK_TRAVERSAL.
  • the drawing operation is performed. Therefore, there is the following problem: the drawing must wait for the synchronization of the vsync (the time interval of the vsync signal is 16.6 ms), and the response speed of the affected UI. Based on this, a method, an apparatus, and a terminal for accelerating interface rendering are provided by embodiments of the present invention. A method for speeding up interface rendering disclosed in the embodiments of the present invention is first described in detail below.
  • FIG. 2 is a schematic flow chart of a first embodiment of a method for accelerating interface rendering according to the present invention.
  • the method flow shown in this embodiment includes the following steps:
  • Step S21 when an input event triggered by the touch operation is received, the type of the input event is recorded.
  • Step S22 when the type of the input event is pressing or sliding, under the condition that the vertical synchronization function is disabled, the first drawing event of the touch operation is monitored, and if so, the drawing process of the first drawing event is called.
  • a touch event of type press or slide may trigger drawing.
  • the vertical synchronization function that is, the Vsync synchronization mechanism, does not need to wait for the vsync signal to arrive before drawing the vertical synchronization function.
  • the system listens to whether the multiple input events of the touch operation trigger the first drawing event.
  • the input event triggers the postCallback function of the Choreographer class, and the parameter type of the postCallback function is CALLBACK_TRAVERSAL for the first time
  • event Whether the identifier is the first drawing event can be performed by a counter or by setting a flag bit. For example, when a drawing event does not occur, the value of the counter is 0.
  • the counter is incremented by 1, only the value of the counter is equal to At 1 o'clock, it is determined that the first drawing event of the touch operation occurs.
  • the processing flow of the first drawing event is called.
  • the process of executing the process according to USE_VSYNC is NO.
  • Directly call doFrame do not need to wait for the vsync signal to arrive and then call doFrame. Therefore, the waiting time of the first drawing of the touch operation is reduced, thereby improving the response speed of the UI.
  • step S23 the vertical synchronization function is enabled, and the subsequent interface drawing of the touch operation is continued.
  • the vertical synchronization function is enabled, that is, only the input event that actually triggers the drawing process for the first time triggers the drawing process call doFrame immediately under the condition that the vertical synchronization function is disabled, and other subsequent operations of the touch operation
  • the input event is drawn with the vertical sync enabled, in order to avoid jitter or tearing of the display by using the vsync sync signal.
  • the drawing process of the first drawing event is executed under the condition that the vertical synchronization function is disabled.
  • the subsequent interface drawing of the touch operation is performed under the condition that the vertical synchronization function is enabled, that is, the first drawing process does not need to wait for the synchronization signal to be directly drawn, thereby reducing the drawing waiting time of the touch operation, thereby speeding up the interface drawing and improving the UI. responding speed.
  • the Android terminal applied in the method of this embodiment supports the vertical synchronization function.
  • the function is set to a valid (available) state, and in consideration of reducing the waiting time for the first drawing, the function needs to be set to an invalid (disabled) state.
  • the following two methods are included:
  • the default state of the vertical synchronization function is preset to be disabled
  • the default state of the vertical synchronization function is preset to be a disabled state; or, when the first input event triggered by the touch operation is received, specifically, the vertical synchronization function is disabled. This is done by setting the variable USE_VSYNC to be invalid.
  • the method provided in this embodiment further optimizes the judgment of the first sliding event, wherein the step S21 of recording the type of the input event includes:
  • the type of the input event is recorded as a slip, and the first distance threshold is set as a second distance threshold, and the second distance threshold is greater than the first distance threshold.
  • the input event when the sliding event has not been determined in the input event of the touch operation, the input event is determined to be the threshold of the sliding operation, so that the input event triggers the real sliding process more quickly. Therefore, when the input event is identified, the first distance threshold is used, and after the first drawn sliding event has been identified, the first distance threshold is set to a second distance threshold, wherein the second distance threshold is greater than the first distance threshold
  • the second distance threshold is a default value of the touch screen recognition sliding operation.
  • the first distance threshold is 4.8
  • the second distance threshold is 8 (the default value of the system).
  • the android architecture determines whether the click or slide, ie the sensitivity of the click, is determined by the following config_viewConfigurationTouchSlop threshold.
  • the above touchSlop represents the sliding distance value, that is, when the hand touch slides on the screen, only when the sliding distance exceeds the touchSlop value, it is considered to be a sliding operation and responds.
  • the above threshold is lowered, and the default value is restored as soon as the first drawn sliding event is recognized.
  • the method provided by this embodiment further optimizes the thread that processes the Input event, as follows: the priority of the Input thread task is set to a value between -8 and -16; Thread tasks include the InputReader and InputDispatcher thread tasks.
  • Input mainly has kernel-driven driver threads and user-mode InputReader and InputDispatcher two thread tasks.
  • the kernel-mode driver thread is responsible for reading the TP firmware data and dispatching it to the user state.
  • the InputReader mainly reads the raw data in the eventub, and the InputDispatcher processes the events read by the InputReader and performs further processing.
  • the priority of InputReader and InputDispatcher is originally ANDROID_PRIORITY_URGENT_DISPLAY level, ie -8, and the level is adjusted between ANDROID_PRIORITY_URGENT_DISPLAY and ANDROID_PRIORITY_AUDIO, that is, between -8 and -16 (the smaller the value, the higher the priority) Such as -16 to -8 high).
  • By adjusting the priority of the thread task it is guaranteed to run on the cpu big core, and the task is in real-time priority, which can improve the time slice in which the task is scheduled to be executed, so that the input event can be processed more timely.
  • the Input kernel state drives the thread to process data in a serial manner, which can avoid asynchronous overhead and maintain real-time performance.
  • the land filter function of the existing TP firmware ensures the accuracy, but affects the performance.
  • the method provided in this embodiment also improves the land filter function, dynamically adjusts the filter, and some actions are moved to the AP end, as follows:
  • the anti-shake filtering function includes at least one of the following parameter settings: the idle time of the touch screen doze_mode is less than 20ms, and is greater than 10ms; the jitter determination threshold of the touch screen is between 50 and 255; the misdetection determination of the non-detection area is calculated as Invalid state, wherein the non-detected area is a preset area; the reporting rate is between 110 Hz and 120 Hz.
  • the above improvements include two aspects of modification: the first part reduces the delay of the TP contact to the TP response, the optimization method is achieved by reducing the idle time of the TP (doze_mode); the second part reduces the time of the AP processing point, and the optimization method is adopted. Decrease the jitter judgment threshold, cancel the jitter judgment, and calculate the non-detection area and improve the report rate to achieve the delay requirement.
  • the setting of the duration of the doze_mode takes into account the balance of the response of the TP to the user's touch operation and the power consumption.
  • the doze_mode When the doze_mode is less than 10 ms, the power consumption of the TP is too large, which is not conducive to the endurance performance of the terminal;
  • the touch determination is calculated as an invalid state, that is, no jitter determination is performed on the non-detection area, and the non-detection area is the central area of the TP (relative to the edge area around the TP); the report rate is increased to 110 Hz to 120 Hz. The value between them increases speed by increasing the frequency of the touch operation.
  • part of the action is moved to the AP end; by adjusting the priority of the InputReader and InputDispatcher thread tasks, the processing priority is improved, thereby improving the input speed;
  • the first drawing of the lower and the sliding no longer waiting for the arrival of the synchronization signal, directly drawing, only processing the pressed or sliding input that needs to be drawn for the first time; in addition, when the first drawing sliding event has not been triggered yet
  • the input event is judged as the threshold of the sliding operation, so that the event is more easily recognized as a sliding, thereby triggering the corresponding drawing of the real sliding motion more quickly; thereby speeding up the interface drawing and improving the response speed of the UI.
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for speeding up interface rendering according to the present invention.
  • the method of the method shown in the embodiment includes the following steps:
  • step S31 the mobile terminal is powered on.
  • Step S32 receiving an input event triggered by a touch operation.
  • step S33 it is determined whether the distance moved by the center of the finger corresponding to the input event of the touch operation is greater than the first distance threshold for the first time. If yes, go to step S34, if no, go to step S35.
  • Determining whether the input event is the input event of the first one of the plurality of input events corresponding to the current touch operation is recognized as a sliding operation by determining whether the distance moved by the center of the finger corresponding to the input event is greater than the first distance threshold.
  • a first distance threshold is used in the first input event identified as a sliding operation, the first distance threshold being less than a default value (for identifying other input events)
  • Step S34 recording the type of the input event as sliding, and setting the first distance threshold as the second distance threshold.
  • the threshold for determining the sliding operation is restored, and the second distance threshold is greater than the first distance threshold.
  • the second distance threshold is the threshold value of the system original saved.
  • step S35 the type of the input event is recorded.
  • Step S36 when the type of the input event is pressed or swiped, under the condition that the vertical synchronization function is disabled, it is determined whether the input event triggers the first drawing event of the touch operation. If yes, go to step S37; if no, go to step S39.
  • the drawing process is directly triggered without waiting for the synchronization of the vsync.
  • Step S37 calling the drawing process of the first drawing event.
  • step S38 the vertical synchronization function is enabled, and the subsequent interface drawing of the touch operation is continued.
  • the vertical synchronization function is re-enabled, that is, other input events of the touch operation after the first input event that actually triggers the drawing process are vertically synchronized.
  • step S39 it is determined whether the input event triggers a drawing event. If yes, go to step S40; if no, end the process.
  • Step S40 calling the drawing process corresponding to the input event.
  • Embodiment 3 of the present invention provides an apparatus for speeding up interface rendering, which is applied to an Android terminal supporting the Choreographer mechanism.
  • the type recording module 410, the first drawing module 420, and the continuing drawing module 430 are included. , wherein the functions of each module are as follows:
  • the type recording module 410 is configured to record a type of the input event when receiving an input event triggered by the touch operation;
  • the first drawing module 420 is configured to monitor whether the first drawing event of the touch operation occurs under the condition that the vertical synchronization function is disabled when the type of the input event is pressing or sliding, and if so, calling the first drawing The process of drawing the event;
  • the drawing module 430 is continued to enable the vertical synchronization function to continue the subsequent interface drawing of the touch operation.
  • the drawing process of the first drawing event is executed under the condition that the vertical synchronization function is disabled.
  • the subsequent interface drawing of the touch operation is performed under the condition that the vertical synchronization function is enabled, that is, the first drawing process does not need to wait for the synchronization signal to be directly drawn, thereby reducing the drawing waiting time of the touch operation, thereby speeding up the interface drawing and improving the UI. responding speed.
  • the device further includes: a disabling module 510, configured to preset a default state of the vertical synchronization function to be in a disabled state; or, when receiving a first input triggered by a touch operation When an event occurs, the state of the vertical sync function is set to the disabled state. Among them, the vertical synchronization function is disabled and the invalid state is achieved by setting the variable USE_VSYNC.
  • the first drawing module 420 is further configured to: when the input event triggers the postCallback function of the Choreographer class, and the parameter type of the postCallback function is CALLBACK_TRAVERSAL for the first time, determine the first drawing event of the touch operation.
  • the type recording module 410 is further configured to: when the distance of the first input event of the touch operation corresponding to the movement of the finger center is greater than the first distance threshold, the type of the recording input event is sliding, and the first distance threshold is set to a second distance threshold. The second distance threshold is greater than the first distance threshold.
  • the device further includes: a priority setting module 610, configured to set the priority of the Input thread task to a value between -8 and -16; Includes the InputReader and InputDispatcher thread tasks.
  • the apparatus further includes: a serial processing module 710, configured to drive the thread in a serial manner to process data by the input kernel state.
  • the device further includes: an anti-shake module 810, configured to apply an anti-shake filter function to determine a finger center of the touch operation; wherein the anti-shake filter function includes at least the following One parameter setting: the idle time of the touch screen doze_mode is less than 20ms and greater than 10ms; the jitter judgment threshold of the touch screen is between 50 and 255; the false touch determination of the non-detection area is calculated as invalid, wherein the non-detection area It is a preset area; the reporting rate is between 110Hz and 120Hz.
  • the anti-shake filter function includes at least the following One parameter setting: the idle time of the touch screen doze_mode is less than 20ms and greater than 10ms; the jitter judgment threshold of the touch screen is between 50 and 255; the false touch determination of the non-detection area is calculated as invalid, wherein the non-detection area It is a preset area; the reporting rate is between 110Hz and 120Hz.
  • Embodiment 4 of the present invention provides a terminal, including a processor and a memory for storing processor-executable instructions; the processor is configured to: when receiving an input event triggered by a touch operation, record a type of the input event; When the type of the event is pressed or swiped, under the condition that the vertical synchronization function is disabled, the first drawing event of the touch operation is monitored, and if so, the drawing process of the first drawing event is called; the vertical synchronization function is enabled, and the continuation is continued. Perform a touch operation subsequent interface drawing.
  • FIG. 9 is a block diagram showing the structure of a terminal 100 that can be applied to an embodiment of the present invention.
  • the mobile terminal 100 includes an apparatus 101 for accelerating interface rendering, a memory 102, a memory controller 104, one or more (only one shown) processor 106, a peripheral interface 108, a radio frequency module 110, The audio module 112, the touch screen 114, and the like. These components communicate with one another via one or more communication bus/signal lines 116.
  • the memory 102 can be used to store software programs and modules, such as a method for accelerating interface rendering and program instructions/modules corresponding to the device in the embodiment of the present invention.
  • the processor 106 executes each of the software programs and modules stored in the memory 102.
  • a functional application and data processing such as the method for accelerating interface rendering provided by the embodiments of the present invention.
  • Memory 102 can include high speed random access memory and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. Access to the memory 102 by the processor 106 and other possible components can be performed under the control of the memory controller 104.
  • non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. Access to the memory 102 by the processor 106 and other possible components can be performed under the control of the memory controller 104.
  • Peripheral interface 108 couples various input/output devices to processor 106 and memory 102.
  • peripheral interface 108, processor 106, and memory controller 104 can be implemented in a single chip. In other instances, they can be implemented by separate chips.
  • the radio frequency module 110 is configured to receive and transmit electromagnetic waves, and realize mutual conversion between electromagnetic waves and electric signals, thereby communicating with a communication network or other devices.
  • the audio module 112 provides an audio interface to the user, which may include one or more microphones, one or more speakers, and audio circuitry.
  • the touch screen 114 provides an output and input interface simultaneously between the mobile terminal 100 and the user.
  • the touch screen 114 supports single-point and multi-touch operations.
  • the touch screen 114 can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations is that the touch screen 114 can sense simultaneous touch operations from one or more locations on the touch screen 11 and pass the sensed multi-touch operations to the processor. 106 for processing.
  • the structure shown in FIG. 9 is merely illustrative, and the mobile terminal 100 may further include more or less components than those shown in FIG. 9, or have a different configuration from that shown in FIG.
  • the components shown in Figure 9 can be implemented in hardware, software, or a combination thereof.
  • the embodiment of the invention further provides a computer storage medium for storing computer software instructions for the device for drawing the acceleration interface, which comprises a program designed to execute the device for accelerating interface rendering in the above aspect.
  • the instructions included in the foregoing program may be used to implement the method in the foregoing method embodiments. For specific implementations, refer to the method embodiments, and details are not described herein.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Execute the instruction.
  • the functions noted in the blocks may also occur in a different order than that illustrated in the drawings. For example, two consecutive blocks may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or action. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • the disclosed methods, systems, and devices may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the module is only a logical function division.
  • multiple modules or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some communication interface, device or unit, and may be electrical, mechanical or otherwise.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种加速界面绘制的方法、装置和终端,涉及智能终端技术领域,该方法包括:当接收到触摸操作触发的输入事件时,记录输入事件的类型(S21);当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程(S22);启用垂直同步功能,继续执行触摸操作后续的界面绘制(S23)。本方法、装置和终端可以加快界面绘制,提高UI的响应速度,进而提升了终端的跟手性能。

Description

加速界面绘制的方法、装置和终端
本申请要求于2017年06月20日提交中国专利局、申请号为201710472260.2、发明名称为“加速界面绘制的方法、装置和终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及智能终端技术领域,尤其是涉及一种加速界面绘制的方法、装置和终端。
背景技术
对于安卓(Android)智能终端来说触摸操作的跟手性至关重要,其直接影响用户触摸操作的体验。目前为了改善触摸操作的跟手性,主要有以下两种方式:一种是采用输入事件提频(input boost)机制,当有输入(input)事件时,通过提高CPU(Central Processing Unit,中央处理单元)主频的方式改善跟手性能;另一种是采用预判机制,该机制主要是根据触摸屏固件发送的input事件进行预判,提前上报input事件给应用。
对于上述输入事件提频(input boost)机制,如果频率提高不多或者提高时间太短时,跟手性能改善的效果不明显;如果频率提高得太多或者持续时间太长,功耗又会明显增加,影响手机的续航性能;而上述预判机制的准确性无法保证,存在一定的误判概率。由此可见,目前的处理机制的跟手性能均不理想。
申请内容
有鉴于此,本发明的目的在于提供一种加速界面绘制的方法、装置和终端,以加快触摸事件触发的界面绘制,提升终端的跟手性能。
本发明采用的第一技术方案是:一种加速界面绘制的方法,应用于支持Choreographer机制的Android终端,所述方法包括:当接收到触摸操作触发的输入事件时,记录所述输入事件的类型;当所述输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现所述触摸操作的第一次绘制事件,如果是,调用所述第一次绘制事件的绘制流程;启用所述垂直同步功能,继续执行所述触摸操作后续的界面绘制。
进一步,所述方法还包括:预先设置所述垂直同步功能的默认状态为禁用状态;或者,当接收到触摸操作触发的首个输入事件时,设置所述垂直同步功能的状态为禁用状态。
进一步,所述垂直同步功能为禁用状态通过设置变量USE_VSYNC为无效实现。
进一步,所述监听是否出现所述触摸操作的第一次绘制事件的步骤,包括:当所述输入事件触发调用Choreographer类的postCallback函数,且所述postCallback函数的参数类型首次为CALLBACK_TRAVERSAL时,确定出现所述触摸操作的第一次绘制事件。
进一步,所述记录所述输入事件的类型的步骤,包括:当所述触摸操作的首个输入事件对应手指中心移动的距离大于第一距离阈值时,记录所述输入事件的类型为滑动,并设置所述第一距离阈值为第二距离阈值,所述第二距离阈值大于所述第一距离阈值。
进一步,所述方法还包括:将Input线程任务的优先级设置为-8至-16之间的数值;所述Input线程任务包括InputReader和InputDispatcher线程任务。
进一步,所述方法还包括:Input内核态驱动线程通过串行方式处理数据。
进一步,所述方法还包括:应用防抖过滤功能确定所述触摸操作的手指中心;其中,所述防抖过滤功能至少包括以下之一参数设置:触摸屏的空闲时间doze_mode的时长小于20ms,且大于10ms; 触摸屏的抖动判断阈值在50至255之间;非侦测区域的误触判别计算为无效状态,其中,所述非侦测区域为预先设置的区域;报点率在110Hz至120Hz之间。
本发明采用的第二技术方案是:一种加速界面绘制的装置,应用于支持Choreographer机制的Android终端,所述装置包括:类型记录模块,用于当接收到触摸操作触发的输入事件时,记录所述输入事件的类型;第一次绘制模块,用于当所述输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现所述触摸操作的第一次绘制事件,如果是,调用所述第一次绘制事件的绘制流程;继续绘制模块,用于启用所述垂直同步功能,继续执行所述触摸操作后续的界面绘制。
本发明采用的第三技术方案是:一种终端,包括处理器和用于存储处理器可执行指令的存储器;处理器用于:当接收到触摸操作触发的输入事件时,记录输入事件的类型;当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程;启用垂直同步功能,继续执行触摸操作后续的界面绘制。
本发明公开的实施例提供的技术方案可以包括如下有益效果:
本实施例提供的加速界面绘制的方法、装置和终端,当输入事件的类型为按下或滑动时,监听到触摸操作的第一次绘制事件时,在禁用垂直同步功能的条件下执行第一次绘制事件的绘制流程,触摸操作后续的界面绘制在启用垂直同步功能的条件下进行,即第一次绘制流程不需要等待同步信号可以直接进行绘制,减少了触摸操作的绘制等待时间,从而可以加快界面绘制,提高UI(User Interface,用户界面)的响应速度,进而提升了终端的跟手性能。
本发明的其他特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。
为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
附图说明
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的Android Choreographer绘制流程图;
图2为本发明提供的一种加速界面绘制的方法的第一实施方式的流程示意图;
图3为本发明提供的一种加速界面绘制的方法的第二实施方式的流程示意图;
图4为本发明提供的一种加速界面绘制的装置的实施方式的结构示意图;
图5为本发明提供的一种加速界面绘制的装置的另一种实施方式的结构示意图;
图6为本发明提供的一种加速界面绘制的装置的另一种实施方式的结构示意图;
图7为本发明提供的一种加速界面绘制的装置的另一种实施方式的结构示意图;
图8为本发明提供的一种加速界面绘制的装置的另一种实施方式的结构示意图;
图9是本发明提供的一种终端的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是 本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例中提到的跟手性能,通常指终端对触摸操作的响应性能,跟手性能越好,说明终端响应用户触摸操作进行显示越及时,提供的用户体验越好,如果跟手性能较差,则用户会感觉终端的显示响应慢,引起用户不必要的多次触摸操作,导致终端执行无意义的触摸事件,进一步影响用户的正常使用。
为便于对上述跟手性能进行直观地理解,本发明实施例提供了图1所示的Android Choreographer绘制流程示意图,对终端的绘制过程简单介绍如下:Android***中Choreographer类用来控制同步处理输入(Input)、动画(Animation)、绘制(Draw)三个UI操作。具体地,Android中的Choreographer机制,用于与Vsync机制配合,实现统一调度界面绘图。Choreographer主要注册了CALLBACK_INPUT、CALLBACK_ANIMATION、CALLBACK_TRAVERSAL三个回调函数(callback),只有CALLBACK_TRAVERSAL与绘制直接联系。
参见图1所示,当监听到有触摸操作时,发起回调函数PostCallBack,以及依次执行函数PostCallBackDelayed、PostCallBackDelayedInternal;然后判断设定的执行时间是否在当前时间之后,若否(即图中标识的“N”),发送MSG_DO_SCHEDULE_CALLBACK消息到主线程Frame Handler请求执行回调函数(callback),安排执行函数doScheduleCallback,再在主线程调用函数scheduleFrameLocked;若是(即图中标识的“Y”),在主线程调用函数scheduleFrameLocked。
接着判断是否使用Vsync机制,变量USE_VSYNC用于表示***是否使用Vsync机制,该变量的值可以通过读取***属性debug.choreographer.vsync获取。若使用Vsync机制(即图中标识的“Y”), 则判断当前线程是否具备消息循环(即当前线程是否是UI线程);若具备消息循环,则在主线程调用scheduleVsyncLocked,请求垂直同步信号;若不具备消息循环,则发送MSG_DO_SCHEDULE_VSYNC消息请求Vsync信号,并执行函数doScheduleVsync。在主线程调用scheduleVsyncLocked,收到垂直同步信号后,发送Runnable对象到主线程,请求执行函数doFrame。最后执行函数doFrame,渲染下一帧。
若未使用Vsync机制(即图中标识的“N”),发送MSG_DO_FRAME到Frame Handler,并请求执行函数doFrame。
其中,在使用vsync机制的情况下,当函数postCallback的参数类型为CALLBACK_TRAVERSAL且vsync信号到来时,才会在函数doFrame中执行真正的绘制动作。
在滑动手机时,触摸屏(TP)固件会上报很多输入事件(input event),用户态的输入调度(input dispatcher)线程将处理过的事件最终上报给App。APP由于显示(layout)、可见性(visibility)等发生改变,进而注册参数类型为CALLBACK_TRAVERSAL的postCallback,当下一个vsync信号到来时,进行绘制动作。因此存在以下问题:绘制必须要等待vsync的同步(vsync信号的时间间隔为16.6ms),影响的UI的响应速度。基于此,本发明实施例提供的一种加速界面绘制的方法、装置和终端。以下首先对本发明实施例所公开的一种加速界面绘制的方法进行详细介绍。
实施例1
图2是本发明一种加速界面绘制的方法的第一实施方式的流程示意图。应用于支持Choreographer机制的Android终端,本实施方式示出的方法流程包括如下步骤:
步骤S21,当接收到触摸操作触发的输入事件时,记录输入事件的类型。
触摸操作触发的输入事件的类型包括三种,分别是按下(DOWN)、抬起(UP)或者滑动(MOVE)。在接收到触摸屏采集的输入事件时,记录该输入事件的类型,具体地在input native层记录当前input event的类型。对于输入事件的属性,是在InputReader中的dispatchTouches()函数中定义的。
步骤S22,当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程。
在上述三种类型的触摸事件中,类型为按下或滑动的触摸事件才可能触发绘制。该垂直同步功能即Vsync同步机制,在禁用垂直同步功能的条件下,不需要等待vsync信号到来时再进行绘制。***监听本次触摸操作的多个输入事件是否触发第一次绘制事件,当输入事件触发调用Choreographer类的postCallback函数,且postCallback函数的参数类型首次为CALLBACK_TRAVERSAL时,确定出现触摸操作的第一次绘制事件。其中标识是否是第一次绘制事件,可以通过计数器或者设置标识位的方式进行,例如未出现绘制事件时,计数器的值为0,当满足上述条件时,计数器加1,仅在计数器的值等于1时,确定出现触摸操作的第一次绘制事件。
在出现触摸操作的第一次绘制事件时,调用第一次绘制事件的处理流程,参见图1所示的绘制流程图,在禁用垂直同步功能的情况下,按照USE_VSYNC判断结果为NO的流程执行,直接调用doFrame,不需要等待vsync信号到来时再调用doFrame。因此减少了触摸操作的第一次绘制的等待时间,从而提高UI的响应速度。
步骤S23,启用垂直同步功能,继续执行触摸操作后续的界面绘制。
在第一次绘制事件的绘制流程执行后,启用垂直同步功能,即只有首次真正触发绘制流程的输入事件是在禁用垂直同步功能的条件下立即触 发绘制流程调用doFrame,该触摸操作的其他后续的输入事件在启用垂直同步功能的条件下进行绘制,目的是通过使用vsync同步信号,避免显示画面抖动或撕裂(tearing)。
本实施例提供的上述方法,当输入事件的类型为按下或滑动时,监听到触摸操作的第一次绘制事件时,在禁用垂直同步功能的条件下执行第一次绘制事件的绘制流程,触摸操作后续的界面绘制在启用垂直同步功能的条件下进行,即第一次绘制流程不需要等待同步信号可以直接进行绘制,减少了触摸操作的绘制等待时间,从而可以加快界面绘制,提高UI的响应速度。
本实施例方法应用的Android终端,支持垂直同步功能,在正常情况下该功能被设置为有效(可用)状态,考虑到减少首次绘制的等待时间,需要将该功能设置为无效(禁用)状态,具体包括以下两种方式:
(1)预先设置垂直同步功能的默认状态为禁用状态;
(2)当接收到触摸操作触发的首个输入事件时,设置垂直同步功能的状态为禁用状态。
其中,在接收触摸操作触发的输入事件前,已经预先设置垂直同步功能的默认状态为禁用状态;或者,在接收到触摸操作触发的首个输入事件时设置,具体地,垂直同步功能为禁用状态通过设置变量USE_VSYNC为无效实现。
为了进一步加快绘制进程,加速UI响应,本实施例提供的方法还对首次滑动事件的判断进行了优化,其中记录输入事件的类型的步骤S21,具体包括:
当触摸操作的首个输入事件对应手指中心移动的距离大于第一距离阈值时,记录输入事件的类型为滑动,并设置第一距离阈值为第二距离阈值,第二距离阈值大于第一距离阈值。
其中,当触摸操作的输入事件中还未判断出现滑动事件时,降低输入事件判断为滑动操作的阈值,使输入事件更快地触发真正的滑动流程。因此,在识别输入事件时,使用第一距离阈值,在已经识别到第一个绘制的滑动事件后,将该第一距离阈值设置为第二距离阈值,其中第二距离阈值大于第一距离阈值,优选地第二距离阈值是触摸屏识别滑动操作的默认值。例如上述第一距离阈值为4.8,上述第二距离阈值为8(***的默认值)。
具体说来,android架构中通过如下config_viewConfigurationTouchSlop阀值来判断是点击还是滑动,即点击的灵敏度。上述touchSlop表示的是滑动距离值,即当手触摸在屏幕上滑动时,只有滑动距离超过touchSlop值时,才认为是滑动操作并去响应。在第一个绘制的滑动事件还没有到来时,降低上述阈值,一旦识别到第一个绘制的滑动事件后,立即恢复默认值。通过在首个滑动输入事件使用了较小的判断阈值,使事件更容易被识别为滑动,从而更快地触发真正的滑动动作对应的绘制。
为了进一步加快绘制进程,加速UI响应,本实施例提供的方法还对处理Input事件的线程进行了优化,具体如下:将Input线程任务的优先级设置为-8至-16之间的数值;Input线程任务包括InputReader和InputDispatcher线程任务。
其中,Input最主要有内核态的驱动线程和用户态的InputReader与InputDispatcher两个线程任务。内核态的驱动线程负责读取TP固件数据并派发到用户态,InputReader主要读取eventhub中的原始数据(raw data),而InputDispatcher处理InputReader读取的事件并做进一步处理。
在现有技术中InputReader和InputDispatcher的优先级原本为ANDROID_PRIORITY_URGENT_DISPLAY级别,即-8,将该级别调整为ANDROID_PRIORITY_URGENT_DISPLAY和ANDROID_PRIORITY_AUDIO之间,即-8和-16之间(数值越小,代表 优先级越高,如-16比-8高)。通过调整线程任务的优先级,保证其运行在cpu大核,任务处于实时优先级,可以提高任务被调度执行的时间片,使之更及时的处理input event。
进一步地,Input内核态驱动线程通过串行方式处理数据,可以规避异步开销,保持实时性。
现有的TP固件的land filter功能虽然保证了准确性,但影响性能,本实施例提供的方法还对land filter功能进行了改进,动态调整filter,部分动作移到AP端进行,具体如下:
应用防抖过滤功能确定触摸操作的手指中心。其中,防抖过滤功能至少包括以下之一参数设置:触摸屏的空闲时间doze_mode的时长小于20ms,且大于10ms;触摸屏的抖动判断阈值在50至255之间;非侦测区域的误触判别计算为无效状态,其中,非侦测区域为预先设置的区域;报点率在110Hz至120Hz之间。
上述改进包括两个方面的修改:第一部分减少TP触点到TP响应的延时,优化方法是通过减少TP的空闲时间(doze_mode)来实现;第二部分减少AP处理点的时间,优化方法通过减小抖动判断阀值,取消抖动判断对非侦测区域的计算和提高报点率三者综合修改来达到延时的要求。其中对doze_mode的时长的设置综合考虑TP对用户触摸操作的响应和功耗的平衡,在doze_mode时长小于10ms时,TP的功耗过大,不利于终端的续航性能;将非侦测区域的误触判别计算为无效状态,即对非侦测区域不进行抖动判断计算,非侦测区域为TP的中心区域(相对于TP四周的边缘区域而言);将报点率提高为110Hz至120Hz之间的数值,通过提高采集触摸操作的频率,从而加快速度。
本实施例提供的上述方法,通过动态调整过滤器(filter),部分动作移到AP端进行;通过调整InputReader和InputDispatcher线程任务的优先级,达到提高处理优先级,从而改善input速度;通过识别按下和滑动 的第一次绘制,不再等同步信号的到来,直接进行绘制,仅对第一次需要绘制的按下或者滑动的input进行处理;另外当还未触发第一个绘制的滑动事件,降低输入事件判断为滑动操作的阈值,使事件更容易被识别为滑动,从而更快地触发真正的滑动动作对应的绘制;从而可以加快界面绘制,提高UI的响应速度。
实施例2
图3是本发明一种加速界面绘制的方法的第二实施方式的流程示意图,本实施例的以带有触摸屏的Android移动终端为例进行说明,该实施方式示出的方法流程包括如下步骤:
步骤S31,移动终端开机。
步骤S32,接收触摸操作触发的输入事件。
步骤S33,判断触摸操作的输入事件对应的手指中心移动的距离是否首次大于第一距离阈值。如果是,执行步骤S34,如果否,执行步骤S35。
通过判断输入事件对应的手指中心移动的距离是否首次大于第一距离阈值,来判断该输入事件是否是本次触摸操作对应的多个输入事件中第一个被识别为滑动操作的输入事件,仅对该第一个被识别为滑动操作的输入事件的过程中使用第一距离阈值,该第一距离阈值小于默认值(用于识别其他输入事件)
步骤S34,记录该输入事件的类型为滑动,并设置第一距离阈值为第二距离阈值。
在将上述输入事件的类型记录为滑动后,恢复判断滑动操作的阈值,上述第二距离阈值大于第一距离阈值,优选地,第二距离阈值即***原保存的阈值默认值。
步骤S35,记录该输入事件的类型。
步骤S36,当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,判断该输入事件是否触发该触摸操作的第一次绘制事件。如果是,执行步骤S37;如果否,执行步骤S39。
对第一次真正触发绘制流程的输入事件,在禁用垂直同步功能的条件下,直接触发绘制流程,不需要等待vsync的同步。
步骤S37,调用该第一次绘制事件的绘制流程。
步骤S38,启用垂直同步功能,并继续执行触摸操作后续的界面绘制。
在执行第一次真正触发绘制流程的输入事件的绘制流程时,将垂直同步功能重新启用,即在该第一次真正触发绘制流程的输入事件之后的该触摸操作的其他输入事件均在垂直同步功能启动的条件下进行绘制,即经过vsync的同步,可以避免画面抖动的发生。
步骤S39,判断该输入事件是否触发绘制事件。如果是,执行步骤S40;如果否,结束流程。
在经过是否触发该触摸操作的第一次绘制事件的判断,得到判断结果为否的情况下,还需要判断该输入事件是否触发绘制事件:如果触发绘制事件,调用对应的绘制流程;如果不触发绘制事件,则结束流程。在此需要说明的是,在触发绘制事件的情况下(且该输入事件不是第一次触发绘制流程的输入事件),垂直同步功能已经被更改为启动状态(步骤S38)。
步骤S40,调用该输入事件对应的绘制流程。
本实施例提供的上述方法,当输入事件的类型为按下或滑动时,判断该输入事件是否触发第一次真正绘制流程,如果是则不再等同步信号的到来,直接进行该输入事件的绘制,并且仅对第一次类型为滑动的输入事件进行阈值优化,降低输入事件判断为滑动操作的阈值,使事件更容易被识别为滑动,从而更快地触发真正的滑动动作对应的绘制;从而可以加快界面绘制,提高UI的响应速度。
实施例3
本发明实施例3提供了一种加速界面绘制的装置,应用于支持Choreographer机制的Android终端,参见图4所示的结构示意图,包括类型记录模块410、第一次绘制模块420和继续绘制模块430,其中,各模块的功能如下:
类型记录模块410,用于当接收到触摸操作触发的输入事件时,记录输入事件的类型;
第一次绘制模块420,用于当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程;
继续绘制模块430,用于启用垂直同步功能,继续执行触摸操作后续的界面绘制。
本实施例提供的上述装置,当输入事件的类型为按下或滑动时,监听到触摸操作的第一次绘制事件时,在禁用垂直同步功能的条件下执行第一次绘制事件的绘制流程,触摸操作后续的界面绘制在启用垂直同步功能的条件下进行,即第一次绘制流程不需要等待同步信号可以直接进行绘制,减少了触摸操作的绘制等待时间,从而可以加快界面绘制,提高UI的响应速度。
参见图5所示的加速界面绘制的装置的结构示意图,上述装置还包括:禁用模块510,用于预先设置垂直同步功能的默认状态为禁用状态;或者,当接收到触摸操作触发的首个输入事件时,设置垂直同步功能的状态为禁用状态。其中,垂直同步功能为禁用状态通过设置变量USE_VSYNC为无效实现。
具体地,上述第一次绘制模块420还用于:当输入事件触发调用Choreographer类的postCallback函数,且postCallback函数的参数类型首次为CALLBACK_TRAVERSAL时,确定出现触摸操作的第一次绘制事件。
上述类型记录模块410还用于:当触摸操作的首个输入事件对应手指中心移动的距离大于第一距离阈值时,记录输入事件的类型为滑动,并设置第一距离阈值为第二距离阈值,第二距离阈值大于第一距离阈值。
参见图6所示的加速界面绘制的装置的结构示意图,上述装置还包括:优先级设置模块610,用于将Input线程任务的优先级设置为-8至-16之间的数值;Input线程任务包括InputReader和InputDispatcher线程任务。
进一步,参见图7所示的加速界面绘制的装置的结构示意图,上述装置还包括:串行处理模块710,用于Input内核态驱动线程通过串行方式处理数据。
进一步,参见图8所示的加速界面绘制的装置的结构示意图,上述装置还包括:防抖模块810,用于应用防抖过滤功能确定触摸操作的手指中心;其中,防抖过滤功能至少包括以下之一参数设置:触摸屏的空闲时间doze_mode的时长小于20ms,且大于10ms;触摸屏的抖动判断阈值在50至255之间;非侦测区域的误触判别计算为无效状态,其中,非侦测区域为预先设置的区域;报点率在110Hz至120Hz之间。
本发明实施例所提供的装置,其实现原理及产生的技术效果和前述方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应内容。
实施例4
本发明实施例4提供了一种终端,包括处理器和用于存储处理器可执行指令的存储器;上述处理器用于:当接收到触摸操作触发的输入事件时,记录输入事件的类型;当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程;启用垂直同步功能,继续执行触摸操作后续的界面绘制。
图9示出了一种可应用于本发明实施例中的终端100的结构框图。如图9所示,移动终端100包括加速界面绘制的装置101、存储器102、存储控制器104,一个或多个(图中仅示出一个)处理器106、外设接口108、射频模块110、音频模块112、触控屏幕114等。这些组件通过一条或多条通讯总线/信号线116相互通讯。
存储器102可用于存储软件程序以及模块,如本发明实施例中的加速界面绘制的方法、装置对应的程序指令/模块,处理器106通过运行存储在存储器102内的软件程序以及模块,从而执行各种功能应用以及数据处理,如本发明实施例提供的加速界面绘制的方法。
存储器102可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。处理器106以及其他可能的组件对存储器102的访问可在存储控制器104的控制下进行。
外设接口108将各种输入/输出装置耦合至处理器106以及存储器102。在一些实施例中,外设接口108,处理器106以及存储控制器104可以在单个芯片中实现。在其他一些实例中,他们可以分别由独立的芯片实现。
射频模块110用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯。
音频模块112向用户提供音频接口,其可包括一个或多个麦克风、一个或者多个扬声器以及音频电路。
触控屏幕114在移动终端100与用户之间同时提供一个输出及输入界面。在本实施例中,上述触控屏幕114支持单点和多点触控操作,例如,该触控屏幕114可为支持单点和多点触控操作的电容式触摸屏或电阻式触摸屏等。支持单点和多点触控操作是触控屏幕114能感应到来自该触摸屏11上一个或多个位置处同时产生的触控操作,并将该感应到的多点触控操作交由处理器106进行处理。
可以理解,图9所示的结构仅为示意,移动终端100还可包括比图9中所示更多或者更少的组件,或者具有与图9所示不同的配置。图9中所示的各组件可以采用硬件、软件或其组合实现。
本发明实施例还提供了一种计算机存储介质,用于储存为上述加速界面绘制的装置所用的计算机软件指令,其包含用于执行上述方面为加速界面绘制的装置所设计的程序。上述程序包括的指令可用于执行前面方法实施例中的方法,具体实现可参见方法实施例,在此不再赘述。
附图中的流程图和框图显示了根据本发明的多个实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,该模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
在本申请所提供的几个实施例中,应该理解到,所揭露的方法、***和装置,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,该模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个模块或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
以上实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明保护范围的限制。应当指出的是,对于本 领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明的保护范围应以所附权利要求为准。

Claims (10)

  1. 一种加速界面绘制的方法,其特征在于,应用于支持Choreographer机制的Android终端,所述方法包括:
    当接收到触摸操作触发的输入事件时,记录所述输入事件的类型;
    当所述输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现所述触摸操作的第一次绘制事件,如果是,调用所述第一次绘制事件的绘制流程;
    启用所述垂直同步功能,继续执行所述触摸操作后续的界面绘制。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    预先设置所述垂直同步功能的默认状态为禁用状态;或者,
    当接收到触摸操作触发的首个输入事件时,设置所述垂直同步功能的状态为禁用状态。
  3. 根据权利要求2所述的方法,其特征在于,所述垂直同步功能为禁用状态通过设置变量USE_VSYNC为无效实现。
  4. 根据权利要求1所述的方法,其特征在于,所述监听是否出现所述触摸操作的第一次绘制事件的步骤,包括:
    当所述输入事件触发调用Choreographer类的postCallback函数,且所述postCallback函数的参数类型首次为CALLBACK_TRAVERSAL时,确定出现所述触摸操作的第一次绘制事件。
  5. 根据权利要求1所述的方法,其特征在于,所述记录所述输入事件的类型的步骤,包括:
    当所述触摸操作的首个输入事件对应手指中心移动的距离大于第一距离阈值时,记录所述输入事件的类型为滑动,并设置所述第一距离阈值为第二距离阈值,所述第二距离阈值大于所述第一距离阈值。
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    将Input线程任务的优先级设置为-8至-16之间的数值;所述Input线程任务包括InputReader和InputDispatcher线程任务。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    Input内核态驱动线程通过串行方式处理数据。
  8. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    应用防抖过滤功能确定所述触摸操作的手指中心;其中,所述防抖过滤功能至少包括以下之一参数设置:
    触摸屏的空闲时间doze_mode的时长小于20ms,且大于10ms;
    触摸屏的抖动判断阈值在50至255之间;
    非侦测区域的误触判别计算为无效状态,其中,所述非侦测区域为预先设置的区域;
    报点率在110Hz至120Hz之间。
  9. 一种加速界面绘制的装置,其特征在于,应用于支持Choreographer机制的Android终端,所述装置包括:
    类型记录模块,用于当接收到触摸操作触发的输入事件时,记录所述输入事件的类型;
    第一次绘制模块,用于当所述输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现所述触摸操作的第一次绘制事件,如果是,调用所述第一次绘制事件的绘制流程;
    继续绘制模块,用于启用所述垂直同步功能,继续执行所述触摸操作后续的界面绘制。
  10. 一种终端,其特征在于,包括处理器和用于存储所述处理器可执行指令的存储器;所述处理器用于:当接收到触摸操作触发的输入事件时,记录输入事件的类型;当输入事件的类型为按下或滑动时,在禁用垂直同步功能的条件下,监听是否出现触摸操作的第一次绘制事件,如果是,调用第一次绘制事件的绘制流程;启用垂直同步功能,继续执行触摸操作后续的界面绘制。
PCT/CN2018/092024 2017-06-20 2018-06-20 加速界面绘制的方法、装置和终端 WO2018233636A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710472260.2 2017-06-20
CN201710472260.2A CN107273130B (zh) 2017-06-20 2017-06-20 加速界面绘制的方法、装置和终端

Publications (1)

Publication Number Publication Date
WO2018233636A1 true WO2018233636A1 (zh) 2018-12-27

Family

ID=60069330

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/092024 WO2018233636A1 (zh) 2017-06-20 2018-06-20 加速界面绘制的方法、装置和终端

Country Status (2)

Country Link
CN (1) CN107273130B (zh)
WO (1) WO2018233636A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4206914A4 (en) * 2020-09-30 2024-03-20 Huawei Technologies Co., Ltd. EVENT PROCESSING METHOD AND APPARATUS

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107273130B (zh) * 2017-06-20 2020-08-04 深圳市万普拉斯科技有限公司 加速界面绘制的方法、装置和终端
CN108829475B (zh) * 2018-05-29 2021-08-17 北京小米移动软件有限公司 Ui绘制方法、装置及存储介质
CN109558059B (zh) * 2018-11-12 2021-10-22 大陆汽车车身电子***(芜湖)有限公司 手写轨迹绘制方法及装置
CN110008027B (zh) * 2019-04-09 2021-08-20 Oppo广东移动通信有限公司 进程的运行方法、装置、终端及存储介质
CN110018874B (zh) * 2019-04-09 2021-07-13 Oppo广东移动通信有限公司 垂直同步方法、装置、终端及存储介质
CN110007803A (zh) * 2019-04-15 2019-07-12 深圳市万普拉斯科技有限公司 触摸屏报点方法、装置、触摸屏和电子设备
CN111460350B (zh) * 2020-04-07 2023-06-09 上海熙菱信息技术有限公司 一种防抖与节流封装方法及***
CN113535340B (zh) * 2020-04-13 2023-03-31 荣耀终端有限公司 一种任务调度方法、装置及电子设备
CN112799805A (zh) * 2021-01-21 2021-05-14 惠州Tcl移动通信有限公司 基于终端设备的调度方法、装置、存储介质及终端设备
CN113986107A (zh) * 2021-10-22 2022-01-28 北京鲸鲮信息***技术有限公司 基于图形显示***的触控处理方法及装置、电子设备、存储介质
CN117396835A (zh) * 2022-05-11 2024-01-12 北京小米移动软件有限公司 显示图像的更新方法、装置及存储介质
CN116860420B (zh) * 2023-09-05 2024-03-01 荣耀终端有限公司 事件处理方法、可读存储介质和电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103389848A (zh) * 2013-08-08 2013-11-13 华映视讯(吴江)有限公司 驱动触控显示器的方法及提升信噪比的触控显示器
US20150097768A1 (en) * 2013-10-03 2015-04-09 Leap Motion, Inc. Enhanced field of view to augment three-dimensional (3d) sensory space for free-space gesture interpretation
CN104978064A (zh) * 2011-04-15 2015-10-14 夏普株式会社 显示装置、显示装置的驱动方法以及电子设备
CN106462275A (zh) * 2014-06-09 2017-02-22 索尼公司 自适应触摸面板同步
CN106598320A (zh) * 2015-10-20 2017-04-26 乐金显示有限公司 具有触摸传感器的显示设备及其驱动方法
CN107273130A (zh) * 2017-06-20 2017-10-20 深圳市万普拉斯科技有限公司 加速界面绘制的方法、装置和终端

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011145360A1 (ja) * 2010-05-21 2011-11-24 シャープ株式会社 表示装置およびその駆動方法、ならびに表示システム
EP2620857A1 (en) * 2012-01-27 2013-07-31 Research In Motion Limited Touch-sensitive display and method of controlling a touch-sensitive display
CN105913371A (zh) * 2015-11-16 2016-08-31 乐视致新电子科技(天津)有限公司 一种针对虚拟现实应用延迟的***优化方法和装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978064A (zh) * 2011-04-15 2015-10-14 夏普株式会社 显示装置、显示装置的驱动方法以及电子设备
CN103389848A (zh) * 2013-08-08 2013-11-13 华映视讯(吴江)有限公司 驱动触控显示器的方法及提升信噪比的触控显示器
US20150097768A1 (en) * 2013-10-03 2015-04-09 Leap Motion, Inc. Enhanced field of view to augment three-dimensional (3d) sensory space for free-space gesture interpretation
CN106462275A (zh) * 2014-06-09 2017-02-22 索尼公司 自适应触摸面板同步
CN106598320A (zh) * 2015-10-20 2017-04-26 乐金显示有限公司 具有触摸传感器的显示设备及其驱动方法
CN107273130A (zh) * 2017-06-20 2017-10-20 深圳市万普拉斯科技有限公司 加速界面绘制的方法、装置和终端

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4206914A4 (en) * 2020-09-30 2024-03-20 Huawei Technologies Co., Ltd. EVENT PROCESSING METHOD AND APPARATUS

Also Published As

Publication number Publication date
CN107273130B (zh) 2020-08-04
CN107273130A (zh) 2017-10-20

Similar Documents

Publication Publication Date Title
WO2018233636A1 (zh) 加速界面绘制的方法、装置和终端
US11887557B2 (en) Method for image processing based on vertical synchronization signals and electronic device
WO2020259457A1 (zh) 一种基于垂直同步信号的控制方法及电子设备
CN108512695B (zh) 监控应用卡顿的方法及装置
CN108062190B (zh) 一种应用运行状态控制方法及移动终端
CN107783803B (zh) 智能终端的***优化方法、装置、存储介质及智能终端
EP3413163A1 (en) Method for processing data collected by touch panel, and terminal device
CN104598112B (zh) 按钮交互方法和装置
US11310646B2 (en) Bluetooth-based playback method and electronic device
CN115631258B (zh) 一种图像处理方法及电子设备
CN107851050B (zh) 具有看门狗定时器的装置及用于操作看门狗定时器的方法
WO2019024642A1 (zh) 进程控制方法、装置、存储介质以及电子设备
US20240021176A1 (en) Image Processing Method Based on Vertical Sychronization Signal and Electronic Device
CN108132735B (zh) 终端与应用控制方法
KR20160001964A (ko) 마이크 운용 방법 및 이를 지원하는 전자 장치
US20140289683A1 (en) Method and apparatus for calculating channel quality adaptively in mobile communication system
CN104866212A (zh) 一种快速调用程序或功能的方法及其***
CN114911336B (zh) 调整频率的方法、装置、电子设备及可读存储介质
CN110209428A (zh) 一种终端屏幕唤醒方法、装置、终端及存储介质
CN105138112A (zh) 一种显示控制方法及装置
CN112764891B (zh) 电子终端及控制应用的方法
CN103997673B (zh) 一种事件处理方法和装置
WO2012151952A1 (zh) 一种响应屏幕触摸事件的方法、装置及通讯终端
US11994931B2 (en) Frame rate setting method, apparatus, storage medium and mobile terminal
EP4310836A1 (en) Text reading method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18820194

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 15/05/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18820194

Country of ref document: EP

Kind code of ref document: A1