Page resource processing method and device, electronic equipment and readable storage medium
By determining the page interaction hierarchy and dynamically adjusting cache priority in electronic devices, the problem of a single page resource caching method is solved, enabling flexible page resource management and fast page switching, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- VIVO MOBILE COMM CO LTD
- Filing Date
- 2026-03-27
- Publication Date
- 2026-06-09
AI Technical Summary
In the existing technology, electronic devices have a relatively simple method for caching page resources, which makes the processing inflexible, especially since the least recently used page resources are difficult to cache.
By determining the interaction level of each page relative to the currently displayed page, the caching priority of page resources is dynamically adjusted. An interaction hierarchy tree and a node tree are used to manage page resource caching and dynamically update the caching order of page resources.
It enables flexible management of page resource caching on electronic devices, improves page switching speed and user experience, avoids lag caused by insufficient memory, and improves the efficiency of page resource processing.
Smart Images

Figure CN122173187A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment technology, specifically relating to a page resource processing method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] Currently, electronic devices typically employ a Least Recently Used (LRU) strategy to process page images. This means that electronic devices always prioritize caching the most recently used page resources, resulting in the least recently used page resources being evicted first. Consequently, the least recently used page resources are difficult to cache on electronic devices. Therefore, this approach makes the caching method for page resources on electronic devices relatively simplistic and inflexible. Summary of the Invention
[0003] This application provides a page resource processing method, apparatus, electronic device, and readable storage medium, which can solve the problem of insufficient flexibility in the processing of page resources by electronic devices in related technologies.
[0004] Firstly, a page resource processing method is provided, applied to electronic devices, the method comprising:
[0005] When the first page is displayed, the interaction level of each page in the electronic device relative to the first page is determined, and the interaction level is used to indicate the minimum number of operations required to switch each page to be displayed on the electronic device.
[0006] The page resource caching priority for each page is determined based on the interaction level of each page relative to the first page.
[0007] Secondly, a page resource processing apparatus is provided for use in an electronic device, the apparatus comprising:
[0008] A first determining module is used to determine the interaction level of each page in the electronic device relative to the first page when the first page is displayed. The interaction level is used to indicate the minimum number of operations required for each page to be switched to be displayed on the electronic device.
[0009] The second determining module is used to determine the page resource caching priority of each page based on the interaction level of each page relative to the first page.
[0010] Thirdly, an electronic device is provided, the terminal including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method as described in the first aspect.
[0011] Fourthly, a readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0012] Fifthly, a chip is provided, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the steps of the method described in the first aspect.
[0013] In a sixth aspect, a computer program / program product is provided, the computer program / program product being stored in a storage medium, the computer program / program product being executed by at least one processor to perform the steps of the method as described in the first aspect.
[0014] In this embodiment, when an electronic device displays a first page, it determines the interaction level of each page relative to the first page and determines the page resource caching priority corresponding to each page based on the interaction level of each page relative to the first page. The interaction level indicates the minimum number of operations required to switch each page to its display on the electronic device. This can also be understood as indicating the minimum number of operations required to switch each page to its display interface on the electronic device. Since the display interface of the electronic device can change based on the user's page switching operations, the interaction level of each page also changes dynamically. This results in the page resource caching priority of each page, determined by its interaction level, also changing dynamically. The electronic device can cache page resources sequentially according to their caching priority, thus dynamically changing the caching order of page resources instead of relying on the traditional LRU strategy. This makes the caching of page resources more flexible and helps the electronic device handle page resources more flexibly. Attached Figure Description
[0015] Figure 1 This is a flowchart of a page resource processing method provided in an embodiment of this application;
[0016] Figure 2a This is a schematic diagram of an interactive hierarchy tree that can be applied in the page resource processing method provided in the embodiments of this application;
[0017] Figure 2b This is a schematic diagram of a node tree that can be applied in the page resource processing method provided in the embodiments of this application;
[0018] Figure 2cThis is a schematic diagram illustrating the method for determining the interaction level of each page in the page resource processing method provided in this application embodiment;
[0019] Figure 2d This is another schematic diagram illustrating the method for determining the interaction level of each page in the page resource processing method provided in this application embodiment;
[0020] Figure 3 This is a flowchart of another page resource processing method provided in the embodiments of this application;
[0021] Figure 4 This is a structural diagram of a page resource processing device provided in an embodiment of this application;
[0022] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application;
[0023] Figure 6 This is a structural diagram of another electronic device provided in an embodiment of this application. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0025] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0026] The page resource processing method, apparatus, and electronic device provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0027] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a page resource processing method provided in an embodiment of this application. The method is applied to electronic devices, including but not limited to mobile phones, tablets, smartwatches, and smart wristbands. Figure 1 As shown, the method includes the following steps:
[0028] Step 101: When the first page is displayed, determine the interaction level of each page in the electronic device relative to the first page.
[0029] The interaction level is used to indicate the minimum number of operations required to switch each page to its display on the electronic device. In some embodiments, the interaction level can also be understood as the minimum number of operations required to switch each page to its display interface on the electronic device. Understandably, if the electronic device is currently displaying a first page, this first page can be understood as the current display page of the electronic device; that is, it is necessary to determine the interaction level of each page relative to the current display page. For example, if the electronic device switches from the first page to a second page, the second page becomes the current display page of the electronic device. In this case, it is necessary to determine the interaction level of each page in the electronic device relative to the second page, rather than the interaction level of each page relative to the first page. Understandably, if the current display page of the electronic device changes, the interaction level of each page in the electronic device relative to the current display page will also change accordingly.
[0030] The interaction hierarchy of each page in an electronic device relative to the first page can be understood as the minimum number of operations required to switch each page to be displayed on the electronic device when the first page is currently being displayed.
[0031] Optionally, the electronic device can establish an interaction hierarchy tree based on the hierarchical relationship between the pages. It should be noted that the "pages" mentioned in this embodiment can refer to all pages that can be displayed on the electronic device, including the homepage of all applications and pages displayed based on operations on the controls in each application. For example, taking a communication application as an example, the homepage of this application displays multiple communication objects (each communication object can be understood as an operation control), contact list controls, edit controls, back controls, and other operation controls. Clicking any of these operation controls will display the corresponding page; for example, clicking the contact list control will display the contact list page. The contact list page may display multiple contacts, each contact can be understood as an operation control. When the user clicks on any contact, the information page corresponding to that contact will be further displayed, such as displaying phone number, detailed name, etc. This information page can also further display related pages based on the user's operation, which will not be described in detail here.
[0032] In this embodiment of the application, after determining all pages that can be displayed on the electronic device, an interaction hierarchy tree is established based on the hierarchical relationship between the pages. For example, as shown... Figure 2aAs shown, taking the desktop application and settings application in an electronic device as examples, the desktop application and settings application belong to the same interaction level, and both belong to the root node. The display pages of the desktop application include the negative one screen, the home screen, and the application list. The negative one screen, the home screen, and the application list are also the next level nodes of the desktop application. The negative one screen, the home screen, and the application list each correspond to three display pages. The negative one screen further includes two display pages: the card list and the card editing page. Thus, the card list and the card editing page are also the next level nodes of the negative one screen. In this way, based on the hierarchical relationship between all the pages included in the desktop application and the settings application, an interaction hierarchy tree as shown in 2a can be established. Furthermore, based on the established interaction hierarchy tree, the interaction level of each page relative to the first page (i.e., the currently displayed page) is determined, that is, the minimum number of operations required for each page to be switched to be displayed on the electronic device is determined. For example, if the interaction level of the currently displayed page (e.g., the first page) in the interaction hierarchy tree is set to 0, and the page corresponding to node A requires at least k operations to be displayed on the electronic device, then the interaction level of the page corresponding to node A is k.
[0033] For example, please refer to Figure 2a Assuming the current displayed page of the electronic device (i.e., the first page) is the homepage of the desktop application, the interaction level corresponding to the homepage is 0. If the user enters the card list page on the negative one screen through one operation (e.g., swiping right), the interaction level corresponding to the card list page is 1. If the user further enters the card editing page through a click operation, the card editing page requires two operations relative to the homepage before it is displayed on the electronic device, so the interaction level corresponding to the card editing page is 2. In this way, the interaction level of each page relative to the first page can be determined based on the current displayed page of the electronic device (i.e., the first page).
[0034] Step 102: Determine the page resource caching priority for each page based on the interaction level of each page relative to the first page.
[0035] In this embodiment, after determining the interaction level of each page relative to the first page, the page resource caching priority of each page is determined according to the interaction level of each page. For example, the lower the interaction level of a page, the higher the page resource caching priority of that page, meaning that the page will be stored more preferentially, for example, stored in the page resource cache list. In other words, page resources of pages with lower interaction levels will be stored more preferentially in the page resource cache list. For example, if the page resource cache list can only store 10 page resources, after determining the page resource caching priority of each page according to the interaction level of each page relative to the first page, the page resources of the top 10 pages with the highest priority can be stored in the page resource cache list. Since the lower the interaction level of a page, the higher the page resource caching priority of that page, the page resources of the top 10 pages with the lowest interaction levels can also be stored in the page resource cache list.
[0036] Optionally, the method may further include:
[0037] Based on the interaction level of each page relative to the first page, the page resource caching priority of each page is determined, and a page resource cache list is determined based on the page resource caching priority of each page.
[0038] Understandably, the lower the interaction level of a page, the higher the priority of its page resources in the cache; in other words, its page resources are stored earlier, or page resources from pages with lower interaction levels are stored with priority. For example, for pages A and B, if page A's interaction level is lower than page B's, then page A's page resources have a higher cache priority than page B's. If the page resource cache list can only store one more page resource, then page A's page resources will be stored in the page resource cache list first. As another example, assuming the page resource cache list can only store a maximum of 10 page resources, after determining the page resource cache priority of each page based on its corresponding interaction level, the page resources of the first 10 pages with the highest cache priority are stored in the page resource cache list. These 10 page resources correspond to the page resources of the 10 pages with the lowest interaction levels.
[0039] In this way, the page resource caching priority of each page can be determined according to the interaction level of each page, that is, the page resource caching order of each page can be determined. The page resources of pages with lower interaction levels are stored in the page resource cache list with higher priority. This makes the page resources stored in the page resource cache list related to the page's interaction level. The interaction level is used to represent the minimum number of operations required to switch the page to be displayed on the electronic device. Therefore, the page resources stored in the page resource cache list are also related to the minimum number of operations required to switch the page to be displayed on the electronic device, making the management of page resources stored in the page resource cache list by the electronic device more flexible.
[0040] Understandably, once the page resource cache list is determined, the storage of page resources for the page to be switched can be processed according to the page resource cache list, thereby realizing page switching.
[0041] In this embodiment, when an electronic device displays a first page, it determines the interaction level of each page relative to the first page and determines the page resource caching priority of each page based on the interaction level. The interaction level indicates the minimum number of operations required to switch each page to its display on the electronic device. This can also be understood as indicating the minimum number of operations required to switch each page to its display interface on the electronic device. Since the display interface of the electronic device can change based on the user's page switching operations, the interaction level of each page also changes dynamically. This results in a dynamic change in the page resource caching priority determined by the interaction level of each page. The electronic device can cache the page resources of each page sequentially according to their caching priority, thus dynamically changing the caching order instead of relying on an LRU strategy. This makes the caching of page resources more flexible and helps the electronic device handle page resources more flexibly.
[0042] Optionally, in some implementations, upon receiving a page switching request to switch from the first page to the second page, the method further includes any one of the following:
[0043] If the page resource cache priority of the second page is greater than or equal to the preset priority, the page resource of the second page is obtained, and the user is switched to the second page.
[0044] For example, in some implementations, when the electronic device is displaying a first page, if a page switching request is received, such as a request to switch from the first page to a second page, the page resource cache priority of the second page is obtained. It is understood that when the electronic device is displaying the first page, it can already determine the page resource cache priority of each page based on the interaction level of each page relative to the first page; that is, the page resource cache priority of the second page has already been determined, and therefore the page resource cache priority of the second page is obtained.
[0045] Optionally, the preset priority can be the page resource cache priority corresponding to the target page, where the target page is the page with the lowest page resource cache priority among the pages corresponding to the page resources stored in the page resource cache list. For example, if the page resource cache list can store 10 page resources, and page C has the lowest page resource cache priority, then page C is also the target page, and the page resource cache priority of page C is the preset priority. In this embodiment, if the page resource cache priority of the second page is greater than or equal to the preset priority, it means that the page resources of the second page have been stored in the page resource cache list. In this case, the page resources of the second page are directly retrieved from the page resource cache list and the user switches to the second page, thus switching the electronic device from displaying the first page to displaying the second page, thereby completing the page switching.
[0046] In this embodiment, when the electronic device switches pages, if the page resource cache priority of the second page to be switched to is greater than or equal to the preset priority, the page resource of the second page is directly obtained and the device switches to the second page, thereby enabling the page switching to be completed quickly.
[0047] For example, in some other embodiments, when the electronic device is displaying a first page, if a page switching request to switch from the first page to a second page is received, the page resource cache priority of the second page is obtained. If the page resource cache priority of the second page is less than a preset priority (the preset priority is defined as described above), it means that the page resources of the second page are not stored in the page resource cache list. In this case, the page resource cache list is obtained, and the page resources of the second page are processed according to the page resource cache list. For example, the page resources of the second page are loaded into the page resource cache list, or some page resources in the page resource cache list are cleared first, and then the page resources of the second page are loaded into the page resource cache list, so that the electronic device can obtain the page resources of the second page from the page resource cache list and complete the page switching. In this way, the page resources of the second page can be processed based on the page resource cache list, which helps the electronic device to manage page resources more flexibly.
[0048] Optionally, when the page resource cache priority of the second page is lower than the preset priority, processing the page resources of the second page according to the page resource cache list includes:
[0049] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has sufficient memory, the page resource of the second page is loaded and the page resource of the second page is arranged at the front of the page resource cache list. The page resource of the second page is then retrieved from the page resource cache list to switch to the second page.
[0050] In some implementations, if the page resource cache priority of the second page is lower than the preset priority, it indicates that the page resource of the second page is not stored in the page resource cache list. In this case, it is necessary to determine whether the electronic device or the page resource cache list has sufficient memory. If the electronic device or the page resource cache list currently has sufficient memory, the page resource of the second page is loaded into the page resource cache list and arranged at the forefront of the page resource cache list. That is, the page resource of the second page has the first priority in the page resource cache list, so the electronic device will obtain and display the page resource of the second page with the highest priority, thereby completing the page switching.
[0051] Optionally, when the page resource cache priority of the second page is lower than the preset priority, processing the page resources of the second page according to the page resource cache list includes:
[0052] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has insufficient memory, at least one page resource at the end of the page resource cache list is cleared, the page resource of the second page is loaded and arranged at the front of the page resource cache list, and the page resource of the second page is obtained from the page resource cache list to switch to the second page.
[0053] In some implementations, if the page resource cache priority of the second page is lower than the preset priority, it indicates that the page resource of the second page is not stored in the page resource cache list, and at this time, the electronic device or the page resource cache list has insufficient memory, meaning that no new page resource can be loaded into the page resource cache list. In this case, at least one page resource at the end of the page resource cache list is cleared first, for example, the last page resource in the page resource cache list is cleared, or two or three page resources at the end of the page resource cache list can be cleared according to the cache size of the second page's page resources, thereby freeing up memory. This allows the electronic device to load the page resource of the second page into the page resource cache list and arrange the page resource of the second page at the front of the page resource cache list, that is, the page resource of the second page has the first priority in the page resource cache list. Therefore, the electronic device will obtain and display the page resource of the second page with the highest priority, thereby completing the page switching. In this embodiment, when the electronic device is short of memory, it will prioritize clearing the page resources at the end of the page resource cache list, that is, page resources with lower page resource cache priority. The lower the page resource cache priority, the higher the interaction level of the page. Therefore, when the electronic device is short of memory, it will first clear the page resources of pages with higher interaction level (that is, pages that require multiple operations to switch to display on the electronic device), rather than page resources that have not been used for a long time, thus providing a new way to manage and process page resources.
[0054] In this embodiment, when the electronic device switches pages, it determines a page resource cache list based on the page resource cache priority corresponding to each page. The page resource cache priority is determined based on the page's interaction level. The page's interaction level represents the minimum number of operations required to switch the page to display on the electronic device. Since the currently displayed page of the electronic device changes dynamically, the interaction level of each page relative to the currently displayed page (e.g., the first page) also changes dynamically, and the page resource cache priority corresponding to each page also changes dynamically. This ensures that the page resources stored in the page resource cache list determined by the page's resource cache priority are also dynamically changing, helping the electronic device to manage page resources more flexibly.
[0055] For example, when a user needs to return to the home screen of a desktop application (which can also be understood as the desktop) from a certain page, it's understandable that in some cases, the user only needs to press the return button (such as the home button) once to switch to the desktop. That is, only one operation is needed to switch to the desktop, and the desktop's interaction level relative to the currently displayed page is 1. The lower the page's interaction level, the higher the priority of its page resource caching. The page resources of that page are stored more preferentially in the page resource cache list, and their order in the cache list is also closer to the front. Therefore, they are less likely to be cleared when memory is insufficient. It's understandable that the desktop's interaction level is 1, so its page resources are always preferentially stored at the front of the page resource cache list and are not cleared. Thus, when switching to the desktop, even if the desktop application has not been used for a long time, the electronic device can quickly retrieve and display the desktop's page resources from the cache list without reloading them. This avoids lag during page switching, making the electronic device retrieve page resources faster and effectively improving the user experience.
[0056] In this embodiment, the currently displayed page of the electronic device changes dynamically. For example, each time a page switch is performed, the currently displayed page of the electronic device will also change. Understandably, the interaction level of a page is relative to the currently displayed page. Therefore, if the currently displayed page changes, the interaction level of each corresponding page will also change accordingly. The page resources in the page resource cache list are determined based on the page resource cache priority of each page, which is determined based on the page's interaction level. Therefore, the page resources in the page resource cache list may also change due to the switching of the currently displayed page. In this way, the page resources in the page resource cache list are no longer deleted only when memory is insufficient, but can actively change with each page switch. This makes the management of page resources in the page resource cache list more flexible and allows users to obtain page resources more quickly when switching pages, improving the efficiency of page resource processing.
[0057] Optionally, determining the interaction level of each page in the electronic device relative to the first page includes:
[0058] A node tree is generated based on the hierarchical relationship between the pages, and one page corresponds to one node in the node tree;
[0059] Based on the node position of the first page in the node tree, the interaction level of each page relative to the first page is determined.
[0060] The interaction level of the target page is determined based on the interaction level of the page corresponding to the parent node of the target node and the relative level corresponding to the target node. The target page is any page among the pages, the target node is the node corresponding to the target page, and the relative level corresponding to the target node is used to indicate the number of operations required to switch from the target page to the page corresponding to the parent node of the target node.
[0061] In this embodiment, the electronic device can generate a node tree based on the hierarchical relationship between pages. Understandably, the electronic device can independently determine the hierarchical relationship between pages. For example, the desktop of the electronic device can be understood as a first-level page, and the pages corresponding to the operation controls displayed on the desktop can be understood as second-level pages. For instance, clicking the application icon of application A on the desktop (which can be understood as an operation control) displays the homepage of application A, which can be understood as a second-level page. Furthermore, the pages corresponding to the operation controls on the homepage of application A can be understood as third-level pages. For instance, clicking a control on application A further displays a third-level page. In this way, the electronic device can determine the hierarchical relationship between pages and generate a node tree based on this relationship.
[0062] Understandably, the node tree includes at least a root node, at least one parent node, and at least one child node, with each parent node including at least one child node. For example, an electronic device can generate a hierarchical tree based on the relationships between pages, such as... Figure 2b The node tree shown can be understood as follows: page A and page B can be considered as parent nodes in the node tree. Page A further includes three child nodes: page C, page D and page E. Page C can be understood as the parent node of page I and page J. Further details are omitted here.
[0063] In this embodiment, after generating a node tree based on the hierarchical relationship between pages, the electronic device can determine the interaction level of each page relative to the first page based on the node position of the first page (i.e., the currently displayed page) in the node tree. Optionally, the interaction level of the target page = the interaction level of the page corresponding to the parent node of the target node + the relative level corresponding to the target node.
[0064] For example, please refer to Figure 2bAssume the currently displayed first page (i.e., the current page in use) is page D under page A (page A is displayed as page C, page D, or page E), and the interaction level between page A and page D is 0. If the target page is page C, the node corresponding to page C is also the target node, and the node corresponding to page A is also the parent node of the target node; understandably, if the interaction level of page A is 0, then the relative level of the target node (the node corresponding to page C) is 1. Figure 2b The numbers on the connecting lines between the squares represent relative levels. For example, page C requires one operation to switch to page A, therefore the interaction level of page C is 0+1=1. Another example: suppose page J is the target page, and the node corresponding to page J is also the target node. The node corresponding to page C is the parent node of the target node. If page C is displayed as either page I or page J, and page C is preferentially displayed as page I, then the relative level of the node corresponding to page I is 0, and the relative level of the node corresponding to page J is 1. This means page J requires one operation to return to page C, and page C's interaction level is 1. Therefore, page J's interaction level is 1+1=2. In this way, the interaction level of each page relative to the first page (i.e., the currently displayed page) can be determined.
[0065] In this embodiment, the electronic device can generate a node tree based on the relationships between pages, and then determine the interaction level of each page relative to the first page based on the node position of the currently displayed first page in the node tree. Thus, for a pair of pages, the interaction level can be determined simply by considering the interaction level of the parent node of the corresponding node and the relative level of the corresponding node, eliminating the need to calculate the number of times the page is switched to the display interface. This allows for faster determination of the interaction level of each page and makes the method for determining the page's interaction level more flexible. Furthermore, determining the page's interaction level using a node tree also allows for faster updates to the interaction level of each page when page switching occurs.
[0066] Optionally, in one implementation, each page includes a third page, the first page corresponds to a first child node, the third page corresponds to a second child node, and the first child node and the second child node belong to the same parent node. In this case, before determining the interaction level of each page relative to the first page, the method further includes:
[0067] When switching from the third page to the first page, the first relative level corresponding to the first child node and the second relative level corresponding to the second child node are determined.
[0068] For example, please refer to Figure 2cAssume the first page is page J, the third page is page I, and page I is the currently displayed page. Figure 2c As shown in (a), the interaction level of page I is 0, the interaction level of page J is 1, and the interaction levels of other pages are as follows. Figure 2c As shown in (a), this will not be elaborated upon here. If the user switches from page I to page J, the relative hierarchy of the nodes corresponding to page I and page J will also change. For example... Figure 2c As shown in (b), the first relative level corresponding to the node of page I becomes 1, meaning that page I needs to undergo one operation to switch to page C. Page J then becomes the currently displayed page, and consequently, the second relative level corresponding to the node of page J becomes 0, meaning that page C is now displayed as page J. Further, based on the determined first relative level corresponding to page I and the second relative level corresponding to page J, the interaction level of each page relative to page J (i.e., the currently displayed first page) is determined, as follows: Figure 2c As shown in (c), at this time, page J is the currently displayed page (i.e., the first page), the interaction level of page I (i.e., the third page) is determined to be 1, while the interaction level of page J is determined to be 0.
[0069] Understandably, in this implementation, since page switching is between pages of two child nodes belonging to the same parent node, only the interaction level of the pages corresponding to these two child nodes needs to be adjusted. The interaction level of the parent node of these two child nodes and the pages corresponding to other parent nodes has not changed. Therefore, the interaction level of the pages corresponding to the child nodes under other parent nodes does not need to be changed, which makes it possible to determine the interaction level of each page more quickly.
[0070] Optionally, in another implementation, each page includes a fourth page, the fourth page corresponding to a first parent node, the first page corresponding to a second parent node, the first parent node including at least one child node, and the second parent node including at least one child node. In this case, before determining the interaction hierarchy of each page relative to the first page, the method further includes:
[0071] When switching from the fourth page to the first page, determine the third relative level corresponding to the first parent node and the fourth relative level corresponding to the second parent node;
[0072] The relative hierarchy of each child node included in the first parent node is determined according to the third relative hierarchy.
[0073] The relative hierarchy of each child node included in the second parent node is determined based on the fourth relative hierarchy.
[0074] For example, please refer to Figure 2d Assume the fourth page is page B, the first page is page A, page B corresponds to the first parent node, and page A corresponds to the second parent node. Both the first and second parent nodes belong to the root node. The first parent node has three child nodes (the nodes corresponding to pages F, G, and H), and the second parent node has three child nodes (the nodes corresponding to pages C, D, and E). Figure 2d As shown in (a), the currently displayed page is page B, which is displayed as page G. The interaction level between page B and page G is 0. Page A is displayed through page D, and the interaction level between page A and page D is 1. The interaction levels of other pages are as follows. Figure 2d As shown in (a), which will not be elaborated upon here. When switching from page B to page A, the relative hierarchy of the corresponding nodes on page B and page A also changes. For example... Figure 2d As shown in (b), the third relative level corresponding to the node of page B becomes 1, while page A becomes the currently displayed page. Consequently, the fourth relative level corresponding to the node of page A becomes 0, and correspondingly, the interaction level of page A also becomes 0, while the interaction level of page B becomes 1. It can be understood that the nodes corresponding to pages A and B are both parent nodes. Since the relative and interaction levels of pages A and B have changed, the interaction levels of the child nodes included in the parent nodes of pages A and B also need to be updated accordingly. Taking page C as an example, the node corresponding to page C is a child node of page A. When page A is displayed as page D, the interaction level of page D is also 0. Since the interaction level of page A becomes 0, page C needs to undergo an operation before it can be switched to be displayed on the electronic device. That is, the relative level corresponding to page C is now 1, and therefore the interaction level corresponding to page C is 0+1=1. Furthermore, the child nodes under the node corresponding to page C are traversed. For example, the interaction level of page I is updated to 1, and the interaction level of page J is updated to 2. Thus, based on the adjustment of the interaction levels of pages B and A, the interaction levels of other pages can be determined accordingly, as shown below. Figure 2d As shown in (c), we will not go into too much detail here.
[0075] In this implementation, since page switching is a switching between pages corresponding to two parent nodes, when the relative level corresponding to the parent node is updated, the relative level corresponding to the child nodes included in the parent node can also be updated according to the update of the relative level of the parent node, thereby updating the interaction level corresponding to each page, making the method of determining the interaction level of the page more flexible.
[0076] In this embodiment, the electronic device can generate a node tree based on the hierarchical relationship between pages. The interaction level of a page is determined by the node tree. Thus, when a page switch occurs, the interaction level of the page can be quickly updated according to the position of the page in the node tree. This helps to improve the processing efficiency of determining the interaction level of a page and makes the method of determining the interaction level of a page more flexible.
[0077] Please refer to Figure 3 , Figure 3 This is a flowchart of another page resource processing method provided in the embodiments of this application, such as... Figure 3 As shown, the method includes the following steps:
[0078] Step 301: Perform page switching based on user actions;
[0079] Step 302: Recalculate the interaction hierarchy of each page;
[0080] Step 303: Reorder the page resource cache list according to the interaction level of each page;
[0081] Among them, the lower the interaction level of a page, the higher the priority of its page resource caching, and the earlier its page resources are in the page resource cache list. Conversely, the higher the interaction level of a page, the lower the priority of its page resource caching, and the later its page resources are in the page resource cache list.
[0082] Step 304: Determine whether the page resources of the page to be switched are in the page resource cache list;
[0083] Step 305: If yes, directly retrieve the page resources of the page to be switched from the page resource cache list and execute step 309;
[0084] Step 306: If not, determine whether the electronic device currently has sufficient memory;
[0085] Step 307: If the current memory is insufficient, clear the page resources of the pages at the end of the page resource cache list and the pages with a low interaction level, and then proceed to step 308.
[0086] Step 308: If there is sufficient memory, load the page resources of the page to be switched, and put the page resources of the page to be switched at the front of the page resource cache list, and determine that the interaction level of the page to be switched is 0.
[0087] Step 309: Display the page to be switched.
[0088] In this embodiment, when the electronic device switches pages, it recalculates the interaction level of each page based on the page switch and further updates the page resource cache list. This ensures that the page resources in the page resource cache list, determined by the page interaction level, are dynamically changing. Each time the electronic device performs a page switch, it updates the page resources in the page resource cache list and further processes the page resources based on the updated list. This allows the electronic device to manage page resources more flexibly.
[0089] The page resource processing method provided in this application can be executed by a page resource processing device. This application uses an example of a page resource processing device executing the page resource processing method to illustrate the page resource processing device provided in this application.
[0090] Please refer to Figure 4 , Figure 4 This is a structural diagram of a page resource processing device provided in an embodiment of this application. The page resource processing device is applied to an electronic device. The application of the page resource processing device to an electronic device can be understood as meaning that the page resource device is a component within the electronic device, such as a chip. Figure 4 As shown, the page resource processing device 400 includes:
[0091] The first determining module 401 is used to determine the interaction level of each page in the electronic device relative to the first page when the first page is displayed. The interaction level is used to indicate the minimum number of operations required for each page to be switched to be displayed on the electronic device.
[0092] The second determining module 402 is used to determine the page resource caching priority of each page according to the interaction level of each page relative to the first page.
[0093] Optionally, the first determining module 401 is further configured to:
[0094] A node tree is generated based on the hierarchical relationship between the pages, and one page corresponds to one node in the node tree;
[0095] Based on the node position of the first page in the node tree, the interaction level of each page relative to the first page is determined.
[0096] Optionally, upon receiving a page switching request to switch from the first page to the second page, the device further includes any one of the following:
[0097] The acquisition module is used to acquire the page resources of the second page and switch to the second page when the page resource caching priority of the second page is greater than or equal to a preset priority;
[0098] The processing module is used to process the page resources of the second page according to the page resource cache list when the page resource cache priority of the second page is lower than the preset priority.
[0099] Optionally, the processing module is further configured to:
[0100] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has sufficient memory, the page resource of the second page is loaded and the page resource of the second page is arranged at the front of the page resource cache list. The page resource of the second page is then retrieved from the page resource cache list to switch to the second page.
[0101] Optionally, the processing module is further configured to:
[0102] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has insufficient memory, at least one page resource at the end of the page resource cache list is cleared, the page resource of the second page is loaded and arranged at the front of the page resource cache list, and the page resource of the second page is obtained from the page resource cache list to switch to the second page.
[0103] In this embodiment, the interaction level is used to indicate the minimum number of operations required to switch each page to its display on the electronic device. This can also be understood as the interaction level indicating the minimum number of operations required to switch each page to its display interface on the electronic device. Since the display interface of the electronic device can change based on the user's page switching operations, the interaction level of each page also changes dynamically. This results in the page resource caching priority of each page, determined by its interaction level, also changing dynamically. The electronic device can cache page resources sequentially according to their caching priority, thus dynamically changing the caching order of page resources instead of relying on the traditional LRU strategy. This makes the caching of page resources more flexible and helps the electronic device handle page resources more flexibly.
[0104] The page resource processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0105] The page resource processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0106] The page resource processing device provided in this application embodiment can achieve... Figure 1 and Figure 3 The various processes implemented in the method embodiment can achieve the same technical effect, and will not be described again here to avoid repetition.
[0107] Optionally, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501 and a memory 502. The memory 502 stores a program or instructions that can run on the processor 501. When the program or instructions are executed by the processor 501, they implement the various steps of the above-described page resource processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0108] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0109] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0110] The electronic device 600 includes, but is not limited to, components such as: radio frequency unit 601, network module 602, audio output unit 603, input unit 604, sensor 605, display unit 606, user input unit 607, interface unit 608, memory 609, and processor 610.
[0111] Those skilled in the art will understand that the electronic device 600 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 610 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0112] The processor 610 is used for:
[0113] When the first page is displayed, the interaction level of each page in the electronic device relative to the first page is determined, and the interaction level is used to indicate the minimum number of operations required to switch each page to be displayed on the electronic device.
[0114] The page resource caching priority for each page is determined based on the interaction level of each page relative to the first page.
[0115] Optionally, the processor 610 is also used for:
[0116] A node tree is generated based on the hierarchical relationship between the pages, and one page corresponds to one node in the node tree;
[0117] Based on the node position of the first page in the node tree, the interaction level of each page relative to the first page is determined.
[0118] Optionally, upon receiving a page switching request to switch from the first page to the second page, the processor 610 is further configured to:
[0119] If the page resource cache priority of the second page is greater than or equal to the preset priority, the page resource of the second page is obtained and the user is switched to the second page.
[0120] If the page resource cache priority of the second page is lower than the preset priority, the page resources of the second page are processed according to the page resource cache list.
[0121] Optionally, the processor 610 is also used for:
[0122] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has sufficient memory, the page resource of the second page is loaded and the page resource of the second page is arranged at the front of the page resource cache list. The page resource of the second page is then retrieved from the page resource cache list to switch to the second page.
[0123] Optionally, the processor 610 is also used for:
[0124] If the page resource cache priority of the second page is lower than the preset priority and the electronic device has insufficient memory, at least one page resource at the end of the page resource cache list is cleared, the page resource of the second page is loaded and arranged at the front of the page resource cache list, and the page resource of the second page is obtained from the page resource cache list to switch to the second page.
[0125] In this embodiment, the interaction level is used to indicate the minimum number of operations required to switch each page to its display on the electronic device. This can also be understood as the interaction level indicating the minimum number of operations required to switch each page to its display interface on the electronic device. Since the display interface of the electronic device can change based on the user's page switching operations, the interaction level of each page also changes dynamically. This results in the page resource caching priority of each page, determined by its interaction level, also changing dynamically. The electronic device can cache page resources sequentially according to their caching priority, thus dynamically changing the caching order of page resources instead of relying on the traditional LRU strategy. This makes the caching of page resources more flexible and helps the electronic device handle page resources more flexibly.
[0126] It should be understood that, in this embodiment, the input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042. The GPU 6041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 607 includes at least one of a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0127] The memory 609 can be used to store software programs and various data. The memory 609 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 609 may include volatile memory or non-volatile memory, or it may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 609 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0128] Processor 610 may include one or more processing units; optionally, processor 610 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 610.
[0129] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described page resource processing method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0130] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0131] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described page resource processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0132] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0133] This application provides a computer program product stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the page resource processing method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0134] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0135] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0136] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A page resource processing method, applied to electronic devices, characterized in that, The method includes: When the first page is displayed, the interaction level of each page in the electronic device relative to the first page is determined, and the interaction level is used to indicate the minimum number of operations required to switch each page to be displayed on the electronic device. The page resource caching priority for each page is determined based on the interaction level of each page relative to the first page.
2. The method according to claim 1, characterized in that, Determining the interaction level of each page in the electronic device relative to the first page includes: A node tree is generated based on the hierarchical relationship between the pages, and one page corresponds to one node in the node tree; Based on the node position of the first page in the node tree, the interaction level of each page relative to the first page is determined.
3. The method according to claim 1 or 2, characterized in that, Upon receiving a page switching request to switch from the first page to the second page, the method further includes any one of the following: If the page resource cache priority of the second page is greater than or equal to the preset priority, the page resource of the second page is obtained and the user is switched to the second page. If the page resource cache priority of the second page is lower than the preset priority, the page resources of the second page are processed according to the page resource cache list.
4. The method according to claim 3, characterized in that, When the page resource cache priority of the second page is lower than the preset priority, the page resources of the second page are processed according to the page resource cache list, including: If the page resource cache priority of the second page is lower than the preset priority and the electronic device has sufficient memory, the page resource of the second page is loaded and the page resource of the second page is arranged at the front of the page resource cache list. The page resource of the second page is then retrieved from the page resource cache list to switch to the second page.
5. The method according to claim 3, characterized in that, When the page resource cache priority of the second page is lower than the preset priority, the page resources of the second page are processed according to the page resource cache list, including: If the page resource cache priority of the second page is lower than the preset priority and the electronic device has insufficient memory, at least one page resource at the end of the page resource cache list is cleared, the page resource of the second page is loaded and arranged at the front of the page resource cache list, and the page resource of the second page is obtained from the page resource cache list to switch to the second page.
6. A page resource processing device, applied to electronic devices, characterized in that, The device includes: A first determining module is used to determine the interaction level of each page in the electronic device relative to the first page when the first page is displayed. The interaction level is used to indicate the minimum number of operations required for each page to be switched to be displayed on the electronic device. The second determining module is used to determine the page resource caching priority of each page based on the interaction level of each page relative to the first page.
7. The apparatus according to claim 6, characterized in that, The first determining module is further configured to: A node tree is generated based on the hierarchical relationship between the pages, and one page corresponds to one node in the node tree; Based on the node position of the first page in the node tree, the interaction level of each page relative to the first page is determined.
8. The apparatus according to claim 6 or 7, characterized in that, Upon receiving a page switching request to switch from the first page to the second page, the device further includes any one of the following: The acquisition module is used to acquire the page resources of the second page and switch to the second page when the page resource caching priority of the second page is greater than or equal to a preset priority; The processing module is used to process the page resources of the second page according to the page resource cache list when the page resource cache priority of the second page is lower than the preset priority.
9. The apparatus according to claim 8, characterized in that, The processing module is also used for: If the page resource cache priority of the second page is lower than the preset priority and the electronic device has sufficient memory, the page resource of the second page is loaded and the page resource of the second page is arranged at the front of the page resource cache list. The page resource of the second page is then retrieved from the page resource cache list to switch to the second page.
10. The apparatus according to claim 8, characterized in that, The processing module is also used for: If the page resource cache priority of the second page is lower than the preset priority and the electronic device has insufficient memory, at least one page resource at the end of the page resource cache list is cleared, the page resource of the second page is loaded and arranged at the front of the page resource cache list, and the page resource of the second page is obtained from the page resource cache list to switch to the second page.
11. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the page resource processing method as described in any one of claims 1-5.
12. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the page resource processing method as described in any one of claims 1-5.