Application processing method and related device
By setting thresholds in electronic devices to monitor the number of layers and stopping the application that occupies more layers, the display abnormality caused by layer leakage is solved, and the stability and user experience of the device are improved.
Patent Information
- Application Number
- CN202311855290.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2043-12-28
AI Technical Summary
Electronic devices are prone to display abnormalities when running multiple applications, such as splash screen, screen sweeping, restarting or lag, which is mainly due to the excessive number of layers, which leads to insufficient memory.
By setting a threshold to monitor the number of layers, when the threshold is reached or exceeded, the application that occupies more layers is stopped to free up memory and reduce the probability of layer leakage.
It effectively reduces the probability of the layer occupies memory, reduces the occurrence of display exceptions, and improves the user experience.
Smart Images

Figure CN120276622A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of terminals, and in particular, to an application processing method and related devices. Background Art
[0002] With the development of terminal technology, more and more applications can be supported by electronic devices. Currently, when an electronic device runs multiple applications, problems such as abnormal display may occur. For example, the electronic device may experience problems such as screen flashing, screen distortion, restarting, or freezing. Summary of the Invention
[0003] Embodiments of this application provide an application processing method and related devices, which are applied to the technical field of terminals and are beneficial to reducing the probability of abnormal display.
[0004] In a first aspect, embodiments of this application provide an application processing method that can be applied to an electronic device. The method includes: at a first moment, a first application runs in the foreground of the electronic device, a second application and a third application run in the background of the electronic device, and the number of layers in the electronic device is a first number, where the first number is less than or equal to a first threshold; at a second moment, the first application runs in the foreground of the electronic device, the number of layers in the electronic device is a second number, where the second number is greater than the first threshold, the second application running in the background is stopped, and the third application running in the background is maintained, and the number of layers occupied by the third application in the layers of the electronic device is less than the number of layers occupied by the second application in the layers of the electronic device; where the second moment is later than the first moment, and between the first moment and the second moment, the first application continuously runs in the foreground, and the second application and the third application continuously run in the background.
[0005] The first application, the second application, and the third application may be three different applications deployed in the electronic device. In some implementations, the first application may be a video application, the second application may be a chat application, and the third application may be a gallery application. In other implementations, the first application may be a calendar application, the second application may be a video application, and the third application may be a chat application. Embodiments of this application do not limit the first application, the second application, and the third application.
[0006] The first threshold is used to represent a critical value. When the number of layers is greater than the first threshold, it indicates that the number of layers needs to be controlled. When the number of layers is less than or equal to the first threshold, it indicates that the number of layers does not reach the condition that needs to be controlled.
[0007] At the first moment, the number of layers in the electronic device is the first number, and the first number is less than or equal to the first threshold, indicating that the number of layers does not reach the condition that needs to be controlled. At the second moment, the number of layers in the electronic device is the second number, and the second number is greater than the first threshold, indicating that the number of layers needs to be controlled, then the electronic device can stop the application that occupies more layer numbers. It can be understood that the reason why the second number is greater than the first threshold at the second moment is that the first application is running in the foreground and can continuously create layers, making the number of layers in the electronic device greater than the first threshold and reaching the condition that needs to be controlled.
[0008] In the embodiment of the present application, when the number of layers in the electronic device is greater than the first threshold, it can be called that layer leakage occurs. The first threshold can refer to Figure 5 M in it. In one example, M can be 3500.
[0009] The first application is running in the foreground. If this application is stopped, it will affect the user's use. Among the applications running in the background, the number of layers occupied by the third application in the layers of the electronic device is less than the number of layers occupied by the second application in the layers of the electronic device, indicating that the second application occupies more layer numbers. Therefore, the electronic device stops the second application from running in the background.
[0010] It can be understood that at the second moment, if there are other applications running in the background of the electronic device in addition to the second application and the third application, and there are some applications among the other applications whose number of layers occupied in the layers of the electronic device is greater than or equal to less than the number of layers occupied by the second application in the layers of the electronic device, the electronic device can also stop running these applications.
[0011] In this way, when the number of layers in the electronic device is greater than the first threshold, the second application occupies more layer numbers in the layers of the electronic device, and the probability that the second application abnormally adds layers or cannot normally release layers is relatively high. Stopping the operation of the second application can release the memory occupied by the second application, which is beneficial to reducing the probability of memory shortage and further beneficial to reducing the probability of display abnormality.
[0012] In a possible implementation manner, the number of layers occupied by the second application in the layers of the electronic device is greater than the second threshold, and the number of layers occupied by the third application in the layers of the electronic device is less than the second threshold, and the second threshold is less than the first threshold.
[0013] The second threshold is used to represent a critical value. When the number of layers occupied by an application in the layers of an electronic device is greater than the second threshold, it indicates that the number of layers occupied by the application in the layers of the electronic device is relatively large, and the application needs to be stopped. When the number of layers occupied by the application in the layers of the electronic device is less than or equal to the second threshold, it indicates that the number of layers occupied by the application in the layers of the electronic device is relatively small, and the application does not need to be stopped.
[0014] In an embodiment of the present application, the second threshold may refer to Figure 5 i in. In one example, i may be 50.
[0015] The number of layers occupied by the second application in the layers of the electronic device is greater than the second threshold, and the number of layers occupied by the third application in the layers of the electronic device is less than the second threshold. Therefore, the electronic device can stop the second application from running in the background and maintain the third application running in the background. In this way, it is beneficial to obtain the application that needs to be stopped from running.
[0016] In a possible implementation manner, the number of layers occupied by the first application in the layers of the electronic device is greater than or equal to the number of layers occupied by the second application in the layers of the electronic device; the method further includes: when the first application switches to running in the background, stopping the first application.
[0017] If the number of layers occupied by the first application in the layers of the electronic device is greater than or equal to the number of layers occupied by the second application in the layers of the electronic device, it indicates that the first application should also be stopped. In order not to affect the user experience, the first application can be stopped when it switches to running in the background. In this way, the probability of display anomalies can be reduced while the probability of affecting the user experience is reduced.
[0018] In a possible implementation manner, the layers in the electronic device include a first layer, and the method further includes: determining whether the number of the first layers in the electronic device is greater than a third threshold, where the third threshold is less than or equal to the first threshold; in the case where the number of the first layers in the electronic device is greater than the third threshold, obtaining a fourth application, where the number of the first layers occupied by the fourth application in the first layer of the electronic device is greater than a fourth threshold, and the fourth threshold is less than the third threshold; determining whether the fourth application is running in the background; and in the case where the fourth application is running in the background, stopping the fourth application.
[0019] The first layer is used to represent a layer that occupies more memory than a threshold in the layers. For example, the first layer may be one or more of a buffer layer (BufferLayer), a PictureLayer (image type Layer), and a TextureLayer (video type Layer).
[0020] The third threshold is used to represent a critical value. When the number of the first layers is greater than the third threshold, it indicates that the number of the first layers needs to be controlled. When the number of the first layers is less than or equal to the third threshold, it indicates that the number of the first layers does not reach the condition that needs to be controlled.
[0021] The fourth threshold is used to represent a critical value. When the occupied number in the first layer of the electronic device is greater than the fourth threshold, it indicates that the occupied number in the first layer of the electronic device is relatively large and the application needs to be stopped. When the occupied number in the first layer of the electronic device is less than or equal to the fourth threshold, it indicates that the occupied number in the first layer of the electronic device is relatively small and the application does not need to be stopped.
[0022] In the embodiment of the present application, the third threshold can refer to Figure 5 N in Figure 5 and the fourth threshold can refer to j in
[0023] The fourth application may include one application or multiple applications, and the embodiment of the present application does not limit this. The fourth application may run in the foreground or in the background, and the embodiment of the present application does not limit this.
[0024] When the number of the first layers in the electronic device is greater than the third threshold, the occupied number of the first layers of the fourth application in the first layer of the electronic device is greater than the fourth threshold, and the fourth application runs in the background, stop running the fourth application.
[0025] In this way, when the number of the first layers in the electronic device is greater than the third threshold, the occupied number of the first layers of the fourth application in the layers of the electronic device is relatively large, and the probability that the fourth application abnormally adds the first layer or cannot normally release the first layer is relatively high. Stopping the operation of the fourth application can release the memory occupied by the fourth application, which is beneficial to reducing the probability of out-of-memory and further beneficial to reducing the probability of display anomalies.
[0026] In a possible implementation manner, the above method further includes: when the fourth application does not run in the background, stop running the fourth application when the fourth application switches to the background. The fourth application switching to the background may indicate that the fourth application has no visible window. In this way, when the fourth application switches to the background, stopping the operation of the fourth application can reduce the probability of display anomalies and is beneficial to reducing the probability of affecting the user experience.
[0027] In a possible implementation manner, determining whether the number of the first layers in the electronic device is greater than the third threshold includes: when the number of the layers in the electronic device is less than or equal to the first threshold, determining whether the number of the first layers in the electronic device is greater than the third threshold.
[0028] In the embodiments of the present application, this example can refer to Figure 6 , the number of layers can refer to the total number of layers, the first threshold can refer to M, the number of the first layer can refer to the number of buffer layers, and the third threshold can refer to N.
[0029] In this way, determining the number of layers based on the number of layers does not need to be controlled. Judging the number of the first layer to determine whether to control the number of the first layer, and performing multi-level judgment is beneficial to better controlling the number of layers, and further beneficial to reducing the probability that the layers occupy more memory.
[0030] In a possible implementation manner, the above method further includes: judging whether the number of windows in the electronic device is greater than a fifth threshold; when the number of windows in the electronic device is greater than the fifth threshold, obtaining a fifth application, and the number of windows occupied by the fifth application in the windows of the electronic device is greater than a sixth threshold, and the sixth threshold is less than the fifth threshold; judging whether the fifth application is running in the background; when the fifth application is running in the background, stopping the fifth application.
[0031] The fifth threshold is used to represent a critical value. When the number of windows in the electronic device is greater than the fifth threshold, it indicates that the number of windows in the electronic device needs to be controlled. When the number of windows in the electronic device is less than or equal to the fifth threshold, it indicates that the number of windows in the electronic device does not reach the condition that needs to be controlled. It should be noted that the window is a step before creating a layer. If the number of windows needs to be controlled, it can indicate that the number of layers needs to be controlled. If the number of windows does not need to be controlled, it can indicate that the number of layers does not need to be controlled.
[0032] The sixth threshold is used to represent a critical value. When the number of occupied by the application in the windows of the electronic device is greater than the sixth threshold, it indicates that the number of occupied by the application in the windows of the electronic device is relatively large and the application needs to be stopped. When the number of occupied by the application in the windows of the electronic device is less than or equal to the sixth threshold, it indicates that the number of occupied by the application in the windows of the electronic device is relatively small and the application does not need to be stopped.
[0033] In the embodiments of the present application, the fifth threshold can refer to Figure 5 O in Figure 5 , the sixth threshold can refer to
[0034] The fifth application can include one application or multiple applications, and the embodiments of the present application do not limit this. The fifth application can run in the foreground or in the background, and the embodiments of the present application do not limit this.
[0035] When the number of windows in the electronic device is greater than a fifth threshold, the number of windows occupied by a fifth application in the windows of the electronic device is greater than a sixth threshold, and the fifth application is running in the background, stop running the fifth application.
[0036] In this way, when the number of windows in the electronic device is greater than the fifth threshold, the fifth application occupies a relatively large number of windows in the windows of the electronic device, and the probability of an abnormality in the fifth application is relatively high. Stopping the operation of the fifth application can release the memory occupied by the fifth application, which is beneficial to reducing the probability of memory shortage and further beneficial to reducing the probability of display abnormality.
[0037] In a possible implementation manner, the method further includes: when the fifth application is not running in the background, stop running the fifth application when the fifth application switches to the background. In this way, when the fifth application switches to the background, stopping the operation of the fifth application can reduce the probability of display abnormality and is beneficial to reducing the probability of affecting the user experience.
[0038] In a possible implementation manner, the layers in the electronic device include a first layer. Determining whether the number of windows in the electronic device is greater than a fifth threshold includes: when the number of layers in the electronic device is less than or equal to a first threshold and the number of the first layer in the electronic device is less than or equal to a third threshold, determining whether the number of windows in the electronic device is greater than the fifth threshold, where the third threshold is less than or equal to the first threshold.
[0039] In the embodiments of the present application, this example can refer to Figure 6 , the number of layers can refer to the total number of layers, the first threshold can refer to M, the number of the first layer can refer to the number of buffer layers, the third threshold can refer to N, the number of windows can refer to the number of application windows, and the fifth threshold can refer to O.
[0040] In this way, it is not necessary to control the number of layers determined based on the number of layers, and it is not necessary to control the number of layers determined based on the number of the first layer. Judging the number of windows to determine whether to control the number of windows and performing multi-level judgment is beneficial to better controlling the number of windows, and further achieving the control of the number of layers and realizing the reduction of the probability that the layers occupy too much memory.
[0041] In a possible implementation manner, the above method further includes: determining whether the number of surfaces in the electronic device is greater than a seventh threshold; when the number of surfaces in the electronic device is greater than the seventh threshold, obtaining a sixth application, where the number of surfaces occupied by the sixth application in the surfaces of the electronic device is greater than an eighth threshold, and the eighth threshold is less than the seventh threshold; determining whether the sixth application is running in the background; when the sixth application is running in the background, stop running the sixth application.
[0042] The seventh threshold is used to represent a critical value. When the number of surfaces in the electronic device is greater than the seventh threshold, it indicates that the number of surfaces in the electronic device needs to be controlled. When the number of surfaces in the electronic device is less than or equal to the seventh threshold, it indicates that the number of surfaces in the electronic device does not reach the condition that needs to be controlled. It should be noted that surface is a step before creating a layer. If the number of surfaces needs to be controlled, it can indicate that the number of layers needs to be controlled. If the number of surfaces does not need to be controlled, it can indicate that the number of surfaces does not need to be controlled.
[0043] The eighth threshold is used to represent a critical value. When the number of surfaces occupied by an application in the electronic device is greater than the eighth threshold, it indicates that the number of surfaces occupied by the application in the electronic device is relatively large and the application needs to be stopped. When the number of surfaces occupied by an application in the electronic device is less than or equal to the eighth threshold, it indicates that the number of surfaces occupied by the application in the electronic device is relatively small and the application does not need to be stopped.
[0044] In the embodiment of the present application, the seventh threshold can refer to Figure 5 P in Figure 5 and the eighth threshold can refer to m in
[0045] The sixth application may include one application or multiple applications, and the embodiment of the present application does not limit this. The sixth application may run in the foreground or in the background, and the embodiment of the present application does not limit this.
[0046] When the number of surfaces in the electronic device is greater than the seventh threshold, the number of surfaces occupied by the sixth application in the surfaces of the electronic device is greater than the eighth threshold, and the sixth application is running in the background, stop running the sixth application.
[0047] In this way, when the number of surfaces in the electronic device is greater than the seventh threshold, the number of surfaces occupied by the sixth application in the surfaces of the electronic device is relatively large, and the probability of the sixth application being abnormal is relatively high. Stopping the operation of the sixth application can release the memory occupied by the sixth application, which is beneficial to reducing the probability of out-of-memory and further beneficial to reducing the probability of display anomalies.
[0048] In a possible implementation, the method further includes: when the sixth application switches to running in the background while the sixth application is not running in the background, stop running the sixth application. In this way, when the sixth application switches to running in the background, stopping the sixth application can reduce the probability of display anomalies and is conducive to reducing the probability of affecting the user experience.
[0049] In a possible implementation, the layers in the electronic device include a first layer. Determining whether the number of surfaces in the electronic device is greater than a seventh threshold includes: when the number of layers in the electronic device is less than or equal to a first threshold, and the number of first layers in the electronic device is less than or equal to a third threshold, determining whether the number of surfaces in the electronic device is greater than the seventh threshold, where the third threshold is less than or equal to the first threshold.
[0050] In the embodiments of the present application, this example can be referred to Figure 6 , the number of layers can refer to the total number of layers, the first threshold can refer to M, the number of first layers can refer to the number of buffer layers, the third threshold can refer to N, the number of surfaces can refer to the number of interfaces, and the seventh threshold can refer to m.
[0051] In this way, it is not necessary to control the number of layers determined based on the number of layers, it is not necessary to control the number of layers determined based on the number of first layers, and the number of surfaces is judged to determine whether to control the number of surfaces, and multi-level judgment is performed, which is conducive to better controlling the number of surfaces, and then achieving the control of the number of layers, and realizing the reduction of the probability that the layers occupy more memory.
[0052] In a possible implementation, before the second quantity is greater than the first threshold, the method further includes: determining whether the number of layers in the electronic device is greater than a ninth threshold, where the ninth threshold is less than or equal to the first threshold; when the number of layers in the electronic device is greater than the ninth threshold, output an alarm message, and the alarm message is used to indicate that the number of layers is abnormal.
[0053] The ninth threshold is used to represent a critical value. When the number of layers is greater than the ninth threshold, it means that the condition for the number of layers to be abnormal is met. When the number of layers is less than or equal to the ninth threshold, it means that the condition for the number of layers to be abnormal is not met.
[0054] If the first threshold is the same as the ninth threshold, for example, both the first threshold and the ninth threshold are 3500, then the number of layers can be controlled while giving an alarm. In this way, the implementation is simple. If the first threshold is different from the ninth threshold, for example, the first threshold is 3000 and the second threshold is 3500, then after giving an alarm, the layers can continue to be monitored, and when the control condition is reached, the number of layers is controlled. In this way, the flexibility is stronger.
[0055] In this way, when the number of layers is greater than the ninth threshold, it indicates that there may be an abnormality in the layers, and an alarm message can be output to facilitate the monitoring and control of the layers.
[0056] In a possible implementation, determining whether the number of layers in the electronic device is greater than the ninth threshold includes: periodically polling to determine whether the number of layers in the electronic device is greater than the ninth threshold, or, when the number of layers in the electronic device is greater than the tenth threshold, determining whether the number of layers in the electronic device is greater than the ninth threshold, where the tenth threshold is less than the ninth threshold.
[0057] The polling time can be 3 minutes, 5 minutes, 6 minutes, etc., and the embodiments of the present application do not limit this. In some implementations, the electronic device can determine whether the number of layers in the electronic device is greater than the ninth threshold every 3 minutes.
[0058] In the embodiments of the present application, periodically determining whether the number of layers in the electronic device is greater than the ninth threshold can refer to Figure 4 the periodic polling for layer leakage in [reference]. In this way, periodic determination is beneficial to power saving compared to real-time determination.
[0059] The tenth threshold is used to represent the critical value. When the number of layers is greater than the tenth threshold, it indicates that the condition for monitoring the number of layers is met. When the number of layers is less than or equal to the tenth threshold, it indicates that the condition for monitoring the number of layers is not met.
[0060] When the number of layers in the electronic device is greater than the tenth threshold, the electronic device can determine in real time whether the number of layers in the electronic device is greater than the ninth threshold. In the embodiments of the present application, the tenth threshold can refer to X, and when the number of layers is greater than X, it is detected whether the layer leaks.
[0061] In this way, real-time determination when the number of layers in the electronic device is greater than the tenth threshold is beneficial to power saving compared to real-time determination without any conditions.
[0062] In a possible implementation, the layers in the electronic device include a first layer. Before the second quantity is greater than the first threshold, the method further includes: determining whether the number of the first layers in the electronic device is greater than the eleventh threshold, where the eleventh threshold is less than or equal to the first threshold; and when the number of the first layers in the electronic device is greater than the eleventh threshold, outputting an alarm message, where the alarm message is used to indicate that the number of layers is abnormal.
[0063] The eleventh threshold is used to represent the critical value. When the number of the first layers is greater than the eleventh threshold, it indicates that the condition for the number of layers being abnormal is met. When the number of the first layers is less than or equal to the eleventh threshold, it indicates that the condition for the number of layers being abnormal is not met.
[0064] In this way, when the number of the first layers is greater than the eleventh threshold, it indicates the possibility of abnormal layers, and then an alarm message can be output to facilitate the monitoring and control of the layers.
[0065] In a possible implementation manner, determining whether the number of the first layers in the electronic device is greater than the eleventh threshold includes: periodically polling to determine whether the number of the first layers in the electronic device is greater than the eleventh threshold, or, when the number of layers in the electronic device is greater than the tenth threshold, determining whether the number of the first layers in the electronic device is greater than the eleventh threshold. In this way, it is beneficial to save power consumption.
[0066] In a second aspect, an application processing apparatus is provided in an embodiment of the present application. The application processing apparatus may be an electronic device, or a chip or a chip system inside the electronic device. The application processing apparatus may include a processing unit. When the application processing apparatus is an electronic device, the processing unit may be a processor. The application processing apparatus may further include a storage unit, and the storage unit may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to enable the electronic device to implement an application processing method described in the first aspect or any one of the possible implementation manners of the first aspect. When the application processing apparatus is a chip or a chip system inside the electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to enable the electronic device to implement an application processing method described in the first aspect or any one of the possible implementation manners of the first aspect. The storage unit may be a storage unit inside the chip (for example, a register, a cache, etc.), or a storage unit outside the chip and inside the electronic device (for example, a read-only memory, a random access memory, etc.).
[0067] Exemplarily, the processing unit is configured to, at a first moment, run a first application in the foreground of the application processing apparatus, run a second application and a third application in the background of the application processing apparatus, and the number of layers in the application processing apparatus is a first number, and the first number is less than or equal to the first threshold; at a second moment, run the first application in the foreground of the application processing apparatus, the number of layers in the application processing apparatus is a second number, the second number is greater than the first threshold, stop running the second application in the background, and maintain running the third application in the background, and the number of layers occupied by the third application in the layers of the application processing apparatus is less than the number of layers occupied by the second application in the layers of the application processing apparatus; wherein, the second moment is later than the first moment, and between the first moment and the second moment, the first application continuously runs in the foreground, and the second application and the third application continuously run in the background.
[0068] In a possible implementation, the number of layers occupied by the second application in the layers of the electronic device is greater than a second threshold, the number of layers occupied by the third application in the layers of the electronic device is less than the second threshold, and the second threshold is less than the first threshold.
[0069] In a possible implementation, the number of layers occupied by the first application in the layers of the electronic device is greater than or equal to the number of layers occupied by the second application in the layers of the electronic device; the processing unit is further configured to: when the first application switches to running in the background, stop running the first application.
[0070] In a possible implementation, the layers in the electronic device include a first layer, and the processing unit is further configured to: determine whether the number of first layers in the electronic device is greater than a third threshold, where the third threshold is less than or equal to the first threshold; when the number of first layers in the electronic device is greater than the third threshold, obtain a fourth application, where the number of first layers occupied by the fourth application in the first layer of the electronic device is greater than a fourth threshold, and the fourth threshold is less than the third threshold; determine whether the fourth application is running in the background; when the fourth application is running in the background, stop running the fourth application.
[0071] In a possible implementation, the above-mentioned processing unit is further configured to: when the fourth application is not running in the background, stop running the fourth application when the fourth application switches to running in the background.
[0072] In a possible implementation, the processing unit is further configured to: when the number of layers in the electronic device is less than or equal to the first threshold, determine whether the number of first layers in the electronic device is greater than the third threshold.
[0073] In a possible implementation, the above-mentioned processing unit is further configured to: determine whether the number of windows in the electronic device is greater than a fifth threshold; when the number of windows in the electronic device is greater than the fifth threshold, obtain a fifth application, where the number of windows occupied by the fifth application in the windows of the electronic device is greater than a sixth threshold, and the sixth threshold is less than the fifth threshold; determine whether the fifth application is running in the background; when the fifth application is running in the background, stop running the fifth application.
[0074] In a possible implementation, the processing unit is further configured to: when the fifth application is not running in the background, stop running the fifth application when the fifth application switches to running in the background.
[0075] In a possible implementation, the layers in the electronic device include a first layer, and the processing unit is further configured to: when the number of layers in the electronic device is less than or equal to the first threshold and the number of first layers in the electronic device is less than or equal to the third threshold, determine whether the number of windows in the electronic device is greater than the fifth threshold, where the third threshold is less than or equal to the first threshold.
[0076] In a possible implementation, the above processing unit is further configured to: determine whether the number of surfaces in the electronic device is greater than a seventh threshold; when the number of surfaces in the electronic device is greater than the seventh threshold, obtain a sixth application, where the number of surfaces occupied by the sixth application in the surfaces of the electronic device is greater than an eighth threshold, and the eighth threshold is less than the seventh threshold; determine whether the sixth application is running in the background; and when the sixth application is running in the background, stop running the sixth application.
[0077] In a possible implementation, the processing unit is further configured to: when the sixth application is not running in the background, stop running the sixth application when the sixth application switches to running in the background.
[0078] In a possible implementation, the layers in the electronic device include a first layer, and the processing unit is further configured to: when the number of layers in the electronic device is less than or equal to a first threshold and the number of first layers in the electronic device is less than or equal to a third threshold, determine whether the number of surfaces in the electronic device is greater than the seventh threshold, and the third threshold is less than or equal to the first threshold.
[0079] In a possible implementation, before the second quantity is greater than the first threshold, the processing unit is further configured to: determine whether the number of layers in the electronic device is greater than a ninth threshold, and the ninth threshold is less than or equal to the first threshold; when the number of layers in the electronic device is greater than the ninth threshold, output an alarm message, where the alarm message is used to indicate that the number of layers is abnormal.
[0080] In a possible implementation, the processing unit is further configured to: periodically poll to determine whether the number of layers in the electronic device is greater than the ninth threshold, or, when the number of layers in the electronic device is greater than a tenth threshold, determine whether the number of layers in the electronic device is greater than the ninth threshold, and the tenth threshold is less than the ninth threshold.
[0081] In a possible implementation, the layers in the electronic device include a first layer, and before the second quantity is greater than the first threshold, the processing unit is further configured to: determine whether the number of first layers in the electronic device is greater than an eleventh threshold, and the eleventh threshold is less than or equal to the first threshold; when the number of first layers in the electronic device is greater than the eleventh threshold, output an alarm message, where the alarm message is used to indicate that the number of layers is abnormal.
[0082] In a possible implementation, the processing unit is further configured to: periodically poll to determine whether the number of first layers in the electronic device is greater than the eleventh threshold, or, when the number of layers in the electronic device is greater than the tenth threshold, determine whether the number of first layers in the electronic device is greater than the eleventh threshold.
[0083] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. The memory is used to store code instructions, and the processor is used to run the code instructions to execute the method described in the first aspect or any possible implementation manner of the first aspect.
[0084] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction runs on a computer, the computer is enabled to execute the method described in the first aspect or any possible implementation manner of the first aspect.
[0085] In a fifth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program runs on a computer, the computer is enabled to execute the method described in the first aspect or any possible implementation manner of the first aspect.
[0086] In a sixth aspect, the present application provides a chip or a chip system. The chip or the chip system includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected by a line. The at least one processor is used to run a computer program or instruction to execute the method described in the first aspect or any possible implementation manner of the first aspect. Among them, the communication interface in the chip can be an input / output interface, a pin, a circuit, etc.
[0087] In a possible implementation, the chip or the chip system described above in the present application further includes at least one memory, and instructions are stored in the at least one memory. The memory can be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (such as a read-only memory, a random access memory, etc.).
[0088] It should be understood that the second aspect to the sixth aspect of the present application correspond to the technical solutions of the first aspect of the present application. The beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 It is a schematic diagram of the relationship among an App, a WMS, and SurfaceFlinger;
[0090] Figure 2 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;
[0091] Figure 3 It is a schematic diagram of the software architecture of an electronic device provided by an embodiment of the present application;
[0092] Figure 4Schematic flowchart of an application processing method provided by an embodiment of the present application;
[0093] Figure 5 Schematic diagram of an application that needs to be controlled obtained by a WMS provided by an embodiment of the present application;
[0094] Figure 6 Another schematic diagram of an application that needs to be controlled obtained by a WMS provided by an embodiment of the present application;
[0095] Figure 7 Schematic diagram of a processing method for an application in a control processing list provided by an embodiment of the present application;
[0096] Figure 8 Another schematic flowchart of an application processing method provided by an embodiment of the present application;
[0097] Figure 9 Schematic diagram of the structure of a chip provided by an embodiment of the present application. Detailed implementation manners
[0098] To facilitate a clear description of the technical solutions of the embodiments of the present application, the following explanations are made first:
[0099] In the embodiments of the present application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and effects. For example, the first application and the second application are only used to distinguish different chips, and their sequence is not limited. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.
[0100] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0101] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of single item (item) or multiple items (items). For example, at least one (item) of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c can be single or multiple.
[0102] Currently, when an electronic device runs multiple applications, problems such as abnormal display may occur. For example, the electronic device may experience problems such as screen flickering, screen distortion, restart, or lag.
[0103] When an electronic device runs multiple applications, it is inevitable to synthesize a large number of interfaces. A layer is the basic unit for synthesizing an interface, and each application's interface corresponds to a layer, so the number of layers is large. Since each layer occupies memory, especially the buffer layer (BufferLayer), which carries a graphics buffer and occupies a large amount of memory, one BufferLayer can occupy about 10 megabytes (Mega, M). Therefore, when the number of layers reaches a certain amount, it occupies a large amount of memory, and the electronic device will experience insufficient memory, resulting in various display abnormalities such as screen distortion, screen flickering, and lag. If the upper limit is reached, a restart problem will also occur.
[0104] Generally, if a layer is created or released normally, it is not easy to reach the upper limit. For example, when the electronic device displays an interface, a layer is created, and when the interface runs in the background, the electronic device releases the layer after a certain period of time, or when the interface stops running, the electronic device releases the layer.
[0105] In some scenarios, for example, when the electronic device abnormally adds or creates layers, or fails to release layers normally, etc., it is easy to cause a large number of layers, occupy more memory, lead to insufficient memory, and cause layer leakage.
[0106] Exemplarily, in some scenarios, due to reasons such as non-standard design or abnormal code logic of the applications in the electronic device, the interface frequently adds and creates many layers, resulting in layer leakage.
[0107] In another scenario, an abnormal situation occurs in the electronic device, resulting in the failure to release layers normally, causing the layers to occupy the inner layer for a long time, resulting in layer leakage.
[0108] For example, when the electronic device displays an interface, a Layer is created. When the interface runs in the background, the electronic device does not release the Layer after a certain period of time, or when the interface stops running, the electronic device does not release the Layer.
[0109] The more interfaces the electronic device synthesizes, the more layers there are. If a Layer leak occurs, it will cause the number of layers to reach the upper limit more easily, resulting in insufficient memory and causing various abnormalities in the electronic device, such as screen flashing, screen distortion, restart, and freezing, which make it impossible to use the device normally.
[0110] Exemplarily, the maximum number of default Layers of the electronic device can be 4096, which can be expressed as static const size_t MAX_LAYERS = 4096. When the electronic device detects that the number of Layers exceeds 4096, it will return ErrorCode = -12, and ErrorCode = -12 is used to indicate an exception. For example, when the electronic device detects that the number of Layers is equal to 4096, if the electronic device is still creating layers, it will return ErrorCode = -12. When the electronic device detects that ErrorCode = -12 is returned, it will restart.
[0111] To better understand the relationship between the interface and the layer, the relationship between the interface and the layer will be described below.
[0112] The display of the interface on the electronic device can be completed jointly by an application (App), the WindowManagerService (WMS), the SurfaceFlinger, the display driver, and the display screen. Among them, the App is responsible for the content displayed in the window, the WMS manages window states, sizes, transparency, and other parameters, and the SurfaceFlinger is responsible for allocating the graphic buffers required by the application and composing the entire graphic window in the electronic device, that is, synthesizing Layers. This Layer can include a Z-order, that is, the order in the interface displayed on the electronic device. The SurfaceFlinger can draw or update the content of the graphic window to the display screen through the display driver for display.
[0113] Figure 1 Shows the relationship between the App, the WMS, and the SurfaceFlinger. As Figure 1 shown, the electronic device can include multiple Apps, namely App1, App2, and App3. Each App can include multiple interfaces. As Figure 1As shown, App1 includes activity 1, activity 2, view 1, and Figure 2 . App2 includes activity 1, activity 2, Figure 1 and Figure 2 . App3 includes activity 1, activity 2, Figure 1 and Figure 2 . The activities and views included in different Apps can be different. Among them, an activity can represent the interface displayed on the screen of an electronic device, and each activity can have a window associated with it to indicate the interface content. A view is the basic building block of the interface and is used to represent visible elements on the interface, such as buttons, text boxes, and pictures, etc.
[0114] WMS is used to manage windows. In Figure 1 , WMS can manage WindowState 1, WindowState 2, WindowState 3, WindowState 4, WindowState 5, and WindowState 6.
[0115] SurfaceControl can manage the interface. As Figure 1 shown, SurfaceControl can manage surface 1, surface 2, and surface 3.
[0116] SurfaceFlinger can synthesize layers. As Figure 1 shown, SurfaceFlinger can synthesize layer 1, layer 2, layer 3, layer 4, layer 5, and layer 6.
[0117] As Figure 1 shown, there is a corresponding relationship among activity 2, WindowState 2, surface 3, and layer 3 in App1. App1 can be responsible for the window display content, WMS manages WindowState 2, and WMS can also call surface 3 to enable SurfaceFlinger to synthesize the layer. SurfaceFlinger is responsible for allocating the graphic buffer required by App1 and combining the entire graphic window in the electronic device to synthesize layer 3.
[0118] As can be seen from the above, there is a certain corresponding relationship among the interface, windows, and layers. In the scenario of layer leakage, if the number of layers is not restricted, the number of layers will become more and more, occupying more and more memory, and it is easy to cause insufficient memory space.
[0119] In view of this, embodiments of the present application provide an application processing method and related device. A threshold is set. When the number of layers reaches the threshold, an application that occupies a relatively large number of layers is obtained and the operation of the application is stopped to release the layers. In this way, the probability of layers occupying more memory can be reduced, which is beneficial to reducing the probability of display anomalies. It can be understood that the threshold can be less than the upper limit of the number of layers.
[0120] The method provided by embodiments of the present application can be applicable to electronic devices. The electronic devices involved in embodiments of the present application may include handheld devices with display functions, vehicle-mounted devices, etc. For example, some electronic devices are: mobile phones, tablet computers, palmtop computers, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication functions, computing devices or other processing devices connected to a wireless modem, vehicle-mounted devices, wearable devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc. Embodiments of the present application are not limited thereto.
[0121] By way of example and not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. A wearable device, also known as a wearable intelligent device, is a general term for devices developed by applying wearable technology to intelligently design daily wearables, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is either directly worn on the body or integrated into the user's clothes or accessories. A wearable device is not just a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable intelligent devices include those with complete functions and large sizes that can achieve complete or partial functions without relying on a smartphone, such as smart watches or smart glasses, etc., and those that only focus on a certain type of application function and need to cooperate with other devices such as smartphones, such as various smart bracelets and smart jewelry for physical sign monitoring.
[0122] The electronic device in the embodiments of the present application may also be referred to as: a terminal device, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), an access terminal, a user unit, a user station, a mobile station, a mobile platform, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, a user agent, or a user device, etc.
[0123] For ease of understanding, the hardware structure of the electronic device in the embodiments of the present application will be introduced below.
[0124] Exemplarily, Figure 2 is a schematic diagram of the hardware structure of an electronic device provided in the embodiments of the present application. As Figure 2 shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, and a display screen 194, etc.
[0125] Optionally, the above sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0126] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0127] The processor 110 and the display screen 194 may be used to implement the display function involved in the embodiments of the present application.
[0128] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. The layered architecture may adopt the Android system, the iOS system, or other operating systems, and the embodiments of the present application do not limit this. Taking the Android system with a layered architecture as an example below, the software architecture of the electronic device provided by the embodiments of the present application will be exemplarily described.
[0129] Figure 3 It is a schematic diagram of the software architecture of an electronic device provided by the embodiments of the present application. As Figure 3 shown, the layered architecture divides the software system of the electronic device into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may be divided into five layers, from top to bottom, namely the application layer (applications), the application framework layer (application framework), the hardware abstraction layer (hardware abstraction layer, HAL), the kernel layer (kernel), and the hardware layer. The application layer may include a series of application packages, and the application layer runs the applications by calling the application programming interfaces (APIs) provided by the application framework layer. As Figure 3 shown, the application packages may include applications such as chat, calendar, gallery, and video.
[0130] The application framework layer provides APIs and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. As Figure 3As shown, the application framework layer may include SurfaceFlinger, WMS, and ActivityManagerService (AMS), etc. Among them, SurfaceFlinger can be used to detect the number of created layers. If it exceeds the warning threshold, it sends a warning to WMS. After receiving the warning, WMS can store the applications that occupy a large number of layers in the control processing list. AMS is used to stop running the application when there is an application in the control processing list to release the layers occupied by the application.
[0131] The purpose of the HAL layer is to abstract the hardware, which can provide a unified interface for upper-layer applications to query hardware devices, or can also provide data storage services for upper-layer applications. As Figure 3 shown, the HAL layer may include a display driver module and sensor hardware abstraction (sensor hidl). Among them, the display driver module can be used to transfer the display-related content in the application framework layer to the display driver in the kernel layer.
[0132] The kernel layer is the layer between the hardware and the software. As Figure 3 shown, the kernel layer may include one or more of the following: sensor drivers and display drivers, etc. In the embodiments of the present application, the display driver can drive the display screen to display the display-related content from the application framework layer.
[0133] The hardware layer may include hardware such as a microphone, a camera, and a display screen. Among them, the display screen is used to display the interface of the application.
[0134] It should be understood that in some embodiments, the layers that implement the same function may be called other names, or the layer that can implement the functions of multiple layers may be regarded as one layer, or the layer that can implement the functions of multiple layers may be divided into multiple layers. The embodiments of the present application do not limit this.
[0135] Above in combination with Figure 2 and Figure 3 the electronic device of the embodiments of the present application has been introduced. Next, the method provided by the embodiments of the present application will be introduced.
[0136] Figure 4 shows a schematic flowchart of an application processing method provided by the embodiments of the present application. This method can be executed by an electronic device, and the software architecture of the electronic device can be as described above Figure 3 shown. The electronic device may include SurfaceFlinger, WMS, and AMS.
[0137] As Figure 4 shown, this method may include the following steps:
[0138] S401. SurfaceFlinger periodically polls whether a layer leaks, or, when the number of layers is greater than X, detects whether a layer leaks.
[0139] When an electronic device creates a layer, it can save the process identifier (ProcessID) of the newly created and added Layer object and count the number of Layer objects. Among them, Layer can include: ContainerLayer (container type Layer), BufferLayer (graphics buffer Layer), PictureLayer (image type Layer), TextureLayer (video type Layer), etc.
[0140] Exemplarily, when an electronic device creates a layer, it can add the process identifier of the newly created layer to the mCurrentState array through the addClientLayer function and count the number of Layer objects, which is represented by mNumLayers.
[0141] In some implementations, SurfaceFlinger can periodically poll whether a layer leaks. To save the power consumption of the electronic device, SurfaceFlinger can start the periodic polling mechanism when the electronic device's screen is on to monitor whether a layer leaks.
[0142] Exemplarily, SurfaceFlinger can detect whether a layer leaks every 3 minutes after the electronic device's screen is on.
[0143] In other implementations, SurfaceFlinger can detect whether a layer leaks when the number of layers is greater than X. The value of X can be set to different values according to different requirements, and the embodiments of the present application do not limit this.
[0144] Exemplarily, SurfaceFlinger can detect whether a layer leaks when the number of layers mNumLayers is greater than 1000.
[0145] Whether a layer leaks can be whether the total number of layers exceeds a threshold. SurfaceFlinger detects whether a layer leaks, that is, detects whether the total number of layers exceeds the threshold Y. The threshold Y can be set to different values according to different requirements, and the embodiments of the present application do not limit this.
[0146] In some implementations, a layer leak can be that the total number of layers exceeds 3200; a layer does not leak can be that the total number of layers does not exceed 3200. Or, a layer leak can be that the total number of layers exceeds 3000; a layer does not leak can be that the total number of layers does not exceed 3000.
[0147] Since the buffer layer in the layer occupies a large amount of memory, in some implementations, whether the layer leaks can be determined by whether the number of BufferLayers in the total layer exceeds the threshold Z. This threshold Z can be set to different values according to different requirements, and the embodiments of the present application do not limit this. Among them, the buffer layer can include layers such as BufferStatelayer and BufferQueueLayer, and the embodiments of the present application do not limit this.
[0148] In some implementations, layer leakage can be that the number of BufferLayers in the total layer exceeds 80; layer non-leakage can be that the total layer number does not exceed 80. Or, layer leakage can be that the total layer number exceeds 90; layer non-leakage can be that the total layer number does not exceed 90.
[0149] S402. In the case of layer leakage, SurfaceFlinger transmits a layer exception warning information event to WMS.
[0150] In some examples, in the case of layer leakage, SurfaceFlinger can transmit a layer exception warning information event (Transaction LayerLeak Event) to WMS through the notifyLayerLeakWarning function.
[0151] S403. After obtaining the layer exception warning information event, WMS stores the applications to be controlled in the control processing list.
[0152] Exemplarily, after obtaining the layer exception warning information event, WMS can obtain the applications to be controlled through the handleLayerLeak function and store the applications to be controlled in the control processing list. In some implementations, WMS can trigger the handleLayerLeak function through an asynchronous message to obtain the applications to be controlled and store the applications to be controlled in the control processing list.
[0153] It should be noted that storing the applications to be controlled by WMS in the control processing list is only an example, and WMS can also store the applications to be controlled in the form of an array or a matrix. The embodiments of the present application do not limit this.
[0154] Figure 5 Shows a schematic diagram of WMS obtaining the applications to be controlled. As Figure 5As shown, after the WMS receives the event of the layer exception warning message, it can determine whether the total number of layers is greater than M. If the total number of layers is greater than M, it can indicate layer leakage. Then the WMS can execute 3 steps: 1) Obtain and save the layer-related information; 2) Perform fault marking; 3) Obtain the application A whose layer occupancy is greater than i, and store the application A in the control processing list.
[0155] Among them, M can be the same as or different from the above-mentioned Y. The embodiments of the present application do not limit this. If M is the same as Y, after the WMS receives the event of the layer exception warning message, it can directly execute the above 3 steps. In this way, it is beneficial to quickly process the layer leakage.
[0156] If M is different from Y and M can be greater than Y, after the WMS receives the event of the layer exception warning message, it can monitor the total number of layers. If the total number of layers is greater than M, it will execute the above 3 steps. In this way, the WMS can independently execute between obtaining the applications that need to be controlled and the event of the layer exception warning message, with stronger flexibility.
[0157] For the above step 1), the layer-related information can include the total number of layers, the application and application status corresponding to each layer in the total layers, the number of BufferLayers in the total layers, and the application and application status corresponding to the BufferLayers. Among them, the application status can include not running, inactive, active, background, and suspended. Not running is used to indicate that the application has terminated or has not been started yet. Inactive is used to indicate that the application is in the foreground but no longer receives events. For example, the user locks the device when the application is active. Active is used to indicate the state of being in use, or rather, the application is in the foreground. Background is used to indicate that the application is not displayed on the screen but still executes the code related to the application. Suspended is used to indicate that the application resides in memory but does not execute the code related to the application. The WMS can save the layer-related information in a list, workbook, or database. The embodiments of the present application do not limit this.
[0158] Exemplarily, the WMS can save the layer-related information in the layerleak.txt file.
[0159] For the above step 2), layer leakage can be understood as a failure of the electronic device. The WMS can use the layer-related information as the fault information so that the layer leakage is included when the fault information is called later.
[0160] In some implementations, the WMS can also report the layer-related information to the server or cloud for subsequent analysis of the faults of the electronic device.
[0161] For step 3) above, the WMS can count the number of layers occupied by each application, obtain application A whose number of occupied layers is greater than i, and store application A in the management list. Application A may include one or more applications, and the embodiments of the present application do not limit this.
[0162] If there is an application with the number of occupied layers greater than i, it can indicate that the number of layers corresponding to this application is relatively large and needs to be managed. The WMS can store these applications in the management processing list. It can be understood that i is less than or equal to M. In some examples, M can be 3500, 3200, or 3300, etc., and i can be 50, 45, etc., and the embodiments of the present application do not limit this.
[0163] For the above three steps, there can be steps executed serially or steps executed in parallel, and the embodiments of the present application do not limit this.
[0164] Exemplarily, steps 1) and 2) above can be executed in parallel, and step 3) is executed serially with the previous two steps. M can be 3500. If the total number of layers is greater than 3500, the WMS triggers a dumpsys event. The dumpsys event includes steps 1) and 2). After executing the triggered dumpsys event, step 3) is executed.
[0165] As Figure 5 shown, after the WMS receives the layer exception warning information event, it can determine whether the number of buffered layers is greater than N. If the number of buffered layers is greater than N, it can indicate layer leakage. Then the WMS can obtain application B whose number of occupied buffered layers is greater than j, and store application B in the management processing list.
[0166] Application B may include one or more applications, and the embodiments of the present application do not limit this. If there is an application with the number of occupied buffered layers greater than j, it can indicate that the number of buffered layers corresponding to this application is relatively large and needs to be managed. The WMS can store these applications in the management processing list. It can be understood that j is less than or equal to N, and N is a value less than or equal to M. In some examples, N can be 100, 80, or 90, etc., and j can be 25, 30, etc., and the embodiments of the present application do not limit this.
[0167] As Figure 5 shown, after the WMS receives the layer exception warning information event, it can also determine whether the number of application windows is greater than O. If the number of application windows is greater than O, it can indicate layer leakage. Then the WMS can obtain application C whose number of occupied application windows is greater than k, and store application C in the management processing list.
[0168] Application C may include one or more applications, and the embodiments of the present application do not limit this. If there is an application whose number of application windows occupied is greater than k, it can be stated that the number of application windows corresponding to this application is relatively large and needs to be controlled. The WMS can store these applications in the control processing list. It can be understood that k is less than or equal to O. In some examples, O can be 3500, 3000, 150 or 3200, and k can be 60, 50 or 55, etc., and the embodiments of the present application do not limit this.
[0169] As Figure 5 shown, after the WMS receives the layer exception warning information event, it can also determine whether the number of surfaces is greater than P. If the number of interfaces is greater than P, it can be stated that there is a layer leak. Then the WMS can obtain the application D whose number of interfaces occupied is greater than m and store the application D in the control processing list.
[0170] Application D may include one or more applications, and the embodiments of the present application do not limit this. If there is an application whose number of interfaces occupied is greater than m, it can be stated that the number of interfaces corresponding to this application is relatively large and needs to be controlled. The WMS can store these applications in the control processing list. It can be understood that m is less than or equal to P. In some examples, P can be 3500, 3000, 150 or 3200, etc., and m can be 40, 30 or 35, etc., and the embodiments of the present application do not limit this.
[0171] In Figure 5 it, M, O and P may be the same or different, and the embodiments of the present application do not limit this. I, j, k and m may be the same or different, and the embodiments of the present application do not limit this. In some examples, since the memory occupied by the interface is greater than the memory occupied by the application window, m may be less than k to facilitate reasonable control of the application.
[0172] In Figure 5 the method shown, the WMS can judge one or multiple, and the embodiments of the present application do not limit this. If multiple are judged, it is more conducive to controlling the number of layers and reducing the probability of layer leakage.
[0173] The above Figure 5 is only an example. In another example, Figure 5 the shown judgment processes may not be parallel.
[0174] Figure 6 shows another schematic diagram of the WMS obtaining the applications that need to be controlled. As Figure 6As shown, after the WMS receives the layer exception warning information event, it can determine whether the total number of layers is greater than M. If the total number of layers is greater than M, the WMS can perform 3 steps: 1) Obtain and save the layer-related information; 2) Perform fault marking; 3) Obtain the application A that occupies more than i layers and store the application A in the control processing list.
[0175] If the total number of layers is less than or equal to M, the WMS can determine whether the number of buffer layers is greater than N. If the number of buffer layers is greater than N, it can indicate layer leakage. Then the WMS can obtain the application B that occupies more than j buffer layers and store the application B in the control processing list.
[0176] If the number of buffer layers is less than or equal to N, the WMS can determine whether the number of application windows is greater than O and whether the number of interfaces is greater than P. If the number of application windows is greater than O, it can indicate layer leakage. Then the WMS can obtain the application C that occupies more than k application windows and store the application C in the control processing list. If the number of interfaces is greater than P, it can indicate layer leakage. Then the WMS can obtain the application D that occupies more than m interfaces and store the application D in the control processing list.
[0177] In this way, making judgments in sequence is conducive to obtaining the applications that need to be controlled in different situations.
[0178] S404. When it is detected that the number of applications in the control processing list is greater than 1, the AMS processes the applications in the control processing list.
[0179] The AMS processes the applications in the control processing list to achieve the control of the layers and reduce the probability of layer leakage.
[0180] Figure 7 Shows a schematic diagram of a processing method for the applications in the control processing list. As Figure 7 shown, when it is detected that the number of applications in the control processing list is greater than 1, the AMS can determine whether each application in the control processing list is in the background. For the applications in the background, the AMS can stop running the application to release the leaked Layer.
[0181] For the applications in the control processing list that are not in the background, the AMS can determine whether there is a visible window for the applications that are not in the background. For the applications that are not in the background and have no visible window, the AMS can stop running the application to release the leaked Layer.
[0182] If the application is not in the background and there is a visible window, it means that the application is running in the foreground. For applications that are not in the background and have a visible window, AMS can monitor the status of such applications. When such applications switch to the background, AMS stops running these applications to release the leaked Layer.
[0183] Exemplarily, for applications that are not in the background and have a visible window, AMS can start or call a monitoring of the application. When such applications switch to the background, AMS stops running these applications.
[0184] In some implementations, AMS can stop the running of the application by calling the forceStopPackage function.
[0185] In the application processing method provided by the embodiments of the present application, SurfaceFlinger can detect layer leakage. WMS can obtain the applications that need to be controlled in the case of layer leakage. AMS can process the applications that need to be controlled, and can achieve the control of the number of layers. In this way, the probability of layers occupying more memory can be reduced, and further the probability of display anomalies can be reduced.
[0186] Optionally, for applications that are not in the background and have a visible window, AMS can start a timed monitoring of the application. When the timing arrives and such applications are still not in the background and have a visible window, the application process of such applications is ended. In this way, the application is forced to be processed, reducing the probability of display anomalies.
[0187] Exemplarily, for applications that are not in the background and have a visible window, AMS can start a 5-minute timed monitoring of the application. When the timing arrives and such applications are still not in the background and have a visible window, the application process of such applications is ended by killprocess.
[0188] From the method shown above Figure 4 When the electronic device runs an application and layer leakage occurs, the application with layer leakage is obtained, and such applications are processed at an appropriate time to release the memory occupied by the layers of such applications, reducing the probability that layer resources are occupied for a long time without being released. The applications with layer leakage may include one or more of application A with more than i layers occupied, application B with more than j buffer layers occupied, application C with more than k application windows occupied, or application D with more than m surfaces occupied. It can be understood that if these applications can release layers normally, the probability of exceeding the set threshold is relatively high. If the set threshold is exceeded, it can be said that the probability of abnormality is relatively high. When such applications are in the background, stopping the running of such applications is also beneficial to the impact on user use.
[0189] The above is described by taking the implementation inside an electronic device as an example. Below, taking the electronic device as the execution subject, the method provided in the embodiments of the present application will be described.
[0190] Exemplarily, Figure 8 A schematic flowchart of an application processing method provided in the embodiments of the present application is shown. This method can be applied to an electronic device. As Figure 8 shown, this method may include the following steps:
[0191] S801. At a first moment, a first application runs in the foreground of the electronic device, a second application and a third application run in the background of the electronic device, the number of layers in the electronic device is a first number, and the first number is less than or equal to a first threshold.
[0192] S802. At a second moment, the first application runs in the foreground of the electronic device, the number of layers in the electronic device is a second number, the second number is greater than the first threshold, the second application running in the background is stopped, and the third application is maintained to run in the background. The number of layers occupied by the third application in the layers of the electronic device is less than the number of layers occupied by the second application in the layers of the electronic device. Wherein, the second moment is later than the first moment, and between the first moment and the second moment, the first application continuously runs in the foreground, and the second application and the third application continuously run in the background.
[0193] In this way, when the number of layers in the electronic device is greater than the first threshold, the second application occupies a relatively large number of layers in the layers of the electronic device, and the probability that the second application abnormally adds layers or cannot normally release layers is relatively large. Stopping the operation of the second application can release the memory occupied by the second application, which is beneficial to reducing the probability of out-of-memory, and further beneficial to reducing the probability of display anomalies.
[0194] Optionally, the number of layers occupied by the second application in the layers of the electronic device is greater than a second threshold, the number of layers occupied by the third application in the layers of the electronic device is less than the second threshold, and the second threshold is less than the first threshold. In this way, it is beneficial to obtain the application that needs to be stopped from running.
[0195] Optionally, the number of layers occupied by the first application in the layers of the electronic device is greater than or equal to the number of layers occupied by the second application in the layers of the electronic device; the method further includes: when the first application switches to running in the background, stopping the operation of the first application. In this way, while reducing the probability of display anomalies, it is beneficial to reduce the probability of affecting the user experience.
[0196] Optionally, the layers in the electronic device include a first layer, and the method further includes: determining whether the number of first layers in the electronic device is greater than a third threshold, where the third threshold is less than or equal to the first threshold; when the number of first layers in the electronic device is greater than the third threshold, obtaining a fourth application, where the number of first layers occupied by the fourth application in the first layer of the electronic device is greater than a fourth threshold, and the fourth threshold is less than the third threshold; determining whether the fourth application is running in the background; and when the fourth application is running in the background, stopping the fourth application.
[0197] In this way, when the number of first layers in the electronic device is greater than the third threshold, the fourth application occupies a relatively large number of first layers in the layers of the electronic device, and there is a relatively high probability that the fourth application abnormally adds first layers or fails to normally release first layers. Stopping the operation of the fourth application can release the memory occupied by the fourth application, which is beneficial to reducing the probability of memory shortage and further beneficial to reducing the probability of display abnormality.
[0198] Optionally, the above method further includes: when the fourth application is not running in the background, stopping the fourth application when the fourth application switches to running in the background. In this way, when the fourth application switches to running in the background, stopping the fourth application can reduce the probability of display abnormality and is beneficial to reducing the probability of affecting the user experience.
[0199] Optionally, determining whether the number of first layers in the electronic device is greater than the third threshold includes: when the number of layers in the electronic device is less than or equal to the first threshold, determining whether the number of first layers in the electronic device is greater than the third threshold.
[0200] In this way, based on the number of layers, it is determined that the number of layers does not need to be controlled. By determining the number of first layers to determine whether to control the number of first layers, multi-level judgment is performed, which is beneficial to better controlling the number of layers and further beneficial to reducing the probability that the layers occupy a large amount of memory.
[0201] Optionally, the above method further includes: determining whether the number of windows in the electronic device is greater than a fifth threshold; when the number of windows in the electronic device is greater than the fifth threshold, obtaining a fifth application, where the number of windows occupied by the fifth application in the windows of the electronic device is greater than a sixth threshold, and the sixth threshold is less than the fifth threshold; determining whether the fifth application is running in the background; and when the fifth application is running in the background, stopping the fifth application.
[0202] In this way, when the number of windows in the electronic device is greater than the fifth threshold, the fifth application occupies a relatively large number of windows among the windows of the electronic device, and the probability of an abnormality in the fifth application is relatively high. Stopping the operation of the fifth application can release the memory occupied by the fifth application, which is beneficial to reducing the probability of memory shortage, and further beneficial to reducing the probability of display abnormality.
[0203] Optionally, the method further includes: when the fifth application is not running in the background, stopping the operation of the fifth application when the fifth application switches to running in the background. In this way, when the fifth application switches to running in the background, stopping the operation of the fifth application can, while reducing the probability of display abnormality, be beneficial to reducing the probability of affecting the user experience.
[0204] Optionally, the layers in the electronic device include a first layer. Determining whether the number of windows in the electronic device is greater than the fifth threshold includes: when the number of layers in the electronic device is less than or equal to the first threshold and the number of the first layer in the electronic device is less than or equal to the third threshold, determining whether the number of windows in the electronic device is greater than the fifth threshold, where the third threshold is less than or equal to the first threshold.
[0205] In this way, based on the number of layers, it is determined that the number of layers does not need to be controlled, and based on the number of the first layer, it is determined that the number of layers does not need to be controlled. By judging the number of windows to determine whether to control the number of windows, multi-level judgment is performed, which is beneficial to better controlling the number of windows, and further achieving the control of the number of layers and realizing the reduction of the probability that the layers occupy too much memory.
[0206] Optionally, the above method further includes: judging whether the number of surfaces in the electronic device is greater than the seventh threshold; when the number of surfaces in the electronic device is greater than the seventh threshold, obtaining a sixth application, where the number of surfaces occupied by the sixth application among the surfaces of the electronic device is greater than the eighth threshold, and the eighth threshold is less than the seventh threshold; judging whether the sixth application is running in the background; and when the sixth application is running in the background, stopping the operation of the sixth application.
[0207] In this way, when the number of surfaces in the electronic device is greater than the seventh threshold, the sixth application occupies a relatively large number of surfaces among the surfaces of the electronic device, and the probability of an abnormality in the sixth application is relatively high. Stopping the operation of the sixth application can release the memory occupied by the sixth application, which is beneficial to reducing the probability of memory shortage, and further beneficial to reducing the probability of display abnormality.
[0208] Optionally, the method further includes: when the sixth application switches to running in the background while the sixth application is not running in the background, stopping the sixth application. In this way, when the sixth application switches to running in the background, stopping the sixth application can reduce the probability of display anomalies and is conducive to reducing the probability of affecting the user experience.
[0209] Optionally, the layers in the electronic device include a first layer. Determining whether the number of surfaces in the electronic device is greater than a seventh threshold includes: when the number of layers in the electronic device is less than or equal to a first threshold and the number of first layers in the electronic device is less than or equal to a third threshold, determining whether the number of surfaces in the electronic device is greater than the seventh threshold, where the third threshold is less than or equal to the first threshold.
[0210] In this way, based on the number of layers, it is determined that the number of layers does not need to be controlled. Based on the number of first layers, it is determined that the number of layers does not need to be controlled. By judging the number of surfaces to determine whether to control the number of surfaces and performing multi-level judgment, it is beneficial to better control the number of surfaces, and further achieve the control of the number of layers, so as to reduce the probability of the layers occupying too much memory.
[0211] Optionally, before the second quantity is greater than the first threshold, the method further includes: determining whether the number of layers in the electronic device is greater than a ninth threshold, where the ninth threshold is less than or equal to the first threshold; when the number of layers in the electronic device is greater than the ninth threshold, outputting an alarm message, where the alarm message is used to indicate that the number of layers is abnormal.
[0212] In this way, when the number of layers is greater than the ninth threshold, it indicates that there may be an abnormality in the layers, and an alarm message can be output to facilitate the monitoring and control of the layers.
[0213] Optionally, determining whether the number of layers in the electronic device is greater than the ninth threshold includes: periodically polling to determine whether the number of layers in the electronic device is greater than the ninth threshold, or when the number of layers in the electronic device is greater than a tenth threshold, determining whether the number of layers in the electronic device is greater than the ninth threshold, where the tenth threshold is less than the ninth threshold. In this way, it is beneficial to save power consumption.
[0214] Optionally, the layers in the electronic device include a first layer. Before the second quantity is greater than the first threshold, the method further includes: determining whether the number of first layers in the electronic device is greater than an eleventh threshold, where the eleventh threshold is less than or equal to the first threshold; when the number of first layers in the electronic device is greater than the eleventh threshold, outputting an alarm message, where the alarm message is used to indicate that the number of layers is abnormal.
[0215] In this way, when the number of the first layers is greater than the eleventh threshold, it indicates that there may be an abnormality in the layers, and an alarm message can be output to facilitate the monitoring and control of the layers.
[0216] Optionally, determining whether the number of the first layers in the electronic device is greater than the eleventh threshold includes: periodically polling to determine whether the number of the first layers in the electronic device is greater than the eleventh threshold, or, when the number of layers in the electronic device is greater than the tenth threshold, determining whether the number of the first layers in the electronic device is greater than the eleventh threshold. In this way, it is beneficial to save power consumption.
[0217] It should be noted that the module names involved in the embodiments of the present application can all be defined as other names, as long as the functions of the modules can be realized, and no specific restrictions are imposed on the module names.
[0218] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0219] The application processing method of the embodiments of the present application has been described above. Next, the device for executing the above method provided by the embodiments of the present application will be described. Those skilled in the art can understand that the method and the device can be combined and cited with each other, and the relevant device provided by the embodiments of the present application can execute the steps in the above application processing method.
[0220] Exemplarily, Figure 9 is a schematic structural diagram of a chip provided by an embodiment of the present application. As Figure 9 shown, the chip 90 includes one or more than two (including two) processors 901, a communication line 902, a communication interface 903, and a memory 904.
[0221] In some embodiments, the memory 904 stores the following elements: executable modules or data structures, or subsets thereof, or extended sets thereof.
[0222] The measurement method of physiological characteristic indicators described in the embodiments of the present application can be applied to or implemented by the processor 901. The processor 901 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the measurement method of the physiological characteristic indicators can be completed by the integrated logic circuit of the hardware in the processor 901 or the instructions in the form of software. The above-mentioned processor 901 may be a general-purpose processor (e.g., a microprocessor or a conventional processor), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate, transistor logic devices, or discrete hardware components. The processor 901 can implement or execute various processing-related methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0223] The steps of the measurement method of physiological characteristic indicators disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. Among them, the software module can be located in mature storage media in the art such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in the memory 904, and the processor 901 reads the information in the memory 904 and combines its hardware to complete the steps of the above method.
[0224] Communication can be carried out between the processor 901, the memory 904, and the communication interface 903 through the communication line 902.
[0225] The application processing method provided by the embodiments of the present application can be applied to an electronic device with communication functions. The electronic device includes a terminal device. The specific device form of the terminal device and the like can refer to the above relevant descriptions and will not be elaborated here.
[0226] The embodiments of the present application provide a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.
[0227] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored on or transmitted over a computer-readable medium as one or more instructions or codes. The computer-readable medium can include a computer storage medium and a communication medium, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0228] In a possible implementation, the computer-readable medium may include RAM, ROM, a compact disc read-only memory (CD-ROM), or other optical disc storage, a magnetic disk storage, or other magnetic storage devices, or any other medium targeted to carry or store the required program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is properly termed a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of the medium. As used herein, disk and disc include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while discs reproduce data optically using lasers. The above combinations should also be included within the scope of the computer-readable medium.
[0229] The embodiments of the present application provide a computer program product. The computer program product includes a computer program, and when the computer program is run, it causes the computer to execute the above method.
[0230] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable devices to generate a machine, such that the instructions executed by the processing unit of the computer or other programmable data processing devices generate for implementing in the process Figure 1One process or multiple processes and / or boxes Figure 1 A device for the functions specified in one box or multiple boxes.
[0231] In the above specific embodiments, the purpose, technical solutions and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the present invention shall be included in the protection scope of the present invention.
Claims
1. An application processing method, characterized in that, Applied to an electronic device, including: At a first moment, a first application runs in the foreground of the electronic device, a second application and a third application run in the background of the electronic device, and the number of layers in the electronic device is a first number, and the first number is less than or equal to a first threshold; At a second moment, the first application runs in the foreground of the electronic device, the number of layers in the electronic device is a second number, the second number is greater than the first threshold, the second application running in the background is stopped, and the third application is maintained to run in the background, and the number of layers occupied by the third application in the layers of the electronic device is less than the number of layers occupied by the second application in the layers of the electronic device; Wherein, the second moment is later than the first moment, and between the first moment and the second moment, the first application continuously runs in the foreground, and the second application and the third application continuously run in the background.
2. The method according to claim 1, characterized in that The number of layers occupied by the second application in the layers of the electronic device is greater than a second threshold, the number of layers occupied by the third application in the layers of the electronic device is less than the second threshold, and the second threshold is less than the first threshold.
3. The method according to claim 1 or 2, characterized in that, The number of layers occupied by the first application in the layers of the electronic device is greater than or equal to the number of layers occupied by the second application in the layers of the electronic device; The method further includes: When the first application switches to running in the background, stop running the first application.
4. The method according to any one of claims 1 to 3, characterized in that, The layers in the electronic device include a first layer, and the method further includes: Judge whether the number of the first layers in the electronic device is greater than a third threshold, and the third threshold is less than or equal to the first threshold; When the number of the first layers in the electronic device is greater than the third threshold, obtain a fourth application, and the number of the first layers occupied by the fourth application in the first layers of the electronic device is greater than a fourth threshold, and the fourth threshold is less than the third threshold; Judge whether the fourth application is running in the background; When the fourth application is running in the background, stop running the fourth application.
5. The method according to claim 4, wherein The method further includes: When the fourth application is not running in the background, when the fourth application switches to running in the background, stop running the fourth application.
6. The method according to claim 4 or 5, characterized in that, The judgment of whether the number of the first layers in the electronic device is greater than the third threshold includes: When the number of layers in the electronic device is less than or equal to the first threshold, judge whether the number of the first layers in the electronic device is greater than the third threshold.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Judge whether the number of windows in the electronic device is greater than a fifth threshold; When the number of windows in the electronic device is greater than the fifth threshold, obtain a fifth application, and the number of windows occupied by the fifth application in the windows of the electronic device is greater than a sixth threshold, and the sixth threshold is less than the fifth threshold; Judge whether the fifth application is running in the background; When the fifth application is running in the background, stop running the fifth application.
8. The method according to claim 7, wherein The method further includes: When the fifth application is not running in the background, stop running the fifth application when it switches to the background.
9. The method according to claim 7 or 8, characterized in that The layers in the electronic device include a first layer. The determination of whether the number of windows in the electronic device is greater than a fifth threshold includes: When the number of layers in the electronic device is less than or equal to the first threshold and the number of first layers in the electronic device is less than or equal to a third threshold, determine whether the number of windows in the electronic device is greater than the fifth threshold, where the third threshold is less than or equal to the first threshold.
10. The method according to any one of claims 1 to 9, characterized in that The method further includes: Determine whether the number of surfaces in the electronic device is greater than a seventh threshold; When the number of surfaces in the electronic device is greater than the seventh threshold, obtain a sixth application, where the number of surfaces occupied by the sixth application in the surfaces of the electronic device is greater than an eighth threshold, and the eighth threshold is less than the seventh threshold; Determine whether the sixth application is running in the background; When the sixth application is running in the background, stop running the sixth application.
11. The method according to claim 10, wherein, The method further includes: When the sixth application is not running in the background, stop running the sixth application when it switches to the background.
12. The method according to claim 10 or 11, characterized in that The layers in the electronic device include a first layer. The determination of whether the number of surfaces in the electronic device is greater than a seventh threshold includes: When the number of layers in the electronic device is less than or equal to the first threshold and the number of first layers in the electronic device is less than or equal to a third threshold, determine whether the number of surfaces in the electronic device is greater than the seventh threshold, where the third threshold is less than or equal to the first threshold.
13. The method according to any one of claims 1 to 12, characterized in that, Before the second quantity is greater than the first threshold, the method further includes: Determine whether the number of layers in the electronic device is greater than a ninth threshold, where the ninth threshold is less than or equal to the first threshold; When the number of layers in the electronic device is greater than the ninth threshold, output an alarm message for indicating an abnormal number of layers.
14. The method according to claim 13, characterized in that, The determination of whether the number of layers in the electronic device is greater than the ninth threshold includes: Periodically poll to determine whether the number of layers in the electronic device is greater than the ninth threshold, or When the number of layers in the electronic device is greater than a tenth threshold, determine whether the number of layers in the electronic device is greater than the ninth threshold, where the tenth threshold is less than the ninth threshold.
15. The method according to any one of claims 1 to 12, characterized in that The layers in the electronic device include a first layer. Before the second quantity is greater than the first threshold, the method further includes: Determine whether the number of first layers in the electronic device is greater than an eleventh threshold, where the eleventh threshold is less than the first threshold; When the number of first layers in the electronic device is greater than the eleventh threshold, output an alarm message for indicating an abnormal number of layers.
16. The method according to claim 15, wherein The determination of whether the number of first layers in the electronic device is greater than the eleventh threshold includes: Periodically polling to determine whether the number of the first layers in the electronic device is greater than the eleventh threshold, or when the number of layers in the electronic device is greater than the tenth threshold, determining whether the number of the first layers in the electronic device is greater than the eleventh threshold.
17. An electronic device, characterized in that, Comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1-16.
18. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1-16 is implemented.
19. A chip system, characterized in that, Comprising at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to run a computer program or instruction to execute the method according to any one of claims 1-16.
20. A computer program product, characterized in that, Comprising a computer program, when the computer program is run, the computer is caused to execute the method according to any one of claims 1-16.
Citation Information
Patent Citations
User interface lag detection method and device and electronic equipment
CN111367741A
Memory processing method and related device
CN115794413A
Layer processing method, electronic equipment and readable storage medium
CN116048679A
Webpage application cache management method and device, equipment and storage medium
CN116484128A
Method for monitoring radio link and terminal device
US20210127345A1