A method, a building device and a terminal device for building an application resource package

By building a target resource package with access times greater than the preset number, the resource not frequently accessed is eliminated, which solves the problems of large storage space and slow decompression of the application resource package, improves the decompression and reading efficiency of the resource package, and reduces startup time and virtual memory usage.

CN112835610BActive Publication Date: 2025-07-25HUAWEI DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911167399.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-25
Publication Date
2025-07-25
Estimated Expiration
2039-11-25

AI Technical Summary

Technical Problem

Existing application resource packages occupy a large storage space, low decompression and reading efficiency, long startup time, and a lot of virtual memory.

Method used

By obtaining the number of accesses to the original resource package of the application, building resource packages with accesses greater than the preset number, generating target resource packages, eliminating resources that are not frequently accessed, and reducing the size of resource packages.

Benefits of technology

It reduces the storage space usage of application resource packages, improves the decompression and reading efficiency, shortens the startup time, and reduces the virtual memory usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112835610B_ABST
    Figure CN112835610B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method, a building device, a terminal device, a computer-readable storage medium, and a computer program product for building an application program resource package, which are used to reduce the storage space occupied by the resource package of a target application program and improve the resource decompression and reading efficiency. The method of the embodiments of the present application includes: obtaining an original resource package of a target application program; obtaining the access times of each original resource in the original resource package; and building a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage, and in particular, to a method for constructing an application resource package, a construction device, a terminal device, a computer-readable storage medium, and a computer program product. Background Art

[0002] In common terminals, the application (APP) files of the operating system include resource packages and code. Among them, the resource package usually contains various resources such as multiple languages, multiple layout files, multiple pictures, and configuration information. In order to facilitate internationalization, the resource packages of APPs usually package resource files in different national languages. This will cause the following problems: The resource package of the APP is relatively large, so the occupied storage space is very large; moreover, when the application is started, it is necessary to decompress the resource package of the APP, read the resource index into the memory, and construct a virtual resource index structure when the APP runs. The time-consuming of the application during this startup process and the size of the resource index are proportional to the number of resources of the APP. The more resources there are, the slower the decompression, the slower the startup, and at the same time, the more memory is occupied. Summary of the Invention

[0003] Embodiments of this application provide a method for constructing an application resource package, a construction device, a terminal device, a computer-readable storage medium, and a computer program product, which are used to reduce the storage space occupied by the resource package of the target application and improve the resource decompression and reading efficiency.

[0004] In view of this, a first aspect of this application provides a method for constructing an application resource package, which may include: obtaining the original resource package of the target application; obtaining the access times of each original resource in the original resource package; where the sequence of obtaining the original resource package of the target application and obtaining the access times of each original resource in the original resource package is not limited; then, the original resources with access times greater than the corresponding preset times in the original resource package can be used to construct the first target resource package. Since the first target resource package is constructed from the original resource package, that is, the volume of the resource package used by the APP is reduced, thereby reducing the storage space occupied by the resource package of the target application, improving the resource decompression and reading efficiency, reducing the startup time of the application; reducing the virtual memory occupation during the operation of the application; and a smaller resource package is also beneficial to system operation.

[0005] Optionally, in some embodiments of the present application, the obtaining of the access times of each original resource in the original resource package may be: obtaining the average access times of each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance; it can be understood that the historical access data of the multiple terminal devices can be obtained from the server or from these multiple terminal devices. Among them, using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package may be: using the original resources in the original resource package whose average access times are greater than the corresponding preset times to construct the first target resource package. The preset times corresponding to each original resource may be the same or different, which can be determined according to historical experience values. Among them, the setting of the preset times can also be adjusted according to actual needs.

[0006] In the embodiments of the present application, the access times of each original resource of the target application accessed by multiple users corresponding to multiple terminal devices can be obtained, and then the average access times of each accessed original resource can be calculated; if the average access times are greater than the corresponding preset times, it can be considered that this original resource is frequently accessed by many users. Therefore, when reconstructing the target resource package, building this original resource into the target resource package can meet the access needs of most users; at the same time, the volume of the resource package used by the APP is reduced, thereby reducing the storage space occupied by the resource package of the target application, improving the resource decompression and reading efficiency, and reducing the startup time of the application.

[0007] Optionally, in some embodiments of the present application, the obtaining of the access times of each original resource in the original resource package may include: obtaining a record file of accessing the original resource package, and the record file may include the access times of each original resource in the original resource package.

[0008] In the embodiments of the present application, the record file includes the access times of the user accessing the original resources of the target application on the terminal device. At this time, using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package can meet the personal access needs of the user. At the same time, the volume of the resource package used by the APP is reduced, thereby reducing the storage space occupied by the resource package of the target application, improving the resource decompression and reading efficiency, and reducing the startup time of the application.

[0009] Optionally, in some embodiments of the present application, using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package may include: under the condition of meeting the preset conditions, using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package;

[0010] Among them, the preset conditions include at least one of the following conditions:

[0011] Condition 1: The recording period recorded by the recording file is greater than a preset duration. Among them, the recording period recorded by the recording file being greater than the preset duration, the specific implementation can include but is not limited to the following methods:

[0012] (1) The duration from the initial time recorded by the recording file to the current time is greater than a first preset duration.

[0013] It can be understood that if the duration from the initial time recorded by the recording file to the current time is too short, then the reliability of the first target resource package reconstructed is too low and may not meet the actual needs of users. Therefore, if the time recorded by the recording file has been a relatively long period (such as one month, three months, etc.), at this time, the probability that the first target resource package constructed using the original resources with the access times greater than the corresponding preset times in the original resource package meets the user's needs is relatively large.

[0014] (2) The duration from the initial access time of the latest original resource in the recording file to the current time is greater than a second preset duration.

[0015] It should be noted that if this condition is met, it can be considered that the original resources accessed by the user during this period have been fixed and no new original resources have been accessed. At this time, the probability that the constructed target resource package meets the user's needs is very high.

[0016] Condition 2: The number of original resources with the access times greater than the corresponding preset times is lower than a preset threshold.

[0017] It can be understood that if the number of original resources with the access times greater than the corresponding preset times recorded in the recording file is very large and almost the same as the total number of original resources of the target application program, then the significance of reconstruction is not great. Therefore, here it can also be that when the number of original resources with the access times greater than the corresponding preset times is lower than the preset threshold, the step of reconstructing the target resource package can be triggered.

[0018] Condition 3: The target application program is in an idle state.

[0019] If the target application program is in an idle state, reconstruct the target resource package to avoid affecting the normal use of users and improve the user experience.

[0020] Optionally, in some embodiments of the present application, when the preset conditions are met, the original resources in the original resource package with access times greater than the corresponding preset times are used to construct a first target resource package, which may include: when the preset conditions are met, construction indication information may be generated; then the construction indication information is displayed; the user can operate on the displayed construction indication information, and the construction device responds to the user's operation on the construction indication information to generate a construction request; finally, according to the construction request, the original resources in the original resource package with access times greater than the corresponding preset times are used to construct the first target resource package. In the embodiments of the present application, when constructing the first target resource package, it can also be decided by the user whether to reconstruct instead of automatic construction, providing an implementation method for triggering the construction of the target resource package and improving the diversity and flexibility of the implementation of the solution in the embodiments of the present application.

[0021] Optionally, in some embodiments of the present application, the original resource package includes: an original resource index and an original resource file; the original resource index is used to represent the correspondence between the original resource identifier and the original resource file; the first target resource package includes: a target resource index and a target resource file; the target resource index is used to represent the correspondence between the target resource identifier and the target resource file. In the embodiments of the present application, an explanation is made on the information included in the original resource package and the target resource package.

[0022] Optionally, in some embodiments of the present application, using the original resources in the original resource package with access times greater than the corresponding preset times to construct the first target resource package may include: copying the original resource indexes with access times greater than the corresponding preset times from the original resource index to obtain the target resource index; copying the original resource files with access times greater than the corresponding preset times from the original resource file to obtain the target resource file; then using the target resource index and the target resource file to construct the first target resource package. In the embodiments of the present application, an implementation method for constructing the first target resource package is provided, which constructs the first target resource package by copying the original resource file and the original resource index, increasing the diversity of the technical solution of the present application.

[0023] Optionally, in some embodiments of the present application, using the target resource index and the target resource file to construct the first target resource package may include: compressing the target resource index and the target resource file to obtain the first target resource package. In the embodiments of the present application, after compressing the target resource index and the target resource file, the first target resource package is obtained, which can save storage space.

[0024] Optionally, in some embodiments of the present application, the method may further include: saving the first target resource package in the local storage space; moving the original resource package from the local storage space to the cloud storage space. That is, after the first target resource package is constructed, the terminal device may save the original resource package and the first target resource package in different storage spaces or storage media. Since the first target resource package is saved in the local storage space, it is convenient for users to access. Saving the original resource package in other storage spaces or storage media can save local storage space.

[0025] Optionally, in some embodiments of the present application, constructing the first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times may include: removing the resource indexes with access times less than or equal to the corresponding preset times from the original resource index to obtain the target resource index; removing the resource files with access times less than or equal to the corresponding preset times from the original resource file to obtain the target resource file; and then using the target resource index and the target resource file to construct the first target resource package. In the embodiments of the present application, an implementation manner for constructing the first target resource package is provided, which constructs the first target resource package by removing the original resource file and the original resource index, increasing the diversity of the technical solutions of the present application.

[0026] Optionally, in some embodiments of the present application, after constructing the first target resource package with the target resource index and the target resource file, the method may further include: obtaining a target resource access request for the target application, where the target resource access request includes a target resource identifier; then loading the first target resource package according to the target resource access request; if it is determined that the target resource identifier is in the target resource index, accessing the target resource file through the target resource index. In the embodiments of the present application, after the first target resource package is constructed, the first target resource package can be accessed.

[0027] Optionally, in some embodiments of the present application, the method may further include: if it is determined that the target resource identifier is not in the target resource index, loading the original resource package according to the target resource request; if it is determined that the target resource identifier is in the original resource index, accessing the original resource file through the original resource index. In the embodiments of the present application, if the target resource identifier is not in the target resource index, it can be considered that the target resource file corresponding to the target resource identifier to be accessed is not in the first target resource package, and the original resource package of the target application can be loaded for access. An implementation manner of resource access is provided, ensuring the access requirements of users.

[0028] Optionally, in some embodiments of the present application, the method may further include: if it is determined that the target resource identifier is not in the target resource index, obtaining an updated record file, where the updated record file includes the updated access times of each original resource; using the original resources in the original resource package whose updated access times are greater than the corresponding preset times to construct a second target resource package. In the embodiments of the present application, the record file is updated in real time. When the target resource accessed by the target APP is not in the first target resource package, the terminal device can reconstruct the second target resource package according to the real-time updated record file and the original resource package. Furthermore, the target resource package can be reconstructed according to the adjustment of the user's needs.

[0029] Optionally, in some embodiments of the present application, obtaining the record file for accessing the original resource package may include: obtaining an original resource access request for the target application program, where the original resource access request includes an original resource identifier; then loading the original resource package according to the original resource access request, and accessing the original resource file through the original resource index using the original resource identifier; recording the relevant information about accessing the original resource file of the target application program to obtain a record file. In the embodiments of the present application, the relevant information of the original resource access request for accessing the original resources in the target application program is recorded to obtain a record file, which can be used to analyze the user's usage habits and usage needs, thereby providing a guarantee for constructing a target resource package that better meets the user's needs.

[0030] A second aspect of the embodiments of the present application provides a construction device, which has the function of reducing the storage space occupied by the resource package of the target application program and improving the resource decompression and reading efficiency. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0031] A third aspect of the embodiments of the present application provides a terminal device, which has the function of reducing the storage space occupied by the resource package of the target application program and improving the resource decompression and reading efficiency. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0032] A fourth aspect of the embodiments of the present application provides a construction device, which may include:

[0033] One or more processors;

[0034] A memory;

[0035] Multiple application programs;

[0036] and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the building device, the building device is caused to execute the method for building an application program resource package as described in the first aspect of this application and any optional manner of the first aspect.

[0037] A fifth aspect of the embodiments of this application provides a terminal device, which may include:

[0038] One or more processors;

[0039] Memory;

[0040] Multiple application programs;

[0041] and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the terminal device, the terminal device is caused to execute the method for building an application program resource package as described in the first aspect of this application and any optional manner of the first aspect.

[0042] A sixth aspect of the embodiments of this application provides a computer-readable storage medium, in which instructions are stored, and when it runs on a computer, the computer is caused to execute the methods described in the above aspects. It should be noted that the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and is used to store the computer software instructions for the above building device or terminal device, and it includes a program designed for the building device or terminal device as described in the first aspect above.

[0043] This storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0044] A seventh aspect of the embodiments of this application provides a computer program product containing instructions, and when it runs on a computer, the computer is caused to execute the method as described in the first aspect of this application or any optional implementation manner of the first aspect.

[0045] From the above technical solutions, it can be seen that the embodiments of this application have the following advantages:

[0046] In the embodiment of the present application, the original resource package of the target application is obtained; the original resource package of the target application is obtained; the access times of each original resource in the original resource package are obtained; and the first target resource package is constructed with the original resources in the original resource package whose access times are greater than the corresponding preset times. Since the first target resource package is constructed from the original resource package, that is, the volume of the resource package used by the APP is reduced, the storage space occupied by the resource package of the target application can be reduced, the resource decompression and reading efficiency can be improved, and the startup time of the application can be reduced; the virtual memory occupation during the operation of the application can be reduced; and the smaller resource package is also beneficial to system operation. Description of the Drawings

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments and the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained according to these drawings.

[0048] Figure 1 System architecture diagram of the construction device applied in the embodiment of the present application;

[0049] Figure 2 Schematic diagram of an embodiment of the method for constructing an application program resource package in the embodiment of the present application;

[0050] Figure 3A Schematic diagram of obtaining the record file for accessing the original resource package in the embodiment of the present application;

[0051] Figure 3B Schematic diagram of the construction instruction information for the user in the embodiment of the present application;

[0052] Figure 3C Schematic diagram of constructing the target resource package in the embodiment of the present application;

[0053] Figure 3D Schematic diagram of resource package trimming in the embodiment of the present application;

[0054] Figure 3E Schematic diagram of obtaining the resource access request of the application program in the embodiment of the present application;

[0055] Figure 3F Another schematic diagram of obtaining the resource access request of the application program in the embodiment of the present application;

[0056] Figure 3G Schematic diagram of a process of the resource access request in the embodiment of the present application;

[0057] Figure 4 Schematic diagram of an embodiment of the construction device in the embodiment of the present application;

[0058] Figure 5 Schematic diagram of an embodiment of the terminal device in an embodiment of the present application;

[0059] Figure 6 Schematic diagram of another embodiment of the terminal device in an embodiment of the present application;

[0060] Figure 7 It is a software structure block diagram of the terminal device in an embodiment of the present application. Specific implementation manner

[0061] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, they should all fall within the scope of protection of the present application.

[0062] In one implementation, language resource packages for specified markets can be prefabricated for the markets where the terminals are launched, so as to reduce the language resources in the APP resource package; alternatively, resource packages of other types (such as attributes, pictures, etc.) can also be prefabricated, so as to reduce other types of resources in the APP resource package. However, this solution cannot customize languages for personalized users. For example, a Chinese person is abroad and buys a locally customized mobile phone there, then there may be no Chinese language to choose; among them, resources such as pictures and layouts still need to be fully prefabricated.

[0063] In another implementation, through Bundle, feature sub-packages are provided for the terminal, which can also be called Bundle sub-packaging; that is, users can download various small packages with corresponding features from the application mall, application market, etc. according to their own needs. For example, which small packages with which functions are needed, etc. However, Bundle requires the application program to decompose features during compilation, and the process is complex; moreover, most application programs on the market still adopt the overall package method, that is, the resources in the feature sub-packages are not loaded on demand, and a lot of resources that users do not need will still be loaded into the memory; if there is no network, the sub-packages for different languages and features need to be downloaded online.

[0064] Among them, Bundle is a kind of resource package in the Unity development platform, and this kind of resource package can be almost all the resources to be used in the game. For example: most file updates such as models, textures, presets, scenes, etc., and can be dynamically loaded at runtime. Bundle can be selected to be compressed and then transmitted over the network, which can improve the transmission efficiency and reduce the package size, etc.

[0065] Such as Figure 1As shown in the figure, it is the system architecture diagram of the construction device applied in the embodiment of the present application. In Figure 1 As shown, the construction device may include a resource management module and a resource optimization module.

[0066] Among them, the resource management module is mainly responsible for resource loading, parsing, and providing resource information for the APP. It is used to decompress the resource package of the APP, read it into memory, and generate a resource index; when the APP requests a resource, the resource management module will query the resource index, find the resource information or the resource location information, and feedback the resource information or the resource location information to the APP.

[0067] The resource optimization module may include, but is not limited to: function modules such as a profiling file (Profile file), a decision-making algorithm, resource reconstruction, and resource trimming, as shown below:

[0068] a) The profiling file is used to save the relevant information of resource requests, including information such as resource names, configurations, and language settings; that is, it is responsible for recording the resource requests from the APP to the resource management module and saving them to the profiling file.

[0069] b) The decision-making algorithm mainly decides when resource package reconstruction can be performed according to the change trend of the profiling file; according to the content of the profiling file, it decides which resources need to be reconstructed into the target resource package, or which resources need to be trimmed from the original resource package. For example, the decision-making algorithm can determine the resources to be reconstructed according to the access quantity and the change trend of the resources in the profiling file.

[0070] c) Resource reconstruction generates a target resource package according to the content of the profiling file and the decision-making algorithm.

[0071] d) Resource copying or trimming copies or trims the content built into the target resource package from the original resource package according to the content of the profiling file and the decision-making algorithm, and completes the resource package replacement.

[0072] Next, a simple explanation is given to some terms involved in the embodiment of the present application:

[0073] Resource file: The object of a resource request. All files from which the required resources can be read can be called "resource files". The types of resources can be pictures, audio, video, text resources, or other content that can be displayed on a computer, etc. It can be read by a dedicated program interface and displayed to the user as needed in the application program.

[0074] Resource index: Used to represent the correspondence between the resource identifiers of an application program and the resource files.

[0075] Virtual resource index: A logical structure constructed in physical memory (ram) for the computer program to access in a timely manner.

[0076] In an embodiment of the present application, an original resource package of a target application is obtained; a record file for accessing the original resource package is obtained, and the record file includes the access times of each original resource; the original resources in the original resource package with access times greater than the corresponding preset times are used to construct a first target resource package. Since the first target resource package is constructed from the original resource package, that is, the volume of the resource package used by the APP is reduced, the storage space occupied by the first target resource package of the target application can be reduced, the resource decompression and reading efficiency can be improved, and the startup time of the application can be reduced; the virtual memory occupation during the operation of the application can be reduced; moreover, a smaller resource package is also beneficial to system operations.

[0077] It should be noted that the method for constructing an application resource package provided in the embodiment of the present application can be applied to a construction device, and the construction device can be applied to a terminal device or a cloud server. Exemplarily, the terminal device may include devices such as a mobile phone, a tablet computer, a desktop computer, a laptop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), a wearable electronic device, or a smart watch. The embodiment of the present application does not impose special restrictions on the specific form of the terminal.

[0078] Next, the technical solution of the present application will be further described by way of embodiments. Among them, the construction device is described by taking a terminal device as an example. As Figure 2 shown, it is a schematic diagram of an embodiment of the method for constructing an application resource package in an embodiment of the present application, which may include:

[0079] 201. Obtain the original resource package of the target application.

[0080] In an embodiment of the present application, the terminal device obtains the original resource package of the target application. The original resource package may include: an original resource index and original resource files. The original resource index is used to represent the correspondence between the original resource identifier and the original resource file. Among them, it can be understood that the original resource package of the application may be pre-stored in the terminal device or may be a resource package included in the installation package downloaded from the application store. The original resource files here may include resource files such as strings, multiple languages, multiple layout files, multiple pictures, and configuration information. The target application may be each application installed on the terminal device. For example: applications such as maps, calendars, browsers, weather, and languages.

[0081] Exemplarily, the original resource package may be a language resource package, and the original resource files may include resource files in Chinese, English, French, Japanese, Italian, Portuguese, etc.

[0082] 202. Obtain the access times of each original resource in the original resource package.

[0083] For the terminal device to obtain the access times of each original resource in the original resource package, it may include:

[0084] (1) The terminal device obtains the average access times of each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance.

[0085] Furthermore, the terminal device constructs a first target resource package with the original resources in the original resource package whose average access times are greater than the corresponding preset times. It can be understood that the access times of each original resource of the target application accessed by multiple users corresponding to multiple terminal devices can be obtained, and then the average access times of each accessed original resource can be calculated; among them, the historical access data of the multiple terminal devices can be obtained from the server or from the multiple terminal devices. If the average access time is greater than the corresponding preset time, it can be considered that this original resource is frequently accessed by many users. Therefore, when reconstructing the target resource package, including this original resource in the target resource package can meet the access needs of most users.

[0086] (2) The terminal device obtains a record file of the access to the original resource package, and the record file includes the access times of each original resource in the original resource package. It can be understood that the record file includes the access times of the original resources of the target application accessed by the user on this terminal device. At this time, constructing a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times can meet the personal access needs of this user.

[0087] For the terminal device to obtain a record file of the access to the original resource package of the target application, it may include: The terminal device obtains an original resource access request for the target application, and the original resource access request includes an original resource identifier; Exemplarily, it may be that the terminal device responds to a user's resource access operation on the target application (such as touch, swipe, click, double-click, press, etc.), or an operation on a preset control (the preset control is a control that is preset to be able to access the target application), and generates an original resource access request. The terminal device then loads the original resource package according to the original resource access request, and accesses the original resource file through the original resource index using the original resource identifier. Furthermore, the terminal device can also record relevant information about accessing the original resource file of the target application to obtain a record file.

[0088] Among them, the terminal device obtaining a record file for accessing the original resource package may include: the terminal device obtaining an original resource access request for the target application, where the original resource access request includes an original resource identifier; the terminal device then loading the original resource package according to the original resource access request and accessing the original resource file through the original resource index using the original resource identifier; the terminal device recording relevant information about accessing the original resource file of the target application to obtain a record file. It can be understood that the terminal device records the relevant information of the original resource access request for accessing the original resources in the target application, thereby obtaining a record file, which can be used to analyze the user's usage habits and usage requirements, and thus provides a guarantee for constructing a target resource package that better meets the user's needs.

[0089] Among them, the terminal device accessing the original resource file through the original resource index using the original resource identifier may be: if the terminal device determines that the original resource identifier is in the original resource index, it can use the original resource identifier to access the original resource file through the original resource index. That is, the terminal device accesses the original resource file through the original resource index according to the original resource identifier included in the original resource access request, thereby obtaining the original resource.

[0090] It should be noted that the terminal device can collect resource information such as resources, configuration items, and pictures loaded during the user's use of the target APP and record them in the record file corresponding to the target APP. It can be understood that the relevant information for accessing the original resource file of the target application may include information such as the resource package name, version number, path, file type, attribute, resource identifier (such as the real value), access times (which can also be called hit times), last update time (which can be understood as the initial access time), last access time, and last record file time.

[0091] Exemplarily, as Figure 3A shown, it is a schematic diagram of obtaining a record file for accessing the original resource package in an embodiment of the present application. In Figure 3AAs shown in the figure, in the startup phase: the terminal device loads the original resource package of the target APP from the Rom space (which can be understood as the physical space) through the resource manager. The original resource package includes the original resource index and the original resource package file, and constructs a virtual resource index. Among them, when constructing the virtual resource index, first decompress the original resource package obtained from the Rom space, then map, read or download the original resource index and the original resource package file, and then construct the virtual resource index through the original resource index. In the running phase: the APP requests resources through the interface of the resource manager; the resource manager accesses the original resource file through the virtual resource index according to the requested original resource identity (identity document, ID) information, obtains the accessed original resource, and feeds the accessed original resource back to the target APP; at the same time, the resource manager stores the relevant information of accessing the original resource file into the record file through asynchronous events after parameter parsing of the original resource ID requested by the target APP and the fed-back original resource. In the end phase: the resource manager releases the virtual resource index.

[0092] As shown in Table 1 below, it is the record file for the terminal device to obtain and access the original resource package of the target application.

[0093]

[0094] Table 1

[0095] It can be understood that each application can have a corresponding record file, and this record file can be updated in real time. The record files of each application can be stored in the same storage space. When calling the record file of a certain application, the corresponding record file can be found according to the identity of the target application.

[0096] 203. Use the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package.

[0097] It can be understood that the preset times corresponding to the access times of each original resource can be determined according to empirical values, and they can be the same or different. If the access times are more, it means that the probability of this original resource being accessed by the user is greater, then this original resource will be included in the re-constructed target resource package; if the access times are less or none, it means that the probability of this original resource being accessed by the user is smaller, then this original resource will not be included in the re-constructed target resource package.

[0098] Exemplarily, as shown in Table 2 below, the original resource package includes an original resource index and original resource files, and the original resources corresponding to the original resource files can be accessed through the original resource index. Taking the original resource package that can access the original resource 0XFEADC1, the original resource OX34523S, the original resource A, the original resource B, the original resource C, the original resource D, and the original resource E as an example for illustration.

[0099] Original Resource Index Original Resource File Original Resource Index 1 Original Resource 0XFEADC1 File Original Resource Index 2 Original Resource OX34523S File Original Resource Index 3 Original Resource A File Original Resource Index 4 Original Resource B File Original Resource Index 5 Original Resource C File Original Resource Index 6 Original Resource D File Original Resource Index 7 Original Resource E File

[0100] Table 2

[0101] Taking the original resource index including the original resource identifier as an example for illustration in combination with Table 2 above. For example: the original resource index 1 is the original resource 0XFEADC1, the original resource index 2 is the original resource OX34523S, the original resource index 3 is the original resource A, the original resource index 4 is the original resource B, the original resource index 5 is the original resource C, the original resource index 6 is the original resource D, and the original resource index 7 is the original resource E.

[0102] Since the access count (201) of the original resource 0XFEADC1 is less than the first preset count (such as 300), therefore, the original resource 0XFEADC1 file is not in the reconstructed first target resource package; the access count (9) of the original resource OX34523S is less than the second preset count (such as 15), therefore, the original resource OX34523S file is not in the reconstructed first target resource package; the access count (15) of the original resource A is less than the third preset count (such as 30), therefore, the original resource A file is not in the reconstructed first target resource package; the access count (100) of the original resource B is greater than the fourth preset count (such as 80), therefore, the original resource B file is in the reconstructed first target resource package; the access count (200) of the original resource C is less than the fifth preset count (such as 300), therefore, the original resource C file is not in the reconstructed first target resource package; the access count (20) of the original resource D is greater than the sixth preset count (such as 15), therefore, the original resource D file is in the reconstructed first target resource package; the access count (520) of the original resource E is greater than the seventh preset count (such as 400), therefore, the original resource E file is in the reconstructed first target resource package.

[0103] The terminal device constructs a first target resource package based on the original resource B file, the original resource D file, and the original resource E file. That is, the first target resource package includes the original resource B file, the original resource D file, and the original resource E file, and does not include the original resource A file, the original resource C file, the original resource 0XFEADC1 file, and the original resource OX34523S file. That is, the terminal device can reconstruct the target resource package according to the user's access requirements. Since the size of the reconstructed target resource package is smaller than the size of the original resource package, the storage space occupied by the resource package of the target application can be reduced, the resource package decompression and resource reading efficiency can be improved, the startup time of the application can be reduced; the virtual memory occupation during the operation of the application can be reduced; and the smaller resource package is also beneficial to system operation.

[0104] It should be noted that as the user accesses the original resources of the target application on the terminal device, the change rate of the original resources in the record file may tend to 0, indicating that the relevant information of the user accessing the original resources of the target application has been basically fixed, and the terminal device can reconstruct the target resource package according to the record file of the target application and the original resource package.

[0105] The terminal device constructs a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times, which may include: under the condition of meeting the preset conditions, constructing a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0106] Among them, the above preset conditions may include but are not limited to the following conditions or combinations of the following conditions:

[0107] Condition 1: The recording period recorded in the record file is greater than the preset duration. The recording period is implemented as the recording start time and the recording end time, and the recording may also continue without ending.

[0108] Among them, the recording period recorded in the record file is greater than the preset duration, and the specific implementation may include but are not limited to the following methods:

[0109] (1) The duration from the initial time recorded in the record file to the current time is greater than the first preset duration.

[0110] It can be understood that if the duration from the initial time recorded in the record file to the current time is too short, then the reliability of the reconstructed first target resource package is too low and may not meet the actual needs of the user. Therefore, if the duration from the initial time recorded in the record file to the current time is greater than the first preset duration, that is, the time recorded in the record file has been a relatively long period of time (such as one month, three months, etc.), at this time, the probability that the first target resource package constructed with the original resources in the original resource package whose access times are greater than the corresponding preset times meets the user's needs is relatively large.

[0111] (2) The duration from the initial access time of the latest original resource in the record file to the current time is greater than a second preset duration.

[0112] It should be noted that the record file may also include: the initial access time corresponding to each accessed original resource. That is, the duration from the initial access time of the latest original resource in the record file to the current time is greater than a second preset duration, which can also be understood as: the minimum duration is greater than the second preset duration, where the minimum duration is the minimum duration from the initial access time of each accessed original resource in the record file to the current time. If this condition is met, it can be considered that the original resources accessed by the user during this period have been fixed and no new original resources have been accessed. At this time, the probability of constructing a target resource package to meet the user's needs is very high.

[0113] Exemplarily, the record file records that the initial access time of original resource A is September 10, 2019, the initial access time of original resource B is October 1, 2019, and the initial access time of original resource C is October 15, 2019. The current time is November 15, 2019. According to this record file, it can be known that the latest original resource is original resource C, and the initial access time is October 15, 2019. It has been one month since the current time of November 15, 2019. During this one month, the user has not accessed other original resources, and this one month is also a relatively long time. That is, as the user accesses the original resources of the target application on the terminal device, the change rate of the original resources in the record file has become 0, indicating that the original resources accessed by the user for the target application have been basically fixed. The terminal device can use the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package.

[0114] Condition 2: The number of original resources whose access times are greater than the corresponding preset times is lower than a preset threshold.

[0115] It can be understood that if the number of original resources whose access times are recorded in the record file and are greater than the corresponding preset times is very large, almost the same as the total number of original resources of the target application, then the significance of reconstruction is not very great. Because the main function of reconstructing the target resource package is that the size of the reconstructed target resource package is smaller than the size of the original resource package. If they are almost the same size, reconstruction will instead waste system resources and may also affect the normal operation of the target application. Therefore, here it can also be that when the number of original resources whose access times are greater than the corresponding preset times is lower than the preset threshold, the step of reconstructing the target resource package can be triggered.

[0116] Condition 3: The target application is in an idle state.

[0117] When the target application is in the idle state, reconstruct the target resource package to avoid affecting the normal use of users and improve the user experience. If the target application is in the working state, reconstructing the target resource package may affect the normal operation of the target application and thus affect the user experience.

[0118] It should be noted that the idle state can be understood as the state where the target application is not being used. For example, during the period from 11:00 p.m. to 7:00 a.m., generally the terminal device is in the idle state, and then the target application is also in the state of not being used; or, when the application used by the user is not the target application, it can be understood that the target application is in the idle state.

[0119] Furthermore, when the terminal device meets the preset conditions, use the original resources in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package, which may include: when the terminal device meets the preset conditions, generate construction indication information; the terminal device displays the construction indication information; the terminal device responds to the user's operation on the construction indication information and generates a construction request; the terminal device constructs the first target resource package according to the construction request by using the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0120] It can be understood that when constructing the first target resource package, it can also be decided by the user whether to reconstruct it instead of automatic construction, providing an implementation method for triggering the construction of the target resource package and improving the diversity and flexibility of the implementation of the solution in this embodiment of the present application.

[0121] As Figure 3B shown, it is a schematic diagram of the user's operation on the construction indication information in an embodiment of the present application. For example, the construction indication information is "Whether to reconstruct the language resource package", or "It is found that some functions of your language are not frequently used. Whether to reconstruct the resource package that does not include the functions not frequently used?" The terminal device can display the prompt information on the display interface and respond to the user's construction operation on the prompt information (for example, the user selects the "Yes" button) to generate a construction request. If the user selects the "No" button, what is generated is a request not to perform construction.

[0122] It can be understood that the preset times, the first preset duration, the second preset duration, the preset threshold, etc. can all be adjusted according to the actual needs of the user, and no specific limitations are made in this embodiment of the present application. Among them, the preset times corresponding to each original resource can be the same or different, and can be set according to historical experience values.

[0123] Among them, the first target resource package includes: a target resource index and a target resource file. The target resource index is used to represent the correspondence between the target resource identifier and the target resource file. The terminal device constructs the first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times. The implementation manners may include, but are not limited to, the following:

[0124] Implementation manner 1:

[0125] The terminal device copies the original resource index whose access times are greater than the corresponding preset times from the original resource index to obtain the target resource index; the terminal device copies the original resource file whose access times are greater than the corresponding preset times from the original resource file to obtain the target resource file; and constructs the first target resource package with the target resource index and the target resource file.

[0126] Exemplarily, as Figure 3C shown, it is a schematic diagram of constructing a target resource package in an embodiment of the present application. The terminal device registers an event in the package manager service (PMS), and this event is the event of constructing the target resource package, by setting the trigger condition for the event of constructing the target resource package; the PMS starts a Profile thread according to the set trigger condition, and the Profile thread reconstructs a target resource package according to the record file and the original resource package, and this target resource package includes the target resource index and the target resource package file.

[0127] Exemplarily, as shown in Table 2 above:

[0128] The access times (201) of the original resource 0XFEADC1 are less than the first preset times (such as 300), so the terminal device does not copy the original resource index 1 and the original resource 0XFEADC1 file; that is, the original resource 0XFEADC1 file is not in the reconstructed first target resource package.

[0129] The access times (9) of the original resource OX34523S are less than the second preset times (such as 15), so the terminal device does not copy the original resource index 2 and the original resource OX34523S file; that is, the original resource OX34523S file is not in the reconstructed first target resource package.

[0130] The access times (15) of the original resource A are less than the third preset times (such as 30), so the terminal device does not copy the original resource index 3 and the original resource A file; that is, the original resource A file is not in the reconstructed first target resource package.

[0131] The access count (100) of the original resource B is greater than the fourth preset count (e.g., 80). Therefore, the terminal device copies the original resource index 4 and the original resource B file; that is, the original resource B file is in the reconstructed first target resource package.

[0132] The access count (200) of the original resource C is less than the fifth preset count (e.g., 300). Therefore, the terminal device does not copy the original resource index 5 and the original resource C file; that is, the original resource C file is not in the reconstructed first target resource package.

[0133] The access count (20) of the original resource D is greater than the sixth preset count (e.g., 15). Therefore, the terminal device copies the original resource index 6 and the original resource D file; that is, the original resource D file is in the reconstructed first target resource package.

[0134] The access count (520) of the original resource E is greater than the seventh preset count (e.g., 400). Therefore, the terminal device copies the original resource index 7 and the original resource E file; that is, the original resource E file is in the reconstructed first target resource package.

[0135] The terminal device constructs the first target resource package based on the original resource B file, the original resource D file, and the original resource E file. That is, the first target resource package includes the original resource B file, the original resource D file, and the original resource E file, and does not include the original resource A file, the original resource C file, the original resource 0XFEADC1 file, and the original resource OX34523S file.

[0136] As shown in Table 3 below, it is a schematic description of the target resource package constructed by the terminal device:

[0137] Original Resource Index Original Resource File Original Resource Index 4 Original Resource B File Original Resource Index 6 Original Resource D File Original Resource Index 7 Original Resource E File

[0138] Table 3

[0139] Optionally, when the terminal device constructs the first target resource package using the target resource index and the target resource file, it can compress the target resource index and the target resource file to obtain the first target resource package.

[0140] It can be understood that the terminal device can save the first target resource package in the local storage space; the terminal device can move the original resource package from the local storage space to the cloud storage space. That is, after the first target resource package is constructed, the terminal device can save the original resource package and the first target resource package in different storage spaces or storage media.

[0141] Exemplarily, the original resource package can be saved in a storage area that is not frequently accessed. For example: cloud storage space, hard disk, slow storage space, etc. When the original resource package is stored in the cloud storage space, it can save the storage space of the terminal device, improve the efficiency of resource package decompression, resource reading, and constructing the virtual resource index (restable), and reduce the startup time of the application program.

[0142] It is also possible to compress the original resource index and the original resource file. If the compression ratio is relatively high, the occupied storage space of the compressed first resource index and the original resource file will be relatively smaller, thereby saving storage space. Among them, the storage space can include memory, network disk, etc.

[0143] That is, the original resource package can be used as a backup file through compression and storage location change. When the resource requested by the target APP for access is not in the first target resource package, the target resource package can be reconstructed again through the original resource package and the refreshed record file. Therefore, the terminal device can flexibly reconstruct the target resource package according to the user's access requirements, thereby meeting the user's needs and improving the user experience.

[0144] Implementation method two:

[0145] The terminal device removes the resource indexes with access times less than or equal to the corresponding preset times from the original resource index to obtain the target resource index; the terminal device removes the resource files with access times less than or equal to the corresponding preset times from the original resource file to obtain the target resource file; and constructs the first target resource package with the target resource index and the target resource file.

[0146] Exemplarily, as Figure 3D shown, it is a schematic diagram of resource package clipping in an embodiment of the present application. Among them, the information for clipping the language resource package can include clipping the original language index and the original language resource file of the original language resource package. a) The original language index can be linguistically clipped according to the condition of the language resource with access times greater than the corresponding preset times, and the clipped language index with access times greater than the corresponding preset times is obtained, which is the target language index. Among them, the languages with access times greater than the corresponding preset times are, for example: user's commonly used language, local language, and general English, etc. b) The layout, pictures, configuration and other resource files for reconstructing the target language resource package are clipped from the original language resource file according to the condition of the language resource with access times greater than the corresponding preset times to obtain the target language file.

[0147] After these processes, there will be two language resource packages. One is the trimmed original language resource index and original language resource files, which can be deleted or compressed and saved. The other is the target language resource index and target language resource files obtained by trimming. The target language resource package is obtained through the target language resource index and target language resource files, and the terminal device will preferentially use the target language resource package.

[0148] It can be understood that since the size of the target language resource package is smaller than that of the original language resource package, it can reduce the storage space occupied by the language resource package, improve the efficiency of decompressing the resource package, resource reading, and constructing the virtual resource index (restable), and reduce the startup time of the application.

[0149] 204. Obtain a target resource access request for the target application, where the target resource access request includes a target resource identifier.

[0150] It can be understood that the user can access the target application on the terminal device, that is, the terminal device responds to the user's resource access operation on the target application (such as touch, swipe, click, double-click, press, etc.), or an operation on a preset control to generate a target resource access request. As Figure 3E shown, it is a schematic diagram of obtaining a resource access request for an application in an embodiment of the present application. As Figure 3F shown, it is another schematic diagram of obtaining a resource access request for an application in an embodiment of the present application.

[0151] 205. Load and access the first target resource package according to the first target resource access request.

[0152] 206. If it is determined that the target resource identifier is in the target resource index, access the target resource file through the target resource index.

[0153] As Figure 3G shown, it is a schematic flowchart of a resource access request in an embodiment of the present application. It can be understood that after the terminal device loads the target resource package stored in the memory, if it is determined that the target resource identifier is in the target resource index, the target resource file is mapped in the virtual resource table through the target resource index, that is, the target resource corresponding to the target resource file can be accessed through the mapping relationship between the virtual resource table and the target resource index. Therefore, when the size of the first target resource package is smaller than that of the original resource package, the corresponding virtual resource table will also be smaller, thereby reducing the virtual memory occupied by the application during operation.

[0154] Optionally, in some embodiments of the present application, if the terminal device determines that the target resource identifier is not in the target resource index, the terminal device loads the original resource package according to the target resource request; if the terminal device determines that the target resource identifier is in the original resource index, the terminal device accesses the original resource file through the original resource index. It can be understood that if the target resource identifier is not in the target resource index, it can be considered that the target resource file corresponding to the target resource identifier to be accessed is not in the first target resource package, and the original resource package of the target application can be loaded for access. An implementation method of resource access is provided.

[0155] Optionally, in some embodiments of the present application, if the terminal device determines that the target resource identifier is not in the target resource index, the terminal device obtains the updated record file, and the updated record file includes the updated access times of each original resource; the terminal device uses the original resources in the original resource package whose updated access times are greater than the corresponding preset times to construct the second target resource package. It can be understood that the record file is updated in real time. When the target resource accessed by the target APP is not in the first target resource package, the terminal device can reconstruct the second target resource package according to the real-time updated record file and the original resource package. Furthermore, the target resource package can be reconstructed according to the adjustment of user requirements. Optionally, the second target resource package can overwrite the first target resource package. Among them, the method of constructing the second target resource package can refer to the construction process of the first target resource package described above and will not be elaborated here.

[0156] It should be noted that in the embodiments of the present application, steps 204-206 are optional steps.

[0157] In the embodiments of the present application, the original resource package of the target application is obtained; the access times of each original resource in the original resource package are obtained; the original resources in the original resource package whose access times are greater than the corresponding preset times are used to construct the first target resource package. Since the first target resource package is constructed through the original resource package, that is, the volume of the resource package used by the target APP is reduced; thus, the storage space occupied by the first target resource package of the target application can be reduced, the efficiency of resource decompression, reading, and constructing the virtual resource index (restable) can be improved, and the startup time of the application can be reduced; the virtual memory occupation during the operation of the application can be reduced; and a smaller resource package is also beneficial to system operations (such as file memory page operations); optionally, the total resource package occupation volume can also be reduced by means of trimming and compressing the original resource package.

[0158] As Figure 4 shown, it is a schematic diagram of an embodiment of the construction device in the embodiments of the present application, which may include:

[0159] An acquisition module 401, configured to acquire an original resource package of a target application; acquire the access times of each original resource in the original resource package;

[0160] A processing module 402, configured to construct a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0161] Optionally, in some embodiments of the present application,

[0162] The acquisition module 401 is specifically configured to acquire the average access times of each original resource in the original resource package from the historical access data of a plurality of terminal devices acquired in advance;

[0163] The processing module 402 is specifically configured to construct a first target resource package with the original resources in the original resource package whose average access times are greater than the corresponding preset times.

[0164] Optionally, in some embodiments of the present application,

[0165] The acquisition module 401 is specifically configured to acquire a record file for accessing the original resource package, where the record file includes the access times of each original resource in the original resource package.

[0166] Optionally, in some embodiments of the present application,

[0167] The processing module 402 is specifically configured to, when a preset condition is met, construct a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times;

[0168] Wherein, the preset condition includes at least one of the following conditions:

[0169] The recording period recorded by the record file is greater than a preset duration;

[0170] The number of original resources whose access times are greater than the corresponding preset times is lower than a preset threshold;

[0171] The target application is in an idle state.

[0172] Optionally, in some embodiments of the present application,

[0173] The processing module 402 is specifically configured to, when a preset condition is met, generate construction indication information; display the construction indication information; in response to an operation of a user on the construction indication information, generate a construction request; and according to the construction request, construct a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0174] Optionally, in some embodiments of the present application,

[0175] The original resource package includes: an original resource index and original resource files; the original resource index is used to represent the correspondence between the original resource identifier and the original resource files.

[0176] The first target resource package includes: a target resource index and target resource files; the target resource index is used to represent the correspondence between the target resource identifier and the target resource files.

[0177] Optionally, in some embodiments of the present application,

[0178] The processing module 402 is specifically configured to copy the original resource indexes with access times greater than the corresponding preset times from the original resource index to obtain the target resource index; copy the original resource files with access times greater than the corresponding preset times from the original resource files to obtain the target resource files; and construct the first target resource package with the target resource index and the target resource files.

[0179] Optionally, in some embodiments of the present application,

[0180] The processing module 402 is specifically configured to compress the target resource index and the target resource files to obtain the first target resource package.

[0181] Optionally, in some embodiments of the present application,

[0182] The processing module 402 is specifically configured to save the first target resource package in the local storage space; move the original resource package from the local storage space to the cloud storage space.

[0183] Optionally, in some embodiments of the present application,

[0184] The processing module 402 is specifically configured to remove the resource indexes with access times less than or equal to the corresponding preset times from the original resource index to obtain the target resource index; remove the resource files with access times less than or equal to the corresponding preset times from the original resource files to obtain the target resource files; and construct the first target resource package with the target resource index and the target resource files.

[0185] Optionally, in some embodiments of the present application,

[0186] The processing module 402 is further configured to obtain a target resource access request for the target application program, where the target resource access request includes a target resource identifier; load the first target resource package according to the target resource access request; and if it is determined that the target resource identifier is in the target resource index, access the target resource file through the target resource index.

[0187] Optionally, in some embodiments of the present application,

[0188] The processing module 402 is further configured to, if it is determined that the target resource identifier is not in the target resource index, load the original resource package according to the target resource request; if it is determined that the target resource identifier is in the original resource index, access the original resource file through the original resource index.

[0189] Optionally, in some embodiments of the present application,

[0190] The processing module 402 is further configured to, if it is determined that the target resource identifier is not in the target resource index, obtain an updated record file, where the updated record file includes the updated access times of each original resource; use the original resources in the original resource package whose updated access times are greater than the corresponding preset times to construct a second target resource package.

[0191] Optionally, in some embodiments of the present application,

[0192] The obtaining module 401 is further configured to obtain an original resource access request for the target application program, where the original resource access request includes an original resource identifier; load the original resource package according to the original resource access request, access the original resource file through the original resource index using the original resource identifier; record relevant information about accessing the original resource file of the target application program to obtain a record file.

[0193] As Figure 5 shown, it is a schematic diagram of an embodiment of a terminal device in an embodiment of the present application, which may include a construction device as Figure 4 shown.

[0194] As Figure 6As shown in the figure, it is a schematic diagram of another embodiment of the terminal device in the embodiment of the present application. The terminal device 600 may include a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, antenna 1, antenna 2, a mobile communication module 650, a wireless communication module 660, an audio module 670, a speaker 670A, a receiver 670B, a microphone 670C, a headphone jack 670D, a sensor module 680, a button 690, a motor 691, an indicator 692, a camera 693, a display screen 694, and a subscriber identification module (SIM) card interface 695, etc. The sensor module 680 may include a pressure sensor 680A, a gyroscope sensor 680B, a barometric pressure sensor 680C, a magnetic sensor 680D, an acceleration sensor 680E, a distance sensor 680F, a proximity light sensor 680G, a fingerprint sensor 680H, a temperature sensor 680J, a touch sensor 680K, an ambient light sensor 680L, a bone conduction sensor 680M, etc.

[0195] It can be understood that the structure schematically shown in the embodiment of the present application does not constitute a specific limitation on the terminal device 600. In other embodiments of the present application, the terminal device 600 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0196] The processor 610 may include one or more processing units. For example, the processor 610 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0197] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.

[0198] A memory can also be provided in the processor 610 for storing instructions and data. In some embodiments, the memory in the processor 610 is a cache memory. This memory can hold the instructions or data that the processor 610 has just used or recycled. If the processor 610 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses and reduces the waiting time of the processor 610, thus improving the efficiency of the system.

[0199] In some embodiments, the processor 610 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0200] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 610 may include multiple groups of I2C buses. The processor 610 can be respectively coupled to the touch sensor 680K, the charger, the flash, the camera 693, etc. through different I2C bus interfaces. For example: The processor 610 can be coupled to the touch sensor 680K through the I2C interface, enabling the processor 610 to communicate with the touch sensor 680K through the I2C bus interface to implement the touch function of the terminal device 600.

[0201] The I2S interface can be used for audio communication. In some embodiments, the processor 610 may include multiple groups of I2S buses. The processor 610 can be coupled to the audio module 670 through the I2S bus to implement communication between the processor 610 and the audio module 670. In some embodiments, the audio module 670 can transmit audio signals to the wireless communication module 660 through the I2S interface to implement the function of answering a call through a Bluetooth headset.

[0202] The PCM interface can also be used for audio communication to sample, quantize, and encode analog signals. In some embodiments, the audio module 670 and the wireless communication module 660 can be coupled through the PCM bus interface. In some embodiments, the audio module 670 can also transmit audio signals to the wireless communication module 660 through the PCM interface to implement the function of answering a call through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0203] The UART interface is a general-purpose serial data bus for asynchronous communication. This bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 610 and the wireless communication module 660. For example, the processor 610 communicates with the Bluetooth module in the wireless communication module 660 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 670 can transmit audio signals to the wireless communication module 660 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0204] The MIPI interface can be used to connect the processor 610 to peripheral devices such as the display screen 694 and the camera 693. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 610 and the camera 693 communicate through the CSI interface to implement the shooting function of the terminal device 600. The processor 610 and the display screen 694 communicate through the DSI interface to implement the display function of the terminal device 600.

[0205] The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 610 to the camera 693, the display screen 694, the wireless communication module 660, the audio module 670, the sensor module 680, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0206] The USB interface 630 is an interface that complies with the USB standard specification, and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 630 can be used to connect a charger to charge the terminal device 600, and can also be used to transfer data between the terminal device 600 and peripheral devices. It can also be used to connect a headset to play audio. This interface can also be used to connect other terminal devices, such as AR devices, etc.

[0207] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative descriptions and do not constitute a structural limitation on the terminal device 600. In other embodiments of the present application, the terminal device 600 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0208] The charging management module 640 is used to receive a charging input from a charger. Among them, the charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 640 can receive the charging input of the wired charger through the USB interface 630. In some embodiments of wireless charging, the charging management module 640 can receive the wireless charging input through the wireless charging coil of the terminal device 600. While charging the battery 642, the charging management module 640 can also supply power to the terminal device through the power management module 641.

[0209] The power management module 641 is used to connect the battery 642, the charging management module 640, and the processor 610. The power management module 641 receives the inputs from the battery 642 and / or the charging management module 640 and supplies power to the processor 610, the internal memory 621, the display screen 694, the camera 693, the wireless communication module 660, etc. The power management module 641 can also be used to monitor parameters such as the battery capacity, the number of battery cycles, and the battery health status (leakage, impedance). In some other embodiments, the power management module 641 can also be provided in the processor 610. In other embodiments, the power management module 641 and the charging management module 640 can also be provided in the same device.

[0210] The wireless communication function of the terminal device 600 can be implemented through antenna 1, antenna 2, the mobile communication module 650, the wireless communication module 660, the modulation and demodulation processor, and the baseband processor, etc.

[0211] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device 600 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: Antenna 1 can be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0212] The mobile communication module 650 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the terminal device 600. The mobile communication module 650 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 650 can receive electromagnetic waves through antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 650 can also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 650 can be provided in the processor 610. In some embodiments, at least some functional modules of the mobile communication module 650 and at least some modules of the processor 610 can be provided in the same device.

[0213] The modulation and demodulation processor can include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 670A, receiver 670B, etc.), or displays images or videos through the display screen 694. In some embodiments, the modulation and demodulation processor can be an independent device. In other embodiments, the modulation and demodulation processor can be independent of the processor 610 and provided in the same device as the mobile communication module 650 or other functional modules.

[0214] The wireless communication module 660 can provide solutions for wireless communications applied to the terminal device 600, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 660 can be one or more devices integrating at least one communication processing module. The wireless communication module 660 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 610. The wireless communication module 660 can also receive the signals to be sent from the processor 610, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.

[0215] In some embodiments, antenna 1 of the terminal device 600 is coupled to the mobile communication module 650, and antenna 2 is coupled to the wireless communication module 660, enabling the terminal device 600 to communicate with the network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).

[0216] The terminal device 600 implements the display function through the GPU, the display screen 694, and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 694 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 610 may include one or more GPUs, which execute program instructions to generate or change display information.

[0217] The display screen 694 is used to display images, videos, etc. The display screen 694 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 600 may include one or N display screens 694, where N is a positive integer greater than 1.

[0218] The terminal device 600 can implement the shooting function through the ISP, the camera 693, the video codec, the GPU, the display screen 694, and the application processor, etc.

[0219] The ISP is used to process the data fed back by the camera 693. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera sensor. The optical signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 693.

[0220] The camera 693 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the sensor. The sensor can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The sensor converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, etc. format. In some embodiments, the terminal device 600 may include one or N cameras 693, where N is a positive integer greater than 1.

[0221] The digital signal processor is used to process digital signals. Besides being able to process digital image signals, it can also process other digital signals. For example, when the terminal device 600 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0222] The video codec is used to compress or decompress digital videos. The terminal device 600 can support one or more video codecs. In this way, the terminal device 600 can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0223] The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission pattern between human brain neurons, it can quickly process the input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the terminal device 600 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.

[0224] The external memory interface 620 can be used to connect to an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 600. The external memory card communicates with the processor 610 through the external memory interface 620 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.

[0225] The internal memory 621 can be used to store computer-executable program code, and the executable program code includes instructions. The internal memory 621 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.). The data storage area can store the data created during the use of the terminal device 600 (such as audio data, phone book, etc.). In addition, the internal memory 621 can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 610 executes various functional applications and data processing of the terminal device 600 by running the instructions stored in the internal memory 621 and / or the instructions stored in the memory provided in the processor.

[0226] The terminal device 600 can implement audio functions through the audio module 670, speaker 670A, receiver 670B, microphone 670C, headphone jack 670D, and the application processor, etc. For example, music playback, recording, etc.

[0227] The audio module 670 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 670 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 670 can be disposed in the processor 610, or some functional modules of the audio module 670 can be disposed in the processor 610.

[0228] The speaker 670A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The terminal device 600 can listen to music or hands-free calls through the speaker 670A.

[0229] The receiver 670B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. When the terminal device 600 answers a call or a voice message, the voice can be listened to by placing the receiver 670B close to the human ear.

[0230] The microphone 670C, also known as the "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak by placing the mouth close to the microphone 670C to input the sound signal into the microphone 670C. The terminal device 600 can be provided with at least one microphone 670C. In some other embodiments, the terminal device 600 can be provided with two microphones 670C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the terminal device 600 can also be provided with three, four or more microphones 670C to collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.

[0231] The headphone jack 670D is used to connect a wired headphone. The headphone jack 670D can be a USB interface 630, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0232] The pressure sensor 680A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 680A can be set on the display screen 694. There are many types of pressure sensors 680A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 680A, the capacitance between the electrodes changes. The terminal device 600 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 694, the terminal device 600 detects the touch operation intensity according to the pressure sensor 680A. The terminal device 600 can also calculate the touch position according to the detection signal of the pressure sensor 680A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0233] The gyroscope sensor 680B can be used to determine the motion posture of the terminal device 600. In some embodiments, the angular velocity of the terminal device 600 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 680B. The gyroscope sensor 680B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 680B detects the angle of the terminal device 600 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the terminal device 600 through reverse motion to achieve anti-shake. The gyroscope sensor 680B can also be used for navigation and somatosensory game scenes.

[0234] The air pressure sensor 680C is used to measure air pressure. In some embodiments, the terminal device 600 calculates the altitude through the air pressure value measured by the air pressure sensor 680C to assist positioning and navigation.

[0235] The magnetic sensor 680D includes a Hall sensor. The terminal device 600 can use the magnetic sensor 680D to detect the opening and closing of the flip leather case. In some embodiments, when the terminal device 600 is a flip phone, the terminal device 600 can detect the opening and closing of the flip cover according to the magnetic sensor 680D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover automatic unlocking and other features are set.

[0236] The acceleration sensor 680E can detect the magnitude of the acceleration of the terminal device 600 in all directions (generally three axes). When the terminal device 600 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the terminal device and applied to applications such as horizontal and vertical screen switching and pedometers.

[0237] A distance sensor 680F is used to measure distance. The terminal device 600 can measure distance through infrared or laser. In some embodiments, when shooting a scene, the terminal device 600 can use the distance sensor 680F to measure distance to achieve fast focusing.

[0238] The proximity light sensor 680G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light-emitting diode may be an infrared light-emitting diode. The terminal device 600 emits infrared light outward through the light-emitting diode. The terminal device 600 uses the photodiode to detect the infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 600. When insufficient reflected light is detected, the terminal device 600 can determine that there is no object near the terminal device 600. The terminal device 600 can use the proximity light sensor 680G to detect that the user holds the terminal device 600 close to the ear for a call, so as to automatically turn off the screen to achieve the purpose of power saving. The proximity light sensor 680G can also be used for the holster mode and automatic unlocking and locking of the pocket mode.

[0239] The ambient light sensor 680L is used to sense the ambient light brightness. The terminal device 600 can adaptively adjust the brightness of the display screen 694 according to the sensed ambient light brightness. The ambient light sensor 680L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 680L can also cooperate with the proximity light sensor 680G to detect whether the terminal device 600 is in the pocket to prevent accidental touch.

[0240] The fingerprint sensor 680H is used to collect fingerprints. The terminal device 600 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access the application lock, fingerprint taking pictures, fingerprint answering calls, etc.

[0241] The temperature sensor 680J is used to detect temperature. In some embodiments, the terminal device 600 uses the temperature detected by the temperature sensor 680J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 680J exceeds the threshold, the terminal device 600 reduces the performance of the processor located near the temperature sensor 680J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal device 600 heats the battery 642 to avoid abnormal shutdown of the terminal device 600 caused by low temperature. In other some embodiments, when the temperature is lower than yet another threshold, the terminal device 600 boosts the output voltage of the battery 642 to avoid abnormal shutdown caused by low temperature.

[0242] The touch sensor 680K, also known as the "touch control device". The touch sensor 680K can be disposed on the display screen 694, and the touch sensor 680K and the display screen 694 together form a touch screen, also known as the "touch control screen". The touch sensor 680K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 694. In some other embodiments, the touch sensor 680K can also be disposed on the surface of the terminal device 600, at a different position from that of the display screen 694.

[0243] The bone conduction sensor 680M can acquire vibration signals. In some embodiments, the bone conduction sensor 680M can acquire vibration signals of the vibrating bone mass of the human vocal part. The bone conduction sensor 680M can also contact the human pulse to receive blood pressure pulsation signals. In some embodiments, the bone conduction sensor 680M can also be disposed in the earphone to form a bone conduction earphone. The audio module 670 can parse out voice signals based on the vibration signals of the vibrating bone mass of the vocal part acquired by the bone conduction sensor 680M to implement the voice function. The application processor can parse out heart rate information based on the blood pressure pulsation signals acquired by the bone conduction sensor 680M to implement the heart rate detection function.

[0244] The keys 690 include a power-on key, volume keys, etc. The keys 690 can be mechanical keys or touch keys. The terminal device 600 can receive key inputs to generate key signal inputs related to the user settings and function control of the terminal device 600.

[0245] The motor 691 can generate vibration prompts. The motor 691 can be used for incoming call vibration prompts and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playing, etc.) can correspond to different vibration feedback effects. Touch operations acting on different areas of the display screen 694 can also correspond to different vibration feedback effects for the motor 691. Different application scenarios (such as time reminder, receiving messages, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0246] The indicator 692 can be an indicator light and can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.

[0247] The SIM card interface 695 is used to connect to a SIM card. The SIM card can be inserted into or removed from the SIM card interface 695 to achieve contact and separation from the terminal device 600. The terminal device 600 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 695 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 695 simultaneously. The types of the multiple cards can be the same or different. The SIM card interface 695 can also be compatible with different types of SIM cards. The SIM card interface 695 can also be compatible with external memory cards. The terminal device 600 interacts with the network through the SIM card to implement functions such as calls and data communication. In some embodiments, the terminal device 600 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the terminal device 600 and cannot be separated from the terminal device 600.

[0248] In the embodiments of the present application, the processor 610 is further configured to obtain the original resource package of the target application program; obtain the access times of each original resource in the original resource package; and construct a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0249] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to obtain the average access times of each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance; and construct a first target resource package with the original resources in the original resource package whose average access times are greater than the corresponding preset times.

[0250] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to obtain a record file for accessing the original resource package, where the record file includes the access times of each original resource in the original resource package.

[0251] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to construct a first target resource package with the original resources in the original resource package whose access times are greater than the corresponding preset times when a preset condition is met;

[0252] Wherein, the preset condition includes at least one of the following conditions:

[0253] The recording period recorded in the record file is greater than a preset duration;

[0254] The number of original resources whose access times are greater than the corresponding preset times is lower than a preset threshold;

[0255] The target application program is in an idle state.

[0256] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to generate construction indication information when a preset condition is met; display the construction indication information; generate a construction request in response to a user's operation on the construction indication information; and construct a first target resource package according to the construction request, using the original resources in the original resource package whose access times are greater than the corresponding preset times.

[0257] Optionally, in some embodiments of the present application,

[0258] The original resource package includes: an original resource index and original resource files; the original resource index is used to represent the correspondence between the original resource identifier and the original resource files;

[0259] The first target resource package includes: a target resource index and target resource files; the target resource index is used to represent the correspondence between the target resource identifier and the target resource files.

[0260] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to copy the original resource indexes in the original resource index whose access times are greater than the corresponding preset times to obtain the target resource index; copy the original resource files in the original resource files whose access times are greater than the corresponding preset times to obtain the target resource files; and construct the first target resource package using the target resource index and the target resource files.

[0261] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to compress the target resource index and the target resource files to obtain the first target resource package.

[0262] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to save the first target resource package in the local storage space; move the original resource package from the local storage space to the cloud storage space.

[0263] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to remove the resource indexes in the original resource index whose access times are less than or equal to the corresponding preset times to obtain the target resource index; remove the resource files in the original resource files whose access times are less than or equal to the corresponding preset times to obtain the target resource files; and construct the first target resource package using the target resource index and the target resource files.

[0264] Optionally, in some embodiments of the present application, the processor 610 is further configured to obtain a target resource access request for the target application, where the target resource access request includes a target resource identifier; load the first target resource package according to the target resource access request; and if it is determined that the target resource identifier is in the target resource index, access the target resource file through the target resource index.

[0265] Optionally, in some embodiments of the present application, the processor 610 is further configured to, if it is determined that the target resource identifier is not in the target resource index, load the original resource package according to the target resource request; and if it is determined that the target resource identifier is in the original resource index, access the original resource file through the original resource index.

[0266] Optionally, in some embodiments of the present application, the processor 610 is further configured to, if it is determined that the target resource identifier is not in the target resource index, obtain an updated record file, where the updated record file includes the updated access times of each original resource; and construct a second target resource package with the original resources in the original resource package whose updated access times are greater than the corresponding preset times.

[0267] Optionally, in some embodiments of the present application, the processor 610 is specifically configured to obtain an original resource access request for the target application, where the original resource access request includes an original resource identifier; load the original resource package according to the original resource access request, access the original resource file through the original resource index using the original resource identifier; and record relevant information about accessing the original resource file of the target application to obtain a record file.

[0268] Further, the software system of the terminal device 600 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present application, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the terminal device 600.

[0269] Figure 7 It is the software structure block diagram of the terminal device 600 in the embodiments of the present application.

[0270] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0271] The application layer may include a series of application packages.

[0272] As Figure 7 shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0273] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.

[0274] As Figure 7 shown, the application framework layer may include window manager, content provider, view system, telephone manager, resource manager, notification manager, etc.

[0275] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0276] The content provider is used to store and obtain data, and enable these data to be accessed by applications. The data may include videos, images, audios, dialed and answered calls, browsing history and bookmarks, phone book, etc.

[0277] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a short message notification icon may include a view for displaying text and a view for displaying pictures.

[0278] The telephone manager is used to provide the communication function of the terminal device 600. For example, the management of call status (including connection, disconnection, etc.).

[0279] The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc.

[0280] The notification manager enables applications to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminder, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as the notification of a background running application, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompt text information in the status bar, emit a prompt sound, vibrate the electronic device, blink the indicator light, etc.

[0281] The Android Runtime includes the core libraries and the virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0282] The core libraries consist of two parts: one part is the functional functions that the Java language needs to call, and the other part is the core libraries of Android.

[0283] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0284] The system libraries can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc.

[0285] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.

[0286] The media library supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0287] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.

[0288] The 2D graphics engine is the drawing engine for 2D drawing.

[0289] The kernel layer is the layer between the hardware and the software. The kernel layer contains at least a display driver, a camera driver, an audio driver, and a sensor driver.

[0290] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.

[0291] Among them, the above computer program product may include one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a high-density digital video disc (DVD)), or a semiconductor medium (for example, a solid-state disk (SSD)), etc.

[0292] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0293] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other may be through some interfaces, and the indirect couplings or communication connections of the devices or units may be in an electrical, mechanical, or other form.

[0294] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0295] In addition, in each embodiment of the present application, each functional unit can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0296] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0297] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present application.

Claims

1. A method for constructing an application resource package, characterized in that, The terminal device is installed with a target application program, and the method includes: The terminal device obtains the original resource package of the target application program. The original resource package includes the resources included in the installation package of the target application program. The original resource package includes: an original resource index and original resource files. The original resource index is used to represent the correspondence between the original resource identifier and the original resource file; The terminal device obtains the access times of each original resource in the original resource package. The obtaining of the access times of each original resource in the original resource package includes: the terminal device collects the access times corresponding to each original resource identifier during the process of the user using the target application program in the running stage of the target application program; When the target application program is in an idle state and meets the preset conditions, the terminal device uses the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package. The first target resource package is loaded when a target resource access request for the target application program is obtained. The first target resource package includes: a target resource index and target resource files. The target resource index is used to represent the correspondence between the target resource identifier and the target resource file, and the target resource index is the original resource index of the original resources in the original resource package whose access times are greater than the corresponding preset times; The method further includes: Obtaining a target resource access request for the target application program, where the target resource access request includes a target resource identifier; Loading the first target resource package according to the target resource access request; If it is determined that the target resource identifier is in the target resource index, the target resource file is accessed through the target resource index.

2. The method according to claim 1, wherein The obtaining of the access times of each original resource in the original resource package includes: Obtaining the average access times of each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance; The using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package includes: Using the original resources in the original resource package whose average access times are greater than the corresponding preset times to construct a first target resource package.

3. The method according to claim 1, characterized in that, The obtaining of the access times of each original resource in the original resource package includes: Obtaining a record file for accessing the original resource package, where the record file includes the access times of each original resource in the original resource package.

4. The method according to claim 3, wherein The using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package includes: When the target application program is in an idle state and meets the preset conditions, using the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package; Wherein, the preset conditions include at least one of the following conditions: The record period recorded in the record file is greater than a preset duration; The number of original resources whose access times are greater than the corresponding preset times is lower than a preset threshold.

5. The method according to any one of claims 1-4, characterized in that, Constructing a first target resource package using the original resources in the original resource package whose access times are greater than the corresponding preset times, includes: Generating construction indication information when a preset condition is met; Displaying the construction indication information; Generating a construction request in response to a user's operation on the construction indication information; According to the construction request, constructing a first target resource package using the original resources in the original resource package whose access times are greater than the corresponding preset times.

6. The method according to claim 1, characterized in that, Constructing a first target resource package using the original resources in the original resource package whose access times are greater than the corresponding preset times, includes: Copying the original resource indexes whose access times are greater than the corresponding preset times from the original resource index to obtain the target resource index; Copying the original resource files whose access times are greater than the corresponding preset times from the original resource files to obtain the target resource files; Constructing the first target resource package using the target resource index and the target resource files.

7. The method according to claim 6, characterized in that, Constructing the first target resource package using the target resource index and the target resource files, includes: Compressing the target resource index and the target resource files to obtain a first target resource package.

8. The method according to claim 6 or 7, characterized in that, The method further includes: Saving the first target resource package in the local storage space; Moving the original resource package from the local storage space to the cloud storage space.

9. The method according to claim 1, characterized in that, Constructing a first target resource package using the original resources in the original resource package whose access times are greater than the corresponding preset times, includes: Removing the resource indexes whose access times are less than or equal to the corresponding preset times from the original resource index to obtain the target resource index; Removing the resource files whose access times are less than or equal to the corresponding preset times from the original resource files to obtain the target resource files; Constructing the first target resource package using the target resource index and the target resource files.

10. The method according to claim 9, wherein The method further includes: If it is determined that the target resource identifier is not in the target resource index, loading the original resource package according to the target resource request; If it is determined that the target resource identifier is in the original resource index, accessing the original resource file through the original resource index.

11. The method according to claim 9, characterized in that, The method further includes: If it is determined that the target resource identifier is not in the target resource index, obtaining an updated record file, where the updated record file includes the updated access times of each original resource; Constructing a second target resource package using the original resources in the original resource package whose updated access times are greater than the corresponding preset times.

12. The method according to claim 3 or 4, characterized in that, Obtaining the record file for accessing the original resource package, includes: Obtaining an original resource access request for the target application program, where the original resource access request includes an original resource identifier; Loading the original resource package according to the original resource access request, and accessing the original resource file using the original resource identifier through the original resource index; Recording the relevant information about accessing the original resource file of the target application program to obtain a record file.

13. The method according to claim 1, characterized in that, The method further includes: During the startup phase of the target application, the terminal device loads the original resource package of the target application through the resource manager. The original resource package includes an original resource index and an original resource package file, and constructs a virtual resource index through the original resource index. During the running phase of the target application, the target application requests the original resource file through the interface of the resource manager. The resource manager accesses the original resource file through the virtual resource index according to the requested original resource identification information, and feeds back the accessed original resource to the target application. The resource manager stores the relevant information of accessing the original resource file, including the number of accesses to the original resource file, into the record file through an asynchronous event. During the exit phase of the target application, the resource manager releases the virtual resource index.

14. A construction device, characterized in that, Applied to a terminal device, the terminal device is installed with a target application, and the building device includes: A first module, configured to collect the number of accesses corresponding to each original resource identifier during the process of the user using the target application during the running phase of the target application. An acquisition module, configured to acquire the original resource package of the target application, where the original resource package includes the resources included in the installation package of the target application; acquire the number of accesses to each original resource in the original resource package; the original resource package includes: an original resource index and an original resource file; the original resource index is used to represent the correspondence between the original resource identifier and the original resource file. A processing module, configured to construct a first target resource package with the original resources in the original resource package whose number of accesses is greater than the corresponding preset number when the target application is in an idle state and meets the preset conditions; the first target resource package is loaded when a target resource access request for the target application is acquired. The first target resource package includes: a target resource index and a target resource file; the target resource index is used to represent the correspondence between the target resource identifier and the target resource file, and the target resource index is the original resource index in the original resource index whose number of accesses is greater than the corresponding preset number. The processing module is further configured to acquire a target resource access request for the target application, where the target resource access request includes a target resource identifier; load the first target resource package according to the target resource access request; if it is determined that the target resource identifier is in the target resource index, access the target resource file through the target resource index.

15. A construction device, characterized in that, Applied to a terminal device, the building device includes: One or more processors; A memory; Multiple applications; the multiple applications include a target application; And one or more computer programs, where the one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the building device, the building device is caused to perform the following operations: Obtain the original resource package of the target application, where the original resource package includes the resources included in the installation package of the target application; the original resource package includes: an original resource index and original resource files; the original resource index is used to represent the correspondence between the original resource identifier and the original resource file; Obtain the access times of each original resource in the original resource package; the obtaining of the access times of each original resource in the original resource package includes: collecting the access times corresponding to each original resource identifier during the process of the user using the target application in the running stage of the target application; When the target application is in an idle state and meets the preset conditions, use the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package; the first target resource package is loaded when a target resource access request for the target application is obtained; the first target resource package includes: a target resource index and target resource files; the target resource index is used to represent the correspondence between the target resource identifier and the target resource file, and the target resource index is the original resource index in which the access times are greater than the corresponding preset times; Obtain a target resource access request for the target application, where the target resource access request includes a target resource identifier; Load the first target resource package according to the target resource access request; If it is determined that the target resource identifier is in the target resource index, access the target resource file through the target resource index.

16. The construction device according to claim 15, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Obtain the average access times of each original resource in the original resource package from the historical access data of a plurality of terminal devices obtained in advance; Use the original resources in the original resource package whose average access times are greater than the corresponding preset times to construct a first target resource package.

17. The construction device according to claim 15, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Obtain a record file for accessing the original resource package, where the record file includes the access times of each original resource in the original resource package.

18. The construction device according to claim 17, characterized in that When the instruction is executed by the construction device, the construction device is caused to perform the following operations: When the target application is in an idle state and meets the preset conditions, use the original resources in the original resource package whose access times are greater than the corresponding preset times to construct a first target resource package; Wherein, the preset conditions include at least one of the following conditions: The recording period recorded in the record file is greater than a preset duration; The number of original resources whose access times are greater than the corresponding preset times is lower than a preset threshold.

19. The construction device according to any one of claims 15-18, characterized in that When the instruction is executed by the construction device, the construction device is caused to perform the following operations: When the target application is in an idle state and meets the preset conditions, generate construction indication information; Display the construction indication information; In response to the user's operation on the construction indication information, generate a construction request; Construct a first target resource package using the original resources in the original resource package whose access times are greater than the corresponding preset times according to the construction request.

20. The building device according to claim 15, characterized in that When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Copy the original resource indexes in the original resource index whose access times are greater than the corresponding preset times to obtain the target resource index; Copy the original resource files in the original resource file whose access times are greater than the corresponding preset times to obtain the target resource file; Construct the first target resource package using the target resource index and the target resource file.

21. The construction device according to claim 20, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Compress the target resource index and the target resource file to obtain a first target resource package.

22. The construction device according to claim 20 or 21, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Save the first target resource package in the local storage space; Move the original resource package from the local storage space to the cloud storage space.

23. The construction device according to claim 15, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Remove the resource indexes in the original resource index whose access times are less than or equal to the corresponding preset times to obtain the target resource index; Remove the resource files in the original resource file whose access times are less than or equal to the corresponding preset times to obtain the target resource file; Construct the first target resource package using the target resource index and the target resource file.

24. The construction device according to claim 23, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: If it is determined that the target resource identifier is not in the target resource index, load the original resource package according to the target resource request; If it is determined that the target resource identifier is in the original resource index, access the original resource file through the original resource index.

25. The building device according to claim 24, wherein When the instruction is executed by the construction device, the construction device is caused to perform the following operations: If it is determined that the target resource identifier is not in the target resource index, obtain an updated record file, where the updated record file includes the updated access times of each original resource; Construct a second target resource package using the original resources in the original resource package whose updated access times are greater than the corresponding preset times.

26. The construction device according to claim 17 or 18, characterized in that, When the instruction is executed by the construction device, the construction device is caused to perform the following operations: Obtain an original resource access request for the target application program, where the original resource access request includes an original resource identifier; Load the original resource package according to the original resource access request, and access the original resource file through the original resource index using the original resource identifier; Record the relevant information about accessing the original resource file of the target application program to obtain a record file.

27. The construction device according to claim 15, wherein: The collecting the access times of each original resource during the process of the user using the target application program in the running stage of the target application program includes: In the startup phase of the target application, the original resource package of the target application is loaded through a resource manager. The original resource package includes an original resource index and an original resource package file, and a virtual resource index is constructed through the original resource index. In the running phase of the target application, the target application requests an original resource file through an interface of the resource manager. The resource manager accesses the original resource file through the virtual resource index according to the requested original resource identification information, and feeds back the accessed original resource to the target application. The resource manager stores the original resource identification information requested by the target application and the fed-back original resource file, as well as the relevant information for accessing the original resource file, into a record file through an asynchronous event. The relevant information includes the number of accesses to the original resource file. In the exit phase of the target application, the resource manager releases the virtual resource index.

28. A terminal device, characterized in that, Including: The construction device according to any one of claims 14 or claims 15-27.

29. A computer-readable storage medium, comprising instructions, characterized in that, When the instruction runs on a terminal device, the terminal device is caused to execute the method according to any one of claims 1-13.

30. A computer program product, characterized in that, When the computer program product runs on a terminal device, the terminal device is caused to execute the method according to any one of claims 1-13.

Citation Information

Patent Citations

  • A resource file display method and device

    CN109739812A

  • Application program repeated resource processing method and device

    CN110232051A