Interface refreshing method of application program, electronic device, and storage medium
By determining the intersection of the preset refresh area of the application interface and the calculation area of the View and/or Layer, the resource waste caused by full-screen refresh is solved, and the efficiency and accuracy of partial refresh are achieved, thereby improving device performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-06-26
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies still use full-screen refresh when updating application interfaces, especially when only a small portion of the content changes, resulting in significant resource waste. Furthermore, calculating the local refresh area based on Layer and View suffers from low accuracy, high performance overhead, and limited flexibility.
By obtaining the intersection of the application's preset refresh area and the refresh area calculated based on View and/or Layer, the local refresh area is determined, and local drawing and rendering are performed to reduce unnecessary resource consumption.
This technology reduces resource waste and improves device performance and efficiency when partially refreshing the application interface. In particular, it accurately determines the partial refresh area in scenarios such as clock applications, avoiding the resource waste caused by full-screen refresh.
Smart Images

Figure CN120762789B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart terminal technology, and in particular to a method for refreshing the interface of an application, an electronic device, and a storage medium. Background Technology
[0002] The display system of electronic devices (such as mobile phones) generally includes a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), and a display. In this system, the CPU is responsible for calculating the image data for each frame, such as performing application-layer operations like measurement, layout, and drawing, and then submitting the calculated image data to the GPU. The GPU renders and composites the image data, storing each processed frame in a buffer. The display is responsible for displaying each frame of image data from the buffer onto the electronic device screen.
[0003] When the image data in an application is updated, the image data stored in the buffer is also updated based on CPU calculations and GPU rendering and compositing. The display can then read the updated image data and display it. Taking a refresh rate of 60 FPS (Frames Per Second) as an example, the display reads and displays the image data in the buffer approximately every 16 ms, thus refreshing the electronic device's display interface. Summary of the Invention
[0004] This application provides a method for refreshing the interface of an application, an electronic device, and a storage medium. In this method, the electronic device determines a partial refresh area based on a preset refresh area of the application and a refresh area calculated based on View and / or Layer, thereby achieving partial refresh of the application interface.
[0005] Firstly, this application provides a method for refreshing the interface of an application. This method is applied to an electronic device and includes:
[0006] When the refresh time is reached, the electronic device acquires the first refresh area preset by the application; the electronic device acquires the second refresh area of the application calculated based on the View and / or Layer; the electronic device takes the intersection of the first refresh area and the second refresh area as the local refresh area corresponding to the current interface refresh; the electronic device draws and renders the image data corresponding to the local refresh area, and then refreshes and displays the application interface.
[0007] The refresh frequency of the application interface is related to the scenario to which the application corresponds. Some application interfaces refresh periodically, while others refresh in response to user operations. This application does not impose any restrictions on this.
[0008] In this application, the second refresh area of the application can be determined based on the actual situation of dividing the application interface into View and Layer, whether it is calculated based on View, calculated based on Layer, or calculated based on both View and Layer.
[0009] In this way, the intersection of the preset refresh area and the refresh area calculated based on the View and / or Layer is used as the local refresh area. The interface is refreshed by redrawing and rendering the local refresh area, reducing the amount of data processing required for the original image and thus saving device power. Furthermore, the preset refresh area is determined by the application based on its actual update situation, overcoming the limitations of calculating the refresh area based on the View and / or Layer.
[0010] According to the first aspect, the application's interface is a View and is not divided into Layers.
[0011] When an application's interface is a single View without defined layers, even when calculating the refresh area based on the View and / or Layers for partial refresh, it is essentially still a full-screen refresh. To address this, this solution effectively enables partial refresh of the application interface, avoiding unnecessary resource waste.
[0012] According to the first aspect, or any implementation of the first aspect above, the application is a clock application; wherein the interface refresh interval of the clock application is 1 second, and the interface of the clock application includes an hour hand, a minute hand, and a second hand.
[0013] According to the first aspect, or any implementation of the first aspect above, the electronic device obtains a first refresh area preset by the application, including: the electronic device determining that the next moment after the refresh time is neither an hour nor a minute; the electronic device determining a first display area of the second hand at the refresh time; the electronic device determining a second display area of the second hand at the next moment; and the electronic device using an area including the first display area and the second display area as the first refresh area.
[0014] In this way, when refreshing the clock application interface, the electronic device determines whether the next moment is the hour or minute. If the next moment is neither the hour nor the minute, the electronic device determines the application's preset refresh area based only on the position change of the second hand, so that the final determined local refresh area is small enough and accurate, minimizing resource waste.
[0015] According to the first aspect, or any implementation of the first aspect above, the electronic device obtains the first refresh area preset by the application, including: the electronic device determines that the next moment of the refresh time is neither an hour nor a minute; when the number of seconds to which the next moment belongs is a first range, the electronic device uses the application preset area corresponding to the first range as the first refresh area; when the number of seconds to which the next moment belongs is a second range, the electronic device uses the application preset area corresponding to the second range as the first refresh area.
[0016] In this way, when the clock application interface is refreshed, the electronic device determines whether the next moment is an hour or a minute. If the next moment is neither an hour nor a minute, the electronic device determines the application preset refresh area corresponding to the current moment as preset area 1 or preset area 2. There is no need to calculate the application preset refresh area for each moment, which can effectively reduce the amount of calculation or the amount of data stored about the application preset refresh area.
[0017] According to the first aspect, or any implementation of the first aspect above, the electronic device obtains a first refresh area preset by the application, which further includes: the electronic device determining that the next moment after the refresh time is an hour or a minute; the electronic device determining that at the refresh time, a third display area including the hour hand, minute hand and second hand; the electronic device determining that at the next moment, a fourth display area including the hour hand, minute hand and second hand; and the electronic device using one of the areas including the third display area and the fourth display area as the first refresh area.
[0018] In this way, when refreshing the clock application interface, the electronic device determines whether the next moment is the hour or minute. If the next moment is the hour or minute, the electronic device determines the application's preset refresh area based on the position changes of each pointer (hour hand, minute hand, second hand), so that the final determined local refresh area is small enough and accurate, minimizing resource waste.
[0019] According to the first aspect, or any implementation of the first aspect above, the preset first refresh area is a rectangular area, and each side of the rectangular area is parallel to the first or second side of the display screen of the electronic device, and the first and second sides are perpendicular.
[0020] When the preset first refresh area is a rectangular area, the final determined local refresh area is also a rectangle, making it easier to implement local area refresh.
[0021] According to the first aspect, or any implementation of the first aspect above, after the electronic device takes the intersection of the first refresh area and the second refresh area as the local refresh area corresponding to the current interface refresh, the method further includes: the electronic device expanding the local refresh area; wherein the number of pixels per row in the expanded local refresh area is equal to the number of pixels per row on the electronic device's display interface.
[0022] In this way, when the display driver refreshes the display interface by pixel row, there is no need to stitch together redrawn and non-redrawn pixels. Any row of pixels displayed in the display area is either all redrawn or all non-redrawn, making partial refreshes easier to implement.
[0023] Secondly, this application provides an electronic device. The electronic device includes: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when executed by the one or more processors, the electronic device performs the interface refresh method of the application of the first aspect and any one of the first aspects.
[0024] The second aspect and any implementation thereof correspond to the first aspect and any implementation thereof, respectively. The technical effects of the second aspect and any implementation thereof are similar to those of the first aspect and any implementation thereof, and will not be repeated here.
[0025] Thirdly, this application provides a computer-readable storage medium. The computer-readable storage medium includes a computer program that, when run on an electronic device, causes the electronic device to execute the interface refresh method of the application program described in the first aspect and any one thereof.
[0026] The third aspect and any implementation thereof correspond to the first aspect and any implementation thereof, respectively. The technical effects of the third aspect and any implementation thereof are similar to those of the first aspect and any implementation thereof, and will not be repeated here.
[0027] Fourthly, this application provides a computer program product, including a computer program that, when run, causes the computer to execute an application interface refresh method as described in the first aspect or any one of the first aspects.
[0028] The fourth aspect and any implementation thereof correspond to the first aspect and any implementation thereof, respectively. The technical effects of the fourth aspect and any implementation thereof are similar to those of the first aspect and any implementation thereof, and will not be repeated here.
[0029] Fifthly, this application provides a chip including a processing circuit and transceiver pins. The transceiver pins and the processing circuit communicate with each other via an internal connection path. The processing circuit executes an interface refresh method of an application program as described in the first aspect or any one thereof, to control the receiving pin to receive signals and to control the transmitting pin to transmit signals.
[0030] The fifth aspect and any implementation thereof correspond to the first aspect and any implementation thereof, respectively. The technical effects of the fifth aspect and any implementation thereof are similar to those of the first aspect and any implementation thereof, and will not be repeated here. Attached Figure Description
[0031] Figure 1a This is an example of determining a local refresh area based on Layer;
[0032] Figure 1b This is an illustrative diagram illustrating how a partial refresh area is determined based on a View.
[0033] Figure 1c This is an illustrative diagram illustrating how a partial refresh area is determined based on View and Layer.
[0034] Figure 2a This is a schematic diagram of the refresh area of a clock application interface as an example.
[0035] Figure 2b This is a schematic diagram of the refresh area of a clock application interface as an example.
[0036] Figure 3a A schematic diagram of the hardware structure of an electronic device as an example;
[0037] Figure 3b A schematic diagram of the software structure of an electronic device as an example;
[0038] Figure 4 This is a schematic diagram illustrating module interaction as an example.
[0039] Figure 5a A flowchart illustrating the calculation of a preset refresh area for a clock application is shown as an example.
[0040] Figure 5b This is an example illustration of a preset refresh area for a clock application.
[0041] Figure 5c A flowchart illustrating the calculation of a preset refresh area for a clock application is shown as an example.
[0042] Figure 5d This is a schematic diagram of the preset refresh area of a clock application as an example.
[0043] Figure 6 This is a schematic diagram of the preset refresh area of a clock application as an example.
[0044] Figure 7a This is a schematic diagram of a partial refresh area of a clock application, as exemplarily shown.
[0045] Figure 7b This is a schematic diagram of a partial refresh area of a clock application, as exemplarily shown.
[0046] Figure 8a This is an illustrative diagram illustrating a scenario of stylus application.
[0047] Figure 8b This is a schematic diagram illustrating a partial refresh area of a stylus application;
[0048] Figure 9 A schematic diagram illustrating a scenario where a clock application is divided into views;
[0049] Figure 10 This is a schematic diagram of a partial refresh area for an exemplary clock application. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0052] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects. For example, "first target object" and "second target object," etc., are used to distinguish different target objects, not to describe a specific order of target objects.
[0053] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0054] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more. For example, multiple processing units means two or more processing units; multiple systems means two or more systems.
[0055] With the development of computer graphics, image processing technology has been widely applied, but it also faces performance challenges. In fields such as real-time rendering, video playback, and game development, the application's display interface needs to be frequently updated to reflect dynamic changes. However, traditional full-screen refresh methods consume a lot of device resources, especially when only a small portion of the application interface changes. Therefore, partial image refresh technology has emerged, aiming to reduce computation by updating only the changed parts of the image.
[0056] As the name suggests, partial image refresh technology updates only the changed parts of an image, without redrawing the entire image. This technology optimizes image drawing and rendering processes, improving the processing efficiency and performance of electronic devices. For example, in gaming applications, especially those requiring real-time rendering and featuring numerous dynamic image changes, partial image refresh technology can significantly reduce the burden on the CPU and GPU, improving the frame rate and smoothness of the game (avoiding frame drops) and ultimately enhancing the player's gaming experience.
[0057] Overall, image local refresh technology optimizes image drawing and rendering processes, thereby improving the performance of electronic devices and saving electronic device resources.
[0058] Currently, electronic devices can support partial refresh of any display area, avoiding problems such as garbled characters and screen tearing during image display, thus enabling the effective application of partial image refresh technology. For example, one implementation of partial refresh of any display area in an electronic device is as follows: First, the electronic device divides the image to be compressed into multiple raw data blocks and stores these raw data blocks in a frame buffer. Then, the electronic device obtains the position and size of the partial refresh area and determines whether the partial refresh area contains partially refreshed (i.e., incompletely refreshed) raw data block areas. If it does, the electronic device obtains the image data of the partial refresh area and expands the partially refreshed raw data block area into a fully refreshed raw data block area. Simultaneously, the electronic device compresses and stores the data blocks corresponding to the unexpanded raw data block area in the frame buffer, and compresses and stores the data blocks corresponding to the expanded raw data block area in the partial refresh buffer. Afterward, the electronic device reads the compressed data from the frame buffer and the partial refresh buffer, decompresses it, performs pixel-line stitching processing, and displays it in the display system. If not included, the electronic device directly acquires the image data block corresponding to the local refresh area, compresses it, and stores it in the frame buffer in the storage space corresponding to the original data block. Then, the electronic device reads the compressed data from the frame buffer, decompresses it, performs pixel row stitching processing, and displays it in the display system. Details not explained here can be found in existing technologies and will not be elaborated further. Of course, the electronic device can also use other local refresh methods that support arbitrary display areas; this embodiment does not limit this approach.
[0059] When implementing partial image refresh in electronic devices, it is necessary to ensure that the refresh area is small enough while maintaining the accuracy of graphic rendering. Therefore, calculating the refresh area is crucial. The method for calculating the refresh area may vary depending on factors such as the application scenario, image type, and device hardware performance. Furthermore, in practical applications, it may be necessary to select an appropriate calculation method based on specific circumstances and perform corresponding optimizations and adjustments.
[0060] In one alternative implementation, the electronic device can determine the refresh area based on layers. A layer is a method for organizing and managing image content. Layers can separate different image elements, allowing them to be drawn, edited, and manipulated independently. A frame of image can consist of one or more layers. Each layer can contain one or more image objects, which can be geometric objects, text, images, etc. Layers can be overlaid on top of each other, and various visual effects can be created by controlling attributes such as transparency, color, and size.
[0061] For example, in the settings application's interface, a complete image frame consists of four parts, each of which we call a Layer: the background layer, the application layer, the status bar, and the toolbar. Combining these Layers together creates a complete image frame.
[0062] Each layer can be responsible for refreshing the content of a single area, which can greatly improve rendering and display efficiency. For example, in the scenario of charging an electronic device, only the "battery level" status in the status bar changes. Only the area where the status bar is located needs to be updated, without having to repeatedly draw and render image data in other layers.
[0063] Figure 1a An exemplary diagram illustrates how an electronic device determines the refresh area based on layers. For example... Figure 1a As shown, the application interface has four layers: Layer1, Layer2, Layer3, and Layer4. Figure 1a As shown in (1), when the application interface is updated, the areas in its display that change include image change area R1 and image change area R2. Image change area R1 is located in Layer 1, and image change area R2 is located in Layer 2. At this time, the electronic device can determine that the area in Layer 1 is the dirty area 1 that needs image updating, the area in Layer 2 is the dirty area 2 that needs image updating, and other areas do not need image updating, such as... Figure 1a As shown in (2). Furthermore, the electronic device can merge dirty region 1 and dirty region 2 to obtain the final determined dirty region (as shown in Figure 2). Figure 1a As shown in (3), the electronic device can use the merged dirty area as the screen refresh area, that is, the local refresh area, such as Figure 1a As shown in (4).
[0064] In one alternative implementation, the electronic device can also determine the refresh area based on a View. A View is the base class for all UI (User Interface) controls in the Android system, providing various methods to control and manage the display, interaction, and other behaviors of controls. Views can separate different image elements, allowing them to be drawn, edited, and manipulated independently. A frame of image can consist of one or more Views. Each View can contain one or more image objects, which can be geometric objects, text, images, etc.
[0065] Each View can be responsible for refreshing the content of a single area, which can greatly improve rendering and display efficiency. For example, in a scenario where a user activates a function, only the state of the function switch control changes. Only the View containing that control needs to be updated, without having to repeatedly draw and render image data in other Views.
[0066] Figure 1b An exemplary diagram illustrates how an electronic device can determine a refresh area based on a view. For example... Figure 1b As shown, the application interface has a layer containing four views: View1, View2, View3, and View4. Figure 1b As shown in (1), when the application interface is updated, the areas in its display that change include image change area R3 and image change area R4. Image change area R3 is located on View1, and image change area R4 is located on View2. At this time, the electronic device can determine that the area where View1 is located is the dirty area 3 that needs image updating, the area where View2 is located is the dirty area 4 that needs image updating, and other areas do not need image updating, such as... Figure 1b As shown in (2). Furthermore, the electronic device can merge dirty regions 3 and 4 to obtain the final determined dirty region (as shown in Figure 2). Figure 1b As shown in (3), the electronic device can use the merged dirty area as the screen refresh area, that is, the local refresh area, such as Figure 1b As shown in (4).
[0067] In one implementation, the application interface can have multiple layers, with one or more views set within at least one layer. In this case, the electronic device can determine the refresh area based on the layer and / or view.
[0068] Figure 1c An exemplary diagram illustrates how an electronic device can determine the refresh area based on Layers and Views. For example... Figure 1c As shown, the application interface has three layers: Layer1, Layer2, and Layer3. Layer1 contains one View (e.g., View1), Layer2 contains one View (e.g., View2), and Layer3 contains two Views: View3 and View4. Figure 1cAs shown in (1), when the application interface is updated, the areas in its display that change include image change area R5 and image change area R6. Image change area R5 is located on View1, and image change area R6 is located in Layer2. At this time, the electronic device can determine that the area where View1 is located is the dirty area 5 that needs image updating, the area where Layer2 is located is the dirty area 6 that needs image updating, and other areas do not need image updating, such as... Figure 1c As shown in (2). Furthermore, the electronic device can merge dirty regions 5 and 6 to obtain the final determined dirty region (as shown in Figure 2). Figure 1c As shown in (3), the electronic device can use the merged dirty area as the screen refresh area, that is, the local refresh area, such as Figure 1c As shown in (4).
[0069] However, calculating the local refresh area of an image based on Layer and / or View has some limitations and pain points, mainly in the following aspects:
[0070] Accuracy issues: When electronic devices calculate the local refresh area of an image based on Layer and / or View methods, the calculation accuracy may be low due to the complexity of the hierarchical relationship between views and layers and coordinate transformations. In particular, in cases with complex view structures or involving multi-layer interactions, it becomes more difficult for electronic devices to accurately determine which parts need to be refreshed.
[0071] Performance overhead: Calculating the local refresh area of an image requires computational resources, especially when the view structure is complex or changes frequently. If the calculation process for the local refresh area is too complex or time-consuming, it may lead to a decrease in the performance of the electronic device, making the advantages of local refresh no longer apparent.
[0072] Flexibility limitations: Electronic devices calculate local refresh areas of images based on layers and / or views, which typically requires a fixed view structure and hierarchy. This limits their flexibility when handling dynamic or irregular refresh areas. Moreover, for non-rectangular or irregularly shaped local refresh areas, more complex algorithms and logic may be required.
[0073] Figure 2a An example is shown: the program interface of a clock application. For example... Figure 2aAs shown in Figure (1), the mobile phone displays the full-screen application interface for the clock (i.e., the analog clock interface or the pointer clock interface). In this application interface, the time is displayed in the style of an analog clock with a second hand, giving the user the feeling of using a pointer clock. Similar to the pointer clock, the dial and background of the analog clock remain unchanged in the analog clock interface. With each passing second, the second hand of the analog clock rotates one small division clockwise (i.e., rotates 6°). When the second hand of the analog clock rotates one full circle clockwise (i.e., rotates 360°), the minute hand of the analog clock rotates one small division clockwise (i.e., rotates 6°). When the minute hand of the analog clock rotates one full circle clockwise, the hour hand of the analog clock rotates one large division clockwise (i.e., rotates 30°). Figure 2a In the illustrated application scenario, the clock application's interface refreshes in seconds. After enabling "Display GPU view updates" in the developer options, the developers discovered that the entire analog clock interface is a single View (let's call it the Clock View). Understandably, the entire analog clock interface resides within a single Layer. Each time the second hand moves, the entire analog clock interface is refreshed. That is, as shown... Figure 2a As shown in (2), when the program interface is refreshed in seconds, the entire analog clock interface will be used as the refresh area, that is, the electronic device implements full-screen refresh.
[0074] Figure 2b An example is shown of the program interface of another clock application. For example... Figure 2b As shown in Figure (1), the phone displays the full-screen interface of the clock application (i.e., the digital clock interface). In this interface, the time is displayed in "hour:minute" format, giving the user the feel of using a digital clock. Similar to the digital clock, the background of the digital clock remains unchanged in the digital clock interface. Every second, the colon ":" between "hour" and "minute" flashes once; every minute, the value of "minute" changes once; and every hour, the value of "hour" changes once. Figure 2b In the illustrated application scenario, the clock application's interface refreshes in seconds. After enabling "Display GPU view updates" in the developer options, the developers discovered that the entire digital clock interface is a single View (let's call it the Clock View). Understandably, the entire digital clock interface resides within a single Layer. Every second that passes, the entire digital clock interface is refreshed. That is, as shown... Figure 2b As shown in (2), when the program interface is refreshed in seconds, the entire digital clock interface will be used as the refresh area, that is, the electronic device implements full-screen refresh.
[0075] Thus, in such Figure 2a , Figure 2bIn the application scenarios shown, although only a small portion of the program interface changes, because the application interface is a View without Layers, the electronic device calculates the local refresh area of the image based on either Layers or Views, resulting in the final calculated local refresh area being the full-screen area. In other words, the electronic device essentially performs a full-screen refresh, leading to a significant waste of unnecessary resources.
[0076] To address the aforementioned issues, this application provides a partial refresh method. In this method, when an application needs to refresh its interface, it obtains a preset refresh area A corresponding to the current refresh and a refresh area B (i.e., the dirty area of the View and / or the dirty area of the Layer) calculated based on the View and / or Layer. The intersection of the preset refresh area A and the refresh area B is taken as the partial refresh area of the application. Subsequently, the electronic device draws and renders this partial refresh area, and then combines the rendered area data with the area that does not need to be refreshed to obtain the refreshed application interface.
[0077] The partial refresh method provided in this application embodiment can be applied to electronic devices such as mobile phones, tablets, smart screens, and smartwatches. This embodiment does not specifically limit the type of electronic device.
[0078] Figure 3a A schematic diagram of the electronic device is shown. It should be understood that... Figure 3a The electronic device shown is merely an example of an electronic device, and electronic devices may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. Figure 3a The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0079] 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, a battery 142, 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, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0080] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0081] The controller can serve as the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0082] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0083] In some embodiments, the processor 110 may include one or more interfaces. It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0084] The wireless communication function of electronic devices can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Mobile communication module 150 can provide solutions for wireless communication applications in electronic devices, including 2G / 3G / 4G / 5G.
[0085] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling the electronic device to communicate with networks and other devices via wireless communication technology.
[0086] Electronic devices implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0087] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In some embodiments, the electronic device may include one or N displays screens 194, where N is a positive integer greater than 1. The electronic device may implement shooting functions through an ISP, camera 193, video codec, GPU, display screen 194, and application processor, etc.
[0088] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0089] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0090] Electronic devices can implement audio functions such as music playback and recording through audio modules 170, speakers 170A, receivers 170B, microphones 170C, headphone jacks 170D, and application processors.
[0091] A touch sensor, also known as a "touch panel," can be located on the display screen 194. The touch sensor and display screen 194 together form a touchscreen, also called a "touch screen." The touch sensor detects touch operations applied to or near it. The touch sensor can then transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor may also be located on the surface of the electronic device, in a different position than the display screen 194.
[0092] The software system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application uses the layered architecture Android system as an example to illustrate the software structure of an electronic device.
[0093] Figure 3b This is a software structure block diagram of an electronic device according to an embodiment of this application.
[0094] The layered architecture of electronic devices divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer. In some embodiments, the Android system can also be divided into five layers, from top to bottom: the application layer, the application framework layer, the Android Runtime and system libraries, the HAL, and the kernel layer.
[0095] The application layer can include a series of application packages.
[0096] like Figure 3b As shown, the application package can include applications such as phone, gallery, clock, stylus app, and camera. The application package can also include applications such as calendar, map, navigation, music, video, and text messaging.
[0097] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0098] like Figure 3b As shown, the application framework layer may include window management services, content providers, view systems, resource managers, layer management services, SurfaceFlinger, etc.
[0099] The window management service is used to manage window programs. The window manager can obtain the screen size, determine if a status bar is present, lock the screen, and capture the screen, etc. In this embodiment, the window management service can also be used to calculate the dirty area for view updates.
[0100] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0101] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0102] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0103] The layer management service is used to manage layers. In this implementation, the layer management service can also be used to calculate the dirty area for layer updates.
[0104] SurfaceFlinger (layer compositing service) is used to provide services related to graphics compositing and rendering.
[0105] The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system.
[0106] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0107] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0108] The system library can include multiple functional modules. For example: a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0109] HAL is the interface layer located between the operating system kernel and the hardware circuitry. HAL includes, but is not limited to, the Layer Composition HAL. Specifically, the Layer Composition HAL is the HAL layer module used by the Android system for window composition and display, providing hardware support for SurfaceFlinger.
[0110] The kernel layer is the layer between hardware and software. It includes at least display drivers, audio drivers, Wi-Fi drivers, and sensor drivers. The hardware includes at least a processor, display screen, Wi-Fi module, and sensors.
[0111] Understandable Figure 3bThe layers in the illustrated software structure and the components contained in each layer do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer layers than illustrated, and each layer may include more or fewer components, or combine some components, or split some components, or arrange the components differently; this application does not impose any limitations.
[0112] It is understood that, in order to implement the interface refresh method in the embodiments of this application, the electronic device includes hardware and / or software modules that perform various functions. Based on the algorithm steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.
[0113] like Figure 4 The diagram shows the interaction between each module. (Refer to...) Figure 4 Taking a clock application as an example, the flow of the interface refresh method provided in this application embodiment specifically includes:
[0114] S201, the clock application sends the application's preset refresh area A corresponding to the current time to SurfaceFlinger.
[0115] For example, in this embodiment, the clock application refreshes the program interface every second.
[0116] Whenever it is determined that the program interface needs to be refreshed, the clock application obtains the application's preset refresh area A corresponding to the current time, that is, the application's preset refresh area A corresponding to the current refresh (or current update). The application's preset refresh area A corresponding to the current time can be pre-calculated and stored, or it can be calculated when it is determined that the program interface needs to be refreshed. This embodiment does not limit this.
[0117] It should be noted that the preset refresh area A can be understood as a display area that changes before and after a refresh, which can be clearly defined at the application level; that is, the area where the application interface changes between the current moment and the next moment. It can be understood that the preset refresh area A can be an area of any shape, such as a circle, a matrix, or a shape matching a graphic pattern, etc.
[0118] The following explanation uses the program interface of a clock application as an example to illustrate how the clock application calculates or determines the application's preset refresh area A corresponding to the current time.
[0119] As an optional implementation method, such as Figure 5a As shown, the process by which the clock application determines the preset refresh area A may include:
[0120] S2011, the clock application determines that the refresh time has been reached, and checks whether the next time is the hour and minute. If not, it executes S2013; if so, it executes S2015.
[0121] The clock application determines the refresh time, which can be understood as the current time being the refresh time, for example, every whole second is a refresh time. The next time can be understood as the time that will be displayed on the clock application interface. Since the clock application refreshes the program interface every second, the current time (i.e., the refresh time) is x1 hour x2 minutes x3 seconds, and the next time is x1 hour x2 minutes x3 + 1 seconds. Here, x1 is any integer from 0 to 23, x2 is any integer from 0 to 59, and x3 is any integer from 0 to 58.
[0122] As you can understand, "hour and minute" refers to the moment when the second hand points exactly to 12, such as x4 hours x5 minutes 0 seconds. Here, x4 is any integer from 0 to 23, and x5 is any integer from 0 to 59. That is, the moment after x6 hours x7 minutes 59 seconds is the hour and minute (i.e., x6 hours x7 + 1 minute 0 seconds). Here, x6 is any integer from 0 to 23, and x7 is any integer from 0 to 58.
[0123] S2013, the clock application determines the preset refresh area A based on the current position of the second hand and the position of the second hand at the next moment.
[0124] If the next moment is not an hour or minute, only the position of the second hand changes in the analog clock interface. The clock application can determine the preset refresh area A based on the current second hand display area and the next second hand display area. That is, the area that includes both the current and next second hand display areas can be used as the preset refresh area A.
[0125] For example, such as Figure 5b As shown in Figure (1), the current time is 08:39:03, and the second hand display area can be referred to as the display area corresponding to second hand 301 in the figure; the next time is 08:39:04, and the second hand display area can be referred to as the display area corresponding to second hand 302 in the figure. Therefore, the change area of the application interface at the current time and the application interface at the next time, that is, the preset refresh area A corresponding to the current time, includes the display area of second hand 301 and the display area of second hand 302.
[0126] For example, in this embodiment, the display area corresponding to the second hand can be rectangular, and each side of the rectangle is parallel to the long or short side of the display screen. That is, the display area corresponding to the second hand includes multiple rows and columns of pixels, with an equal number of pixels in each row and an equal number of pixels in each column. Thus, the preset refresh area A corresponding to the current time can also be rectangular, that is, a rectangular display area including the rectangular display area of second hand 301 and the rectangular display area of second hand 302, which can be referred to... Figure 5b The display area 303 shown in (1) is shown in the middle.
[0127] S2015, the clock application determines the preset refresh area A based on the position of the clock hand at the current moment and the position of the clock hand at the next moment.
[0128] In this step, the clock hands include the hour hand, minute hand, and second hand. That is, the clock application determines the preset refresh area A based on the current positions of the hour, minute, and second hands, and the positions of the hour, minute, and second hands at the next moment.
[0129] When the next moment is the hour and minute, not only does the position of the second hand change in the analog clock interface, but the positions of the minute and hour hands also change. The difference is that the position changes of the minute and hour hands are smaller. At this time, the clock application can determine the preset refresh area A based on the display areas of the hands (hour, minute, and second hands) at the current moment and the display areas of the hands at the next moment. That is, the area that includes both the display areas of the hands at the current moment and the display areas of the hands at the next moment can be used as the preset refresh area A.
[0130] For example, such as Figure 5b As shown in Figure (2), the current time is 08:39:59, and the second hand display area can be referenced to the display area corresponding to second hand 304 in the figure; the next time is 08:40:00, and the second hand display area can be referenced to the display area corresponding to second hand 305 in the figure. Given that the position changes of the minute and hour hands are relatively small, Figure 5b (2) The minute and hour hands for the next moment are not shown. Therefore, the area where the application interface changes between the current moment and the next moment, that is, the preset refresh area A corresponding to the current moment, includes the hour, minute, and second hand display area for the current moment and the hour, minute, and second hand display area for the next moment. Among them, the hour, minute, and second hand display area refers to a display area that simultaneously includes the hour hand display area, the minute hand display area, and the second hand display area.
[0131] In this embodiment, the display area corresponding to each pointer can be rectangular, and each side of the rectangle is parallel to the long or short side of the display screen (the long and short sides are perpendicular to each other). That is, the display area corresponding to each pointer includes multiple rows and columns of pixels, with an equal number of pixels in each row and an equal number of pixels in each column. Thus, the preset refresh area A corresponding to the current time can also be rectangular, that is, a rectangular display area including the display area of the hour, minute, and second hands at the current time and the display area of the hour, minute, and second hands at the next time. (Refer to...) Figure 5b The display area 306 shown in (2) is shown in the middle.
[0132] Thus, when the preset refresh area A is a rectangle, the number of pixels in the rows and columns is equal due to the regular shape of the area, making the data storage for the update corresponding to the preset refresh area A simpler, and the corresponding local refresh of the area easier to implement.
[0133] Understandably, in an analog clock interface, when the dial style (e.g., square, circle, rectangle, etc.) and the style of the hour, minute, and second hands are fixed, the display position of the hour, minute, and second hands at each moment is also determined, and the display area of the hour, minute, and second hands is also determined. Therefore, clock applications can calculate the display area of the hour, minute, and second hands corresponding to each moment. For example, taking the second hand displayed at moment 'a' as an example, the clock application can determine a boundary parallel to the long or short side of the display screen on the top, bottom, left, and right sides of the second hand image displayed at moment 'a' (each boundary has no intersection with the second hand image), and the rectangular area enclosed by the four boundaries is used as the second hand display area at moment 'a'. Of course, the clock application can also determine four vertices around the second hand image displayed at moment 'a' and obtain the second hand display area at moment 'a' based on these four vertices; this embodiment does not limit this.
[0134] As another alternative implementation method, such as Figure 5c As shown, the process by which the clock application determines the preset refresh area A may include:
[0135] S2012, the clock application determines that the refresh time has been reached, and checks whether the next time is the hour and minute. If not, it executes S2014; if so, it executes S2010.
[0136] S2014, the clock application determines the range of seconds the next moment belongs to. If the next moment's seconds belong to range 1, then execute S2016; if the next moment's seconds belong to range 2, then execute S2018.
[0137] For example, second range 1 includes the seconds when the second hand is displayed in the right half of the dial, and second range 2 includes the seconds when the second hand is displayed in the left half of the dial. For instance, second range 1 is 0 seconds to 30 seconds, and second range 2 is 31 seconds to 59 seconds. Another example is second range 1 being 0 seconds to 29 seconds, and second range 2 being 30 seconds to 59 seconds. Yet another example is second range 1 being 1 second to 29 seconds, and second range 2 being 0 seconds and 30 seconds to 59 seconds.
[0138] Taking the current time as 08:39:03 as an example, the next time is 08:39:04, and the range of seconds in the next time is range 1.
[0139] S2016, the clock application determines that the preset refresh area A corresponding to the current time is preset area 1.
[0140] Preset area 1 can include the second hand display area corresponding to each second in the second range 1. Taking the second range 1 as 0 seconds to 30 seconds as an example, when the second hand indicates any second between 0 and 30 seconds at the next moment, the second hand display area can be included in preset area 1. For example, preset area 1 can refer to... Figure 5d The display area 307 shown in (1) is shown in the middle.
[0141] S2018, the clock application determines that the preset refresh area A corresponding to the current time is preset area 2.
[0142] The preset area 2 can include the second hand display area corresponding to each second within the second range 2. Taking the second range 2 as 31 seconds to 59 seconds as an example, when the second hand indicates any second between 31 and 59 seconds at the next moment, the second hand display area can be included in the preset area 2. For example, the preset area 2 can be referred to as... Figure 5d The display area 308 shown in (2) is shown in the middle.
[0143] In this embodiment, preset area 1 and preset area 2 can be rectangles, and each side of the rectangle is parallel to the long or short side of the display screen. That is, preset area 1 or preset area 2 includes multiple rows and columns of pixels, with the number of pixels in each row being equal and the number of pixels in each column being equal.
[0144] S2010, the clock application determines the preset refresh area A corresponding to the current time based on the position of the clock hand at the current time and the position of the clock hand at the next time.
[0145] For an explanation of S2012, please refer to [link / reference]. Figure 5a For an explanation of S2010, please refer to step S2011 in the flowchart shown. Figure 5a S2015 in the process shown will not be described again here.
[0146] In this way, if the next moment is not an hour or minute, the application preset refresh area A corresponding to the current moment is preset area 1 or preset area 2. The clock application does not need to calculate the application preset refresh area A for each moment, which can effectively reduce the amount of calculation or the amount of data stored about the application preset refresh area A.
[0147] The following explanation uses the digital clock interface of a clock application as an example to illustrate how the clock application calculates or determines the application's preset refresh area A corresponding to the current time.
[0148] The clock application determines when the refresh time has been reached and checks whether the next time is an hour (e.g., 13:00:00) or a minute (e.g., 12:03:00). If the next time is neither an hour nor a minute, the clock application uses the display area marked with a colon ":" as the application's preset refresh area A corresponding to the current time. Figure 6 The display area 401 shown in (1) is used. If the next moment is a minute but not an hour, the clock application will use the minute display area as the application's preset refresh area A corresponding to the current moment, for example... Figure 6 The display area 402 shown in (2) is used as the clock application's default refresh area A corresponding to the current time if the next time is the hour. Figure 6 The display area 403 shown in (3) is shown in the middle.
[0149] For example, in such Figure 6 In the example described, the preset refresh area can be a rectangle, with each side of the rectangle parallel to either the long or short side of the display screen. That is, the preset refresh area includes multiple rows and columns of pixels, with an equal number of pixels in each row and an equal number of pixels in each column.
[0150] It should be noted that the preset refresh area A can be a single area or it can include multiple independent areas. This embodiment does not limit this.
[0151] S202, the window management service and the layer management service send the refresh area B, calculated based on the view and / or layer, to SurfaceFlinger.
[0152] If the application's interface calculates the local refresh area based on Views, the window management service can traverse the View tree corresponding to the application's interface, calculate the Views corresponding to the image change area during interface updates, and determine the dirty region corresponding to the current update as refresh area B. For a detailed algorithm on determining the refresh area based on Views, please refer to [link to relevant documentation]. Figure 1bThe examples shown and the relevant prior art will not be elaborated upon here.
[0153] If the application's interface calculates the local refresh area based on layers, the layer management service can traverse each layer corresponding to the application's interface, calculate each layer corresponding to the changed image area during interface updates, and determine the dirty region corresponding to the current update as refresh region B. For a detailed algorithm for determining the refresh region based on layers, please refer to [link to relevant documentation]. Figure 1a The examples shown and the relevant prior art will not be elaborated upon here.
[0154] If the application's interface calculates the local refresh area based on View and Layer, then the window management service calculates the dirty area of the View corresponding to the current update, and the layer management service calculates the dirty area of the Layer corresponding to the current update. The union of the dirty areas of the View and Layer can be used as the refresh area B. This scenario can be referenced... Figure 1c The examples shown and the relevant prior art will not be elaborated upon here.
[0155] exist Figure 2a or Figure 2b In the example shown, the clock application's interface is a View without any Layers. Whether the refresh area B is calculated based on the View or the Layer, the refresh area B is the area corresponding to the entire application interface of the clock application, that is, the full-screen area.
[0156] S203, SurfaceFlinger uses the intersection of the preset refresh area A and refresh area B as the local refresh area, and calls the layer composition HAL to draw, render, and composite the local refresh area.
[0157] In this embodiment, whenever the clock application updates its program interface, the local refresh area is the intersection of the application's preset refresh area A and refresh area B.
[0158] Taking the program interface of a clock application as an example of a simulated clock interface, as exemplarily shown in 7a(1), the application presets refresh area A as display area 501, and refresh area B calculated based on View and / or Layer as display area 502 (i.e., full-screen area). The intersection of display area 501 and display area 502 is used as the local refresh area corresponding to the current program interface update. Among them, in the example of Figure 7a In the example shown in (1), the local refresh area is the application preset refresh area A.
[0159] In some implementations, the display driver does not display the image on the screen all at once, but scans line by line from left to right and top to bottom, sequentially displaying each pixel of the screen. However, this process is so fast that the human eye cannot perceive the change. Therefore, after using the intersection of the application's preset refresh area A and refresh area B as a partial refresh area, SurfaceFlinger can expand this partial refresh area. The number of pixels per row in the expanded partial refresh area is equal to the number of pixels per row on the phone's display screen. That is, the expanded partial refresh area is a continuous multi-row area in the display screen area. For example, after expanding the partial display area 501, it becomes as follows: Figure 7a The local refresh area 503 is shown in (2).
[0160] In this way, when the display driver refreshes the display interface by pixel row, there is no need to stitch together redrawn and non-redrawn pixels. Any row of pixels displayed in the display area is either all redrawn or all non-redrawn, making partial refreshes easier to implement.
[0161] Taking a clock application's program interface as a digital clock interface as an example, as exemplified in 7b(1), the application presets refresh area A as display area 504, and refresh area B calculated based on View and / or Layer as display area 505 (i.e., full-screen area). The intersection of display area 504 and display area 505 serves as the local refresh area corresponding to the current program interface update. In this case, as shown in... Figure 7b In the example shown in (1), the local refresh area is the application preset refresh area A.
[0162] After using the intersection of the preset refresh area A and refresh area B as the local refresh area, SurfaceFlinger can further expand this local refresh area. The number of pixels per row in the expanded local refresh area is equal to the number of pixels per row on the phone's display screen. That is, the expanded local refresh area is a continuous multi-row area within the display screen. For example, after expanding the local display area 504, it becomes as follows: Figure 7b The local refresh area 506 is shown in (2).
[0163] In this way, when the display driver refreshes the display interface by pixel row, there is no need to stitch together redrawn and non-redrawn pixels. Any row of pixels displayed in the display area is either all redrawn or all non-redrawn, making partial refreshes easier to implement.
[0164] It should be noted that when the preset refresh area A includes multiple independent small areas, the intersection calculation of these multiple independent small areas with refresh area B can also result in a local refresh area that includes multiple independent small areas. In this case, SurfaceFlinger can further process the local refresh area, for example, by merging the multiple independent small areas it includes to obtain a larger area that includes these multiple small areas, which is then used as the final determined local refresh area. Of course, if the obtained local refresh area includes multiple independent small areas, SurfaceFlinger may also choose not to perform the small area merging process and instead draw and render the image data corresponding to each small area separately to achieve image refresh for each small area. This embodiment does not limit this approach.
[0165] S204, Layer Composition HAL stores the processed image frame data into the Buffer.
[0166] S205, the display driver reads image frame data from the buffer and displays the image frame data on the display screen.
[0167] SurfaceFlinger is an important component of the Android system, responsible for managing and rendering all graphical interfaces. Its main responsibility is to composite the graphical output of applications and then send the composited image to the display screen for display.
[0168] In addition to compositing layers, SurfaceFlinger is also responsible for sending the composited image data to the display for presentation. SurfaceFlinger interacts with the layer compositing HAL to transmit image data to the display driver. The display driver then converts the image data into signals that the display can recognize and displays it.
[0169] In this embodiment, only the image data corresponding to the locally refreshed area needs to be redrawn and rendered. After the image data corresponding to the locally refreshed area has been drawn and rendered, the display area can refresh the clock application interface.
[0170] For detailed processing flow information regarding SurfaceFlinger, HAL layer compositing, and display drivers, please refer to existing technologies; they will not be elaborated upon here.
[0171] In the interface refresh method provided in this embodiment, the intersection area of the preset refresh area A and the refresh area B calculated based on View and / or Layer is used as the local refresh area. The interface is refreshed by redrawing and rendering the local refresh area, which reduces the amount of data processing of the original image and achieves the purpose of saving device power consumption. Moreover, the preset refresh area A is determined by the application based on its actual update situation, overcoming the limitations of calculating the refresh area B based on View and / or Layer.
[0172] Figures 8a-8b An exemplary schematic diagram of a stylus writing scenario is shown.
[0173] With the development of touch technology, more and more electronic devices are adopting touch for human-computer interaction. In addition to finger touch, the touchscreen displays of electronic devices can also be operated using a stylus. Once a stylus is paired and connected to an electronic device, the user can write on the touchscreen display, such as... Figure 8a As shown in (1), the touch screen displays the handwriting entered by the user through the stylus.
[0174] Continue to refer to Figure 8a In section (2), the stylus application's interface has two layers: the handwriting layer and the background layer. The stylus application's interface updates in response to user input. The stylus application's interface can calculate the refresh area based on the layer to reduce the workload of drawing and rendering image data. It is understandable that when a user uses the stylus to input on the touchscreen, only the handwriting displayed on the touchscreen changes, while the background image corresponding to the handwriting remains unchanged. Therefore, the stylus application's interface can calculate the refresh area based on the layer, which is the area corresponding to the handwriting layer. In other words, the area corresponding to the handwriting layer is the dirty layer area.
[0175] In this embodiment, in response to the user's input operation, the stylus application determines the application's preset refresh area A corresponding to the current moment. For example, the stylus application can determine the application's preset refresh area A based on the contact point position between the stylus and the touchscreen display. For instance, the stylus application can define a circular area with the contact point as the center and a preset size as the radius, and use this circular area as the application's preset refresh area A. As another example, the stylus application can define a rectangular area with the contact point as the center and two preset sizes as the side lengths, and use this rectangular area as the application's preset refresh area A. For example, the stylus application can also invoke a relevant neural network model to predict the application's preset refresh area A.
[0176] Thus, when the stylus application's interface needs to be updated, the stylus application determines the application's preset refresh area A, for example... Figure 8b The display area 701 is shown in (1). Continue to refer to... Figure 8b As shown in Figure (2), when the program interface of the stylus application needs to be updated, the preset refresh area A determined by the stylus application is the display area 701, and the refresh area B calculated based on the Layer is the display area 702. The intersection of the display area 701 and the display area 702 can be used as the local refresh area corresponding to the current program interface update. It should be noted that the local refresh area is a part of the handwriting Layer, and the background Layer does not need to be refreshed.
[0177] In such Figure 8b In the scenario shown, when the program interface of the stylus application needs to be updated, it is not necessary to update the entire handwriting layer area. Instead, only a part of the handwriting layer area is updated, which reduces the amount of image data processing and achieves the goal of saving device power consumption.
[0178] In order to solve such Figure 2a The full-screen refresh shown leads to resource waste. This application also provides a solution to this problem. For example... Figure 9 As shown, a clock application can pre-create two views: a second hand view and a background and hour / minute hand view. The second hand view refers to the control used to control the movement of the second hand in the clock application interface, while the background and hour / minute hand views refer to the controls used to control the movement of the background, hour, and minute hands in the clock application interface.
[0179] When the clock application determines that the refresh time has been reached, the window management service traverses the View tree corresponding to the clock application to identify the Views that have changed. Specifically, when the clock application determines that the refresh time has been reached, if the next time is the hour and minute, the window management service determines that the area corresponding to the second hand View is the dirty area of the View; otherwise, the window management service determines that the second hand View, the background, and the hour and minute hand Views are all part of the dirty area of the View.
[0180] In this way, when only the second hand changes position on the clock application interface, the dirty area of the View is the region corresponding to the second hand View. When the clock application interface does not only have a changing second hand position, the dirty area of the View includes the regions corresponding to the second hand View, the background, and the hour and minute hand Views. Therefore, when only the second hand position changes on the clock application interface, only the region corresponding to the second hand View needs to be updated locally, without needing a full-screen update, thus avoiding unnecessary resource waste.
[0181] In such Figure 9In the scenario shown, where the clock application's interface has two views, the clock application interface can also be refreshed using... Figure 4 The interface refresh method shown.
[0182] Continue to refer to Figure 10 The clock application's interface features two views: a second hand view and a background and hour / minute hand view. The clock application's interface updates every second. For example, see... Figure 10 As shown in (1), when the refresh time is reached, the clock application determines the application's preset refresh area A corresponding to the current time as display area 801. (Continue referring to...) Figure 10 As shown in (2), when the clock application's program interface needs to be updated, the clock application determines the preset refresh area A as display area 801, and the refresh area B calculated based on the View is display area 802 (that is, the dirty area corresponding to the second hand View). The intersection of display area 801 and display area 802 can be used as the local refresh area corresponding to the current program interface update, such as... Figure 10 As shown in (2).
[0183] exist Figure 10 In the scenario shown, the preset refresh area A is smaller than the dirty area corresponding to the second hand view, meaning display area 801 is smaller than display area 802. This results in the final local refresh area being smaller than the dirty area of the second hand view, further reducing the amount of image data processing. Moreover, the clock application's calculation of the preset refresh area A corresponding to the current time is relatively flexible, especially since the shape of the preset refresh area A has fewer limitations and can fit the shape of the image's changing area as closely as possible. This overcomes the limitations of determining the local refresh area based on the dirty area of the view.
[0184] This embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the interface refresh method in the above embodiment.
[0185] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the interface refresh method described in the above embodiment.
[0186] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the interface refresh method in the above method embodiments.
[0187] In this embodiment, the electronic devices (such as mobile phones), computer storage media, computer program products, or chips are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0188] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0189] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0190] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for refreshing the interface of an application, characterized in that, Used in electronic devices, including: Upon reaching the refresh time, a first refresh area preset by the application is obtained; wherein, the application is a clock application, obtaining the first refresh area preset by the application includes: if the next time of the refresh time is neither an hour nor a minute, when the number of seconds to which the next time belongs is a first range, the application preset area corresponding to the first range is used as the first refresh area; when the number of seconds to which the next time belongs is a second range, the application preset area corresponding to the second range is used as the first refresh area; if the next time of the refresh time is an hour or a minute, a third display area including the hour hand, minute hand and second hand at the refresh time is determined, and a fourth display area including the hour hand, minute hand and second hand at the next time is determined, and an area including the third display area and the fourth display area is used as the first refresh area; Obtain the second refresh area of the application calculated based on View and / or Layer; wherein the interface of the application is a View and is not divided into Layers, and the second refresh area is the area corresponding to the entire program interface of the application; The intersection of the first refresh area and the second refresh area is taken as the local refresh area corresponding to the current interface refresh. After drawing and rendering the image data corresponding to the local refresh area, the interface of the application is refreshed and displayed.
2. The method according to claim 1, characterized in that, The clock application's interface refresh interval is 1 second, and the clock application's interface includes an hour hand, a minute hand, and a second hand.
3. The method according to claim 2, characterized in that, Obtaining the first refresh area preset by the application includes: It is determined that the next moment after the refresh time is neither an hour nor a minute. Determine the first display area of the second hand at the refresh time; Determine the second display area of the second hand at the next moment; The area comprising the first display area and the second display area is designated as the first refresh area.
4. The method according to claim 1, characterized in that, The preset first refresh area is a rectangular area, and each side of the rectangular area is parallel to the first or second side of the display screen of the electronic device, and the first side and the second side are perpendicular.
5. The method according to claim 1, characterized in that, After taking the intersection of the first refresh area and the second refresh area as the local refresh area corresponding to the current interface refresh, the method further includes: Expand the local refresh area; In this extended local refresh area, the number of pixels per row is equal to the number of pixels per row on the display interface of the electronic device.
6. An electronic device, characterized in that, include: One or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored on the memory, and when the computer programs are executed by the one or more processors, cause the electronic device to perform the interface refresh method of the application as described in any one of claims 1-5.
7. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the interface refresh method of the application as described in any one of claims 1-5.