CN109725978B - Window refreshing method and device, electronic equipment and storage medium - Google Patents

Window refreshing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109725978B
CN109725978B CN201910060021.5A CN201910060021A CN109725978B CN 109725978 B CN109725978 B CN 109725978B CN 201910060021 A CN201910060021 A CN 201910060021A CN 109725978 B CN109725978 B CN 109725978B
Authority
CN
China
Prior art keywords
window
refreshing
current
request
refresh
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910060021.5A
Other languages
Chinese (zh)
Other versions
CN109725978A (en
Inventor
莫斯挺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910060021.5A priority Critical patent/CN109725978B/en
Publication of CN109725978A publication Critical patent/CN109725978A/en
Application granted granted Critical
Publication of CN109725978B publication Critical patent/CN109725978B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Control Of Indicators Other Than Cathode Ray Tubes (AREA)

Abstract

The application discloses a window refreshing method and device, electronic equipment and a storage medium, and relates to the technical field of electronic equipment. Wherein, the method comprises the following steps: monitoring a window refreshing request of an application program in the current window refreshing circulation flow; when a window refreshing request of an application program is monitored, responding to the window refreshing request; if the current screen state is screen off, judging whether the window refreshing times in the current window refreshing cycle flow reach a first preset time, if not, returning to the step of monitoring the window refreshing request of the application program, if so, ending the current cycle flow, and entering the next window refreshing cycle flow.

Description

Window refreshing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of electronic devices, and in particular, to a window refreshing method and apparatus, an electronic device, and a storage medium.
Background
When the window management service of the system of the electronic equipment monitors the refresh request, the window management service refreshes the window in response to the refresh request. The electronic device responds to all refresh requests in the screen-off state. Therefore, when an application frequently triggers a refresh, the window of the electronic device is also frequently refreshed in response to the frequently triggered refresh request, resulting in unnecessary system consumption.
Disclosure of Invention
In view of the foregoing problems, the present application provides a window refreshing method, device, electronic device and storage medium to solve the foregoing problems.
In a first aspect, an embodiment of the present application provides a window refreshing method, where the method includes: monitoring a window refreshing request of an application program in the current window refreshing circulation flow; when a window refreshing request of an application program is monitored, responding to the window refreshing request; if the current screen state is screen-off, judging whether the window refreshing frequency in the current window refreshing cycle flow reaches a first preset frequency, if not, returning to the step of monitoring the window refreshing request of the application program, if so, ending the current cycle flow, and entering the next window refreshing cycle flow.
In a second aspect, an embodiment of the present application provides a window refreshing method, where the method includes: monitoring a window refreshing request of an application program in the current window refreshing circulation flow; when a window refreshing request of an application program is monitored, if the current screen state is screen off, judging whether the refreshing frequency of a window reaches a first preset frequency in the current window refreshing cycle flow, if not, responding to the window refreshing request, returning to the step of monitoring the window refreshing request of the application program, and if so, ending the current cycle flow and entering the next window refreshing cycle flow.
In a third aspect, an embodiment of the present application provides a window refreshing apparatus, where the apparatus includes: the monitoring module is used for monitoring a window refreshing request of an application program in the current window refreshing cycle flow; the response module is used for responding to the window refreshing request when the window refreshing request of the application program is monitored; and if the current screen state is screen off, when the window refreshing frequency reaches the first preset frequency in the current window refreshing cycle flow, returning to the monitoring module, and if the current screen state is screen off, ending the current cycle flow and entering the next window refreshing cycle flow when the window refreshing frequency reaches the first preset frequency in the current window refreshing cycle flow.
In a fourth aspect, an embodiment of the present application provides a window refreshing apparatus, where the apparatus includes: the monitoring requesting module is used for monitoring a window refreshing request of an application program in the current window refreshing circulation flow; the screen-off judging module is used for judging whether the refreshing frequency of the window reaches a first preset frequency in the current window refreshing circulation flow if the current screen state is screen-off; the circulation module is used for responding to the window refreshing request and returning to the monitoring module when the window refreshing request of the application program is monitored and the refreshing frequency of the window does not reach a first preset frequency in the current window refreshing circulation flow if the current screen state is screen off; if the current screen state is screen off, in the current window refreshing cycle process, when the refreshing frequency of the window reaches a first preset frequency, the current cycle process is ended, and the next window refreshing cycle process is entered.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, the memory being coupled to the processor, the memory storing instructions, when the instructions are executed by the processor, the processor performing the above-mentioned method.
In a sixth aspect, the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, and the program code can be called by a processor to execute the above method.
According to the window refreshing method, the window refreshing device, the electronic equipment and the storage medium, the window refreshing cycle flow receives and responds to the window refreshing request, and when the refreshing frequency is too many in the screen off state, the current cycle flow is ended, and the next cycle flow is started. According to the scheme, under the condition that the refresh request is too frequent in the screen-off state, the receiving and response frequency of the window refresh request is reduced and the system consumption caused by frequent refresh is reduced through the ending and re-entering of the window refresh process.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a flowchart of a window refreshing method according to a first embodiment of the present application.
Fig. 2 shows a flowchart of a window refresh method according to a second embodiment of the present application.
Fig. 3 shows a flowchart of a window refresh method according to a third embodiment of the present application.
Fig. 4 shows a flowchart of a window refreshing method according to a fourth embodiment of the present application.
Fig. 5 shows a flowchart of a window refresh method according to a fifth embodiment of the present application.
Fig. 6 shows another flowchart of a window refreshing method according to a fifth embodiment of the present application.
Fig. 7 shows a flowchart of a window refresh method according to a sixth embodiment of the present application.
Fig. 8 is a functional block diagram of a window refresh apparatus according to an embodiment of the present application.
Fig. 9 is a functional block diagram of a window refresh apparatus according to another embodiment of the present application.
Fig. 10 shows a block diagram of an electronic device according to an embodiment of the present application.
Fig. 11 is a memory unit according to an embodiment of the present disclosure, configured to store or carry program code for implementing a window refresh method according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
When the window of the electronic device monitors the refresh request of the application program, the window can be refreshed in response to the refresh request. If the application program sends a window refreshing message to the system, the system is informed of refreshing the window, and the cache data of the window corresponding to the application program is drawn is updated.
Wherein the window may be a new operating environment in the system of the electronic device. The display screen of the electronic equipment is divided into a plurality of frames, each frame is a window, and each window is responsible for displaying and processing a certain type of information. The user can work on any window at will and exchange information between windows. Alternatively, a window is an important part of the user interface, and is an area on the screen corresponding to an application, such as a rectangular area, including the frame and the client area, and is a visual interface between the user and the application that generated the window. Each time an application begins to run, the application creates and displays a window; when the user manipulates the objects in the window, the program reacts accordingly. A user may terminate the running of a program by closing a window; the corresponding application may be selected by selecting the corresponding application window.
In a research by the inventor, it is found that in a screen-off state, a window management service of an electronic device, such as a window management service (windowmanagerservce) of an Android system, responds to a refresh request only by monitoring the refresh request, and refreshes a window.
Some applications may trigger refreshes frequently, such as some applications frequently for keep-alive, frequently because of a virus, or frequently because a developer inadvertently writes frequently refreshed code. The frequent refresh may be very fast, such as a frequency of millions of times per second, and the interval time between the frequent refresh requests may even be less than or equal to the processing time of the electronic device for one refresh request. When the electronic device is turned off, as long as a certain application frequently triggers refresh, the system will frequently send refresh messages (such as a replay message sent by the android system) to the window management service at the refresh trigger frequency, the window management service will receive and respond to the refresh request, and refresh the window cache data of the application program through a responsive refresh module. However, frequent refreshing of the window requires the electronic device to perform frequent refreshing operations, and the electronic device performs refreshing at the frequency of the refreshing request, that is, how many times the window refreshing request is made and how many times the window refreshing request is made are responded to when the processing speed of the electronic device can be reached. However, the refresh in the screen-off state is of little significance to the user, and in addition, the frequent refresh also increases the consumption of the electronic device, such as power consumption, consumption of system resources, and the like.
Among other things, the possible problem that may be caused by the high consumption of system resources is that frequently sending refresh messages to the window management service results in the message processing (e.g., Handler of android system) of the window management service being stuck. The Handler is the Handler of the system service process, and messages such as window refreshing messages, bright screen correlation and the like are processed in the Handler. At this time, if the screen-up instruction is monitored, if the Handler always processes window refreshing information, the screen-up information is delayed, the screen-up instruction cannot be responded in time, and the electronic device is slow in screen-up. In addition, if there are other messages or instructions processed in the Handler, the other messages or instructions will also delay the response, which affects the user experience.
Therefore, when the application frequently triggers refresh, it is necessary to reduce the refresh frequency, to reduce system consumption, and to reduce delay in command processing. In view of this, the inventor proposes a window refresh method, a window refresh apparatus, an electronic device, and a storage medium according to embodiments of the present application, in which a window refresh request is received and responded in a window refresh cycle flow, and a refresh number is defined in the window refresh flow, so as to reduce the frequency of receiving and responding window refresh messages.
The window refreshing method, the window refreshing apparatus, the electronic device, and the storage medium provided in the embodiments of the present application will be described in detail through specific embodiments.
Referring to fig. 1, a window refreshing method provided in the embodiment of the present application is applied to an electronic device. The electronic device can be a mobile phone, a tablet computer, a computer and other intelligent devices capable of refreshing windows. Specifically, the method may include:
step S110: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
And monitoring a window refreshing request of the application program in the window refreshing circulation flow. The window refresh cycle flow may be in a corresponding window refresh device, for example, a code corresponding to the window refresh cycle flow is in a related code logic file for window refresh, such as adding a cycle body method performance of window refresh () sent in an android system into a related code logic file for window refresh, windowsurface platform.
Step S120: and when the window refreshing request of the application program is monitored, responding to the window refreshing request.
In the window refresh cycle flow, if a window refresh request of an application program is monitored, the window refresh request is responded. Specifically, the response to the refresh request may be to directly perform window refresh, or to invoke other modules performing window refresh to perform window refresh.
Step S130: and if the current screen state is screen off, judging whether the window refreshing times reach a first preset time in the current window refreshing circulation flow. If not, returning to the step S110; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
In a window refresh cycle flow, the number of window refreshes may be counted. And after the window refreshing is carried out in response to the window refreshing request every time, the window refreshing frequency in the window refreshing circulation flow is increased once.
In each window refresh cycle flow, a maximum number of times of window refresh allowed in a screen-off state in the window refresh cycle flow may be set, and in this embodiment of the present application, the maximum number of times may be defined as a first preset number of times. The screen turning off, also called screen extinguishing or screen extinguishing, is to normally turn off the screen backlight and turn off the screen, so that the power supply can be saved in the screen extinguishing state.
If the screen state is the screen off state, after the window refreshing is carried out in response to the window refreshing request, whether the window refreshing frequency reaches a first preset frequency in the current window refreshing cycle flow can be judged, so that whether the window refreshing frequency reaches the maximum frequency allowed in the screen off state is judged.
If the refresh frequency does not reach the first preset frequency, the window refresh can be continued in the window refresh cycle flow, so that the step of monitoring the window refresh request of the application program can be returned again, and a new window refresh request is received to respond. If the refresh frequency reaches the first preset frequency, the current window refresh cycle flow needs to be ended, and the next window refresh cycle flow is entered to monitor the window refresh request of the application program, as shown in fig. 1, one window refresh cycle flow is shown from the beginning to the end, so that the refresh frequency can be reduced by exiting and entering the window refresh cycle flow. For example, when the interval time of the refresh request is less than or equal to the processing time of one refresh request, the current window refresh cycle flow is ended, the next window refresh cycle flow is entered to monitor the window refresh request again, the window refresh request receiving and processing interval time is increased, and the window refresh request receiving frequency is reduced. The processing time of one refresh request can be from the beginning of one monitoring of the window refresh request to the step of returning to the monitoring of the window refresh request of the application program again after responding to the refresh request and judging that the refresh frequency does not reach the first preset frequency.
In the embodiment of the application, a window refresh request is monitored in a window refresh cycle flow and the monitored window refresh request is responded. And, the number of window refreshes is limited in the window refresh cycle flow, so that if the application frequently triggers window refresh, the refresh will not be performed with the trigger frequency of the refresh request. When the refresh is frequently performed, the window refresh cycle flow is ended when the refresh frequency reaches the limited frequency, the window refresh cycle flow needs to be re-entered when a refresh request exists, certain time is consumed for ending and re-entering the window refresh cycle flow, and the processing frequency of screen refresh is reduced.
The window refreshing method provided by the embodiment of the application can further comprise the step of counting the window refreshing times. Specifically, as shown in fig. 2, the method may include:
step S210: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
After entering a window refreshing circulation flow, monitoring a window refreshing request of an application program, and determining whether the window refreshing request of the application program is received.
As a first embodiment, when the window refresh frequency in the current window refresh cycle flow is determined to have not reached the maximum allowed frequency, and the window refresh request of the monitoring application program is returned to, or the window refresh request of the monitoring application program is executed when the current window refresh cycle flow is entered for the first time, the window refresh request is monitored immediately, and whether the window refresh request of the application program is received is monitored only once, if the window refresh request of the application program is not received, the current window refresh cycle flow is exited, and the next window refresh cycle flow is entered. Therefore, the window refreshing cycle flow can be quickly ended when the window refreshing request of the application program does not exist, and the refreshing frequency can also be reduced by ending the window refreshing cycle flow and re-entering when the application program frequently triggers refreshing.
As a second embodiment, when it is determined that the window refresh frequency in the current window refresh cycle flow does not reach the maximum allowable frequency, the step of returning to the window refresh request of the monitoring application program, or when the window refresh request of the monitoring application program is executed by entering the current window refresh cycle flow for the first time, whether there is a window refresh request may be monitored continuously. If the window refreshing request of the application program is not monitored within the first preset time, the current cycle flow is ended, and the next window refreshing cycle flow is entered.
As a third embodiment, when entering a window refresh cycle flow for the first time, if a window refresh request of an application is not monitored, it indicates that no application needs to perform window refresh and no frequent refresh of the application, and in order to reduce processing consumption of the system, infrequently end and enter the window refresh cycle flow, a monitoring state may be maintained in the window refresh cycle flow until the window refresh request of the application is monitored.
The third embodiment described above may be combined with the first embodiment or the second embodiment. For example, in an embodiment in which the third embodiment is combined with the first embodiment, when entering a window refresh cycle flow for the first time, if a window refresh request of an application is not monitored, the window refresh cycle flow keeps the monitoring state until the window refresh request of the application is monitored, and the window refresh request is responded. When the window refreshing frequency in the current window refreshing cycle flow is judged to return to the step of monitoring the window refreshing request of the application program when the window refreshing frequency does not reach the allowed maximum frequency, the window refreshing request is monitored immediately, whether the window refreshing request of the application program is received or not is monitored once, if the window refreshing request is received, the window refreshing request is responded, and if the window refreshing request is not received, the current window refreshing cycle flow is exited, and the next window refreshing cycle flow is entered. Therefore, when there is no refresh request, the window refresh request can be monitored in the window refresh cycle flow. When the application program frequently requests refreshing, the refreshing frequency is reduced through the ending and restarting of the window circulation flow.
In an embodiment combining the third embodiment with the second embodiment, when entering a window refresh cycle flow for the first time, if a window refresh request of an application program is not monitored, the window refresh cycle flow is kept in a monitoring state until the window refresh request of the application program is monitored, and the window refresh request is responded. And when the step of returning to the window refreshing request of the monitoring application program when the window refreshing frequency in the current window refreshing cycle flow is judged to not reach the allowed maximum frequency, continuously monitoring whether the window refreshing request exists, if the window refreshing request of the application program is not monitored within the first preset time, ending the current cycle flow, and entering the next window refreshing cycle flow. The specific time length of the first preset time length is not limited in the embodiment of the present application, and may be determined according to a refresh frequency that needs to be reduced. If the application program continuously sends the refresh request, the set first preset duration plus the one-time processing time of the refresh request is greater than or equal to the interval time of the refresh request, so that the current cycle flow can be ended when the refresh request reaches the first preset times under the condition that the interval time of the continuously sent refresh request is slightly longer.
Step S220: and when monitoring a window refreshing request of the application program, responding to the window refreshing request.
Step S230: and counting the window refreshing times in the current window refreshing circulation flow.
When a window refresh request of an application program is monitored, responded and refreshed, the latest window refresh times in the current window refresh cycle flow can be counted, or the window refresh times in the current window refresh cycle flow can be updated.
For example, the initial value of the refresh number may be set to 0 in each window refresh cycle flow. In the window refresh cycle flow, each time a window refresh is responded, the window refresh frequency is added by 1, so that the refresh frequency in the window refresh cycle flow is obtained, and when the refresh frequency is greater than or equal to a first preset frequency, the window refresh frequency can be judged to reach the first preset frequency.
In addition, in each window refresh cycle flow, the initial value of the refresh frequency may be set to the first preset frequency. In the window refresh cycle flow, the window refresh frequency is reduced by one every time the window refresh is responded, and when the refresh frequency is reduced to 0, the window refresh frequency can be judged to reach the first preset frequency.
Step S240: and if the current screen state is screen off, judging whether the window refreshing times reach a first preset time in the current window refreshing circulation flow. If not, returning to the step S210; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
If the current screen state is screen-off, whether the window refreshing times in the current window refreshing circulation flow reach a first preset time or not can be judged. If the first preset number of times is not reached, the process may return to step S210 to monitor the window refresh request of the application program. If the first preset number of times is reached, the current cycle flow may be ended, and a next window refresh cycle flow is entered, as shown in fig. 2. In fig. 2, a window refresh cycle flow is shown from start to finish.
Optionally, in this embodiment of the present application, before entering the next window refresh cycle flow, a second preset time period may also be waited. By waiting for the second preset duration, the interval time between the two window refresh cycle flows is longer, and the frequency of receiving and responding to the window refresh request can be further reduced under the condition that the application program frequently triggers the window refresh request. The second preset time period is not limited in the embodiment of the present application and may be determined according to a desired response frequency. For example, if it is desired to control the refresh frequency to be once in 2 minutes in the case of frequent refresh requests, the second preset time period may be 2 minutes, or 2 minutes minus the time required between the last response of one window refresh cycle flow and the first response of the next window refresh cycle flow.
Optionally, in this embodiment of the application, when the number of times of refreshing the window in one window refresh cycle flow reaches the first preset number of times, before entering the next window refresh cycle flow, a second preset duration may be waited. Because the number of times of refreshing the window in a window refreshing cycle flow reaches the first preset number of times, it is possible that an application program frequently requests refreshing, and the monitoring and response frequency is reduced by waiting for the second preset duration.
Optionally, when the number of times of refreshing the window in two or more consecutive window refresh cycle flows reaches the first preset number of times, before entering the next window refresh cycle flow, the second preset duration may be waited. The number of window refresh cycle flows in which the number of times of refreshing the window continuously reaches the first preset number is not limited in the embodiment of the present application. When the number of times of refreshing the window in two or more continuous window refreshing circulation flows reaches a first preset number, the possibility that the application program frequently requests refreshing is high, and the monitoring and response frequency can be reduced by waiting for a second preset time.
In the embodiment of the application, the refresh frequency can be controlled in the bright screen state. Specifically, as shown in fig. 3, the present application provides an embodiment, including:
step S310: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
Step S320: and when the window refreshing request of the application program is monitored, responding to the window refreshing request.
Step S330: and judging whether the current screen state is off or on. If the screen is turned off, executing step S340; if the screen is bright, step S350 is executed.
The electronic device may obtain a current screen state to determine whether the current screen state is off or on. And when the screen is in a bright state, the screen is opened, and the screen backlight is lightened.
In the embodiment of the present application, step S330 may be executed after step S320, or may be executed simultaneously with step S320, or may be executed before step S320.
If the steps S330 and S320 are not executed simultaneously, since the electronic device executes the steps quickly, the screen status when responding to the window refresh request is generally consistent with the screen status determined to be the screen status.
In the embodiment of the present application, statistics on the number of refreshes may also be included. As an embodiment, the refresh times in the screen-off state and the refresh times in the screen-on state may be counted jointly. Specifically, in a window refresh cycle flow, the statistics of the refresh times is not affected by the screen state, and the statistics is all the refresh times in the window refresh cycle flow. For example, in a window refresh cycle flow, when the screen state is the screen-off state, the refresh frequency in the window refresh cycle flow is counted as one time, when the window refresh request is monitored again and responded, the screen state is the screen-on state, and the refresh frequency in the window refresh cycle flow is counted as 2 times. And when judging whether the refreshing times reach the corresponding maximum times in the screen-off state or the screen-on state, judging according to the total refreshing times in the window refreshing circulation flow so as to reduce the response frequency of frequent refreshing requests.
As another embodiment, the refresh times in the screen-off state and the refresh times in the screen-on state may be counted respectively, and the judgment of the refresh times is performed according to the counted times of the corresponding screen states. Specifically, in a window refreshing cycle flow, if the screen state changes from off to on, the refreshing times in the on state are counted again; and if the screen state is changed from the bright screen state to the off screen state, counting the refreshing times in the new off screen state again. For example, in a window refresh cycle flow, when the screen state is the screen-off state, counting the refresh frequency in the screen-off state as one time; if the screen state is a bright screen when the window refreshing request is responded again, counting the window refreshing circulation flow, wherein the window refreshing times are 1 time in the bright screen state; if the screen state is screen off when the window refreshing request is responded again in the window refreshing cycle flow, counting the window refreshing time to be 1 time in the window refreshing cycle flow in the screen off state.
Step S340: and if the current screen state is screen off, judging whether the window refreshing times reach a first preset time in the current window refreshing circulation flow. If not, returning to step S310; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
Step S350: if the current screen state is a bright screen, judging whether the window refreshing frequency reaches a second preset frequency in the current window refreshing circulation flow, and if not, returning to the step S310; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
In the screen-off state and in a window refreshing circulation flow, the maximum refreshing time of the window in the screen-off state is limited to a first preset time, and the maximum refreshing time of the window in the screen-on state is limited to a second preset time. Because the user cannot view the screen content in the screen-off state and excessive window refreshing is meaningless, the second preset times can be set to be greater than the first preset times.
When the screen state is screen off, if the current window refreshing frequency reaches a first preset frequency in the window refreshing cycle flow, ending the current cycle flow and entering the next window refreshing cycle flow; and if the first preset times are not reached, returning to the step of monitoring the window refreshing request of the application program again. When the screen state is bright, if the current window refreshing frequency reaches a second preset frequency in the window refreshing cycle flow, ending the current cycle flow and entering the next window refreshing cycle flow; and if the second preset times is not reached, returning to the step of monitoring the window refreshing request of the application program again.
In this embodiment, if the refresh times in the screen-off state and the refresh times in the screen-on state are jointly counted, when the current screen state is the screen-off state, it is determined whether the total refresh times of the window in the current window refresh cycle flow reaches a first preset time; and when the current screen state is a bright screen, judging whether the total refreshing frequency of the window reaches a second preset frequency in the current window refreshing circulation flow.
If the refreshing times in the screen-off state and the refreshing times in the screen-on state are respectively counted, judging whether the refreshing times in the screen-off state reach a first preset time in the current window refreshing circulation flow when the current screen state is in the screen-off state; and when the current screen state is a bright screen, judging whether the refreshing frequency in the bright screen state reaches a second preset frequency in the current window refreshing circulation flow.
In the embodiment of the application, the maximum refreshing times allowed in a window refreshing cycle flow are respectively set for the screen-off state and the screen-on state, so that the refreshing frequency response can be respectively controlled for the screen-off state and the screen-on state, and a better refreshing frequency control effect is obtained.
In the case that the screen is turned off, the continuous refreshing of the window is less significant, and therefore, in the embodiment of the present application, the first preset number may be a relatively small value, for example, 1 time. Specifically, the present application provides an embodiment, in which the first preset number of times is 1. Specifically, referring to fig. 4, the embodiment includes:
step S410: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
Step S420: and when the window refreshing request of the application program is monitored, responding to the window refreshing request.
Step S430: and judging whether the current screen state is off or on. And if the current screen state is screen off, ending the current cycle flow and entering the next window refreshing cycle flow. If the current screen status is bright, step S440 is executed.
Step S440: judging whether the refreshing frequency of the window reaches a second preset frequency in the current window refreshing circulation flow, if not, returning to the step S410; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
In the screen-off state, in a window refreshing cycle flow, refreshing is allowed once, and under the condition of responding to a window refreshing request to refresh a window, if the current screen state is judged to be screen-off, the current cycle flow can be ended, and the next window refreshing cycle flow is entered. If the current screen state is judged to be bright, the next execution content can be determined according to whether the current refreshing frequency reaches a second preset frequency. The second preset number may be a number greater than 1, and a specific value is not limited in the embodiment of the present application, for example, 6.
In the embodiment of the present application, the same or similar steps as those in the previous embodiment may be referred to each other, and are not described again.
In this embodiment, when a window refresh request is monitored, it may be determined whether the window refresh frequency reaches the maximum allowed frequency, and then whether a response of window refresh is performed is determined. Specifically, referring to fig. 5, the method includes:
step S510: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
Step S520: when a window refreshing request of an application program is monitored, if the current screen state is screen off, whether the refreshing frequency of the window reaches a first preset frequency in the current window refreshing circulation flow is judged. If not, go to step S530; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
Step S530: if not, responding to the window refresh request, and returning to the step S510.
In the embodiment of the application, when a window refreshing request is monitored, the screen state is determined and whether the refreshing frequency of the window reaches the corresponding maximum frequency is judged.
If the refreshing frequency of the window does not reach the first preset frequency in the screen extinguishing state, the window can be refreshed. And returning to the step S510 after the window is refreshed, and monitoring the window refreshing request of the application program. In addition, after the window is refreshed, the latest window refreshing times can be counted so as to be used for judging whether the window refreshing times reach the corresponding maximum times when the window refreshing request of the application program is monitored next time.
If the window is in the screen extinguishing state and the refreshing frequency of the window reaches the first preset frequency, the current cycle process can be ended, and the next window refreshing cycle process is entered.
In the embodiment of the application, the number of times of refreshing in the bright screen state can be judged. Specifically, referring to fig. 6, the method may include:
step S510: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
Step S520: and when monitoring a window refreshing request of the application program, judging whether the current screen state is a screen-off state or a screen-on state. If the screen is turned off, executing step S530; if the screen is bright, step S540 is executed.
Step S530: and judging whether the refreshing frequency of the window reaches a first preset frequency in the current window refreshing circulation flow. If not, go to step S550; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
Step S540: and judging whether the refreshing frequency of the window reaches a second preset frequency in the current window refreshing circulation flow. If not, go to step S550; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
Step S550: responding to the window refresh request, and returning to the step S510.
In the embodiment of the application, when a window refreshing request is monitored, the screen state is determined and whether the refreshing frequency of the window reaches the corresponding maximum frequency is judged. And refreshing the screen when the refreshing times in the corresponding screen state do not reach the corresponding maximum refreshing times, and ending the current circulation flow if the refreshing times reach the maximum refreshing times.
In this embodiment, after responding to the window refresh request, the number of refreshes may be counted. In a window refresh cycle flow, the refresh times in the off-screen state and the on-screen state may be respectively counted, or the refresh times in the off-screen state and the on-screen state may be jointly counted, which may specifically refer to the foregoing corresponding embodiments, and will not be described herein again.
The same and similar parts of the embodiments of the present application as those of the previous embodiments may be referred to and combined, and are not described herein again.
In the embodiment of the present application, the first preset number of times may also be 1 time. When the first preset number of times is 1, as shown in fig. 7, the method provided in the embodiment of the present application may be:
step S510: and monitoring a window refreshing request of an application program in the current window refreshing circulation flow.
Step S520: and when monitoring a window refreshing request of the application program, judging whether the current screen state is a screen-off state or a screen-on state. If the screen is turned off, executing step S530; if the screen is bright, step S540 is executed.
Step S530: and responding to the window refreshing request, ending the current cycle flow, and entering the next window refreshing cycle flow.
Step S540: and judging whether the refreshing frequency of the window reaches a second preset frequency in the current window refreshing circulation flow. If not, go to step S550; if so, ending the current cycle flow and entering the next window refreshing cycle flow.
Step S550: responding to the window refresh request, and returning to the step S510.
And when the first preset number of times is one, if the window refreshing request of the application program is monitored and the screen state is judged to be off, responding to the window refreshing request and ending the current cycle flow, so that the window refreshing request is responded to in one window refreshing cycle flow only once in the screen off state. For specific implementation in this embodiment, reference may be made to the foregoing embodiments, which are not described herein again.
The embodiment of the application further provides a window refreshing device 600. As shown in fig. 8, the apparatus 600 includes: a monitoring module 610, configured to monitor a window refresh request of an application program in a current window refresh cycle flow; a response module 620, configured to respond to a window refresh request of an application when the window refresh request is monitored; and a screen-off judging module 630, configured to judge whether, in the current window refresh cycle flow, the number of times of refreshing the window reaches a first preset number of times if the current screen state is screen-off. And the circulating module 640 is configured to, if the current screen state is screen off, return to the monitoring module when the number of times of refreshing the window in the current window refreshing circulating flow does not reach the first preset number of times, and if the current screen state is screen off, end the current circulating flow and enter the next window refreshing circulating flow when the number of times of refreshing the window in the current window refreshing circulating flow reaches the first preset number of times.
The first preset number of times may be 1. When the first preset number of times is 1, the screen-off determining module 630 and the circulating module may be configured to end the current circulating process and enter the next window refreshing circulating process if the current screen state is the screen-off state.
Optionally, the apparatus 600 may further include a counting module, configured to count the window refresh times in the current window refresh cycle flow.
Optionally, the monitoring module 610 may be further configured to, if the window refresh request of the application program is not monitored within the first preset time period, end the current cycle flow and enter a next window refresh cycle flow.
Optionally, the loop module 640 may be further configured to wait for a second preset time period before entering a next window refresh loop flow.
Optionally, in this embodiment of the present application, a bright screen determining module may be further included, configured to determine whether the number of times of refreshing the window reaches a second preset number of times in the current window refreshing cycle flow if the current screen state is a bright screen. The circulation module 640 may be further configured to, if the current screen state is a bright screen and the number of times of refreshing the window does not reach a second preset number of times, return to the monitoring module to monitor the window refreshing request of the application program, and if the number of times of refreshing the window reaches the second preset number of times, end the current circulation process and enter a next window refreshing circulation process, where the second preset number of times is greater than the first preset number of times.
The embodiment of the present application further provides a window refreshing apparatus 700. As shown in fig. 9, the apparatus 700 includes: a monitoring module 710, configured to monitor a window refresh request of an application program in a current window refresh cycle flow; a screen-off judging module 720, configured to, when a window refresh request of an application program is monitored, judge whether the number of times of refreshing a window in a current window refresh cycle flow reaches a first preset number of times if the current screen state is screen-off; the cycle module 730 is configured to, when a window refresh request of an application is monitored, respond to the window refresh request and return to the monitoring module if a current screen state is off, and a refresh frequency of a window does not reach a first preset frequency in a current window refresh cycle flow, and if the current screen state is off, end the current cycle flow and enter a next window refresh cycle flow when the refresh frequency of the window reaches the first preset frequency in the current window refresh cycle flow.
The window refreshing method and device provided by the embodiment of the application respond to the window refreshing request in the window refreshing cycle flow, and set the allowed maximum refreshing times corresponding to the screen-off and the screen-on respectively. Therefore, when an application frequently requests for refreshing, the corresponding maximum refreshing time set in the window refreshing cycle flow can be reached quickly, so that the current window refreshing cycle flow exits, the next window refreshing cycle flow enters, and through various judgment steps and processing steps in the window refreshing cycle flow and the exit and re-entry of the window refreshing cycle flow, the receiving and response frequency of the window refreshing request is reduced, the power consumption of the system is reduced, and the message processing of the system, such as the delay of the handling, the jamming or the message processing of the screen lighting of the android system, is avoided.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
Referring to fig. 10, a block diagram of an electronic device 800 according to an embodiment of the present disclosure is shown. The electronic device 800 may be a mobile phone, a tablet computer, a computer, an electronic book, or other electronic devices capable of refreshing a window and running an application program. The electronic device includes a processor 810 and a memory 820 coupled to the processor, the memory storing instructions that, when executed by the processor, perform the method described in one or more embodiments above.
Processor 810 may include one or more processing cores. The processor 810 interfaces with various interfaces and circuitry throughout the electronic device 800 to perform various functions and process data of the electronic device 800 by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 820 and invoking data stored in the memory 820. Alternatively, the processor 810 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 810 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 810, but may be implemented by a communication chip.
The Memory 820 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 820 may be used to store instructions, programs, code, sets of codes, or sets of instructions, such as instructions or sets of codes for implementing the window refresh methods provided by embodiments of the present application. The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The data storage area can also store data (such as a phone book, audio and video data, chatting record data) and the like created by the electronic equipment in use.
Referring to fig. 11, a block diagram of a computer-readable storage medium provided in an embodiment of the present application is shown. The computer-readable storage medium 900 has stored therein program code that can be called by a processor to execute the methods described in the above-described method embodiments.
The computer-readable storage medium 900 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 900 includes a non-volatile computer-readable storage medium. The computer readable storage medium 900 has storage space for program code 910 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 910 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (9)

1. A window refresh method, the method comprising:
monitoring a window refreshing request of an application program in the current window refreshing circulation flow;
when a window refreshing request of an application program is monitored, responding to the window refreshing request;
if the current screen state is screen-off, judging whether the window refreshing frequency reaches a first preset frequency in the current window refreshing circulation flow,
if not, returning to the step of monitoring the window refresh request of the application program,
if the window refreshing time reaches the first preset time in the continuous window refreshing cycle flows, ending the current cycle flow, and entering the next window refreshing cycle flow after waiting for the second preset time,
if the current screen state is bright, judging whether the window refreshing frequency reaches a second preset frequency in the current window refreshing circulation flow,
if not, returning to the step of monitoring the window refresh request of the application program,
if yes, ending the current cycle process, and entering a next window refreshing cycle process, wherein the second preset times are greater than the first preset times;
the interval duration of the window refreshing request of the application program is less than or equal to the processing duration of one refreshing request.
2. The method of claim 1, wherein the first predetermined number of times is 1.
3. The method according to claim 1, wherein after listening to the window refresh request of the application program and responding to the window refresh request, further comprising:
and counting the window refreshing times in the current window refreshing circulation flow.
4. The method of claim 1, further comprising:
if the window refreshing request of the application program is not monitored within the first preset time, the current cycle flow is ended, and the next window refreshing cycle flow is entered.
5. A method for window refresh, the method comprising:
monitoring a window refreshing request of an application program in the current window refreshing circulation flow;
when monitoring the window refreshing request of the application program, if the current screen state is screen off, judging whether the refreshing frequency of the window reaches a first preset frequency in the current window refreshing circulation flow,
if not, responding the window refresh request and returning to the step of monitoring the window refresh request of the application program,
if the window refreshing time reaches the first preset time in the continuous window refreshing cycle flows, ending the current cycle flow, and entering the next window refreshing cycle flow after waiting for the second preset time,
if the current screen state is bright, judging whether the window refreshing frequency reaches a second preset frequency in the current window refreshing circulation flow,
if not, returning to the step of monitoring the window refresh request of the application program,
if yes, ending the current cycle process, and entering a next window refreshing cycle process, wherein the second preset times are greater than the first preset times;
the interval duration of the window refreshing request of the application program is less than or equal to the processing duration of one refreshing request.
6. A window refreshing apparatus, the apparatus comprising:
the monitoring module is used for monitoring a window refreshing request of an application program in the current window refreshing cycle flow;
the response module is used for responding to the window refreshing request when the window refreshing request of the application program is monitored;
a screen-off judging module for judging whether the window refreshing times reach a first preset times in the current window refreshing cycle flow if the current screen state is screen-off,
a circulation module for returning to the monitoring module when the refreshing frequency of the window does not reach a first preset frequency in the current window refreshing circulation flow if the current screen state is off,
if the current screen state is screen off, the window refreshing frequency in the current window refreshing cycle flow reaches a first preset frequency, and under the condition that the window refreshing frequency in the continuous window refreshing cycle flows reaches the first preset frequency, the current cycle flow is ended, and after waiting for a second preset time, the next window refreshing cycle flow is entered,
if the current screen state is bright, judging whether the window refreshing frequency reaches a second preset frequency in the current window refreshing circulation flow,
if not, returning to the step of monitoring the window refresh request of the application program,
if yes, ending the current cycle process, and entering a next window refreshing cycle process, wherein the second preset times are greater than the first preset times;
the interval duration of the window refreshing request of the application program is less than or equal to the processing duration of one refreshing request.
7. A window refreshing apparatus, the apparatus comprising:
the monitoring module is used for monitoring a window refreshing request of an application program in the current window refreshing cycle flow;
a screen-off judging module, which is used for judging whether the window refreshing times reach a first preset time in the current window refreshing circulation flow if the current screen state is screen-off when monitoring the window refreshing request of the application program,
a cycle module, configured to respond to a window refresh request and return to the monitoring module when a window refresh request of an application program is monitored and if a current screen state is off, and the refresh frequency of a window does not reach a first preset frequency in a current window refresh cycle flow,
if the current screen state is screen off, the window refreshing frequency in the current window refreshing cycle flow reaches a first preset frequency, and under the condition that the window refreshing frequency in the continuous window refreshing cycle flows reaches the first preset frequency, the current cycle flow is ended, and after waiting for a second preset time, the next window refreshing cycle flow is entered,
if the current screen state is bright, judging whether the window refreshing frequency reaches a second preset frequency in the current window refreshing circulation flow,
if not, returning to the step of monitoring the window refresh request of the application program,
if yes, ending the current cycle process, and entering a next window refreshing cycle process, wherein the second preset times are greater than the first preset times;
the interval duration of the window refreshing request of the application program is less than or equal to the processing duration of one refreshing request.
8. An electronic device comprising a memory coupled to the processor and a processor, the memory storing instructions that, when executed by the processor, perform the method of any of claims 1-4 or the instructions, when executed by the processor, perform the method of claim 5.
9. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1 to 4, or to perform the method according to claim 5.
CN201910060021.5A 2019-01-22 2019-01-22 Window refreshing method and device, electronic equipment and storage medium Active CN109725978B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910060021.5A CN109725978B (en) 2019-01-22 2019-01-22 Window refreshing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910060021.5A CN109725978B (en) 2019-01-22 2019-01-22 Window refreshing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109725978A CN109725978A (en) 2019-05-07
CN109725978B true CN109725978B (en) 2022-06-17

Family

ID=66298506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910060021.5A Active CN109725978B (en) 2019-01-22 2019-01-22 Window refreshing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109725978B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106383711A (en) * 2016-09-19 2017-02-08 深圳市茁壮网络股份有限公司 Screen refreshing system, method and apparatus
CN107168508A (en) * 2017-04-26 2017-09-15 上海掌门科技有限公司 A kind of normal display information implementation method of low-power consumption and device
CN108337363A (en) * 2017-12-26 2018-07-27 努比亚技术有限公司 A kind of terminal puts out screen display control method, terminal

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7676585B1 (en) * 2004-04-29 2010-03-09 Cisco Technology, Inc. System and method for dynamically adjusting a refresh interval
JP4991493B2 (en) * 2007-11-16 2012-08-01 株式会社リコー Electronic device, power mode switching method, program, and computer-readable recording medium
US9213226B2 (en) * 2011-10-19 2015-12-15 International Business Machines Corporation Multidirectional display system
CN102547936A (en) * 2011-12-23 2012-07-04 华为终端有限公司 Energy-saving method, energy-saving device and communication terminal
US20150082255A1 (en) * 2013-09-16 2015-03-19 Motorola Mobility Llc Methods and apparatus for displaying notification information
CN104503564B (en) * 2014-12-31 2017-05-03 中科创达软件股份有限公司 Control method and device for picture refreshing of application program
CN105955777A (en) * 2016-05-03 2016-09-21 网易(杭州)网络有限公司 User interface refreshing method and device
CN106250085A (en) * 2016-07-29 2016-12-21 北京小米移动软件有限公司 Refresh rate method of adjustment and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106383711A (en) * 2016-09-19 2017-02-08 深圳市茁壮网络股份有限公司 Screen refreshing system, method and apparatus
CN107168508A (en) * 2017-04-26 2017-09-15 上海掌门科技有限公司 A kind of normal display information implementation method of low-power consumption and device
CN108337363A (en) * 2017-12-26 2018-07-27 努比亚技术有限公司 A kind of terminal puts out screen display control method, terminal

Also Published As

Publication number Publication date
CN109725978A (en) 2019-05-07

Similar Documents

Publication Publication Date Title
US9336070B1 (en) Throttling of application access to resources
JP6370498B2 (en) Method and system for operating state coordination among multiple SOCs in a computing device
CN107783803B (en) System optimization method and device of intelligent terminal, storage medium and intelligent terminal
CN104252389A (en) Application operation method, system and application
JP2003050571A (en) Method and apparatus for updating display frame buffer
US11662803B2 (en) Control method, apparatus, and electronic device
WO2022222721A1 (en) Computational resource scheduling method and apparatus
CN114748873B (en) Interface rendering method, device, equipment and storage medium
CN111240621B (en) Method and device for controlling display frequency of display screen and electronic equipment
US20170160778A1 (en) Method and device for monitoring power-consuming applications, user terminal, computer program and storage medium
CN111752632A (en) Control method and device of mobile terminal, mobile terminal and storage medium
CN115080158B (en) Interface display method, device, terminal equipment and computer readable storage medium
WO2024078494A1 (en) Thread management method and apparatus, electronic device, and storage medium
US8543854B1 (en) Method and system for power configuration
CN109725978B (en) Window refreshing method and device, electronic equipment and storage medium
CN111767136B (en) Process management method, terminal and device with storage function
CN117319376A (en) File downloading control method and device, electronic equipment and storage medium
WO2023130866A1 (en) Method and apparatus for switching operating system, and electronic device and storage medium
CN115469816B (en) Method, device, equipment and storage medium for switching reading and writing of memory
US20220083416A1 (en) Multi-thread exit method and mobile terminal
CN111639004B (en) User interface card pause monitoring method and device and storage medium
CN110737320B (en) Power consumption detection method and device, electronic equipment and storage medium
US11303595B2 (en) Method and device for displaying text and video in two threads
CN113805954A (en) Screen saver display method, electronic device, and computer storage medium
CN112988105A (en) Playing state control method and device, electronic equipment and storage medium

Legal Events

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