Page data processing method and device and electronic equipment
By utilizing the dual storage strategy of memory and storage media when switching between tag pages, the problem of excessive memory usage in traditional systems is solved, and the fluency and user experience of electronic devices are improved.
Patent Information
- Application Number
- CN202411211325.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-20
AI Technical Summary
In the application of multi-tag pages, traditional systems cannot effectively release the memory occupied by invisible tag pages, resulting in excessive memory consumption and affecting the fluency and user experience of electronic devices.
By storing data in both memory and storage media when the tag page is invisible, freeing memory when it is invisible and replacing it with a blank page, fetching data from storage media when it becomes visible to quickly display the page.
It effectively reduces memory usage, improves the sliding fluency of the tag page and the overall device usage fluency, and avoids the need to re-request data.
Smart Images

Figure CN119166934A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing, and specifically relates to a page data processing method, device and electronic device. Background Art
[0002] With the popularity of smart terminals, various applications can be installed on more and more smart terminals. To ensure the fluency of the applications and user experience, the application interfaces in most applications usually need to use multiple tab pages to display multiple content pages.
[0003] In a conventional system, in order to display multiple tab pages, each time a tab page is displayed, page data of the tab page is usually saved in a memory.
[0004] However, since there may be too many tab pages in the application interface of an application, after the electronic device displays the excessive number of tab pages, the electronic device will retain the page data of the excessive number of tab pages in the memory, which may result in a large amount of memory consumption. Therefore, it may cause the electronic device to freeze during use, resulting in poor fluency in the use of the electronic device. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a page data processing method, device, electronic device and readable storage medium, which can reduce the amount of memory data of the electronic device and avoid the problem of freezing of the electronic device during use.
[0006] In a first aspect, an embodiment of the present application provides a page data processing method, which includes: when a first tab page of a first application is in a visible state, storing first page data of the first tab page in a memory and a first storage medium; when the state of the first tab page changes from a visible state to an invisible state, deleting the first page data from the memory and replacing the first tab page with a blank tab page; when the state of the first tab page changes from an invisible state to a visible state, obtaining the first page data from the first storage medium, and displaying the first tab page based on the first page data and the blank tab page.
[0007] In a second aspect, an embodiment of the present application provides a page data processing device, which includes: a storage module, a processing module, an acquisition module and a display module; the storage module is used to store the first page data of the first tab page in the memory and the first storage medium when the first tab page of the first application is in a visible state; the processing module is used to delete the first page data from the memory and replace the first tab page with a blank tab page when the state of the first tab page changes from a visible state to an invisible state; the acquisition module is used to acquire the first page data from the first storage medium when the state of the first tab page changes from an invisible state to a visible state; the display module is used to display the first tab page based on the first page data and the blank tab page.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0011] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0012] In an embodiment of the present application, when the first tab page of the first application is in a visible state, the first page data of the first tab page is stored in the memory and the first storage medium; when the state of the first tab page changes from a visible state to an invisible state, the first page data is deleted from the memory, and the first tab page is replaced with a blank tab page; when the state of the first tab page changes from an invisible state to a visible state, the first page data is obtained from the first storage medium, and the first tab page is displayed based on the first page data and the blank tab page. In the present solution, since when the first tab page is in a visible state, the electronic device can store the first page data in the first storage medium while storing the first page data in the memory. Thus, on the one hand, when the state of the first tab page changes from a visible state to an invisible state, the electronic device can reduce memory by releasing the memory occupied by the first page data. On the other hand, when the state of the first tab page changes from an invisible state to a visible state, the electronic device can also directly obtain the first page data from the first storage medium to quickly redisplay the first tab page based on the first page data without re-requesting the first page data. Therefore, the smoothness of the user sliding to view the first tab page can be guaranteed. Thus, the smoothness of the use of the electronic device can be improved while the smoothness of the user sliding to view the tab page is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a multi-level page schematic diagram of a page data processing method provided by an embodiment of the present application;
[0014] Figure 2 It is a flowchart of a page data processing method provided by an embodiment of the present application;
[0015] Figure 3 This is one of the structural schematic diagrams of a page data processing device provided in an embodiment of the present application;
[0016] Figure 4 This is a second structural diagram of a page data processing device provided in an embodiment of the present application;
[0017] Figure 5 This is a third structural diagram of a page data processing device provided in an embodiment of the present application;
[0018] Figure 6 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;
[0019] Figure 7 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0022] The terms "at least one (item)", "at least one of" and the like in the specification and claims of this application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" means two or more, and its meaning is similar to that of "at least one (item)".
[0023] It should be noted that the page data processing method provided in the embodiments of the present application can be executed by electronic devices such as mobile phones, tablet computers, laptop computers, PDAs, and vehicle-mounted electronic devices. In some embodiments of the present application, the page data processing method provided in the embodiments of the present application is described by taking the electronic device as the execution subject to execute the page data processing method as an example.
[0024] The page data processing method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0025] In mobile devices, in order to ensure the smoothness of the application and user experience, multiple tab pages are usually required to display multiple content pages. However, when the number of tab pages is too large or the content of each tab page is too complex, it may cause problems such as electronic device freezes and memory leaks, resulting in abnormal situations such as application crashes.
[0026] Especially the design of current applications is becoming more and more complex, such as Figure 1 As shown, there are three-level and four-level tab layouts, taking the video application as an example. In the application interface 11 of the video application, there are three levels of tabs. The first-level tab includes: "Home" page, "Listen to Books" page, "Local" page and "My" page; the second-level tab includes: "Music" page and "Video" page; the third-level tab includes: "Recommendation" page, "Live" page, "MV" page, "Variety Show" page, and "Dance" page. When the user clicks "Home" → "Video" → "Recommendation" according to the Tab level, the third-level Tab page, that is, the "Recommendation" content page 12 can be displayed, which displays different videos for users to view and download.
[0027] In the related art, when the cache page setting function (offscreenPageLimit) of the view manager (ViewPager) is set to 1, the number of tabs in memory is at least 2. That is, the minimum page loading number of ViewPager is 1. When the leftmost tab is currently accessed, the first tab on the right will be preloaded; when the second tab is currently accessed, the left and right tabs will be preloaded; when the rightmost tab is currently accessed, the left tab will be preloaded.
[0028] However, combined with Figure 1 , assuming that the first-level interface has 4 tabs, the current ViewPager has at least 2 tabs in memory. Sometimes, in order to quickly respond to page switching and to ensure smooth sliding of tab pages, offscreenPageLimit is usually set to the maximum number of pages. Once a tab is loaded, the memory is always resident and not released, that is, the page data of all loaded tab pages are not released, which leads to more and more memory being occupied.
[0029] In addition, tab pages usually adopt waterfall flow, and the loaded elements are relatively complex. When all homepages and all tabs are visited, the memory occupied sometimes exceeds 1 to 1.5G. Once the application occupies a large amount of memory, the display speed will be slow, the response will not keep up with the hand, and there will be freezes or ANR problems when entering the secondary or tertiary interface from the homepage, which will seriously affect the user experience.
[0030] In this regard, an embodiment of the present application is aimed at the problem that an application with a multi-level tab layout cannot release the memory occupied by the invisible tab in time. The present invention provides a differential recovery method for multi-level page memory based on tab replacement. The multi-level page is a page in an interface that includes multiple tab pages. Based on the tab replacement mechanism, invisible tabs at different levels adopt different memory release strategies, keeping the frequently used tabs in the memory as long as possible, and releasing the memory of the infrequently used tabs as soon as possible.
[0031] Specifically, in the present solution, since when the first tab page is in a visible state, the electronic device can store the first page data in a first storage medium while storing the first page data in the memory. Thus, on the one hand, when the state of the first tab page changes from a visible state to an invisible state, the electronic device can reduce memory by releasing the memory occupied by the first page data. On the other hand, when the state of the first tab page changes from an invisible state to a visible state, the electronic device can directly obtain the first page data from the first storage medium to quickly redisplay the first tab page based on the first page data without re-requesting the first page data. Therefore, the smoothness of the user sliding to view the first tab page can be guaranteed. Thus, the smoothness of the use of the electronic device can be improved while the smoothness of the user sliding to view the tab page is guaranteed.
[0032] The execution subject of the page data processing method provided in this embodiment may be a page data processing device, which may be an electronic device, or a control module or a processing module in the electronic device, etc. The technical solution provided in the embodiment of the present application is described below using an electronic device as an example.
[0033] The present application embodiment provides a method for processing page data. Figure 2 FIG. 1 is a flow chart of a page data processing method provided by an embodiment of the present application, which can be applied to electronic devices. Figure 2 As shown, the page data processing method provided in the embodiment of the present application may include the following steps 201 to 203.
[0034] Step 201: When a first tab page of a first application is in a visible state, the electronic device stores first page data of the first tab page in a memory and a first storage medium.
[0035] In some embodiments of the present application, the first tab page is displayed on the first application interface of the first application.
[0036] In some embodiments of the present application, the first application mentioned above may be any application program that comes with the electronic device or is installed.
[0037] In some embodiments of the present application, the first application interface may be an interface displayed in any application.
[0038] In some embodiments of the present application, the first application interface may be a multi-level interface.
[0039] In some embodiments of the present application, the first application interface includes at least two tab pages.
[0040] In some embodiments of the present application, the above-mentioned label page can be a Tab page, that is, the label page is any page in the multi-level page.
[0041] For example, in combination Figure 1 , the first tab page mentioned above may be a content page 12, namely a “recommendation” page.
[0042] In some embodiments of the present application, the first tab page in a visible state refers to the first tab page currently displayed on the display screen of the electronic device.
[0043] In some embodiments of the present application, the first tab page is in an invisible state because the tab page has been loaded and displayed, but the user has not currently viewed the tab page, and the page data of the tab page is stored in the memory.
[0044] In some embodiments of the present application, the number of the first tab pages may be one or more.
[0045] In some embodiments of the present application, the first page data includes at least one of the following: a page identifier, a first screen image, and first screen cache data.
[0046] Exemplarily, the above page identifier is the page identifier of the first tab page.
[0047] For example, combined with Figure 1 , "Recommendations" on the "Recommendations" page, "Home" on the "Home" page, or videos on the "Videos" page.
[0048] Exemplarily, the first screen image is a snapshot image or a screenshot image of the content page of the first tab page. It is understandable that the first screen image only displays an image, and the logo, control or link therein cannot be clicked.
[0049] Exemplarily, the first screen cache data is view data, control data or link data of the first tab page.
[0050] In some embodiments of the present application, the first storage medium may be a hard disk.
[0051] In some embodiments of the present application, when the electronic device accesses the first tab page, the electronic device will save the Tab Id of the first tab page to the tab management queue, and first cache the data of the first screen, then cache the page snapshot of the first screen, and finally save the blank page, and all these page data will be saved to the memory and the hard disk. Among them, the tab management queue can be stored in the hard disk and / or the memory.
[0052] Step 202: When the state of the first tab page changes from a visible state to an invisible state, the electronic device deletes the first page data from the memory and replaces the first tab page with a blank tab page.
[0053] In some embodiments of the present application, the above-mentioned “changing from a visible state to an invisible state” means that the user switches the first tab page to another tab page.
[0054] In some embodiments of the present application, the electronic device releases the memory occupied by the first page data.
[0055] In some embodiments of the present application, after deleting the first page data in the first tab page, the electronic device will use a blank tab page without page data to occupy the position of the original first tab page, so that the electronic device can generate a tab page in situ when reading the first page data again, thereby improving the efficiency of tab page generation.
[0056] It should be noted that the electronic device only deletes the memory occupied by the first page data, but the first page data is still stored in the hard disk.
[0057] In a possible embodiment, the server will configure a memory release switch for each application. If the switch is -1, or a negative number, it means that the switch is turned off, and the electronic device turns off the memory release policy of the homepage application and manages the page data according to the prior art; if the switch is 0, or greater than 0, it means that the switch is turned on, and the electronic device turns on the memory release policy of the homepage application. At the same time, the server sets a preset memory release duration for each tab page or each application, and the preset memory release duration is the memory release duration of the invisible Tab page.
[0058] Optionally, in some embodiments of the present application, before the above step 202, the page data processing method provided by the embodiment of the present application further includes steps 301 and 302:
[0059] Step 301: The electronic device obtains target information.
[0060] In some embodiments of the present application, the above target information is used to characterize at least one of the following: the importance of the first tab page, and the data processing capability of the electronic device.
[0061] In some embodiments of the present application, the importance of the first tab page may be represented by at least one of the following target information:
[0062] Reload the resources required to display the first tab page;
[0063] How long the first tab page is invisible?
[0064] The level of association between the application to which the first tab page belongs and the application to which the currently displayed tab page belongs;
[0065] The association level between the first tab page and other tab pages, where the other tab pages belong to the same application as the first tab page;
[0066] The content type of the first tab page;
[0067] The Memory tab of the first tab page.
[0068] In some embodiments of the present application, the data processing capability of the electronic device may be characterized by at least one of the following target information:
[0069] Hardware configuration of electronic equipment;
[0070] The current memory size of the electronic device is already occupied;
[0071] Power consumption of electronic devices.
[0072] Step 302: The electronic device determines a first moment according to the target information.
[0073] In some embodiments of the present application, the first moment is any moment, which may be the current moment or a moment after a certain period of time.
[0074] Further, in combination with the above step 301 and step 302, the above step 202 specifically includes step 202a:
[0075] Step 202a: The electronic device deletes the first page data from the memory at a first moment.
[0076] In some embodiments of the present application, the first moment is the moment when the electronic device releases the first page data, that is, the moment when the first page data is deleted.
[0077] In this way, the electronic device can determine the release time of each tab page in combination with the target information of different tab pages, so that the electronic device can selectively release the page data of the tab page at the corresponding release time, that is, delete the page data of the tab page from the memory, thereby minimizing memory usage while ensuring that users can quickly view frequently used tab pages.
[0078] Step 203: when the state of the first tab page changes from the invisible state to the visible state, obtain the first page data from the first storage medium, and display the first tab page based on the first page data and the blank tab page.
[0079] In some embodiments of the present application, the electronic device re-renders the first tab page based on the first page data and with the blank tab page as the original tab page.
[0080] In the page data processing method provided in the embodiment of the present application, since when the first tab page is in a visible state, the electronic device can store the first page data in a first storage medium while storing the first page data in the memory. In this way, on the one hand, when the state of the first tab page changes from a visible state to an invisible state, the electronic device can reduce memory by releasing the memory occupied by the first page data; on the other hand, when the state of the first tab page changes from an invisible state to a visible state, the electronic device can also directly obtain the first page data from the first storage medium to quickly redisplay the first tab page based on the first page data without re-requesting the first page data, thereby ensuring the smoothness of the user sliding to view the first tab page; thereby, the smoothness of the use of the electronic device can be improved while ensuring the smoothness of the user sliding to view the tab page.
[0081] Optionally, in some embodiments of the present application, the electronic device may determine the first moment, i.e., the release moment, of each tab page according to different target information obtained from different tab pages. The following seven possible embodiments are used to explain the process of determining the first moment by the electronic device in scenarios with different target information.
[0082] A first possible implementation:
[0083] In some embodiments of the present application, the target information includes first resource information, and the first resource information is used to indicate the resources required to redisplay the first tab page.
[0084] Furthermore, the above step 302 “the electronic device determines the first time according to the target information” specifically includes steps 302a1 to 302a3:
[0085] Step 302a1: The electronic device uses the first resource information and a weighting factor corresponding to the first resource information to calculate a first release weight value.
[0086] Exemplarily, the first resource information is used to indicate the resources required to redisplay the first tab page.
[0087] Exemplarily, the first resource information includes at least one of the following:
[0088] Redisplay the traffic required for the first tab page.
[0089] The number of views required to redisplay the first tab page,
[0090] The number of threads required to redisplay the first tab page,
[0091] Redisplay the required memory size of the first tab page,
[0092] The frame rate of page sliding when redisplaying the first tab page.
[0093] Exemplarily, each dimension of resource information in the first resource information corresponds to a weighting factor.
[0094] Exemplarily, the electronic device obtains the weight value by calculating the weighting factors corresponding to the resource information of different dimensions.
[0095] It is understandable that the larger the weight value is, the more difficult it is for the electronic device to redisplay the first tab page.
[0096] For example, for a Tab that is used frequently, user experience is more important, and memory jitter and page sliding smoothness need to be better, so the weight is higher; for a Tab that is used less frequently, traffic consumption, view drawing time, and thread consumption are greater, so the weight is higher; if the user is using 3G or 4G with insufficient traffic, the traffic consumption is greater, so the weight is higher; if the system is in a low-power state, the view redrawing and thread consumption are greater when the Tab is rebuilt, so the weight is higher, because reloading the reconstruction and layout of the Tab view takes more time.
[0097] Exemplarily, each of the above weight values corresponds to a first release weight value.
[0098] Exemplarily, the first release weight value is used to be associated with a moment of deleting the first page data of the first tab page in the memory.
[0099] Exemplarily, the first release weight value is positively correlated with the resources consumed for redisplaying the first tab page.
[0100] Exemplarily, the more or greater resources consumed for redisplaying the first tab page, the more difficult it is to redisplay the first tab page, and the higher the first release weight value. Therefore, it is less likely that the electronic device will delete the first page data from the memory. It can also be understood that the larger the first release weight value, the farther the first moment is from the current moment.
[0101] Exemplarily, the electronic device may also color the tab page according to the weight value obtained by each resource information weighting factor, so that the user can clearly know the difficulty of reloading and displaying the tab page.
[0102] For example, after the electronic device releases the invisible Tab, when the Tab is accessed again, the Tab needs to be rebuilt, that is, the Tab is reloaded and displayed. Based on the difficulty of Tab creation, such as traffic consumption (number of interface requests), view drawing time (number of views), thread consumption (number of threads), memory jitter (memory application size), page sliding smoothness (pre-perceived page sliding frame rate), that is, the corresponding first resource information obtains different weighting factors: w1, w2, w3, w4, w5, where w1+w2+w3+w4+w5=1. For different Tab measurement dimensions, the electronic device is colored based on the weighting factor, and each dimension is colored red, green, blue, orange, yellow, etc., and the measurement dimension values x1, x2, x3, x4, x5 are mapped to the corresponding transparency value, which is divided into 256 levels. For example, traffic consumption is colored red, recorded as 0xFF0000, and the x1 value maps the transparency value to DD. Therefore, traffic consumption is converted to transparency + red, and the final coloring value is 0xDDFF0000. That is, the larger the x1 value is, the larger the corresponding transparency value is.
[0103] In this way, after the electronic device colors the difficulty of rebuilding each dimension of the Tab, the user can clearly perceive the difficulty of rebuilding the Tab page in each dimension, and then manually adjust the weight value of each dimension according to preference.
[0104] Step 302a2: The electronic device determines a first duration according to the first release weight value.
[0105] Exemplarily, when the first release weight value is greater than or equal to the first threshold value, the electronic device adds a second duration corresponding to the first release weight value to the first preset duration to obtain the first duration.
[0106] Exemplarily, when the first release weight value is less than the first threshold value, the electronic device reduces the second duration corresponding to the first release weight value from the first preset duration to obtain the first duration;
[0107] Exemplarily, the first threshold may be customized by the electronic device or may be set by the user.
[0108] Exemplarily, the first preset duration is a preset release duration of the first tab page.
[0109] Exemplarily, the first preset duration may be preset according to the page data of each tab page. Specifically, it may be customized by the electronic device or set by the user.
[0110] Exemplarily, different release weight values correspond to different durations, and the electronic device can determine the corresponding second duration according to the first release weight value.
[0111] Step 302a3: The electronic device determines the moment after the first time period from the second moment as the first moment.
[0112] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0113] For example, the first threshold value can be 0.5, and the preset release time of the first tab page is 1 minute. If the first release weight value is 0.7, which is greater than 0.5, the electronic device increases the second time corresponding to the first release weight value of 0.7 on the basis of 1 minute, such as 30 seconds. At this time, the electronic device will delete the page data of the first tab page from the memory at the moment 1 minute and 30 seconds after the second moment, that is, the above-mentioned first moment. If the first release weight value is 0.3, which is less than 0.5, the electronic device reduces the second time corresponding to the first release weight value of 0.3 on the basis of 1 minute, such as 30 seconds. At this time, the electronic device will delete the page data of the first tab page from the memory at the moment 30 seconds after the second moment, that is, the above-mentioned first moment. If the first release weight value is 0, which is less than 0.5, the electronic device reduces the second time corresponding to the first release weight value of 0 on the basis of 1 minute, such as 1 minute. At this time, the electronic device will immediately delete the page data of the first tab page from the memory, that is, the current moment is determined as the first moment.
[0114] A second possible embodiment:
[0115] In some embodiments of the present application, the target information includes the invisibility duration of the first tab page.
[0116] Furthermore, the above step 302 “the electronic device determines the first time according to the target information” specifically includes step 302b1 or step 302b2:
[0117] Step 302b1: When the invisible time length of the first tab page is greater than or equal to the second threshold, the electronic device determines the second moment as the first moment.
[0118] Exemplarily, the second threshold is a time threshold, which may be customized by the electronic device or set by the user.
[0119] Exemplarily, the second thresholds corresponding to the Tabs at different levels may be different or the same.
[0120] For example, the time threshold of the first-level Tab is a, the time threshold of the second-level Tab is a / 2, and the time threshold of the third-level Tab is a / 3.
[0121] Exemplarily, the invisibility time length is used to represent the time length during which the first tab page is not accessed, or the time length since the first tab page was last displayed.
[0122] For example, when tab1 switches to tab2, the electronic device records the first visible time of tab1 as t1, and when tab2 switches to tab3, the electronic device records the current time as t2, then the time from the last visible time of tab1 is t2-t1. If t2-t1 exceeds a certain time threshold, that is, the second threshold mentioned above, the electronic device actively triggers the destroyItem callback to release the memory occupied by the tab and the view ViewPager.
[0123] Step 302b2: The electronic device determines the second release weight value corresponding to the invisible duration of the first tab page, determines the third duration corresponding to the second release weight value, and determines the moment after the third duration from the second moment as the first moment.
[0124] Exemplarily, the second release weight value is negatively correlated with the invisibility duration of the first tab page.
[0125] Exemplarily, the longer the invisibility time of the first tab page, which means that the user has not visited the first tab page for a long time, the smaller the second release weight value is, and the easier it is for the electronic device to delete the page data of the first tab page from the memory.
[0126] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0127] It should be noted that the above-mentioned second release weight value and the step of "determining a moment after a third time period from the second moment as the first moment" can refer to the above-mentioned steps 302a1 to 302a3.
[0128] A third possible embodiment:
[0129] In some embodiments of the present application, the above-mentioned target information includes first indication information, which is used to indicate a first association level between a first application and a second application, where the first application is the application to which the first tab page belongs, and the second application is a process description of the application to which the second tab page belongs.
[0130] Furthermore, before step 202 “when the state of the first tab page changes from a visible state to an invisible state, the electronic device deletes the first page data from the memory”, the page data processing method provided in the embodiment of the present application further includes step 401:
[0131] Step 401: The electronic device switches a first tab page to a second tab page in a second application.
[0132] Exemplarily, the electronic device receives a first input of a user for an identifier corresponding to a second tab page, and in response to the first input, the electronic device switches the first tab page to the second tab page, and at this time, the electronic device displays the second tab page.
[0133] Exemplarily, the first input may be a click input by the user, or a voice input, or a specific gesture input.
[0134] Further, in combination with step 401, the above step 302 "the electronic device determines the first time according to the target information" specifically includes steps 302c1 to 302c3:
[0135] Step 302c1: The electronic device determines a third release weight value corresponding to the first association level.
[0136] Exemplarily, the first association level may be expressed in the form of a priority. For example, a higher priority means a higher association level, and a higher degree of association between the two applications.
[0137] Exemplarily, the first association level may also be represented in digital form, for example, 1-10, where a larger number indicates a higher association level and a higher degree of association between the two applications.
[0138] Exemplarily, the first association level may also be identified by a specific identifier, for example, different identifiers identify different association levels.
[0139] It should be noted that the embodiment of the present application does not limit the representation method of the first association level.
[0140] Exemplarily, the first association level is positively correlated with the third release weight value. The higher the first association level is, the greater the third release weight value is.
[0141] Step 302c2: The electronic device determines a fourth duration according to the third release weight value.
[0142] Step 302c3: The electronic device determines the moment after the fourth time period from the second moment as the first moment.
[0143] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0144] It should be noted that the third release weight value and the step of "determining the moment after the fourth time period from the second moment as the first moment" can refer to the process description of the above steps 302a1 to 302a3.
[0145] For example, suppose the electronic device switches the tab page displayed in application Ac to the tab page in application A1. The electronic device first queries the association level index between the two applications. If the cascade level of A1 and Ac is greater than C, the release weight of application Ac is 0.7. At this time, the electronic device determines the delay time of Ac's memory release, that is, "+wδ".
[0146] Assume that the electronic device switches the tab page displayed in application Ac to the tab page in application A2. The electronic device first queries the association level index between the two applications. If the cascade level of A2 and Ac is less than C, the release weight of application Ac is 0.3. At this time, the electronic device determines to accelerate the memory release time of Ac, that is, "-wδ".
[0147] In this way, the electronic device can determine the release time of the tab page by judging whether the user is likely to visit the tab page before switching again in the near future based on the association level between applications. In this way, memory usage is minimized while ensuring the user experience.
[0148] In a fourth possible embodiment:
[0149] In some embodiments of the present application, the target information includes a second association level between the first tab page and the third tab page, and the third tab page is another tab page in the application of the first tab page.
[0150] Furthermore, before step 202 “when the state of the first tab page changes from a visible state to an invisible state, the electronic device deletes the first page data from the memory”, the page data processing method provided in the embodiment of the present application further includes step 402:
[0151] Step 402: The electronic device switches the first tab page to a third tab page.
[0152] Exemplarily, the electronic device receives a second input of a user for an identifier corresponding to a third tab page, and in response to the second input, the electronic device switches the first tab page to the third tab page, and at this time, the electronic device displays the second tab page.
[0153] Exemplarily, the second input may be a click input by the user, or a voice input, or a specific gesture input.
[0154] Further, in combination with step 401, the above step 302 "the electronic device determines the first time according to the target information" specifically includes steps 302d1 to 302d3:
[0155] Step 302d1: The electronic device determines a fourth release weight value corresponding to the second association level.
[0156] Exemplarily, the second association level may be expressed in the form of a priority. For example, a higher priority means a higher association level, and a higher degree of association between the two applications.
[0157] Exemplarily, the second association level may also be represented in digital form, for example, 1-10, where a larger number indicates a higher association level and a higher degree of association between the two applications.
[0158] Exemplarily, the second association level may also be identified by a specific identifier, for example, different identifiers identify different association levels.
[0159] It should be noted that the embodiment of the present application does not limit the representation method of the second association level.
[0160] Exemplarily, the second association level is positively correlated with the fourth release weight value. The higher the second association level is, the greater the fourth release weight value is.
[0161] Step 302d2: The electronic device determines a fifth duration according to the fourth release weight value;
[0162] Step 302d3: The electronic device determines the moment after the fifth time period from the second moment as the first moment.
[0163] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0164] It should be noted that the fourth release weight value and the step of "determining the moment after the fifth time period from the second moment as the first moment" can refer to the process description of the above steps 302a1 to 302a3.
[0165] For example, suppose the electronic device switches the tab page Pc displayed in the application Ac to the tab page P1. The electronic device first queries the association level index between the two tab pages. If the association level between Pc and P1 is greater than C, the release weight of the application Pc is 0.7. At this time, the electronic device determines the delay time for the memory release of Pc, that is, "+wδ".
[0166] For example, suppose the electronic device switches the tab page Pc displayed in the application Ac to the tab page P1. The electronic device first queries the association level index between the two tab pages. If the association level between Pc and P1 is less than C, the release weight of the application Pc is 0.3. At this time, the electronic device determines to accelerate the memory release time of Pc, that is, "-wδ".
[0167] In another example, the electronic device may also determine the association level between the tab pages according to the content type displayed on the tab pages, and then adjust the release weight value according to the association level.
[0168] For example, assume that the second and third level interfaces corresponding to the first level Tab1 are music type, the second and third level interfaces corresponding to the first level Tab2 are audiobook type, and the second and third level interfaces corresponding to the first level Tab3 are video type.
[0169] Tab2 is currently displayed, and the audiobook content related to the music type is currently being played. The release weight value is increased and the duration of releasing memory of Tab1 is extended.
[0170] Tab2 is currently displayed, and the current playback is an audiobook type, which will reduce the release weight value and reduce the length of time that Tab1 and Tab3 release memory.
[0171] That is, the release weight value of the Tab related to the current playing content is extended, and the release weight value of the Tab unrelated to the current playing content is reduced.
[0172] In this way, the electronic device can determine the release time of the tab page by judging whether the user is likely to visit the tab page before switching again in the near future based on the association level between different tab pages in the same application. In this way, memory usage can be minimized while ensuring the user experience.
[0173] A fifth possible embodiment:
[0174] In some embodiments of the present application, the target information includes at least one of the following: a first application type and historical access data, wherein the first application type is the application type of the first application to which the first tab page belongs, and the historical access data is used to indicate the access frequency of the first tab page.
[0175] In some embodiments of the present application, the above-mentioned historical access data may include at least one of the following: the length of time since the last visit to the first tab page, and the number of visits to the first tab page.
[0176] Furthermore, the above step 302 “the electronic device determines the first moment according to the target information” specifically includes step 302e1 and step 302e2, or step 302e1 and step 302e3:
[0177] Step 302e1: The electronic device determines a change in the size of memory occupied by applications of the first application type.
[0178] Exemplarily, when the electronic device detects the application type of the first tab page, i.e., the first application type mentioned above, it calculates the memory size occupied by the tab page of the same application type as the first application type at that moment, and the change in the memory occupied at a previous moment, which can also be called memory surge.
[0179] Step 302e2: When the change in the size of the memory occupied by applications of the first application type is greater than or equal to the third threshold and the access frequency of the first tab page is less than or equal to the fourth threshold, the electronic device determines the second moment as the first moment.
[0180] Exemplarily, the third threshold may be customized by the electronic device or may be set by the user.
[0181] Exemplarily, the fourth threshold may be customized by the electronic device or may be set by the user.
[0182] Exemplarily, "the access frequency of the first tab page is less than or equal to the fourth threshold" indicates that the first tab page has not been accessed for a long time, indicating that the user may not use the tab page frequently or will not use it again, so the electronic device can release the first tab page immediately.
[0183] Step 302e3: When the change in the size of the memory occupied by applications of the first application type is greater than or equal to the fifth threshold, the electronic device determines the second moment as the first moment.
[0184] Exemplarily, the fifth threshold may be customized by the electronic device or may be set by the user.
[0185] For example, the electronic device will usually set the fifth threshold to a larger threshold. When the change in the memory size occupied by applications of the first application type is greater than or equal to the fifth threshold, it means that the memory occupied by the electronic device is too large and needs to be cleaned up in time. Therefore, the electronic device will delete the page data of all tab pages of the same application type to reduce memory usage.
[0186] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0187] It can be understood that the third threshold is smaller than the fifth threshold.
[0188] In an example, the information such as the first application type and historical access data of the first tab page can be marked on the first tab page in the form of a memory tag.
[0189] Exemplarily, the electronic device tags the first tab page accordingly by identifying the first application type and historical access data of the first tab page, thereby facilitating the electronic device to perform memory tag management on the tab page.
[0190] Exemplarily, when a user launches a new application of the same type and traverses the recent application list, the memory usage surges to exceed a certain threshold, i.e., the third threshold mentioned above. The electronic device then intelligently releases memory based on the memory tag of the tab page. For example, it only releases the memory occupied by the tab page that has not been accessed for a long time, and retains the tab page that is being accessed in the recent application.
[0191] When the memory surge exceeds a certain threshold, that is, the fifth threshold mentioned above, the electronic device will release all tabs of similar applications in recent applications. The released tab records can be recorded in the recent tab list. Each tab will record the following necessary information: application name, tab page name, memory label name, so as to ensure the smoothness of the application and the stability of memory. In this way, when the system's memory drops sharply by more than a certain threshold, that is, the fifth threshold mentioned above, and maintains for a period of 2t, it can be recorded in the recent tab list for recovery, so that the next time the user accesses the tab, the application interface can be quickly presented. Of course, if the data in the recent tab list is cleared, the memory label cannot be restored.
[0192] A sixth possible embodiment:
[0193] In some embodiments of the present application, the above-mentioned target information includes the data processing capability of the electronic device.
[0194] Furthermore, the above step 302 “the electronic device determines the first moment according to the target information” specifically includes steps 302f1 to 302f3:
[0195] Step 302f1: The electronic device determines a fifth release weight value corresponding to the data processing capability of the electronic device.
[0196] Exemplarily, the data processing capability of the electronic device is related to at least one of the following:
[0197] Hardware configuration of electronic equipment;
[0198] The current memory size of the electronic device is already occupied;
[0199] Power consumption of electronic devices.
[0200] Exemplarily, different electronic devices have different data processing capabilities, and the same electronic device may also have different data processing capabilities at different times. Different data processing capabilities correspond to different release weight values.
[0201] Exemplarily, the data processing capability of the electronic device is positively correlated with the fifth release weight value. The stronger the data processing capability of the electronic device, the greater the fifth release weight value.
[0202] Step 302f2: the electronic device determines a sixth duration according to the fifth release weight value;
[0203] Step 302f3: The electronic device determines the moment after the sixth time period from the second moment as the first moment.
[0204] Exemplarily, the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0205] It should be noted that the fifth release weight value and the step of "determining the moment after the sixth time period from the second moment as the first moment" can refer to the process description of the above steps 302a1 to 302a3.
[0206] For example, the electronic device determines whether the current electronic device is in a memory-constrained state based on the system version of the current electronic device, the top 10 models with system unresponsiveness, and memory information. When the system version is lower than 8.0, or the model is in the top 10 with system unresponsiveness, or the memory of the current electronic device is lower than 2G, it is determined to be a low-end machine with weak data processing capabilities, and the low-end machine memory release strategy is enabled to accelerate the memory release of the tab page. Otherwise, the current electronic device is determined to be a high-end machine with strong data processing capabilities, and the memory release of the tab page is delayed.
[0207] A seventh possible implementation example:
[0208] In some embodiments of the present application, the electronic device may release the page data of the first tab page by receiving a third input from the user to the electronic device, that is, delete the page data of the first tab page from the memory.
[0209] Exemplarily, the third input is used to trigger the electronic device to release page data of the first tab page.
[0210] Exemplarily, the third input includes at least one of the following:
[0211] Click the corresponding icon of other tabs except the first-level tab;
[0212] Click and press the Home button;
[0213] Quickly press the system back button twice.
[0214] Thus, for the above seven possible embodiments, the electronic device can determine the release strategy of the tab page according to different target information, such as delayed release, early release, or immediate release, etc. Thus, the electronic device can reduce the memory usage by using different tab page release strategies in different scenarios, thereby improving the operation efficiency of the electronic device while ensuring the smoothness of tab page switching.
[0215] Optionally, in some embodiments of the present application, the first page data of the first tab page is stored in a first storage area of the memory. After the above step 202, the page data processing method provided in the embodiment of the present application further includes step 501:
[0216] Step 501: The electronic device stores second page data in a first storage area.
[0217] In some embodiments of the present application, the first storage area is an area of memory occupied by the first tab page.
[0218] In some embodiments of the present application, the data size of the second page data is smaller than the data size of the first page data.
[0219] Exemplarily, the second page data is blank page data.
[0220] In some embodiments of the present application, when the electronic device switches the first tab page, that is, when the page state of the first tab page changes from a visible state to an invisible state, the electronic device replaces the first tab page with a blank page and stores the data of the first tab page in a tab page management list.
[0221] Optionally, in some embodiments of the present application, in combination with the above step 501, after the above step 203, the page data processing method provided by the embodiment of the present application further includes step 502:
[0222] Step 502: The electronic device replaces the second page data in the first storage area with the first page data.
[0223] In some embodiments of the present application, when the electronic device redisplays the first tab page, it replaces the page data of the blank page with the page data of the blank tab page, and then re-renders and loads the first tab page based on the page data of the first tab page stored in the first storage medium, thereby completing the process of replacing the blank page with the first tab page.
[0224] Specifically:
[0225] (1) When the first tab page is in an invisible state, the current moment is the release moment of the first tab page, and the electronic device saves the tab with data to the hard disk and replaces it with an empty page;
[0226] (2) When the first tab page is accessed, the electronic device obtains a tab with the same tab id as the first tab page from the tab page list manager. If there is one, the electronic device directly replaces the empty page with the tab, that is, redisplays the first tab page;
[0227] (3) If the tab page list manager does not have a tab with the same tab id as the first tab page, continue to obtain the first screen cache data of the first tab page. If the first screen cache data of the first tab page exists, load the first screen cache data and request new data at the same time, and replace it with the first tab page;
[0228] (4) If the first screen cache data of the first tab page does not exist, obtain a first screen snapshot of the first tab page; if it exists, replace it with the first tab page;
[0229] (5) If there is no first screen snapshot of the first tab page, the empty page is an empty Tab, which means a Tab that has not yet displayed any view or image information. At this time, the electronic device requests new data for the first tab page and re-renders the Tab page. Through asynchronous and delayed loading, the first screen content in the page is only loaded at the time point currently required, so as to improve the page loading speed and save memory.
[0230] In this way, since the page data of the blank page is small and occupies less memory, the electronic device reduces memory usage while ensuring a fast response to re-rendering the original tab page by using the blank page to occupy the original tab page.
[0231] It can be understood that the embodiment of the present application adopts a differential memory release strategy for invisible tabs of different levels based on the tab page replacement mechanism, specifically including:
[0232] 1. Pre-sense the difficulty of tab reconstruction and identify coloring. Based on the resource consumption of tab reconstruction, traffic consumption, view drawing time, thread consumption, memory jitter, and sliding smoothness, the reconstruction resource consumption of different tabs is colored and marked based on the weighted factors.
[0233] 2. When switching between tabs, the invisible tab is replaced in the tab queue for standby through page replacement. When it is detected that the tab is not used for a long time, the tab's view and loaded image resources are released, and the tab becomes an empty tab without a view. Therefore, it is not restricted by the number of invisible pages preloaded by the system, and the number of tabs in each level of memory is at most 1;
[0234] 3. The Tab queue manager is used to save and replace pages. When a page is accessed, it is replaced from the queue manager with a Tab that matches the current Tab. When the page is not accessed, the Tab is saved in the queue manager, along with the Tab Id, first screen data, and first screen snapshot. When the release conditions are met, the memory occupied by the Tab is released.
[0235] 4. Application switching expects memory, and accurately decides which tabs of the application to release based on memory requirements.
[0236] 5. Inter-application memory compensation link, directly transfer free memory between applications.
[0237] In this way, the electronic device can determine the release strategy of the tab page according to different target information, such as delayed release, early release, or immediate release, etc. In this way, the electronic device can reduce the memory usage by using different tab page release strategies in different scenarios, thereby improving the operation efficiency of the electronic device while ensuring the smoothness of tab page switching.
[0238] Optionally, in some embodiments of the present application, the memory includes a local memory. After the above step 202, the page data processing method provided by the present application further includes step 601:
[0239] Step 601: The electronic device deletes page data of the first tab page in the local memory.
[0240] In some embodiments of the present application, the page data of the first tab page in the local memory may include at least one of the following:
[0241] The adapter resource of the ViewPagerManager.
[0242] The cache of the recyclable view list (RecyclerView) and the cache of the layout manager (LayoutManager),
[0243] All resources of View and ViewGroup.
[0244] Image resources loaded by ImageView, for example, Glide, a third-party open source library that dynamically loads images.
[0245] In this way, after the invisible Tab is detached (unbound) from the ViewPager (view page), the occupied Java memory can be released, but the occupied Native memory will not be released. When the App runs for a long time, the memory space occupied by the application becomes larger and larger. Therefore, the memory occupied by page data can be further reduced by actively releasing and deleting resources in the local memory.
[0246] Each of the above-mentioned method embodiments, or various possible implementation methods in each method embodiment can be executed separately, or any two or more of them can be executed in combination with each other. The specific implementation method can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0247] The page data processing method provided in the embodiment of the present application can be executed by an electronic device or a page data processing device. In the embodiment of the present application, the page data processing device executing the page data processing method is taken as an example to illustrate the page data processing device provided in the embodiment of the present application.
[0248] Figure 3 FIG. 1 shows a possible structural diagram of a page data processing device involved in an embodiment of the present application. Figure 3 As shown, the page data processing device 700 may include: a storage module 701, a processing module 702, an acquisition module 703 and a display module 704;
[0249] Among them, the above-mentioned storage module 701 is used to store the first page data of the first tab page in the memory and the first storage medium when the first tab page of the first application interface is in a visible state; the above-mentioned processing module 702 is used to delete the first page data from the memory and replace the first tab page with a blank tab page when the state of the first tab page changes from a visible state to an invisible state; the above-mentioned acquisition module 703 is used to acquire the first page data from the first storage medium when the state of the first tab page changes from an invisible state to a visible state; the above-mentioned display module 704 is used to display the first tab page based on the first page data and the blank tab page.
[0250] Optionally, in some embodiments of the present application, the first page data includes at least one of the following: a page identifier, a first screen image, and first screen cache data.
[0251] Optionally, in some embodiments of the present application, combined with Figure 3 ,like Figure 4As shown, the above-mentioned device 700 also includes: a determination module 705; the above-mentioned acquisition module 703 is also used for the above-mentioned processing module 702 to obtain target information before deleting the first page data from the memory, and the target information is used to characterize at least one of the following: the importance of the first tab page, the data processing capability of the electronic device; the above-mentioned determination module 705 is used to determine the first moment according to the target information obtained by the above-mentioned acquisition module 703; the above-mentioned processing module 702 is specifically used to delete the first page data from the memory at the first moment.
[0252] Optionally, in some embodiments of the present application, the target information includes first resource information, and the first resource information is used to indicate the resources required to redisplay the first tab page;
[0253] The determination module 705 is specifically used for:
[0254] The first resource information and the weighting factor corresponding to the first resource information are used to calculate a first release weight value, where the first release weight value is positively correlated with the resources consumed by redisplaying the first tab page;
[0255] Determining a first duration according to the first release weight value;
[0256] The moment after the first time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0257] Optionally, in some embodiments of the present application, the above-mentioned determination module 705 is specifically used to:
[0258] When the first release weight value is greater than or equal to the first threshold, the second duration corresponding to the first release weight value is added to the first preset duration to obtain the first duration; or
[0259] When the first release weight value is less than the first threshold, reducing the second duration corresponding to the first release weight value from the first preset duration to obtain the first duration;
[0260] The first preset duration is a preset release duration of the first tab page.
[0261] Optionally, in some embodiments of the present application, the target information includes the invisibility duration of the first tab page;
[0262] The determination module 705 is specifically used for:
[0263] When the invisible time length of the first tab page is greater than or equal to the second threshold, the second moment is determined as the first moment; or,
[0264] Determine a second release weight value corresponding to the invisibility duration of the first tab page, determine a third duration corresponding to the second release weight value, and determine a moment after the third duration from the second moment as the first moment;
[0265] The second release weight value is negatively correlated with the invisible time duration of the first tab page; the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0266] Optionally, in some embodiments of the present application, combined with Figure 4 ,like Figure 5 As shown, the above device 700 further includes: a switching module 706;
[0267] The target information includes first indication information, where the first indication information is used to indicate a first association level between a first application and a second application, where the first application is an application to which the first tab page belongs, and the second application is an application to which the second tab page belongs;
[0268] The switching module 706 is used for the processing module 702 to switch the first tab page to the second tab page in the second application before deleting the first page data from the memory when the state of the first tab page changes from the visible state to the invisible state;
[0269] The determination module 705 is specifically used for:
[0270] Determine a third release weight value corresponding to the first association level, where the first association level is positively correlated with the third release weight value;
[0271] determining a fourth duration according to the third release weight value;
[0272] A moment after a fourth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0273] Optionally, in some embodiments of the present application, Figure 5 As shown, the above-mentioned device 700 further includes: a switching module;
[0274] The target information includes a second association level between the first tab page and the third tab page, where the third tab page is another tab page in the application of the first tab page;
[0275] The switching module 706 is used for the processing module 702 to switch the first tab page to the third tab page before deleting the first page data from the memory when the state of the first tab page changes from the visible state to the invisible state;
[0276] The determination module 705 is specifically used for:
[0277] Determine a fourth release weight value corresponding to the second association level, where the second association level is positively correlated with the fourth release weight value;
[0278] determining a fifth duration according to the fourth release weight value;
[0279] The moment after the fifth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0280] Optionally, in some embodiments of the present application, the target information includes at least one of the following: a first application type and historical access data, the first application type being an application type of a first application to which the first tab page belongs, and the historical access data being used to indicate a frequency of access to the first tab page;
[0281] The determination module 705 is specifically used for:
[0282] Determine a change in the size of memory occupied by applications of the first application type;
[0283] When the variation is greater than or equal to the third threshold and the access frequency is less than or equal to the fourth threshold, the second moment is determined as the first moment; or,
[0284] When the change amount is greater than or equal to the fifth threshold, determining the second moment as the first moment;
[0285] The second moment is the moment when the state of the first tab page changes from a visible state to an invisible state, and the third threshold is less than the fifth threshold.
[0286] Optionally, in some embodiments of the present application, the target information includes data processing capabilities of the electronic device;
[0287] The determination module 705 is specifically used for:
[0288] determining a fifth release weight value corresponding to the data processing capability, wherein the data processing capability is positively correlated with the fifth release weight value;
[0289] determining a sixth duration according to the fifth release weight value;
[0290] The moment after the sixth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0291] In the page data processing device provided in the embodiment of the present application, since when the first tab page is in a visible state, the page data processing device can store the first page data in the first storage medium while storing the first page data in the memory. In this way, on the one hand, when the state of the first tab page changes from a visible state to an invisible state, the page data processing device can reduce the memory by releasing the memory occupied by the first page data; on the other hand, when the state of the first tab page changes from an invisible state to a visible state, the page data processing device can also directly obtain the first page data from the first storage medium to quickly redisplay the first tab page based on the first page data without re-requesting the first page data, thereby ensuring the smoothness of the user sliding to view the first tab page; thereby, the smoothness of the use of the page data processing device can be improved while ensuring the smoothness of the user sliding to view the tab page.
[0292] The page data processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0293] The page data processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0294] The page data processing device provided in the embodiment of the present application can implement each process implemented in the embodiment of the page data processing method, and will not be described again here to avoid repetition.
[0295] Alternatively, if Figure 6 As shown, an embodiment of the present application further provides an electronic device 800, including a processor 801 and a memory 802, wherein the memory 802 stores programs or instructions that can be executed on the processor 801, and when the program or instructions are executed by the processor 801, the various steps of the above-mentioned page data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0296] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0297] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0298] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0299] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0300] Among them, the above-mentioned memory 109 is used to store the first page data of the first tab page in the memory and the first storage medium when the first tab page of the first application interface is in a visible state; the above-mentioned processor 110 is used to delete the first page data from the memory and replace the first tab page with a blank tab page when the state of the first tab page changes from a visible state to an invisible state; the above-mentioned processor 110 is used to obtain the first page data from the first storage medium when the state of the first tab page changes from an invisible state to a visible state; the above-mentioned display unit 106 is used to display the first tab page based on the first page data and the blank tab page.
[0301] Optionally, in some embodiments of the present application, the first page data includes at least one of the following: a page identifier, a first screen image, and first screen cache data.
[0302] Optionally, in some embodiments of the present application, the processor 110 is also used to obtain target information before deleting the first page data from the memory, where the target information is used to characterize at least one of the following: the importance of the first tab page, the data processing capability of the electronic device; the processor 110 is used to determine the first moment according to the target information obtained by the processor 110; the processor 110 is specifically used to delete the first page data from the memory at the first moment.
[0303] Optionally, in some embodiments of the present application, the target information includes first resource information, and the first resource information is used to indicate the resources required to redisplay the first tab page;
[0304] The processor 110 is specifically configured to:
[0305] The first resource information and the weighting factor corresponding to the first resource information are used to calculate a first release weight value, where the first release weight value is positively correlated with the resources consumed by redisplaying the first tab page;
[0306] Determining a first duration according to the first release weight value;
[0307] The moment after the first time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0308] Optionally, in some embodiments of the present application, the processor 110 is specifically configured to:
[0309] When the first release weight value is greater than or equal to the first threshold, the second duration corresponding to the first release weight value is added to the first preset duration to obtain the first duration; or
[0310] When the first release weight value is less than the first threshold, reducing the second duration corresponding to the first release weight value from the first preset duration to obtain the first duration;
[0311] The first preset duration is a preset release duration of the first tab page.
[0312] Optionally, in some embodiments of the present application, the target information includes the invisibility duration of the first tab page;
[0313] The processor 110 is specifically configured to:
[0314] When the invisible time length of the first tab page is greater than or equal to the second threshold, the second moment is determined as the first moment; or,
[0315] Determine a second release weight value corresponding to the invisibility duration of the first tab page, determine a third duration corresponding to the second release weight value, and determine a moment after the third duration from the second moment as the first moment;
[0316] The second release weight value is negatively correlated with the invisible time duration of the first tab page; the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0317] Optionally, in some embodiments of the present application, the target information includes first indication information, where the first indication information is used to indicate a first association level between the first application and the second application, where the first application is the application to which the first tab page belongs, and the second application is the application to which the second tab page belongs;
[0318] The processor 110 is configured to switch the first tab page to a second tab page in the second application before deleting the first page data from the memory when the state of the first tab page changes from a visible state to an invisible state;
[0319] The processor 110 is specifically configured to:
[0320] Determine a third release weight value corresponding to the first association level, where the first association level is positively correlated with the third release weight value;
[0321] determining a fourth duration according to the third release weight value;
[0322] A moment after a fourth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0323] Optionally, in some embodiments of the present application, the target information includes a second association level between the first tab page and the third tab page, and the third tab page is another tab page in the application of the first tab page;
[0324] The processor 110 is configured to switch the first tab page to a third tab page before deleting the first page data from the memory when the state of the first tab page changes from a visible state to an invisible state;
[0325] The processor 110 is specifically configured to:
[0326] Determine a fourth release weight value corresponding to the second association level, where the second association level is positively correlated with the fourth release weight value;
[0327] determining a fifth duration according to the fourth release weight value;
[0328] The moment after the fifth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0329] Optionally, in some embodiments of the present application, the target information includes at least one of the following: a first application type and historical access data, the first application type being an application type of a first application to which the first tab page belongs, and the historical access data being used to indicate a frequency of access to the first tab page;
[0330] The processor 110 is specifically configured to:
[0331] Determine a change in the size of memory occupied by applications of the first application type;
[0332] When the variation is greater than or equal to the third threshold and the access frequency is less than or equal to the fourth threshold, the second moment is determined as the first moment; or,
[0333] When the change amount is greater than or equal to the fifth threshold, determining the second moment as the first moment;
[0334] The second moment is the moment when the state of the first tab page changes from a visible state to an invisible state, and the third threshold is less than the fifth threshold.
[0335] Optionally, in some embodiments of the present application, the target information includes data processing capabilities of the electronic device;
[0336] The processor 110 is specifically configured to:
[0337] determining a fifth release weight value corresponding to the data processing capability, wherein the data processing capability is positively correlated with the fifth release weight value;
[0338] determining a sixth duration according to the fifth release weight value;
[0339] The moment after the sixth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
[0340] In the electronic device provided in the embodiment of the present application, since when the first tab page is in a visible state, the electronic device can store the first page data in a first storage medium while storing the first page data in the memory. In this way, on the one hand, when the state of the first tab page changes from a visible state to an invisible state, the electronic device can reduce memory by releasing the memory occupied by the first page data; on the other hand, when the state of the first tab page changes from an invisible state to a visible state, the electronic device can also directly obtain the first page data from the first storage medium to quickly redisplay the first tab page based on the first page data without re-requesting the first page data, thereby ensuring the smoothness of the user sliding to view the first tab page; thereby, the smoothness of the use of the electronic device can be improved while ensuring the smoothness of the user sliding to view the tab page.
[0341] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0342] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0343] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0344] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned page data processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0345] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0346] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned page data processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0347] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0348] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned page data processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0349] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0350] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0351] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A page data management method, characterized in that: The method comprises: When a first tab page of a first application is in a visible state, storing first page data of the first tab page in a memory and a first storage medium; When the state of the first tab page changes from a visible state to an invisible state, deleting the first page data from the memory and replacing the first tab page with a blank tab page; When the state of the first tab page changes from an invisible state to a visible state, the first page data is acquired from the first storage medium, and the first tab page is displayed based on the first page data and the blank tab page.
2. The method according to claim 1, characterized in that The first page data includes at least one of the following: a page identifier, a first screen image, and first screen cache data.
3. The method according to claim 1, characterized in that Before deleting the first page data from the memory, the method further includes: Acquire target information, where the target information is used to represent at least one of the following: the importance of the first tab page and the data processing capability of the electronic device; determining a first moment according to the target information; The deleting the first page data from the memory includes: At the first moment, the first page data is deleted from the memory.
4. The method according to claim 3, characterized in that The target information includes first resource information, where the first resource information is used to indicate resources required to redisplay the first tab page; The determining the first time according to the target information includes: The first resource information and a weighting factor corresponding to the first resource information are used to calculate a first release weight value, where the first release weight value is positively correlated with resources consumed by redisplaying the first tab page; Determining a first duration according to the first release weight value; A moment after the first time period from a second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
5. The method according to claim 4, characterized in that The determining a first duration according to the first release weight value includes: When the first release weight value is greater than or equal to the first threshold, adding a second duration corresponding to the first release weight value to the first preset duration to obtain the first duration; or When the first release weight value is less than a first threshold, reducing a second duration corresponding to the first release weight value from a first preset duration to obtain the first duration; The first preset duration is a preset release duration of the first tab page.
6. The method according to claim 3, characterized in that The target information includes the invisibility duration of the first tab page; The determining the first time according to the target information includes: When the invisible time length of the first tab page is greater than or equal to a second threshold, determining the second moment as the first moment; or, Determine a second release weight value corresponding to the invisibility duration of the first tab page, determine a third duration corresponding to the second release weight value, and determine a moment after the third duration from the second moment as the first moment; The second release weight value is negatively correlated with the invisible duration of the first tab page; the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
7. The method according to claim 3, characterized in that The target information includes first indication information, where the first indication information is used to indicate a first association level between a first application and a second application, where the first application is an application to which the first tab page belongs, and the second application is an application to which the second tab page belongs; When the state of the first tab page changes from a visible state to an invisible state, before deleting the first page data from the memory, the method further includes: Switching the first tab page to a second tab page in the second application; The determining the first time according to the target information includes: determining a third release weight value corresponding to the first association level, wherein the first association level is positively correlated with the third release weight value; Determining a fourth duration according to the third release weight value; A moment after the fourth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
8. The method according to claim 3, characterized in that The target information includes a second association level between the first tab page and a third tab page, where the third tab page is another tab page in the first application; When the state of the first tab page changes from a visible state to an invisible state, before deleting the first page data from the memory, the method further includes: Switching the first tab page to the third tab page; The determining the first time according to the target information includes: determining a fourth release weight value corresponding to the second association level, wherein the second association level is positively correlated with the fourth release weight value; Determining a fifth duration according to the fourth release weight value; The moment after the fifth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
9. The method according to claim 3, characterized in that: The target information includes at least one of the following: a first application type and historical access data, the first application type being an application type of a first application to which the first tab page belongs, and the historical access data being used to indicate a frequency of access to the first tab page; The determining the first time according to the target information includes: Determine a change in the size of memory occupied by applications of the first application type; When the variation is greater than or equal to the third threshold and the access frequency is less than or equal to the fourth threshold, the second moment is determined as the first moment; or When the change amount is greater than or equal to a fifth threshold, determining the second moment as the first moment; The second moment is the moment when the state of the first tab page changes from a visible state to an invisible state, and the third threshold is less than the fifth threshold.
10. The method according to claim 3, characterized in that The target information includes the data processing capability of the electronic device; The determining the first time according to the target information includes: determining a fifth release weight value corresponding to the data processing capability, wherein the data processing capability is positively correlated with the fifth release weight value; Determining a sixth duration according to the fifth release weight value; The moment after the sixth time period from the second moment is determined as the first moment, and the second moment is the moment when the state of the first tab page changes from a visible state to an invisible state.
11. A page data management device, characterized in that: The page data processing device comprises: a storage module, a processing module, an acquisition module and a display module; The storage module is used to store the first page data of the first tab page in the memory and the first storage medium when the first tab page of the first application is in a visible state; The processing module is configured to delete the first page data from the memory and replace the first tab page with a blank tab page when the state of the first tab page changes from a visible state to an invisible state; The acquisition module is configured to acquire the first page data from the first storage medium when the state of the first tab page changes from an invisible state to a visible state; The display module is used to display the first tab page based on the first page data and the blank tab page.
12. An electronic device, characterized in that: The method comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the page data processing method as claimed in any one of claims 1 to 10.
Citation Information
Patent Citations
Memory recovery method and device, electronic equipment and storage medium
CN111984413A
Page loading method and device, terminal and storage medium
CN113378085A
Cache data processing method and device and storage medium
CN118395027A
