WO2021104117A1 - 一种构建应用程序资源包的方法、构建装置及终端设备 - Google Patents

一种构建应用程序资源包的方法、构建装置及终端设备 Download PDF

Info

Publication number
WO2021104117A1
WO2021104117A1 PCT/CN2020/129647 CN2020129647W WO2021104117A1 WO 2021104117 A1 WO2021104117 A1 WO 2021104117A1 CN 2020129647 W CN2020129647 W CN 2020129647W WO 2021104117 A1 WO2021104117 A1 WO 2021104117A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
original
target
original resource
package
Prior art date
Application number
PCT/CN2020/129647
Other languages
English (en)
French (fr)
Inventor
沈日胜
徐承桦
马佳俊
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021104117A1 publication Critical patent/WO2021104117A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Definitions

  • This application relates to the storage field, and in particular to a method, a construction device, a terminal device, a computer-readable storage medium, and a computer program product for constructing an application resource package.
  • an application (application, APP) file of an operating system includes a resource package and code.
  • the resource package usually contains resource files such as multiple languages, multiple layout files (layouts), multiple pictures, configuration information, etc.
  • the resource packages of the APP 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 storage space occupied is very large; and when the application is started, the resource package of the APP needs to be decompressed, and the resource index is read into the memory, and the APP runtime is constructed The structure of the virtual resource index. The time it takes for the application to start this process and the size of the resource index are directly proportional to the number of resources in the APP. The more resources, the slower the decompression, the slower the startup, and the more memory it takes up.
  • the embodiments of the present application provide a method, a construction device, a terminal device, a computer-readable storage medium, and a computer program product for constructing an application resource package, which are used to reduce the storage space occupied by the resource package of a target application, and improve resource decompression, Reading efficiency.
  • the first aspect of the present application provides a method for constructing an application resource package, which may include: obtaining the original resource package of the target application; obtaining the number of visits to each original resource in the original resource package; wherein, obtaining The original resource package of the target application and the time sequence for obtaining the number of accesses to each original resource in the original resource package are not limited; later, the original resource in the original resource package with the number of access times greater than the corresponding preset number can be used again. Build the first target resource package.
  • 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, which can reduce the storage space occupied by the resource package of the target application, improve resource decompression and reading efficiency, and reduce applications
  • the startup time of the application program is reduced; the virtual memory occupied by the application program is reduced; and the smaller resource package is also conducive to system operation.
  • the obtaining of the number of accesses to each original resource in the original resource package may be: obtaining access from the historical access data of multiple terminal devices obtained in advance.
  • using the original resource in the original resource package whose access times are greater than the corresponding preset number to construct the first target resource package may be: using the original resource in the original resource package whose average number of access times is greater than the corresponding preset number to construct the first target resource package The first target resource pack.
  • the preset times corresponding to each original resource may be the same or different, and can be determined based on historical experience values. Among them, the setting of the preset times can also be adjusted according to actual needs.
  • the access times of multiple users corresponding to each original resource of the target application of multiple terminal devices it is possible to obtain the access times of multiple users corresponding to each original resource of the target application of multiple terminal devices, and then calculate the average access times of each original resource accessed; if the average access times are greater than the corresponding predetermined
  • the number of times is set, it can be considered that this original resource is frequently accessed by many users. Therefore, when rebuilding the target resource package, after constructing the original resource into the target resource package, the access needs of most users can be met; at the same time, the volume of the resource package used by the APP is reduced, which can reduce the cost of the target application.
  • the storage space occupied by the resource package improves the efficiency of resource decompression and reading, and reduces the startup time of the application.
  • the obtaining the number of times of access to 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 original resource package. The number of visits to each original resource in the resource pack.
  • the record file includes the number of times the user accesses the original resource of the target application on the terminal device.
  • constructing the first target resource package can satisfy the user's personal access needs by constructing the first target resource package by using the original resource whose access times are greater than the corresponding preset times.
  • the volume of the resource pack used by the APP has been reduced, which can reduce the storage space occupied by the resource pack of the target application, improve the efficiency of resource decompression and reading, and reduce the startup time of the application.
  • constructing the first target resource package with the original resource whose access times are greater than the corresponding preset number of times in the original resource package may include: when the preset condition is satisfied, using The original resource in the original resource package whose access times are greater than the corresponding preset times is used to construct the first target resource package;
  • the preset condition includes at least one of the following conditions:
  • the recording period recorded by the recording file is greater than the preset duration.
  • the recording period of the recording file record is greater than the preset duration, and the specific implementation may include but not limited to the following methods:
  • the time length between the initial time recorded in the recording file and the current time is greater than the first preset time length.
  • the recording time of the record file has been quite a long time (for example, one month, three months, etc.), at this time, use the original resource in the original resource package whose access times are greater than the corresponding preset times to construct the first
  • the probability that the target resource package meets the user's needs is relatively large.
  • Condition 2 The number of original resources whose access times are greater than the corresponding preset times is lower than the preset threshold.
  • Condition 3 The target application is idle.
  • the target application If the target application is in an idle state, reconstruct the target resource package to avoid affecting the normal use of the user and improve the user experience.
  • constructing the first target resource package with the original resource whose access times are greater than the corresponding preset number in the original resource package may include: When the preset conditions are met, the construction instruction information can be generated; then the construction instruction information is displayed; the user can operate on the displayed construction instruction information, and the construction device responds to the user's operation on the construction instruction information to generate a construction request ; Finally, according to the construction request, use the original resource in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package.
  • the user when constructing the first target resource package, the user can also decide whether to rebuild, instead of automatically constructing, it provides an implementation method for triggering the construction of the target resource package, which improves the embodiment of the present application. Diversity and flexibility of program realization.
  • the original resource package includes: an original resource index and an original resource file; the original resource index is used to characterize the correspondence between the original resource identifier and the original resource file; the first target resource The package includes: a target resource index and a target resource file; the target resource index is used to characterize the corresponding relationship between the target resource identifier and the target resource file.
  • an explanation is made of the information included in the original resource package and the target resource package.
  • constructing the first target resource package by using the original resource whose access times are greater than the corresponding preset times in the original resource package may include: copying the access from the original resource index The target resource index is obtained if the number of times is greater than the original resource index corresponding to the preset number; from the original resource file, the original resource file with the number of access times greater than the corresponding preset number is copied to obtain the target resource file; the target resource index and The target resource file is used to construct the first target resource package.
  • an implementation method for constructing the first target resource package is provided, which is to construct the first target resource package by copying the original resource file and the original resource index, which adds to the technical solution of the present application Diversity.
  • 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 pack.
  • the first target resource package is obtained, which can save storage space.
  • the method may further include: saving the first target resource package in a local storage space; and moving the original resource package from the local storage space to a cloud storage space. That is, after the first target resource package is constructed, the terminal device may store the original resource package and the first target resource package in different storage spaces or storage media. Because the first target resource package is stored in the local storage space, it is convenient for users to access, and the original resource package is stored in other storage spaces or storage media, which can save local storage space.
  • constructing the first target resource package with the original resource whose access times are greater than the corresponding preset number of times in the original resource package may include: removing from the original resource index The resource index with the number of accesses less than or equal to the preset number of times is used to obtain the target resource index; from the original resource file, the resource file with the number of accesses less than or equal to the preset number of times is removed to obtain the target resource file; and the target resource is used again Index and the target resource file to construct the first target resource package.
  • an implementation method for constructing the first target resource package is provided. The first target resource package is constructed by removing the original resource file and the original resource index, which adds to the technical solution of the present application Diversity.
  • the method may further include: obtaining target resource access to the target application Request, the target resource access request includes a target resource identifier; then 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 through the target resource index file.
  • the first target resource package can be accessed.
  • 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 the target resource is determined If the identifier is in the original resource index, the original resource file is accessed through the original resource index.
  • 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 Make a visit. Provides a way to implement resource access to ensure the user's access needs.
  • 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, the updated record file including each The number of visits after the original resource is updated; the original resource whose updated number of visits in the original resource package is greater than the corresponding preset number is used to construct a second target resource package.
  • the record file is updated in real time.
  • the terminal device can reconstruct the second target resource package according to the real-time updated record file and the original resource package. In turn, the target resource package can be rebuilt according to the adjustment of user needs.
  • the obtaining a record file of accessing the original resource package may include: obtaining an original resource access request for the target application, where the original value resource access request includes Original resource identifier; then load the original resource package according to the original resource access request, use the original resource identifier to access the original resource file through the original resource index; record relevant information about accessing the original resource file of the target application, and get Log files.
  • the original resource access request related to the original resource in the target application is recorded, thereby obtaining a record file, which can be used to analyze the user's usage habits and usage requirements, so as to construct A target resource package that better meets the needs of users is provided, which provides a guarantee.
  • the second aspect of the embodiments of the present application provides a construction device that has the functions of reducing the storage space occupied by the resource package of the target application and improving the efficiency of resource decompression and reading.
  • This function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the third aspect of the embodiments of the present application provides a terminal device, which has the functions of reducing the storage space occupied by the resource package of the target application and improving the efficiency of resource decompression and reading.
  • This function can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • a fourth aspect of the embodiments of the present application provides a construction device, which may include:
  • One or more processors are One or more processors;
  • 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 construction device, the The construction device executes the method for constructing an application resource package as described in the first aspect and any optional manner of the first aspect of the present application.
  • a fifth aspect of the embodiments of the present application provides a terminal device, which may include:
  • One or more processors are One or more processors;
  • 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 The terminal device executes the method for constructing an application program resource package as described in the first aspect and any optional manner of the first aspect of the present application.
  • a sixth aspect of the embodiments of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, which when run on a computer, cause the computer to execute the methods described in the foregoing aspects.
  • the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • the storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
  • the seventh aspect of the embodiments of the present application provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the method described in the first aspect or any optional implementation manner of the first aspect 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 number of visits to each original resource in the original resource package is obtained; the number of visits in the original resource package is used
  • the first target resource package is constructed for the original resources greater than the corresponding preset number of times. Because 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, which can reduce the storage space occupied by the resource package of the target application, improve resource decompression and reading efficiency, and reduce applications
  • the startup time of the application program is reduced; the virtual memory occupied by the application program is reduced; and the smaller resource package is also conducive to system operation.
  • FIG. 1 is a system architecture diagram of a construction device used in an embodiment of the application
  • FIG. 2 is a schematic diagram of an embodiment of a method for constructing an application resource package in an embodiment of the application
  • Fig. 3A is a schematic diagram of obtaining a record file of access to an original resource package in an embodiment of the application
  • FIG. 3B is a schematic diagram of the user's constructing instruction information in an embodiment of the application.
  • FIG. 3C is a schematic diagram of constructing a target resource package in an embodiment of the application.
  • FIG. 3D is a schematic diagram of resource package tailoring in an embodiment of this application.
  • FIG. 3E is a schematic diagram of obtaining a resource access request of an application program in an embodiment of the application.
  • FIG. 3F is another schematic diagram of obtaining a resource access request of an application program in an embodiment of this application.
  • FIG. 3G is a schematic diagram of a flow of a resource access request in an embodiment of this application.
  • Fig. 4 is a schematic diagram of an embodiment of a construction device in an embodiment of the application.
  • FIG. 5 is a schematic diagram of an embodiment of a terminal device in an embodiment of the application.
  • FIG. 6 is a schematic diagram of another embodiment of a terminal device in an embodiment of this application.
  • Fig. 7 is a software structure block diagram of a terminal device according to an embodiment of the present application.
  • language resource packs of the designated market can be pre-made for the market placed by the terminal, so that the language resources in the APP resource pack can be reduced; or, other types of resource packs (such as attributes, pictures, etc.) can also be used. Prefabrication can reduce other types of resources in the APP resource package.
  • this solution cannot customize the language for personalized users. For example, if a Chinese is abroad and buys a local customized mobile phone, there may not be a Chinese language to choose from; among them, resources such as pictures and layout still need to be fully prefabricated.
  • Bundle feature subcontracting is provided for the terminal, which can also be called Bundle subcontracting; that is, the user downloads various small packages of corresponding features from the application mall, application market, etc. according to their own needs. For example, what kind of small packages are needed and what functions are needed.
  • Bundle requires the application to perform feature decomposition at compile time, and the process is complicated; and most applications on the market still adopt the overall package method, that is, the resources in the feature sub-package are not loaded on demand, and many users will still be loaded. Unneeded resources are stored in the memory; if there is no internet, the sub-packages for different languages and features need to be downloaded online.
  • Bundle is a resource pack in the Unity development platform, which can be almost all resources used in the game. For example, most files such as models, textures, presets, scenes, etc. are updated and can be dynamically loaded at runtime. Bundle can choose to be compressed before network transmission, which can improve transmission efficiency and reduce the size of the package.
  • the construction device may include a resource management module and a resource optimization module.
  • the resource management module is mainly responsible for loading and analyzing resources, and providing resource information for APP. It is used to decompress the resource package of the APP, read it into the 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 resource location information, and feedback the resource information or the resource information to the APP. Resource location information.
  • Resource optimization modules can include but are not limited to: record files (Profile files), decision algorithms, resource reconstruction, resource tailoring and other functional modules, as shown below:
  • the record file is used to save the relevant information of the resource request, including the resource name, configuration, language setting and other information; that is, it is responsible for recording the resource request from the APP to the resource management module and save it in the record file.
  • the decision-making algorithm can determine the resource to be reconstructed based on the number of accesses in the record file and the trend of resource changes.
  • Resource file the object of the resource request. All files from which the required resources can be read can be called "resource files”.
  • the type of resources can be pictures, audios, videos, text resources, or other content that can be displayed on the computer, and so on. It can be read by a special program interface and displayed to the user as needed in the application.
  • Resource index used to characterize the correspondence between the resource identifier of the application and the resource file.
  • Virtual resource index a logical structure constructed in physical memory (ram) for timely access by computer programs.
  • the original resource package of the target application is obtained; the record file of access to the original resource package is obtained, and the record file includes the number of accesses to each original resource; the original resource package whose access number is greater than the corresponding preset number is used.
  • Resources build the first target resource package. Because 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, which can reduce the storage space occupied by the first target resource package of the target application, and improve the efficiency of resource decompression and reading. Reduce the startup time of the application; reduce the virtual memory occupation when the application is running; and a smaller resource package is also conducive to system operation.
  • the method for constructing an application resource package can be applied to a construction device, and the construction device can be applied to a terminal device or a cloud server.
  • the terminal device may include a mobile phone, a tablet computer, a desktop, a laptop, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, and a personal digital assistant (personal digital assistant). , PDA), wearable electronic devices, or smart watches, etc.
  • UMPC ultra-mobile personal computer
  • PDA personal digital assistant
  • wearable electronic devices or smart watches, etc.
  • the embodiments of this application do not impose special restrictions on the specific form of the terminal.
  • FIG. 2 a schematic diagram of an embodiment of a method for constructing an application resource package in an embodiment of this application, which may include:
  • the terminal device obtains the original resource package of the target application.
  • the original resource package may include: an original resource index and an original resource file.
  • the original resource index is used to characterize the correspondence between the original resource identifier and the original resource file.
  • the original resource package of the application program may be pre-stored in the terminal device, or may be a resource package included in an installation package downloaded from an application store.
  • the original resource file here may include resource files such as character strings, multiple languages, multiple layout files (layout), multiple pictures, configuration information, and so on.
  • the target application program may be each application program installed on the terminal device. For example: applications such as maps, calendars, browsers, weather, languages, etc.
  • the original resource package may be a language resource package
  • the original resource file may include resource files such as Chinese, English, French, Japanese, Italian, and Portuguese.
  • the terminal device obtains the number of visits to each original resource in the original resource package, which may include:
  • the terminal device obtains the average number of times of access to each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance.
  • the terminal device constructs the first target resource package by using the original resources whose average access times are greater than the corresponding preset times in the original resource packages. It is understandable that it is possible to obtain the access times of each original resource of the target application of multiple terminal devices corresponding to multiple users, and then calculate the average access times of each original resource accessed; among them, the history of the multiple terminal devices The access data can be obtained from the server or from the multiple terminal devices. If the average number of visits is greater than the corresponding preset number, it can be considered that this original resource is frequently accessed by many users. Therefore, when rebuilding the target resource package, after constructing the original resource into the target resource package, the access needs of most users can be met.
  • the terminal device obtains a record file of accessing the original resource package, and the record file includes the number of times of access to each original resource in the original resource package. It can be understood that the log file includes the number of times the user accesses the original resource of the target application on the terminal device.
  • constructing the first target resource package can satisfy the user's personal access needs by constructing the first target resource package by using the original resource whose access times are greater than the corresponding preset number of times in the original resource package.
  • Obtaining the record file of the original resource package for accessing the target application by the terminal device may include: the terminal device obtaining an original resource access request for the target application, the original resource access request including the original resource identifier; for example, the terminal device may respond The user's resource access operations to the target application (such as touch, slide, click, double-click, press, etc.), or the operation of a preset control (the preset control is a preset control that can access the target application) To generate the original resource access request. The terminal device then loads the original resource package according to the original resource access request, and uses the original resource identifier to access the original resource file through the original resource index. Further, the terminal device may also record relevant information about the original resource file of the access target application to obtain a record file.
  • the terminal device acquiring the record file for accessing the original resource package may include: the terminal device acquiring the original resource access request for the target application, wherein the original resource access request includes the original resource identifier; the terminal device then Load the original resource package according to the original resource access request, use the original resource identifier to access the original resource file through the original resource index; the terminal device records related information about accessing the original resource file of the target application to obtain the record file. It is understandable that the terminal device records the original resource access request related to the original resource in the target application, thereby obtaining a record file, which can be used to analyze the user's usage habits and usage requirements, so as to construct a The target resource package that better meets the needs of users provides a guarantee.
  • the terminal device uses the original resource identifier to access the original resource file through the original resource index, which may be: if the terminal device determines that the original resource identifier is in the original resource index, it may 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.
  • the terminal device can collect resource information such as resources, configuration items, pictures, etc. loaded during the user's use of the target APP, and record it in the record file corresponding to the target APP.
  • resource information such as resources, configuration items, pictures, etc. loaded during the user's use of the target APP
  • the related information of accessing the original resource file of the target application can include the resource package name, version number, path, file type, attribute, resource identifier (such as the real value), and the number of accesses (also known as the number of hits) , Last update time (can be understood as the first access time), last access time, last record file time and other information.
  • FIG. 3A it is a schematic diagram of obtaining a record file of access to an original resource package in an embodiment of this application.
  • the terminal device loads the original resource pack of the target APP from the Rom space (which can be understood as the physical space) through the resource manager, and the original resource pack includes the original resource index and the original resource pack file, and Build a virtual resource index.
  • the original resource package obtained from the Rom space is first decompressed, and then the original resource index and the original resource package file are mapped, read or downloaded, and then the virtual resource index is constructed through the original resource index.
  • APP requests resources through the resource manager interface; the resource manager accesses the original resource file through the virtual resource index according to the requested original resource identification (identity document, ID) information, obtains the accessed original resource, and The original resource accessed is fed back to the target APP; at the same time, the resource manager uses asynchronous events to analyze the original resource ID requested by the target APP and the original resource fed back, and store the relevant information about the original resource file accessed in the record file after parameter analysis. .
  • ID original resource identification
  • the terminal device obtains the record file of the original resource package of the access target application.
  • each application program can have a corresponding record file, and this record file can be updated in real time.
  • the record file of each application program can be stored in the same storage space.
  • the corresponding record file can be found according to the identifier of the target application program.
  • the preset times corresponding to the times of access to each original resource may be determined according to empirical values, and may be the same or different. If the number of visits is more, it means that the original resource is more likely to be accessed by the user, and then the original resource will be included in the reconstructed target resource package; if the number of visits is fewer or not, it means that the original resource is being accessed by the user. The lower the probability of access, the original resource will not be included in the reconstructed target resource package.
  • the original resource package includes the original resource index and the original resource file, and the original resource corresponding to the original resource file can be accessed through the original resource index.
  • the original resource 0XFEADC1 the original resource OX34523S
  • the original resource A the original resource B
  • the original resource C the original resource D
  • the original resource E the original resource E as an example for description.
  • original resource index 1 is original resource 0XFEADC1
  • original resource index 2 is original resource OX34523S
  • original resource index 3 is original resource A
  • original resource index 4 is original resource B
  • original resource index 5 is original resource C
  • original resource index 6 is the original resource D
  • the original resource index 7 is the original resource E.
  • the number of visits (201) of the original resource 0XFEADC1 is less than the first preset number (such as 300), the file of the original resource 0XFEADC1 is not in the reconstructed first target resource package; the number of visits (9) of the original resource OX34523S is less than the second The preset number of times (such as 15), so the original resource OX34523S file is not in the reconstructed first target resource package; the number of accesses (15) of the original resource A is less than the third preset number (such as 30), so the original resource A The file is not in the reconstructed first target resource package; the number of visits (100) of the original resource B is greater than the fourth preset number (such as 80), so the original resource B file is in the reconstructed first target resource package; the original The number of accesses (200) of resource C is less than the fifth preset number (such as 300), so the original resource C file is not in the reconstructed first target resource package; the number of accesses (20) of original resource D
  • the terminal device constructs the first target resource package according to 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, but does not include the original resource A file, the original resource C file, the original resource OXFEADC1 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.
  • the size of the reconstructed target resource package is smaller than the size of the original resource package, it can reduce the storage space occupied by the resource package of the target application, improve the efficiency of resource package decompression and resource reading, and reduce the startup time of the application; reduce the application The virtual memory occupancy when the program is running; and the smaller resource package is also conducive to system operation.
  • the rate of change of the original resource in the record file may tend to 0, indicating that the information related to the original resource of the user's access to the target application has been basically fixed, and the terminal device
  • the target resource package can be reconstructed based on the record file of the target application and the original resource package.
  • the terminal device uses 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: if the preset conditions are met, use the original resource packages whose access times are greater than the corresponding preset times Original resources, construct the first target resource package.
  • the aforementioned preset conditions may include, but are not limited to, the following conditions or a combination of the following conditions:
  • the recording period of the recording file record is greater than the preset duration.
  • the recording cycle is realized as a recording start time and a recording end time, and the recording can also continue without ending.
  • the recording period of the recording file record is greater than the preset duration
  • the specific implementation may include but not limited to the following methods:
  • the time length between the initial time recorded in the recording file and the current time is greater than the first preset time length.
  • the time between the initial time recorded in the record file and the current time is greater than the first preset time period, that is, the time recorded by the recording file has been a considerable period of time (for example, one month, three months, etc.), then use If the number of visits in the original resource package is greater than the corresponding preset number of original resources, the probability that the constructed first target resource package meets the needs of the user is relatively large.
  • the record file may also include: the first access time corresponding to each original resource that has been accessed. That is, the time between the first access time of the latest original resource in the record file and the current time is greater than the second preset time period. It can also be understood as: the minimum time period is greater than the second preset time period, where the minimum time period is the original access time in the record file. The minimum length of time between the initial access time of the resource and the current time. If this condition is met, it can be considered that the original resource accessed by the user during this period of time has been fixed, and no new original resource has been accessed. At this time, the probability of constructing the target resource package to meet the user's needs is high.
  • the first access time of original resource A is recorded in the record file as 2019.9.10
  • the first access time of original resource B is recorded as 2019.10.1
  • the first access time of original resource C is recorded as 2019.10.15, and the current time is 2019.11 .15.
  • the record file it can be known that the latest original resource is original resource C, and the first access time is 2019.10.15. It has been one month since the current time of 2019.11.15. During this month, the user did not access other original resources. , And this month is considered a relatively long time.
  • the change rate of the original resource in the record file has been 0, indicating that the original resource of the user accessing the target application has been basically fixed, and the terminal device can use the number of visits in the original resource package
  • the original resources greater than the corresponding preset number of times are used to construct the first target resource package.
  • Condition 2 The number of original resources whose access times are greater than the corresponding preset times is lower than the preset threshold.
  • the meaning of reconstruction is not very significant. Big. Because the main effect of rebuilding the target resource package is that the size of the rebuilt target resource package is smaller than the size of the original resource package. If the size is similar, the reconstruction will waste system resources and may affect the normal operation of the target application. Therefore, 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 rebuilding the target resource package may be triggered.
  • Condition 3 The target application is idle.
  • the target application If the target application is in an idle state, reconstruct the target resource package to avoid affecting the normal use of the user and improve the user experience. If the target application is in a working state, refactoring the target resource package may affect the normal operation of the target application, thereby affecting the user experience.
  • the idle state can be understood as the unused state of the target application. For example, during the period from 11:00 pm to 7:00 am, when the terminal device is generally idle, the target application is also in an unused state; or, when the application used by the user is not the target application, that is, It can be understood that the target application is in an idle state.
  • constructing the first target resource package with the original resource in the original resource package whose access times are greater than the corresponding preset number may include: the terminal device satisfies the preset condition , Generate construction instruction information; the terminal device displays the construction instruction information; the terminal device responds to the user's operation on the construction instruction information to generate a construction request; the terminal device uses the original resource in the original resource package whose access times are greater than the corresponding preset times according to the construction request, Build the first target resource package.
  • the user can also decide whether to rebuild instead of automatic construction. It provides a way to trigger the construction of the target resource package, which improves the implementation of the solution in the embodiments of this application. Diversity and flexibility.
  • the construction instruction message is "Whether to rebuild the language resource pack", or, "It is found that some functions of your language are not used frequently. Do you want to rebuild the resource pack that does not include the functions that are not frequently used?"
  • the terminal device can prompt the message Displayed on the display interface, in response to the user's construction operation of the prompt message (for example, the user selects the "Yes” button), a construction request is generated. If the user selects the "No” button, the build request is not generated.
  • the preset number of 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, which are not specifically limited in the embodiment of the present application.
  • the preset times corresponding to each original resource can be the same or different, and can be set according to historical experience values.
  • the first target resource package includes: a target resource index and a target resource file, and the target resource index is used to characterize the corresponding relationship between the target resource identifier and the target resource file.
  • the terminal device constructs the first target resource package by using the original resources whose access times are greater than the corresponding preset times in the original resource package, which may include, but is not limited to, the following implementation modes:
  • the terminal device obtains the target resource index from the original resource index by copying the number of access times greater than the original resource index corresponding to the preset number of times; the terminal device copies the original resource file with the number of access times greater than the corresponding preset number from the original resource file to obtain the target resource File; use the target resource index and the target resource file to construct the first target resource package.
  • FIG. 3C it is a schematic diagram of constructing a target resource package in an embodiment of this application.
  • the terminal device registers an event in the package manager service (PMS).
  • the event is an event for constructing the target resource package.
  • the PMS starts a profile thread according to the set trigger condition ,
  • the Profile thread reconstructs a target resource package according to the record file and the original resource package.
  • the target resource package includes the target resource index and the target resource package file.
  • the number of accesses (201) of the original resource 0XFEADC1 is less than the first preset number (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 in.
  • the number of visits (9) of the original resource OX34523S is less than the second preset number (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 in.
  • the number of accesses (15) of the original resource A is less than the third preset number (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 in.
  • the number of visits to the original resource B (100) is greater than the fourth preset number (such as 80), so 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 .
  • the number of visits to the original resource C (200) is less than the fifth preset number (such as 300), so 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 in.
  • the number of visits to the original resource D (20) is greater than the sixth preset number (such as 15), so 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 .
  • the number of accesses (520) of the original resource E is greater than the seventh preset number (such as 400), so 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 .
  • the terminal device constructs the first target resource package according to 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, but does not include the original resource A file, the original resource C file, the original resource OXFEADC1 file, and the original resource OX34523S file.
  • the target resource index and the target resource file may be compressed to obtain the first target resource package.
  • the terminal device can store 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 may store the original resource package and the first target resource package in different storage spaces or storage media.
  • the original resource package may be stored in a storage area that is not frequently accessed.
  • a storage area that is not frequently accessed.
  • the storage space of the terminal device can be saved, the efficiency of resource package decompression, resource reading, and construction of virtual resource index (restable) can be improved, and the startup time of the application can be reduced.
  • the original resource index and the original resource file can also be compressed. If the compression ratio is relatively high, the compressed storage space of the first resource index and the original resource file will be relatively small, thereby saving storage space.
  • the storage space may include memory, network disks, and so on.
  • the original resource package can be compressed and changed in storage location as a backup file.
  • the target can be reconstructed again through the original resource package and the re-refreshed record file Resource pack. Therefore, the terminal device can flexibly reconstruct the target resource package according to the user's access demand, so as to meet the user's demand and improve the user experience.
  • the terminal device From the original resource index, the terminal device removes the resource index whose access count is less than or equal to the corresponding preset count to obtain the target resource index; the terminal device removes the resource file whose access count is less than or equal to the corresponding preset count from the original resource file to obtain Target resource file; use the target resource index and the target resource file to construct the first target resource package.
  • the information of the tailored language resource package may include the original language index of the tailored original language resource package and the original language resource file.
  • the original language resource index can be language tailored, and the language index with the number of visits greater than the corresponding preset number of tailoring can be obtained, which is the target language index.
  • the languages whose visit times are greater than the corresponding preset times are, for example, the user's common language, local language, and general English.
  • the layout, pictures, configuration and other resource files of the reconstructed target language resource package are cut out from the original language resource files according to the condition that the access times are greater than the corresponding preset times to obtain the target language files.
  • the size of the target language resource package is smaller than the size of the original language resource package, the storage space occupied by the language resource package can be reduced, and the efficiency of resource package decompression, resource reading, and construction of virtual resource index (restable) can be improved, and the The start time of the application.
  • the user can access the target application of the terminal device, that is, the terminal device responds to the user's resource access operation of the target application (for example, touch, slide, click, double-click, press, etc.), or to the preset
  • the operation of the control generates a target resource access request.
  • FIG. 3E it is a schematic diagram of obtaining a resource access request of an application program in an embodiment of this application.
  • FIG. 3F another schematic diagram of obtaining a resource access request of an application program in an embodiment of this application.
  • the target resource identifier is in the target resource index, access the target resource file through the target resource index.
  • FIG. 3G it is a schematic flow chart of a resource access request in an embodiment of this application. It is understandable 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 virtual resource The mapping relationship between the table and the target resource index to access the target resource corresponding to the target resource file. Therefore, when the size of the first target resource package is smaller than the size of the original resource package, the corresponding virtual resource table will also be smaller, thereby reducing the virtual memory occupation of the application program when it is running.
  • the terminal device 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 is understandable that if the target resource identifier is not in the target resource index, it can be considered that the target resource file to be accessed corresponding to the target resource identifier is not in the first target resource package, and the original resource package of the target application can be loaded for access . Provides a way to implement resource access.
  • 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 record file of each original resource.
  • Number of visits The terminal device uses the original resource whose updated number of visits in the original resource package is greater than the corresponding preset number to construct a second target resource package. It is understandable that the record file is updated in real time.
  • the terminal device can reconstruct the second target resource package according to the real-time updated record file and the original resource package, and then , The target resource package can be rebuilt according to the adjustment of user needs.
  • the second target resource package may cover the first target resource package.
  • the method of constructing the second target resource package can refer to the previous construction process of the first target resource package, which will not be repeated here.
  • steps 204-206 are optional steps.
  • the original resource package of the target application is obtained; the number of accesses to each original resource in the original resource package is obtained; the original resource with the number of access times greater than the corresponding preset number in the original resource package is used, Build the first target resource package. Because the first target resource package is constructed from 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, and resource decompression, reading, and reading can be improved.
  • FIG. 4 it is a schematic diagram of an embodiment of the construction device in the embodiment of this application, which may include:
  • the obtaining module 401 is configured to obtain the original resource package of the target application; obtain the number of visits to each original resource in the original resource package;
  • the processing module 402 is configured to construct the first target resource package by using the original resources whose access times are greater than the corresponding preset times in the original resource packages.
  • the obtaining module 401 is specifically configured to obtain the average number of visits to each original resource in the original resource package from the historical access data of a plurality of terminal devices obtained in advance;
  • the processing module 402 is specifically configured to construct the first target resource package by using the original resources whose average access times are greater than the corresponding preset times in the original resource packages.
  • the obtaining module 401 is specifically configured to obtain a record file of accessing the original resource package, where the record file includes the number of times of access to each original resource in the original resource package.
  • the processing module 402 is specifically configured to construct the first target resource package by using the original resource in the original resource package whose access times are greater than the corresponding predetermined number of times when a preset condition is met;
  • the preset condition includes at least one of the following conditions:
  • the recording period recorded by the recording 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
  • the target application is in an idle state.
  • the processing module 402 is specifically configured to generate construction instruction information when the preset conditions are met; display the construction instruction information; generate a construction request in response to the user's operation on the construction instruction information; and use the construction request according to the construction request. For the original resources whose access times are greater than the corresponding preset times in the original resource package, the first target resource package is constructed.
  • the original resource package includes: an original resource index and an original resource file; the original resource index is used to characterize 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 characterize the corresponding relationship between the target resource identifier and the target resource file.
  • the processing module 402 is specifically configured to obtain the target resource index from the original resource index with the number of copy access times greater than the corresponding preset number from the original resource index; from the original resource file, the number of copy access times is greater than the corresponding preset number
  • the target resource file is obtained from the original resource file of the number of times; the first target resource package is constructed using the target resource index and the target resource file.
  • the processing module 402 is specifically configured to compress the target resource index and the target resource file to obtain a first target resource package.
  • the processing module 402 is specifically configured to store the first target resource package in a local storage space; move the original resource package from the local storage space to a cloud storage space.
  • the processing module 402 is specifically configured to remove, from the original resource index, the resource index whose access times are less than or equal to the corresponding preset number to obtain the target resource index; from the original resource file, the number of access times is less than or equal to The resource file corresponding to the preset number of times is used to obtain the target resource file; the target resource index and the target resource file are used to construct the first target resource package.
  • the processing module 402 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; If the target resource identifier is in the target resource index, the target resource file is accessed through the target resource index.
  • 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 , The original resource file is accessed through the original resource index.
  • 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; The updated access times in the original resource package are greater than the original resources corresponding to the preset times, and the second target resource package is constructed.
  • the obtaining module 401 is further configured to obtain an original resource access request for the target application, the original resource access request includes an original resource identifier; the original resource package is loaded according to the original resource access request, and the original resource is used.
  • the resource identifier accesses the original resource file through the original resource index; records related information about accessing the original resource file of the target application to obtain a record file.
  • FIG. 5 it is a schematic diagram of an embodiment of a terminal device in an embodiment of this application, and may include the construction device as shown in FIG. 4.
  • 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 , Mobile communication module 650, wireless communication module 660, audio module 670, speaker 670A, receiver 670B, microphone 670C, earphone interface 670D, sensor module 680, buttons 690, motor 691, indicator 692, camera 693, display screen 694, and Subscriber identification module (subscriber identification module, SIM) card interface 695, etc.
  • SIM Subscriber identification module
  • the sensor module 680 may include a pressure sensor 680A, a gyroscope sensor 680B, an air 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, and ambient light Sensor 680L, bone conduction sensor 680M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 600.
  • the terminal device 600 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 610 may include one or more processing units.
  • the processor 610 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), etc.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
  • a memory may also be provided in the processor 610 to store instructions and data.
  • the memory in the processor 610 is a cache memory.
  • the memory can store instructions or data that have just been used or recycled by the processor 610. If the processor 610 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 610 is reduced, and the efficiency of the system is improved.
  • the processor 610 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter/receiver (universal asynchronous) interface.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter/receiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB Universal Serial Bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • the processor 610 may include multiple sets of I2C buses.
  • the processor 610 may be coupled to the touch sensor 680K, charger, flash, camera 693, etc., respectively through different I2C bus interfaces.
  • the processor 610 may couple the touch sensor 680K through an I2C interface, so that the processor 610 and the touch sensor 680K communicate through the I2C bus interface to implement the touch function of the terminal device 600.
  • the I2S interface can be used for audio communication.
  • the processor 610 may include multiple sets of I2S buses.
  • the processor 610 may be coupled with the audio module 670 through an I2S bus to implement communication between the processor 610 and the audio module 670.
  • the audio module 670 may transmit audio signals to the wireless communication module 660 through the I2S interface, so as to realize the function of answering calls through the Bluetooth headset.
  • the PCM interface can also be used for audio communication to sample, quantize and encode analog signals.
  • the audio module 670 and the wireless communication module 660 may be coupled through a PCM bus interface.
  • the audio module 670 may also transmit audio signals to the wireless communication module 660 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • the UART interface is usually used to connect the processor 610 and the wireless communication module 660.
  • the processor 610 communicates with the Bluetooth module in the wireless communication module 660 through the UART interface to implement the Bluetooth function.
  • the audio module 670 may transmit audio signals to the wireless communication module 660 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 610 with the display screen 694, the camera 693 and other peripheral devices.
  • the MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on.
  • the processor 610 and the camera 693 communicate through a CSI interface to implement the shooting function of the terminal device 600.
  • the processor 610 and the display screen 694 communicate through a DSI interface to realize the display function of the terminal device 600.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 610 with the camera 693, the display screen 694, the wireless communication module 660, the audio module 670, the sensor module 680, and so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 630 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on.
  • 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 earphones and play audio through earphones. This interface can also be used to connect to other terminal devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the terminal device 600.
  • the terminal device 600 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the charging management module 640 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 640 may receive the charging input of the wired charger through the USB interface 630.
  • the charging management module 640 may receive the wireless charging input through the wireless charging coil of the terminal device 600. While the charging management module 640 charges the battery 642, it can also supply power to the terminal device through the power management module 641.
  • 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 input 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, and the wireless communication module 660.
  • the power management module 641 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 641 may also be provided in the processor 610.
  • the power management module 641 and the charging management module 640 may also be provided in the same device.
  • the wireless communication function of the terminal device 600 can be implemented by the antenna 1, the antenna 2, the mobile communication module 650, the wireless communication module 660, the modem processor, and the baseband processor.
  • the antenna 1 and the 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 reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 650 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the terminal device 600.
  • the mobile communication module 650 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like.
  • the mobile communication module 650 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 650 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via the antenna 1.
  • at least part of the functional modules of the mobile communication module 650 may be provided in the processor 610.
  • at least part of the functional modules of the mobile communication module 650 and at least part of the modules of the processor 610 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through audio equipment (not limited to the speaker 670A, the receiver 670B, etc.), or displays images or videos through the display screen 694.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 610 and be provided in the same device as the mobile communication module 650 or other functional modules.
  • the wireless communication module 660 can provide applications on the terminal device 600 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 660 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 660 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 610.
  • the wireless communication module 660 may also receive the signal to be sent from the processor 610, perform frequency modulation, amplify, and convert it into electromagnetic waves to radiate through the antenna 2.
  • the antenna 1 of the terminal device 600 is coupled with the mobile communication module 650, and the antenna 2 is coupled with the wireless communication module 660, so that the terminal device 600 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (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 technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation systems
  • the terminal device 600 implements a display function through a GPU, a display screen 694, and an application processor.
  • the GPU is an image processing microprocessor, which connects the display screen 694 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations and is used for graphics rendering.
  • the processor 610 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 694 is used to display images, videos, etc.
  • the display screen 694 includes a display panel.
  • the display panel can adopt liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the terminal device 600 may include one or N display screens 694, and N is a positive integer greater than one.
  • the terminal device 600 can realize a shooting function through an ISP, a camera 693, a video codec, a GPU, a display screen 694, and an application processor.
  • the ISP is used to process the data fed back from the camera 693. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transfers the electrical signal to the ISP for processing and transforms it into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 693.
  • the camera 693 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the terminal device 600 may include 1 or N cameras 693, and N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the terminal device 600 selects the frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the terminal device 600 may 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, and so on.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, and so on.
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • applications such as intelligent cognition of the terminal device 600 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
  • the external memory interface 620 may be used to connect an external memory card, such as a Micro SD card, so as 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 realize the data storage function. For example, save music, video and other files in an external memory card.
  • the internal memory 621 may be used to store computer executable program code, where the executable program code includes instructions.
  • the internal memory 621 may include a program storage area and a data storage area.
  • the storage program area can store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required by at least one function, and the like.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the terminal device 600.
  • the internal memory 621 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the processor 610 executes various functional applications and data processing of the terminal device 600 by running instructions stored in the internal memory 621 and/or instructions stored in a memory provided in the processor.
  • the terminal device 600 can implement audio functions through an audio module 670, a speaker 670A, a receiver 670B, a microphone 670C, a headphone interface 670D, and an application processor. For example, music playback, recording, etc.
  • 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 to encode and decode audio signals.
  • the audio module 670 may be provided in the processor 610, or part of the functional modules of the audio module 670 may be provided in the processor 610.
  • the speaker 670A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the terminal device 600 can listen to music through the speaker 670A, or listen to a hands-free call.
  • the receiver 670B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the terminal device 600 answers a call or voice message, it can receive the voice by bringing the receiver 670B close to the human ear.
  • Microphone 670C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 670C through the human mouth, and input the sound signal into the microphone 670C.
  • the terminal device 600 may be provided with at least one microphone 670C. In other embodiments, the terminal device 600 may be provided with two microphones 670C, which can implement noise reduction functions in addition to collecting sound signals. In other embodiments, the terminal device 600 may also be provided with three, four or more microphones 670C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 670D is used to connect wired earphones.
  • the earphone interface 670D may be a USB interface 630, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association
  • the pressure sensor 680A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 680A may be provided on the display screen 694.
  • the capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force is applied to the pressure sensor 680A, the capacitance between the electrodes changes. The terminal device 600 determines the strength 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 intensity of the touch operation according to the pressure sensor 680A.
  • the terminal device 600 may also calculate the touched position according to the detection signal of the pressure sensor 680A.
  • touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example: when a touch operation whose intensity is less than the first pressure threshold is applied to 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.
  • the gyro sensor 680B may be used to determine the motion posture of the terminal device 600.
  • the angular velocity of the terminal device 600 around three axes ie, x, y, and z axes
  • the gyro sensor 680B can be used for image stabilization.
  • the gyro sensor 680B detects the shake angle of the terminal device 600, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the terminal device 600 through reverse movement to achieve anti-shake.
  • the gyroscope sensor 680B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 680C is used to measure air pressure.
  • the terminal device 600 uses the air pressure value measured by the air pressure sensor 680C to calculate the altitude to assist positioning and navigation.
  • the magnetic sensor 680D includes a Hall sensor.
  • the terminal device 600 may use the magnetic sensor 680D to detect the opening and closing of the flip holster.
  • the terminal device 600 when the terminal device 600 is a flip machine, the terminal device 600 can detect the opening and closing of the flip according to the magnetic sensor 680D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 680E can detect the magnitude of the acceleration of the terminal device 600 in various 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 is used in applications such as horizontal and vertical screen switching, and pedometer.
  • the terminal device 600 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the terminal device 600 may use the distance sensor 680F to measure the distance to achieve fast focusing.
  • 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 to the outside through the light emitting diode.
  • the terminal device 600 uses a photodiode to detect 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 to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 680G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
  • the ambient light sensor 680L is used to sense the brightness of the ambient light.
  • the terminal device 600 can adaptively adjust the brightness of the display screen 694 according to the perceived brightness of the ambient light.
  • 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.
  • the fingerprint sensor 680H is used to collect fingerprints.
  • the terminal device 600 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
  • the temperature sensor 680J is used to detect temperature.
  • 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 a threshold value, the terminal device 600 executes to reduce the performance of the processor located near the temperature sensor 680J, so as to reduce power consumption and implement thermal protection.
  • the terminal device 600 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 due to low temperature.
  • the terminal device 600 boosts the output voltage of the battery 642 to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 680K is also called “touch device”.
  • the touch sensor 680K can be arranged on the display screen 694, and the touch screen is composed of the touch sensor 680K and the display screen 694, which is also called a “touch screen”.
  • the touch sensor 680K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 694.
  • the touch sensor 680K may also be disposed on the surface of the terminal device 600, which is different from the position of the display screen 694.
  • the bone conduction sensor 680M can acquire vibration signals.
  • the bone conduction sensor 680M can obtain the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 680M can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 680M may also be provided in the earphone, combined with the bone conduction earphone.
  • the audio module 670 can parse out the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 680M to realize the voice function.
  • the application processor may analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 680M, and realize the heart rate detection function.
  • the button 690 includes a power button, a volume button, and so on.
  • the button 690 may be a mechanical button. It can also be a touch button.
  • the terminal device 600 may receive key input, and generate key signal input related to user settings and function control of the terminal device 600.
  • the motor 691 can generate vibration prompts.
  • the motor 691 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations applied to different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 694, the motor 691 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 692 can be an indicator light, which can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 695 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 695 or pulled out from the SIM card interface 695 to achieve contact and separation with the terminal device 600.
  • the terminal device 600 may support 1 or N SIM card interfaces, and N is a positive integer greater than 1.
  • the SIM card interface 695 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 695 can insert multiple cards at the same time. 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 call and data communication.
  • the terminal device 600 adopts 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.
  • the processor 610 is further configured to obtain the original resource package of the target application; obtain the number of accesses to each original resource in the original resource package; use the number of accesses in the original resource package to be greater than the corresponding The original resources of the preset number of times are used to construct the first target resource package.
  • the processor 610 is specifically configured to obtain the average number of times of access to each original resource in the original resource package from the historical access data of multiple terminal devices obtained in advance. ; Use the original resource in the original resource package whose average number of access times is greater than the corresponding preset number of times to construct the first target resource package.
  • the processor 610 is specifically configured to obtain a record file for accessing the original resource package, where the record file includes the number of times each original resource in the original resource package is accessed.
  • the processor 610 is specifically configured to 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 pack;
  • the preset condition includes at least one of the following conditions:
  • the recording period recorded by the recording 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
  • the target application is in an idle state.
  • the processor 610 is specifically configured to generate construction instruction information when a preset condition is met; display the construction instruction information; and respond to the user's response to the construction instruction information Operate to generate a construction request; according to the construction request, use the original resource in the original resource package whose access times are greater than the corresponding preset times to construct the first target resource package.
  • the original resource package includes: the original resource index and the original resource file; the original resource index is used to characterize 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 characterize the corresponding relationship between the target resource identifier and the target resource file.
  • the processor 610 is specifically configured to obtain the target resource index from the original resource index whose number of copy access times is greater than the corresponding preset number of times; In the original resource file, copy the original resource file whose access times are greater than the corresponding preset times to obtain the target resource file; use the target resource index and the target resource file to construct the first target resource package.
  • the processor 610 is specifically configured to compress the target resource index and the target resource file to obtain the first target resource package.
  • the processor 610 is specifically configured to store the first target resource package in a local storage space; move the original resource package from the local storage space to cloud storage space.
  • the processor 610 is specifically configured to remove, from the original resource index, a resource index whose access times are less than or equal to a corresponding preset number to obtain the target resource index; In the original resource file, the resource files whose access times are less than or equal to the corresponding preset times are removed to obtain the target resource file; the target resource index and the target resource file are used to construct the first target resource package.
  • 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; according to the target resource access Request to load the first target resource package; 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.
  • 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; If it is determined that the target resource identifier is in the original resource index, the original resource file is accessed through the original resource index.
  • 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, and the updated record The file includes the updated access times of each original resource; the original resource with the updated access times greater than the corresponding preset times in the original resource package is used to construct a second target resource package.
  • 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; according to the original resource The access request loads the original resource package, uses the original resource identifier to access the original resource file through the original resource index; records related information about accessing the original resource file of the target application to obtain a record file.
  • the software system of the terminal device 600 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the terminal device 600 by way of example.
  • FIG. 7 is a software structure block diagram of a terminal device 600 according to an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer can include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • the data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the terminal device 600. For example, the management of the call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, and so on.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and application framework layer run in a 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 life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the above-mentioned computer program product may include one or more computer instructions.
  • the processes or functions according to the embodiments of the present application are generated in whole or in part.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • computer instructions may be transmitted from a website, computer, server, or data center through a cable (such as Coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server or data center.
  • 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 integrated with one or more available media.
  • the usable medium can be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a high-density digital video disc (digital video disc, DVD)), or a semiconductor medium (for example, a solid state disk (SSD)) )Wait.
  • a magnetic medium for example, a floppy disk, a hard disk, and a magnetic tape
  • an optical medium for example, a high-density digital video disc (digital video disc, DVD)
  • a semiconductor medium for example, a solid state disk (SSD)
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • 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 they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the 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.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种构建应用程序资源包的方法、构建装置、终端设备、计算机可读存储介质以及计算机程序产品,用于减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率。本申请实施例方法包括:获取目标应用程序的原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。

Description

一种构建应用程序资源包的方法、构建装置及终端设备
本申请要求在2019年11月25日提交中国国家知识产权局、申请号为201911167399.1的中国专利申请的优先权,发明名称为“一种构建应用程序资源包的方法、构建装置及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及存储领域,尤其涉及一种构建应用程序资源包的方法、构建装置、终端设备、计算机可读存储介质以及计算机程序产品。
背景技术
常见的终端中,操作系统的应用程序(application,APP)文件包括资源包和代码。其中,资源包通常包含多种语言、多种布局文件(layout)、多种图片、配置信息等资源文件,为了方便国际化,通常APP的资源包会打包不同国家语言的资源文件。这样会出现如下问题:APP的资源包比较大,所以占用的存储空间非常大;而且应用程序在启动时,需要解压APP的资源包,并且将资源索引读取到内存,并构建出APP运行时的虚拟资源索引结构。应用程序在启动这个过程的耗时以及资源索引的大小都与APP的资源数成正比。资源越多,解压越慢,启动越慢,同时,占用的内存也越多。
发明内容
本申请实施例提供了一种构建应用程序资源包的方法、构建装置、终端设备、计算机可读存储介质以及计算机程序产品,用于减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率。
有鉴于此,本申请第一方面提供一种构建应用程序资源包的方法,可以包括:获取目标应用程序的原始资源包;获取访问该原始资源包中每个原始资源的访问次数;其中,获取目标应用程序的原始资源包,与获取访问该原始资源包中每个原始资源的访问次数的时序不做限定;之后可以再用该原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包。因为第一目标资源包是通过原始资源包构建的,即APP使用的资源包体积得到了减少,从而可以减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率,减少应用程序的启动时间;减少应用程序运行时的虚拟内存占用;而且更小的资源包,也利于系统操作。
可选的,在本申请的一些实施例中,其中,该获取访问该原始资源包中每个原始资源的访问次数,可以是:从预先获取的多个终端设备的历史访问数据中,获取访问该原始资源包中每个原始资源的平均访问次数;可以理解的是,该多个终端设备的历史访问数据可以是从服务器获取的,也可以是从这多个终端设备中获取的。其中,用该原始资源包中访问次数大于对应预设次数的原始资源,来构 建第一目标资源包,可以是:用该原始资源包中平均访问次数大于对应预设次数的原始资源,来构建第一目标资源包。每个原始资源对应的预设次数可能一样,也可能不一样,可根据历史经验值来定,其中,预设次数的设置也可以根据实际需求来进行调整。
在本申请实施例中,可以获取多个用户对应访问多个终端设备的目标应用程序的各个原始资源的访问次数,再计算访问的每个原始资源的平均访问次数;如果平均访问次数大于对应预设次数时,可以认为这个原始资源被很多用户经常访问。所以,在重新构建目标资源包的时候,将该原始资源构建到目标资源包后,可以满足大部分用户的访问需求;同时,APP使用的资源包体积得到了减少,从而可以减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率,减少应用程序的启动时间。
可选的,在本申请的一些实施例中,该获取访问该原始资源包中每个原始资源的访问次数,可以包括:获取访问该原始资源包的记录文件,该记录文件中可以包括该原始资源包中每个原始资源的访问次数。
在本申请实施例中,记录文件包括用户访问该终端设备上目标应用程序的原始资源的访问次数。此时,通过原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包,可以满足该用户的个人访问需求。同时,APP使用的资源包体积得到了减少,从而可以减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率,减少应用程序的启动时间。
可选的,在本申请的一些实施例中,用该原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:在满足预设条件的情况下,用该原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包;
其中,该预设条件包括以下条件中的至少一个:
条件1:该记录文件记录的记录周期大于预设时长。其中,记录文件记录的记录周期大于预设时长,具体的实现可以包括但不限于以下的方式:
(1)记录文件记录的初始时间距离当前时间的时长大于第一预设时长。
可以理解的是,当记录文件记录的初始时间距离当前时间的时长如果太短,那么,重新构建的第一目标资源包可靠性太低,可能不能满足用户的实际需求。所以,如果记录文件记录的时间已经是相当长一段时间了(例如一个月、三个月等),这时,再用原始资源包中访问次数大于对应预设次数的原始资源,构建的第一目标资源包满足用户需求的概率就比较大。
(2)所述记录文件中最新原始资源的初次访问时间距离当前时间的时长大于第二预设时长。
需要说明的是,如果满足这个条件,可以认为,用户在这段时间访问的原始资源已经固定,没有访问新的原始资源,此时构建目标资源包满足用户需求的概率很大。
条件2:该访问次数大于对应预设次数的原始资源的数量低于预置阈值。
可以理解的是,如果记录文件中记录的访问次数大于对应预设次数的原始资源的数量,有很多,几乎和该目标应用程序的原始资源的总个数相同,那么重新构建的意义就不是很大了。所以,这里也可以将访问次数大于对应预设次数的原始资源的数量低于预置阈值时,可以触发重新构建目标资源包的步骤。
条件3:该目标应用程序处于空闲状态。
如果目标应用程序处于空闲状态时,进行目标资源包的重构,避免影响用户的正常使用,提高用户体验。
可选的,在本申请的一些实施例中,该在满足预设条件的情况下,用该原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:在满足预设条件的情况下,可以生成构建指示信息;然后再显示该构建指示信息;用户可以对显示的构建指示信息进行操作,构建装置再响应用户对该构建指示信息的操作,生成构建请求;最后根据该构建请求,用该原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包。在本申请实施例中,在构建第一目标资源包时,也可以由用户来决定是否重新构建,而不是自动构建,提供了一种触发构建目标资源包的实现方式,提高了本申请实施例方案实现的多样性和灵活性。
可选的,在本申请的一些实施例中,该原始资源包包括:原始资源索引和原始资源文件;该原始资源索引用于表征原始资源标识和原始资源文件的对应关系;该第一目标资源包包括:目标资源索引和目标资源文件;该目标资源索引用于表征目标资源标识和目标资源文件的对应关系。在本申请实施例中,对原始资源包和目标资源包包括的信息做了一个说明。
可选的,在本申请的一些实施例中,该用该原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:从该原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到该目标资源索引;从该原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到该目标资源文件;再用该目标资源索引和该目标资源文件,来构建该第一目标资源包。在本申请实施例中,提供了一种构建第一目标资源包的实现方式,是通过复制原始资源文件和原始资源索引的方式,来构建第一目标资源包的,增加了本申请技术方案的多样性。
可选的,在本申请的一些实施例中,该用该目标资源索引和该目标资源文件,构建该第一目标资源包,可以包括:将该目标资源索引和该目标资源文件进行压缩,得到第一目标资源包。在本申请实施例中,将目标资源索引和目标资源文件进行压缩后,得到第一目标资源包,可以节约存储空间。
可选的,在本申请的一些实施例中,该方法还可以包括:将该第一目标资源包保存在本地存储空间;将该原始资源包从该本地存储空间移动到云端存储空间。即当第一目标资源包构建好之后,终端设备可以将原始资源包与第一目标资源包保存在不同的存储空间或者存储介质中。因为第一目标资源包保存在本地存储空间,可以方便用户的访问,将原始资源包保存在其他存储空间或者存储介质中, 可以节约本地存储空间。
可选的,在本申请的一些实施例中,该用该原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:从该原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到该目标资源索引;从该原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到该目标资源文件;再用该目标资源索引和该目标资源文件,来构建该第一目标资源包。在本申请实施例中,提供了一种构建第一目标资源包的实现方式,是通过移除原始资源文件和原始资源索引的方式,来构建第一目标资源包的,增加了本申请技术方案的多样性。
可选的,在本申请的一些实施例中,该用该目标资源索引和该目标资源文件,构建该第一目标资源包之后,该方法还可以包括:获取对该目标应用程序的目标资源访问请求,该目标资源访问请求包括目标资源标识;再根据该目标资源访问请求加载该第一目标资源包;若确定该目标资源标识在该目标资源索引中,则通过该目标资源索引访问该目标资源文件。在本申请实施例中,当第一目标资源包构建好之后,可以对第一目标资源包进行访问。
可选的,在本申请的一些实施例中,该方法还可以包括:若确定该目标资源标识未在该目标资源索引中,则根据该目标资源请求加载该原始资源包;若确定该目标资源标识在该原始资源索引中,则通过该原始资源索引访问该原始资源文件。在本申请实施例中,如果目标资源标识未在目标资源索引中,则可以认为该目标资源标识对应待访问的目标资源文件不在第一目标资源包中,可以加载该目标应用程序的原始资源包进行访问。提供了一种资源访问的实现方式,保证了用户的访问需求。
可选的,在本申请的一些实施例中,该方法还可以包括:若确定该目标资源标识未在该目标资源索引中,则获取更新后的记录文件,该更新后的记录文件包括每个原始资源更新后的访问次数;用该原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建第二目标资源包。在本申请实施例中,记录文件是实时更新的,当目标APP访问的目标资源不在第一目标资源包中时,终端设备可以根据实时更新的记录文件和原始资源包重构第二目标资源包,进而,可以根据用户需求的调整,来重新构建目标资源包。
可选的,在本申请的一些实施例中,该获取访问该原始资源包的记录文件,可以包括:获取对该目标应用程序的原始资源访问请求,其中,该原值资源访问请求中包括有原始资源标识;再根据该原始资源访问请求加载该原始资源包,使用该原始资源标识通过原始资源索引访问该原始资源文件;将关于访问该目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。在本申请实施例中,是对访问目标应用程序中的原始资源的原始资源访问请求的相关进行记录,从而得到记录文件,该记录文件可用于分析用户的使用习惯和使用需求,从而,为构建出更满足用户需求的目标资源包,提供了保证。
本申请实施例第二方面提供一种构建装置,具有减少目标应用程序的资源包 占用的存储空间,提升资源解压、读取效率的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。
本申请实施例第三方面提供一种终端设备,具有减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。
本申请实施例第四方面提供一种构建装置,可以包括:
一个或多个处理器;
存储器;
多个应用程序;
以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令;当所述指令被所述构建装置执行时,使得所述构建装置执行如本申请第一方面及第一方面任一可选方式中所述的构建应用程序资源包的方法。
本申请实施例第五方面提供一种终端设备,可以包括:
一个或多个处理器;
存储器;
多个应用程序;
以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令;当所述指令被所述终端设备执行时,使得所述终端设备执行如本申请第一方面及第一方面任一可选方式中所述的构建应用程序资源包的方法。
本申请实施例第六方面提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述各方面所述的方法。需要说明的是,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产口的形式体现出来,该计算机软件产品存储在一个存储介质中,用于储存为上述构建装置或者终端设备所用的计算机软件指令,其包含用于执行上述第一方面为构建装置或者终端设备所设计的程序。
该存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
本申请实施例第七方面提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如本申请第一方面或第一方面任一可选实现方式所述的方法。
从以上技术方案可以看出,本申请实施例具有以下优点:
在本申请实施例中,获取目标应用程序的原始资源包;获取目标应用程序的 原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。因为第一目标资源包是通过原始资源包构建的,即APP使用的资源包体积得到了减少,从而可以减少目标应用程序的资源包占用的存储空间,提升资源解压、读取效率,减少应用程序的启动时间;减少应用程序运行时的虚拟内存占用;而且更小的资源包,也利于系统操作。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例和现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,还可以根据这些附图获得其它的附图。
图1为本申请实施例中所应用的构建装置的系统架构图;
图2为本申请实施例中构建应用程序资源包的方法的一个实施例示意图;
图3A为本申请实施例中获取访问原始资源包的记录文件的一个示意图;
图3B为本申请实施例中用户对构建指示信息的一个示意图;
图3C为本申请实施例中构建目标资源包的一个示意图;
图3D为本申请实施例中资源包剪裁的一个示意图;
图3E为本申请实施例中获取应用程序的资源访问请求的一个示意图;
图3F为本申请实施例中获取应用程序的资源访问请求的另一个示意图;
图3G为本申请实施例中资源访问请求的一个流程示意图;
图4为本申请实施例中构建装置的一个实施例示意图;
图5为本申请实施例中终端设备的一个实施例示意图;
图6为本申请实施例中终端设备的另一个实施例示意图;
图7是本申请实施例的终端设备的软件结构框图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,都应当属于本申请保护的范围。
在一种实现方式中,可以为终端所投放的市场预制指定市场的语言资源包,这样可以缩减APP资源包中的语言资源;或者,也可以对其他类型(例如属性、图片等)的资源包进行预制,这样可以缩减APP资源包中的其他类型资源。但是该方案无法针对个性化用户定制语言,例如一个中国人在国外,在当地买了一个当地的定制手机,那么可能没有中文语言可以选择;其中,图片、layout等资源依然需要全预制。
在另一种实现方式中,通过Bundle,为终端提供特性分包,也可以称为Bundle分包;即用户根据自身需求,从应用商城、应用市场等下载对应特性的 各种小包。比如需要哪种、哪些功能的小包等。但是,Bundle需要应用程序在编译时进行特性分解,过程复杂;而且市场上大部分的应用程序依然采用整体包的方式,即特性分包中的资源也不是按需加载的,依然会加载很多用户不需要的资源到内存中;如果在无网的情况下,针对不同语言和特性的分包需要联网进行下载。
其中,Bundle是Unity开发平台中的一种资源包,这种资源包可以是游戏内要用到的几乎所有资源。例如:模型、纹理、预设、场景等大部分文件更新,并且可以在运行时动态加载。Bundle可以选择压缩后再进行网络传输,能提升传输效率,减少包体大小等。
如图1所示,为本申请实施例所应用的构建装置的系统架构图。在图1所示中,构建装置可以包括资源管理模块和资源优化模块。
其中,资源管理模块,主要负责资源的加载、解析,以及为APP提供资源信息。用于将APP的资源包解压,读取到内存、生成资源索引;当APP请求一种资源时,资源管理模块将查询资源索引,找到资源信息或者资源位置信息,向APP反馈该资源信息或者该资源位置信息。
资源优化模块可以包括但不限于:记录文件(Profile文件)、决策算法、资源重构、资源剪裁等功能模块,如下所示:
a)记录文件,用于保存资源请求的相关信息,包括资源名称、配置、语言设置等信息;即负责记录APP到资源管理模块的资源请求,并保存到记录文件中。
b)决策算法,主要根据记录文件的变化趋势决策何时可以进行资源包重构;根据记录文件的内容,决策哪些资源需要重构到目标资源包中,或者,哪些资源需要从原始资源包中剪裁。例如,决策算法可以根据记录文件中的访问数量和资源的变化趋势,确定重构的资源。
c)资源重构,根据记录文件的内容和决策算法,生成目标资源包。
d)资源复制或剪裁,根据记录文件的内容和决策算法,复制或剪裁原资源包中构建到目标资源包中的内容,并完成资源包替换。
下面对本申请实施例中所涉及的一些术语做一个简单的说明:
资源文件:资源请求的客体。所有可以从中读取出需要的资源的文件,可以称之为“资源文件”。资源的类型可以是图片、音频、视频、文字资源,或者其他可以在计算机中展示的内容等等。可以由专门的程序接口去读取,并在应用程序中根据需要向用户展示。
资源索引:用于表征应用程序的资源标识与资源文件的对应关系。
虚拟资源索引:是在物理内存中(ram),构建出来的用于计算机程序及时访问的逻辑结构。
在本申请实施例中,获取目标应用程序的原始资源包;获取访问原始资源包的记录文件,记录文件包括每个原始资源的访问次数;用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。因为第一目标资源包是通过原始资源包构建的,即APP使用的资源包体积得到了减少,从而可以减少目标 应用程序的第一目标资源包占用的存储空间,提升资源解压、读取效率,减少应用程序的启动时间;减少应用程序运行时的虚拟内存占用;而且更小的资源包,也利于系统操作。
需要说明的是,本申请实施例提供的构建应用程序资源包的方法,可以应用于构建装置,该构建装置又可以应用于终端设备或者云端服务器。示例性的,该终端设备可以包括手机、平板电脑、桌面型、膝上型、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、手持计算机、上网本、个人数字助理(personal digital assistant,PDA)、可穿戴电子设备、或智能手表等设备,本申请实施例对终端的具体形式不做特殊限制。
下面以实施例的方式,对本申请技术方案做进一步的说明,其中,构建装置以终端设备为例进行说明。如图2所示,为本申请实施例中构建应用程序资源包的方法的一个实施例示意图,可以包括:
201、获取目标应用程序的原始资源包。
在本申请实施例中,终端设备获取目标应用程序的原始资源包,该原始资源包可以包括:原始资源索引和原始资源文件,原始资源索引用于表征原始资源标识和原始资源文件的对应关系。其中,可以理解的是,应用程序的原始资源包可以是预存在终端设备中,也可以是在应用商店下载的安装包中包括的资源包。这里的原始资源文件可以包括字符串、多种语言、多种布局文件(layout)、多种图片、配置信息等资源文件。目标应用程序可以为终端设备上安装的各个应用程序。例如:地图、日历、浏览器、天气、语言等应用程序。
示例性的,原始资源包可以为语言资源包,原始资源文件可以包括中文、英文、法文、日语、意大利文、葡萄牙文等资源文件。
202、获取访问所述原始资源包中每个原始资源的访问次数。
终端设备获取访问原始资源包中每个原始资源的访问次数,可以包括:
(1)终端设备从预先获取的多个终端设备的历史访问数据中,获取访问原始资源包中每个原始资源的平均访问次数。
进一步的,终端设备用原始资源包中平均访问次数大于对应预设次数的原始资源,构建第一目标资源包。可以理解的是,可以获取多个用户对应访问多个终端设备的目标应用程序的各个原始资源的访问次数,再计算访问的每个原始资源的平均访问次数;其中,该多个终端设备的历史访问数据可以是从服务器获取的,也可以是从这多个终端设备中获取的。如果平均访问次数大于对应预设次数时,可以认为这个原始资源被很多用户经常访问。所以,在重新构建目标资源包的时候,将该原始资源构建到目标资源包后,可以满足大部分用户的访问需求。
(2)终端设备获取访问原始资源包的记录文件,记录文件包括原始资源包中每个原始资源的访问次数。可以理解的是,记录文件包括用户访问该终端设备上目标应用程序的原始资源的访问次数。此时,通过原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包,可以满足该用户的个人访问需求。
终端设备获取访问目标应用程序的原始资源包的记录文件,可以包括:终端设备获取对目标应用程序的原始资源访问请求,该原始资源访问请求包括原始资源标识;示例性的,可以是终端设备响应用户对目标应用程序的资源访问操作(例如触摸、滑动、点击、双击、按压等操作),或者,对预设控件的操作(该预设控件是预先设置好的可以访问目标应用程序的控件),生成原始资源访问请求。终端设备再根据原始资源访问请求加载原始资源包,使用原始资源标识通过原始资源索引访问原始资源文件。进一步的,终端设备还可以将关于访问目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。
其中,该终端设备获取访问该原始资源包的记录文件,可以包括:终端设备获取对该目标应用程序的原始资源访问请求,其中,该原值资源访问请求中包括有原始资源标识;终端设备再根据该原始资源访问请求加载该原始资源包,使用该原始资源标识通过原始资源索引访问该原始资源文件;终端设备将关于访问该目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。可以理解的是,终端设备对访问目标应用程序中的原始资源的原始资源访问请求的相关进行记录,从而得到记录文件,该记录文件可用于分析用户的使用习惯和使用需求,从而,为构建出更满足用户需求的目标资源包,提供了保证。
其中,终端设备使用原始资源标识通过原始资源索引访问原始资源文件,可以是:若终端设备确定该原始资源标识在原始资源索引中,则可以使用原始资源标识,通过原始资源索引访问原始资源文件。即终端设备根据原始资源访问请求中包括的原始资源标识,通过原始资源索引访问原始资源文件,从而得到原始资源。
需要说明的是,终端设备可以收集用户使用目标APP的过程中加载过的资源、配置项、图片等资源信息,记录到该目标APP对应的记录文件中。可以理解的是,访问目标应用程序的原始资源文件的相关信息可以包括资源包名称、版本号、路径、文件类型、属性、资源标识(如真实值)、访问次数(也可以称为命中次数)、上次更新时间(可以理解为初次访问时间)、上次访问时间、上次记录文件时间等信息。
示例性的,如图3A所示,为本申请实施例中获取访问原始资源包的记录文件的一个示意图。在图3A所示中,在启动阶段:终端设备通过资源管理器从Rom空间(可以理解为物理空间)加载目标APP的原始资源包,该原始资源包包括原始资源索引和原始资源包文件,并构建虚拟资源索引。其中,在构建虚拟资源索引的时候,先对从Rom空间获取的原始资源包进行解压,然后进行映射、读取或者下载原始资源索引和原始资源包文件,再通过原始资源索引构建虚拟资源索引。在运行阶段:APP通过资源管理器的接口,请求资源;资源管理器根据请求的原始资源标识(identity document,ID)信息,通过虚拟资源索引访问原始资源文件,获取到访问的原始资源,并将访问到的原始资源反馈给目标APP;同时,资源管理器通过异步事件,将目标APP请求的原始资源ID和反馈的原始资源,经过参数解析,将访问原始资源文件的相关信息存储到记录文件中。在结束阶段: 资源管理器释放虚拟资源索引。
如下表1所示,为终端设备获取访问目标应用程序的原始资源包的记录文件。
Figure PCTCN2020129647-appb-000001
表1
可以理解的是,每个应用程序都可以有对应的记录文件,这个记录文件可以是实时更新的。每个应用程序的记录文件可以保存在相同的存储空间,当调用某一个应用程序的记录文件时,可以根据该目标应用程序的标识,来查找对应的记录文件。
203、用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可以理解的是,每个原始资源的访问次数对应的预设次数可以根据经验值来确定的,可以相同,也可以不同。如果访问次数越多,意味着这个原始资源被用户访问的概率越大,那么在重新构建的目标资源包中就会包括这个原始资源;如果访问次数越少或者没有,意味着这个原始资源被用户访问的概率越小,那么在重新构建的目标资源包中就不会包括这个原始资源。
示例性的,如下述表2所示,原始资源包中包括原始资源索引和原始资源文 件,可以通过原始资源索引访问到原始资源文件对应的原始资源。以原始资源包中可以访问原始资源0XFEADC1、原始资源OX34523S、原始资源A、原始资源B、原始资源C、原始资源D和原始资源E为例进行说明。
原始资源索引 原始资源文件
原始资源索引1 原始资源0XFEADC1文件
原始资源索引2 原始资源OX34523S文件
原始资源索引3 原始资源A文件
原始资源索引4 原始资源B文件
原始资源索引5 原始资源C文件
原始资源索引6 原始资源D文件
原始资源索引7 原始资源E文件
表2
结合上述表2所示,以原始资源索引包括原始资源标识为例进行说明。例如:原始资源索引1为原始资源0XFEADC1,原始资源索引2为原始资源OX34523S,原始资源索引3为原始资源A,原始资源索引4为原始资源B,原始资源索引5为原始资源C,原始资源索引6为原始资源D,原始资源索引7为原始资源E。
因为原始资源0XFEADC1的访问次数(201)小于第一预设次数(如300),所以,原始资源0XFEADC1文件不在重构的第一目标资源包中;原始资源OX34523S的访问次数(9)小于第二预设次数(如15),所以,原始资源OX34523S文件不在重构的第一目标资源包中;原始资源A的访问次数(15)小于第三预设次数(如30),所以,原始资源A文件不在重构的第一目标资源包中;原始资源B的访问次数(100)大于第四预设次数(如80),所以,原始资源B文件在重构的第一目标资源包中;原始资源C的访问次数(200)小于第五预设次数(如300),所以,原始资源C文件不在重构的第一目标资源包中;原始资源D的访问次数(20)大于第六预设次数(如15),所以,原始资源D文件在重构的第一目标资源包中;原始资源E的访问次数(520)大于第七预设次数(如400),所以,原始资源E文件在重构的第一目标资源包中。
终端设备根据原始资源B文件、原始资源D文件和原始资源E文件,构建第一目标资源包。即第一目标资源包中包括原始资源B文件、原始资源D文件和原始资源E文件,不包括原始资源A文件、原始资源C文件、原始资源0XFEADC1文件和原始资源OX34523S文件。即终端设备可以根据用户的访问需求,重新构建目标资源包。因为重新构建的目标资源包的大小小于原始资源包的大小,所以,可以减少目标应用程序的资源包占用的存储空间,提升资源包解压、资源读取效率,减少应用程序的启动时间;减少应用程序运行时的虚拟内存占用;而且更小的资源包,也利于系统操作。
需要说明的是,随着用户访问终端设备的目标应用程序的原始资源,记录文件中原始资源的变化率可能趋向于0,表示用户访问目标应用程序的原始资源的 相关信息已经基本固定,终端设备可以根据目标应用程序的记录文件和原始资源包重新构建目标资源包。
终端设备用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:在满足预设条件的情况下,用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
其中,上述的预设条件可以包括但不限于以下条件或以下条件的组合:
条件1:记录文件记录的记录周期大于预设时长。记录周期实现为记录开始时间和记录结束时间,记录也可以不结束一直持续。
其中,记录文件记录的记录周期大于预设时长,具体的实现可以包括但不限于以下的方式:
(1)记录文件记录的初始时间距离当前时间的时长大于第一预设时长。
可以理解的是,当记录文件记录的初始时间距离当前时间的时长如果太短,那么,重新构建的第一目标资源包可靠性太低,可能不能满足用户的实际需求。所以,如果记录文件记录的初始时间距离当前时间的时长大于第一预设时长,即记录文件记录的时间已经是相当长一段时间了(例如一个月、三个月等),这时,再用原始资源包中访问次数大于对应预设次数的原始资源,构建的第一目标资源包满足用户需求的概率就比较大。
(2)所述记录文件中最新原始资源的初次访问时间距离当前时间的时长大于第二预设时长。
需要说明的是,记录文件中还可以包括:已访问的每个原始资源对应的初次访问时间。即记录文件中最新原始资源的初次访问时间距离当前时间的时长大于第二预设时长,也可以理解为:最小时长大于第二预设时长,其中,最小时长为记录文件中各个已访问的原始资源的初次访问时间距离当前时间的最小时长。如果满足这个条件,可以认为,用户在这段时间访问的原始资源已经固定,没有访问新的原始资源,此时构建目标资源包满足用户需求的概率很大。
示例性的,记录文件中记录原始资源A的初次访问时间为2019.9.10,记录原始资源B的初次访问时间为2019.10.1,记录原始资源C的初次访问时间为2019.10.15,当前时间为2019.11.15。根据该记录文件,可以得知,最新原始资源为原始资源C,初次访问时间为2019.10.15,距离当前时间2019.11.15已经一个月了,在这一个月内,用户也没访问其他的原始资源,而且这一个月的时间也算比较长的时间了。即随着用户访问终端设备的目标应用程序的原始资源,记录文件中原始资源的变化率已经为0,表示用户访问目标应用程序的原始资源已经基本固定,终端设备可以用原始资源包中访问次数大于对应预设次数的原始资源,来构建第一目标资源包。
条件2:访问次数大于对应预设次数的原始资源的数量低于预置阈值。
可以理解的是,如果记录文件中记录的访问次数大于对应预设次数的原始资源的数量,有很多,几乎和该目标应用程序的原始资源的总个数相同,那么重新构建的意义就不是很大了。因为重新构建目标资源包的主要作用在于,重新构建 的目标资源包的大小小于原始资源包的大小,如果差不多大小的话,重新构建反而会浪费系统资源,也可能会影响目标应用程序的正常运行。所以,这里也可以将访问次数大于对应预设次数的原始资源的数量低于预置阈值时,可以触发重新构建目标资源包的步骤。
条件3:目标应用程序处于空闲状态。
如果目标应用程序处于空闲状态时,进行目标资源包的重构,避免影响用户的正常使用,提高用户体验。如果目标应用程序处于工作状态的话,进行目标资源包的重构,可能会影响目标应用程序的正常运行,进而影响用户的体验。
需要说明的是,空闲状态可以理解为目标应用程序未被使用的状态。例如,在晚上11:00-早晨7:00这段时间,一般终端设备处于空闲状态,那么目标应用程序也处于未被使用的状态;或者,用户在使用的应用程序不是目标应用程序时,即可以理解为目标应用程序处于空闲状态。
进一步的,终端设备在满足预设条件的情况下,用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括:终端设备在满足预设条件的情况下,生成构建指示信息;终端设备显示构建指示信息;终端设备响应用户对构建指示信息的操作,生成构建请求;终端设备根据构建请求,用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可以理解的是,在构建第一目标资源包时,也可以由用户来决定是否重新构建,而不是自动构建,提供了一种触发构建目标资源包的实现方式,提高了本申请实施例方案实现的多样性和灵活性。
如图3B所示,为本申请实施例中用户对构建指示信息的一个示意图。例如,该构建指示信息为“是否重新构建语言资源包”,或者,“发现您的语言有些功能未经常使用,是否重新构建不包括未经常使用功能的资源包?”终端设备可以将该提示信息在显示界面显示,响应用户对提示信息的构建操作(例如,用户选择“是”按钮),生成构建请求。如果用户选择“否”按钮,则生成的是不进行构建请求。
可以理解的是,预设次数、第一预设时长、第二预设时长、预置阈值等都可以根据用户的实际需求进行调整,本申请实施例中不做具体限定。其中,每个原始资源对应的预设次数可以相同,也可以不同,可根据历史经验值进行设定。
其中,第一目标资源包包括:目标资源索引和目标资源文件,目标资源索引用于表征目标资源标识和目标资源文件的对应关系。终端设备用原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,可以包括但不限于以下的实现方式:
实现方式一:
终端设备从原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到目标资源索引;终端设备从原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到目标资源文件;用目标资源索引和目标资源文件,构建第一目标资源包。
示例性的,如图3C所示,为本申请实施例中构建目标资源包的一个示意图。终端设备在包管理服务(package manager service,PMS)中注册事件,该事件为构建目标资源包的事件,通过设置好构建目标资源包事件的触发条件;PMS根据设置的触发条件,启动一个Profile线程,Profile线程根据记录文件和原始资源包,重新构建出一个目标资源包,该目标资源包包括目标资源索引和目标资源包文件。
示例性的,结合上述表2所示:
原始资源0XFEADC1的访问次数(201)小于第一预设次数(如300),所以,终端设备不拷贝原始资源索引1和原始资源0XFEADC1文件;即原始资源0XFEADC1文件不在重构的第一目标资源包中。
原始资源OX34523S的访问次数(9)小于第二预设次数(如15),所以,终端设备不拷贝原始资源索引2和原始资源OX34523S文件;即原始资源OX34523S文件不在重构的第一目标资源包中。
原始资源A的访问次数(15)小于第三预设次数(如30),所以,终端设备不拷贝原始资源索引3和原始资源A文件;即原始资源A文件不在重构的第一目标资源包中。
原始资源B的访问次数(100)大于第四预设次数(如80),所以,终端设备拷贝原始资源索引4和原始资源B文件;即原始资源B文件在重构的第一目标资源包中。
原始资源C的访问次数(200)小于第五预设次数(如300),所以,终端设备不拷贝原始资源索引5和原始资源C文件;即原始资源C文件不在重构的第一目标资源包中。
原始资源D的访问次数(20)大于第六预设次数(如15),所以,终端设备拷贝原始资源索引6和原始资源D文件;即原始资源D文件在重构的第一目标资源包中。
原始资源E的访问次数(520)大于第七预设次数(如400),所以,终端设备拷贝原始资源索引7和原始资源E文件;即原始资源E文件在重构的第一目标资源包中。
终端设备根据原始资源B文件、原始资源D文件和原始资源E文件,构建第一目标资源包。即第一目标资源包中包括原始资源B文件、原始资源D文件和原始资源E文件,不包括原始资源A文件、原始资源C文件、原始资源0XFEADC1文件和原始资源OX34523S文件。
如下述表3所示,为终端设备构建的目标资源包的一个示意说明:
原始资源索引 原始资源文件
原始资源索引4 原始资源B文件
原始资源索引6 原始资源D文件
原始资源索引7 原始资源E文件
表3
可选的,终端设备用目标资源索引和目标资源文件,构建第一目标资源包时,可以将目标资源索引和目标资源文件进行压缩,得到第一目标资源包。
可以理解的是,终端设备可以将第一目标资源包保存在本地存储空间;终端设备将原始资源包可以从本地存储空间移动到云端存储空间。即当第一目标资源包构建好之后,终端设备可以将原始资源包与第一目标资源包保存在不同的存储空间或者存储介质中。
示例性的,可以将原始资源包保存在不常被访问的存储区域。例如:云端存储空间、硬盘、慢存储空间等。当原始资源包存储在云端的存储空间时,可以节省终端设备的存储空间,提升资源包解压、资源读取、构造虚拟资源索引(restable)的效率,减少应用程序的启动时间。
也可以将原始资源索引和原始资源文件进行压缩,如果压缩比例比较高的话,压缩后的第一资源索引和原始资源文件的占用存储空间就会相对小一些,进而节省存储空间。其中,存储空间可以包括内存、网络磁盘等。
即原始资源包可以通过压缩和存储位置变更,作为备份文件,当目标APP请求访问的资源不在第一目标资源包中时,可以再通过原始资源包和重新刷新后的记录文件,再次重构目标资源包。所以,终端设备可以根据用户的访问需求,灵活的重构目标资源包,从而满足用户需求,提高用户体验。
实现方式二:
终端设备从原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到目标资源索引;终端设备从原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到目标资源文件;用目标资源索引和目标资源文件,构建第一目标资源包。
示例性的,如图3D所示,为本申请实施例中资源包剪裁的一个示意图。其中,剪裁语言资源包的信息,可以包括裁剪原始语言资源包的原始语言索引和原始语言资源文件。a)可以按照访问次数大于对应预设次数的语言资源的条件,对原始语言资源索引进行语言剪裁,剪裁得到访问次数大于对应预设次数的语言索引,即为目标语言索引。其中,访问次数大于对应预设次数的语言例如:用户常用语言、当地语言和通用英语等。b)将重构目标语言资源包的layout、图片、配置等资源文件,按照访问次数大于对应预设次数的语言资源的条件,从原始语言资源文件剪裁出来,得到目标语言文件。
经过这几个流程,将存在两个语言资源包,一个是裁剪后的原始语言资源索引和原始语言资源文件,可以删除,也可以压缩保存;一个是裁剪得到的目标语言资源索引和目标语言资源文件,通过目标语言资源索引和目标语言资源文件得到目标语言资源包,终端设备将优先使用目标语言资源包。
可以理解的是,因为目标语言资源包的大小小于原始语言资源包的大小,可以减少语言资源包占用的存储空间,提升资源包解压、资源读取、构造虚拟资源索引(restable)的效率,减少应用程序的启动时间。
204、获取对目标应用程序的目标资源访问请求,目标资源访问请求包括目 标资源标识。
可以理解的是,用户可以对终端设备的目标应用程序进行访问,即终端设备响应用户对目标应用程序的资源访问操作(例如触摸、滑动、点击、双击、按压等操作),或者,对预设控件的操作,生成目标资源访问请求。如图3E所示,为本申请实施例中获取应用程序的资源访问请求的一个示意图。如图3F所示,为本申请实施例中获取应用程序的资源访问请求的另一个示意图。
205、根据第一目标资源访问请求加载访问第一目标资源包。
206、若确定目标资源标识在目标资源索引中,则通过目标资源索引访问目标资源文件。
如图3G所示,为本申请实施例中资源访问请求的一个流程示意图。可以理解的是,终端设备在加载保存在内存中的目标资源包后,若确定目标资源标识在目标资源索引中,通过目标资源索引将目标资源文件映射在虚拟资源表中,即可以通过虚拟资源表和目标资源索引的映射关系,访问目标资源文件对应的目标资源。所以,当第一目标资源包的大小小于原始资源包的大小时,对应的虚拟资源表也会比较小,从而减少应用程序在运行时的虚拟内存占用。
可选的,在本申请的一些实施例中,若终端设备确定目标资源标识未在目标资源索引中,则终端设备根据目标资源请求加载原始资源包;若终端设备确定目标资源标识在原始资源索引中,则终端设备通过原始资源索引访问原始资源文件。可以理解的是,如果目标资源标识未在目标资源索引中,则可以认为该目标资源标识对应待访问的目标资源文件不在第一目标资源包中,可以加载该目标应用程序的原始资源包进行访问。提供了一种资源访问的实现方式。
可选的,在本申请的一些实施例中,若终端设备确定目标资源标识未在目标资源索引中,则终端设备获取更新后的记录文件,更新后的记录文件包括每个原始资源更新后的访问次数;终端设备用原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建第二目标资源包。可以理解的是,记录文件是实时更新的,当目标APP访问的目标资源不在第一目标资源包中时,终端设备可以根据实时更新的记录文件和原始资源包重构第二目标资源包,进而,可以根据用户需求的调整,来重新构建目标资源包。可选的,第二目标资源包可以将第一目标资源包覆盖。其中,构建第二目标资源包的方式可以参考前面对第一目标资源包的构建过程,此处不再赘述。
需要说明的是,在本申请实施例中,步骤204-206为可选的步骤。
在本申请实施例中,获取目标应用程序的原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。因为第一目标资源包是通过原始资源包构建的,即目标APP使用的资源包体积得到了减少;从而可以减少目标应用程序的第一目标资源包占用的存储空间,提升资源解压、读取、构造虚拟资源索引(restable)效率,减少应用程序的启动时间;减少应用程序运行时的虚拟内存占用;而且更小的资源包,也利于系统操作(如文件内存页操作);可选的,通 过原资源包的剪裁、压缩等方式,也可以缩小总资源包占用体积。
如图4所示,为本申请实施例中构建装置的一个实施例示意图,可以包括:
获取模块401,用于获取目标应用程序的原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;
处理模块402,用于用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,
获取模块401,具体用于从预先获取的多个终端设备的历史访问数据中,获取访问所述原始资源包中每个原始资源的平均访问次数;
处理模块402,具体用于用所述原始资源包中平均访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,
获取模块401,具体用于获取访问所述原始资源包的记录文件,所述记录文件包括所述原始资源包中每个原始资源的访问次数。
可选的,在本申请的一些实施例中,
处理模块402,具体用于在满足预设条件的情况下,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包;
其中,所述预设条件包括以下条件中的至少一个:
所述记录文件记录的记录周期大于预设时长;
所述访问次数大于对应预设次数的原始资源的数量低于预置阈值;
所述目标应用程序处于空闲状态。
可选的,在本申请的一些实施例中,
处理模块402,具体用于在满足预设条件的情况下,生成构建指示信息;显示所述构建指示信息;响应用户对所述构建指示信息的操作,生成构建请求;根据所述构建请求,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,
原始资源包包括:原始资源索引和原始资源文件;所述原始资源索引用于表征原始资源标识和原始资源文件的对应关系;
第一目标资源包包括:目标资源索引和目标资源文件;所述目标资源索引用于表征目标资源标识和目标资源文件的对应关系。
可选的,在本申请的一些实施例中,
处理模块402,具体用于从所述原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到所述目标资源索引;从所述原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到所述目标资源文件;用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
可选的,在本申请的一些实施例中,
处理模块402,具体用于将所述目标资源索引和所述目标资源文件进行压缩, 得到第一目标资源包。
可选的,在本申请的一些实施例中,
处理模块402,具体用于将所述第一目标资源包保存在本地存储空间;将所述原始资源包从所述本地存储空间移动到云端存储空间。
可选的,在本申请的一些实施例中,
处理模块402,具体用于从所述原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到所述目标资源索引;从所述原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到所述目标资源文件;用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
可选的,在本申请的一些实施例中,
处理模块402,还用于获取对所述目标应用程序的目标资源访问请求,所述目标资源访问请求包括目标资源标识;根据所述目标资源访问请求加载所述第一目标资源包;若确定所述目标资源标识在所述目标资源索引中,则通过所述目标资源索引访问所述目标资源文件。
可选的,在本申请的一些实施例中,
处理模块402,还用于若确定所述目标资源标识未在所述目标资源索引中,则根据所述目标资源请求加载所述原始资源包;若确定所述目标资源标识在所述原始资源索引中,则通过所述原始资源索引访问所述原始资源文件。
可选的,在本申请的一些实施例中,
处理模块402,还用于若确定所述目标资源标识未在所述目标资源索引中,则获取更新后的记录文件,所述更新后的记录文件包括每个原始资源更新后的访问次数;用所述原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建第二目标资源包。
可选的,在本申请的一些实施例中,
获取模块401,还用于获取对所述目标应用程序的原始资源访问请求,所述原值资源访问请求包括原始资源标识;根据所述原始资源访问请求加载所述原始资源包,使用所述原始资源标识通过原始资源索引访问所述原始资源文件;将关于访问所述目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。
如图5所示,为本申请实施例中终端设备的一个实施例示意图,可以包括如图4所示的构建装置。
如图6所示,为本申请实施例中终端设备的另一个实施例示意图。终端设备600可以包括处理器610,外部存储器接口620,内部存储器621,通用串行总线(universal serial bus,USB)接口630,充电管理模块640,电源管理模块641,电池642,天线1,天线2,移动通信模块650,无线通信模块660,音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接口670D,传感器模块680,按键690,马达691,指示器692,摄像头693,显示屏694,以及用户标识模块(subscriber identification module,SIM)卡接口695等。其中传感器模块680可以包括压力传感器680A,陀螺仪传感器680B,气压传感器680C, 磁传感器680D,加速度传感器680E,距离传感器680F,接近光传感器680G,指纹传感器680H,温度传感器680J,触摸传感器680K,环境光传感器680L,骨传导传感器680M等。
可以理解的是,本申请实施例示意的结构并不构成对终端设备600的具体限定。在本申请另一些实施例中,终端设备600可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器610可以包括一个或多个处理单元,例如:处理器610可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器610中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器610中的存储器为高速缓冲存储器。该存储器可以保存处理器610刚用过或循环使用的指令或数据。如果处理器610需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器610的等待时间,因而提高了系统的效率。
在一些实施例中,处理器610可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器610可以包含多组I2C总线。处理器610可以通过不同的I2C总线接口分别耦合触摸传感器680K,充电器,闪光灯,摄像头693等。例如:处理器610可以通过I2C接口耦合触摸传感器680K,使处理器610与触摸传感器680K通过I2C总线接口通信,实现终端设备600的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器610可以包含多组I2S总线。处理器610可以通过I2S总线与音频模块670耦合,实现处理器610与音频模块670之间的通信。在一些实施例中,音频模块670可以通过I2S接口向无 线通信模块660传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块670与无线通信模块660可以通过PCM总线接口耦合。在一些实施例中,音频模块670也可以通过PCM接口向无线通信模块660传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器610与无线通信模块660。例如:处理器610通过UART接口与无线通信模块660中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块670可以通过UART接口向无线通信模块660传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器610与显示屏694,摄像头693等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器610和摄像头693通过CSI接口通信,实现终端设备600的拍摄功能。处理器610和显示屏694通过DSI接口通信,实现终端设备600的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器610与摄像头693,显示屏694,无线通信模块660,音频模块670,传感器模块680等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口630是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口630可以用于连接充电器为终端设备600充电,也可以用于终端设备600与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他终端设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端设备600的结构限定。在本申请另一些实施例中,终端设备600也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块640用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块640可以通过USB接口630接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块640可以通过终端设备600的无线充电线圈接收无线充电输入。充电管理模块640为电池642充电的同时,还可以通过电源管理模块641为终端设备供电。
电源管理模块641用于连接电池642,充电管理模块640与处理器610。电源管理模块641接收电池642和/或充电管理模块640的输入,为处理器610,内部存储器621,显示屏694,摄像头693,和无线通信模块660等供电。电源 管理模块641还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块641也可以设置于处理器610中。在另一些实施例中,电源管理模块641和充电管理模块640也可以设置于同一个器件中。
终端设备600的无线通信功能可以通过天线1,天线2,移动通信模块650,无线通信模块660,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。终端设备600中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块650可以提供应用在终端设备600上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块650可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块650可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块650还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块650的至少部分功能模块可以被设置于处理器610中。在一些实施例中,移动通信模块650的至少部分功能模块可以与处理器610的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器670A,受话器670B等)输出声音信号,或通过显示屏694显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器610,与移动通信模块650或其他功能模块设置在同一个器件中。
无线通信模块660可以提供应用在终端设备600上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块660可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块660经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器610。无线通信模块660还可以从处理器610接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,终端设备600的天线1和移动通信模块650耦合,天线2和无线通信模块660耦合,使得终端设备600可以通过无线通信技术与网络以及 其他设备通信。所述无线通信技术可以包括全球移动通讯系统(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,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
终端设备600通过GPU,显示屏694,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏694和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器610可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏694用于显示图像,视频等。显示屏694包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,终端设备600可以包括1个或N个显示屏694,N为大于1的正整数。
终端设备600可以通过ISP,摄像头693,视频编解码器,GPU,显示屏694以及应用处理器等实现拍摄功能。
ISP用于处理摄像头693反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头693中。
摄像头693用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,终端设备600可以包括1个或N个摄像头693,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当终端设备600在频点选择时,数字信号处理器用于对 频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。终端设备600可以支持一种或多种视频编解码器。这样,终端设备600可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现终端设备600的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口620可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端设备600的存储能力。外部存储卡通过外部存储器接口620与处理器610通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器621可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器621可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储终端设备600使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器621可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器610通过运行存储在内部存储器621的指令,和/或存储在设置于处理器中的存储器的指令,执行终端设备600的各种功能应用以及数据处理。
终端设备600可以通过音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接口670D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块670用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块670还可以用于对音频信号编码和解码。在一些实施例中,音频模块670可以设置于处理器610中,或将音频模块670的部分功能模块设置于处理器610中。
扬声器670A,也称“喇叭”,用于将音频电信号转换为声音信号。终端设备600可以通过扬声器670A收听音乐,或收听免提通话。
受话器670B,也称“听筒”,用于将音频电信号转换成声音信号。当终端设备600接听电话或语音信息时,可以通过将受话器670B靠近人耳接听语音。
麦克风670C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风670C发声,将声音信号输入到麦克风670C。终端设备600可以设置至少一个麦克风670C。在另一些实施例中,终端设备600可以设置两个麦克风670C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,终端设备600还可以设置三个,四个或更多麦克风670C,实现采集声音信号,降噪,还可以识别声音来源,实现定 向录音功能等。
耳机接口670D用于连接有线耳机。耳机接口670D可以是USB接口630,也可以是3.5mm的开放移动终端设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器680A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器680A可以设置于显示屏694。压力传感器680A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器680A,电极之间的电容改变。终端设备600根据电容的变化确定压力的强度。当有触摸操作作用于显示屏694,终端设备600根据压力传感器680A检测所述触摸操作强度。终端设备600也可以根据压力传感器680A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器680B可以用于确定终端设备600的运动姿态。在一些实施例中,可以通过陀螺仪传感器680B确定终端设备600围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器680B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器680B检测终端设备600抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消终端设备600的抖动,实现防抖。陀螺仪传感器680B还可以用于导航,体感游戏场景。
气压传感器680C用于测量气压。在一些实施例中,终端设备600通过气压传感器680C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器680D包括霍尔传感器。终端设备600可以利用磁传感器680D检测翻盖皮套的开合。在一些实施例中,当终端设备600是翻盖机时,终端设备600可以根据磁传感器680D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器680E可检测终端设备600在各个方向上(一般为三轴)加速度的大小。当终端设备600静止时可检测出重力的大小及方向。还可以用于识别终端设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器680F,用于测量距离。终端设备600可以通过红外或激光测量距离。在一些实施例中,拍摄场景,终端设备600可以利用距离传感器680F测距以实现快速对焦。
接近光传感器680G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。终端设备600通过发光二极管向外发射红外光。终端设备600使用光电二极管检测来自附近物体的红外反射光。当 检测到充分的反射光时,可以确定终端设备600附近有物体。当检测到不充分的反射光时,终端设备600可以确定终端设备600附近没有物体。终端设备600可以利用接近光传感器680G检测用户手持终端设备600贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器680G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器680L用于感知环境光亮度。终端设备600可以根据感知的环境光亮度自适应调节显示屏694亮度。环境光传感器680L也可用于拍照时自动调节白平衡。环境光传感器680L还可以与接近光传感器680G配合,检测终端设备600是否在口袋里,以防误触。
指纹传感器680H用于采集指纹。终端设备600可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器680J用于检测温度。在一些实施例中,终端设备600利用温度传感器680J检测的温度,执行温度处理策略。例如,当温度传感器680J上报的温度超过阈值,终端设备600执行降低位于温度传感器680J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,终端设备600对电池642加热,以避免低温导致终端设备600异常关机。在其他一些实施例中,当温度低于又一阈值时,终端设备600对电池642的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器680K,也称“触控器件”。触摸传感器680K可以设置于显示屏694,由触摸传感器680K与显示屏694组成触摸屏,也称“触控屏”。触摸传感器680K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏694提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器680K也可以设置于终端设备600的表面,与显示屏694所处的位置不同。
骨传导传感器680M可以获取振动信号。在一些实施例中,骨传导传感器680M可以获取人体声部振动骨块的振动信号。骨传导传感器680M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器680M也可以设置于耳机中,结合成骨传导耳机。音频模块670可以基于所述骨传导传感器680M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器680M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键690包括开机键,音量键等。按键690可以是机械按键。也可以是触摸式按键。终端设备600可以接收按键输入,产生与终端设备600的用户设置以及功能控制有关的键信号输入。
马达691可以产生振动提示。马达691可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏694不同区域的触摸操作,马达691也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信 息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器692可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口695用于连接SIM卡。SIM卡可以通过插入SIM卡接口695,或从SIM卡接口695拔出,实现和终端设备600的接触和分离。终端设备600可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口695可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口695可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口695也可以兼容不同类型的SIM卡。SIM卡接口695也可以兼容外部存储卡。终端设备600通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,终端设备600采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在终端设备600中,不能和终端设备600分离。
在本申请实施例中,处理器610,还用于获取目标应用程序的原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,处理器610,具体用于从预先获取的多个终端设备的历史访问数据中,获取访问所述原始资源包中每个原始资源的平均访问次数;用所述原始资源包中平均访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,处理器610,具体用于获取访问所述原始资源包的记录文件,所述记录文件包括所述原始资源包中每个原始资源的访问次数。
可选的,在本申请的一些实施例中,处理器610,具体用于在满足预设条件的情况下,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包;
其中,所述预设条件包括以下条件中的至少一个:
所述记录文件记录的记录周期大于预设时长;
所述访问次数大于对应预设次数的原始资源的数量低于预置阈值;
所述目标应用程序处于空闲状态。
可选的,在本申请的一些实施例中,处理器610,具体用于在满足预设条件的情况下,生成构建指示信息;显示所述构建指示信息;响应用户对所述构建指示信息的操作,生成构建请求;根据所述构建请求,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
可选的,在本申请的一些实施例中,
原始资源包包括:原始资源索引和原始资源文件;原始资源索引用于表征原始资源标识和原始资源文件的对应关系;
第一目标资源包包括:目标资源索引和目标资源文件;目标资源索引用于表征目标资源标识和目标资源文件的对应关系。
可选的,在本申请的一些实施例中,处理器610,具体用于从所述原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到所述目标资源索引;从所述原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到所述目标资源文件;用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
可选的,在本申请的一些实施例中,处理器610,具体用于将所述目标资源索引和所述目标资源文件进行压缩,得到第一目标资源包。
可选的,在本申请的一些实施例中,处理器610,具体用于将所述第一目标资源包保存在本地存储空间;将所述原始资源包从所述本地存储空间移动到云端存储空间。
可选的,在本申请的一些实施例中,处理器610,具体用于从所述原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到所述目标资源索引;从所述原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到所述目标资源文件;用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
可选的,在本申请的一些实施例中,处理器610,还用于获取对所述目标应用程序的目标资源访问请求,所述目标资源访问请求包括目标资源标识;根据所述目标资源访问请求加载所述第一目标资源包;若确定所述目标资源标识在所述目标资源索引中,则通过所述目标资源索引访问所述目标资源文件。
可选的,在本申请的一些实施例中,处理器610,还用于若确定所述目标资源标识未在所述目标资源索引中,则根据所述目标资源请求加载所述原始资源包;若确定所述目标资源标识在所述原始资源索引中,则通过所述原始资源索引访问所述原始资源文件。
可选的,在本申请的一些实施例中,处理器610,还用于若确定所述目标资源标识未在所述目标资源索引中,则获取更新后的记录文件,所述更新后的记录文件包括每个原始资源更新后的访问次数;用所述原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建第二目标资源包。
可选的,在本申请的一些实施例中,处理器610,具体用于获取对所述目标应用程序的原始资源访问请求,所述原值资源访问请求包括原始资源标识;根据所述原始资源访问请求加载所述原始资源包,使用所述原始资源标识通过原始资源索引访问所述原始资源文件;将关于访问所述目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。
进一步的,终端设备600的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明终端设备600的软件结构。
图7是本申请实施例的终端设备600的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别 为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图7所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图7所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供终端设备600的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
其中,上述计算机程序产品可以包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也 可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (32)

  1. 一种构建应用程序资源包的方法,其特征在于,包括:
    获取目标应用程序的原始资源包;
    获取访问所述原始资源包中每个原始资源的访问次数;
    用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  2. 根据权利要求1所述的方法,其特征在于,所述获取访问所述原始资源包中每个原始资源的访问次数,包括:
    从预先获取的多个终端设备的历史访问数据中,获取访问所述原始资源包中每个原始资源的平均访问次数;
    所述用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,包括:
    用所述原始资源包中平均访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  3. 根据权利要求1所述的方法,其特征在于,所述获取访问所述原始资源包中每个原始资源的访问次数,包括:
    获取访问所述原始资源包的记录文件,所述记录文件包括所述原始资源包中每个原始资源的访问次数。
  4. 根据权利要求3所述的方法,其特征在于,所述用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,包括:
    在满足预设条件的情况下,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包;
    其中,所述预设条件包括以下条件中的至少一个:
    所述记录文件记录的记录周期大于预设时长;
    所述访问次数大于对应预设次数的原始资源的数量低于预置阈值;
    所述目标应用程序处于空闲状态。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述在满足预设条件的情况下,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,包括:
    在满足预设条件的情况下,生成构建指示信息;
    显示所述构建指示信息;
    响应用户对所述构建指示信息的操作,生成构建请求;
    根据所述构建请求,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  6. 根据权利要求1-5中任一项所述的方法,其特征在于:
    所述原始资源包包括:原始资源索引和原始资源文件;所述原始资源索引用于表征原始资源标识和原始资源文件的对应关系;
    所述第一目标资源包包括:目标资源索引和目标资源文件;所述目标资源索引用于表征目标资源标识和目标资源文件的对应关系。
  7. 根据权利要求6所述的方法,其特征在于,所述用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,包括:
    从所述原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到所述目标资源索引;
    从所述原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到所述目标资源文件;
    用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
  8. 根据权利要求7所述的方法,其特征在于,所述用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包,包括:
    将所述目标资源索引和所述目标资源文件进行压缩,得到第一目标资源包。
  9. 根据权利要求7或8所述的方法,其特征在于,所述方法还包括:
    将所述第一目标资源包保存在本地存储空间;
    将所述原始资源包从所述本地存储空间移动到云端存储空间。
  10. 根据权利要求6所述的方法,其特征在于,所述用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包,包括:
    从所述原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到所述目标资源索引;
    从所述原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到所述目标资源文件;
    用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
  11. 根据权利要求7或10所述的方法,其特征在于,所述用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包之后,所述方法还包括:
    获取对所述目标应用程序的目标资源访问请求,所述目标资源访问请求包括目标资源标识;
    根据所述目标资源访问请求加载所述第一目标资源包;
    若确定所述目标资源标识在所述目标资源索引中,则通过所述目标资源索引访问所述目标资源文件。
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    若确定所述目标资源标识未在所述目标资源索引中,则根据所述目标资源请求加载所述原始资源包;
    若确定所述目标资源标识在所述原始资源索引中,则通过所述原始资源索引访问所述原始资源文件。
  13. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    若确定所述目标资源标识未在所述目标资源索引中,则获取更新后的记录文件,所述更新后的记录文件包括每个原始资源更新后的访问次数;
    用所述原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建 第二目标资源包。
  14. 根据权利要求3或4所述的方法,其特征在于,所述获取访问所述原始资源包的记录文件,包括:
    获取对所述目标应用程序的原始资源访问请求,所述原值资源访问请求包括原始资源标识;
    根据所述原始资源访问请求加载所述原始资源包,使用所述原始资源标识通过原始资源索引访问所述原始资源文件;
    将关于访问所述目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。
  15. 一种构建装置,其特征在于,包括:
    获取模块,用于获取目标应用程序的原始资源包;获取访问所述原始资源包中每个原始资源的访问次数;
    处理模块,用于用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  16. 一种构建装置,其特征在于,包括:
    一个或多个处理器;
    存储器;
    多个应用程序;
    以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令;当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    获取目标应用程序的原始资源包;
    获取访问所述原始资源包中每个原始资源的访问次数;
    用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  17. 根据权利要求16所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    从预先获取的多个终端设备的历史访问数据中,获取访问所述原始资源包中每个原始资源的平均访问次数;
    用所述原始资源包中平均访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  18. 根据权利要求16所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    获取访问所述原始资源包的记录文件,所述记录文件包括所述原始资源包中每个原始资源的访问次数。
  19. 根据权利要求18所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    在满足预设条件的情况下,用所述原始资源包中访问次数大于对应预设次数 的原始资源,构建第一目标资源包;
    其中,所述预设条件包括以下条件中的至少一个:
    所述记录文件记录的记录周期大于预设时长;
    所述访问次数大于对应预设次数的原始资源的数量低于预置阈值;
    所述目标应用程序处于空闲状态。
  20. 根据权利要求16-19中任一项所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    在满足预设条件的情况下,生成构建指示信息;
    显示所述构建指示信息;
    响应用户对所述构建指示信息的操作,生成构建请求;
    根据所述构建请求,用所述原始资源包中访问次数大于对应预设次数的原始资源,构建第一目标资源包。
  21. 根据权利要求16-20中任一项所述的构建装置,其特征在于,
    所述原始资源包包括:原始资源索引和原始资源文件;所述原始资源索引用于表征原始资源标识和原始资源文件的对应关系;
    所述第一目标资源包包括:目标资源索引和目标资源文件;所述目标资源索引用于表征目标资源标识和目标资源文件的对应关系。
  22. 根据权利要求21所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    从所述原始资源索引中,拷贝访问次数大于对应预设次数的原始资源索引,得到所述目标资源索引;
    从所述原始资源文件中,拷贝访问次数大于对应预设次数的原始资源文件,得到所述目标资源文件;
    用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
  23. 根据权利要求22所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    将所述目标资源索引和所述目标资源文件进行压缩,得到第一目标资源包。
  24. 根据权利要求22或23所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    将所述第一目标资源包保存在本地存储空间;
    将所述原始资源包从所述本地存储空间移动到云端存储空间。
  25. 根据权利要求21所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    从所述原始资源索引中,移除访问次数小于等于对应预设次数的资源索引,得到所述目标资源索引;
    从所述原始资源文件中,移除访问次数小于等于对应预设次数的资源文件,得到所述目标资源文件;
    用所述目标资源索引和所述目标资源文件,构建所述第一目标资源包。
  26. 根据权利要求22或25所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    获取对所述目标应用程序的目标资源访问请求,所述目标资源访问请求包括目标资源标识;
    根据所述目标资源访问请求加载所述第一目标资源包;
    若确定所述目标资源标识在所述目标资源索引中,则通过所述目标资源索引访问所述目标资源文件。
  27. 根据权利要求26所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    若确定所述目标资源标识未在所述目标资源索引中,则根据所述目标资源请求加载所述原始资源包;
    若确定所述目标资源标识在所述原始资源索引中,则通过所述原始资源索引访问所述原始资源文件。
  28. 根据权利要求26所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    若确定所述目标资源标识未在所述目标资源索引中,则获取更新后的记录文件,所述更新后的记录文件包括每个原始资源更新后的访问次数;
    用所述原始资源包中更新后的访问次数大于对应预设次数的原始资源,构建第二目标资源包。
  29. 根据权利要求18或19所述的构建装置,其特征在于,当所述指令被所述构建装置执行时,使得所述构建装置执行以下操作:
    获取对所述目标应用程序的原始资源访问请求,所述原值资源访问请求包括原始资源标识;
    根据所述原始资源访问请求加载所述原始资源包,使用所述原始资源标识通过原始资源索引访问所述原始资源文件;
    将关于访问所述目标应用程序的原始资源文件的相关信息进行记录,得到记录文件。
  30. 一种终端设备,其特征在于,包括:如权利要求15或者权利要求16-29中任一项所述的构建装置。
  31. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在终端设备上运行时,使得所述终端设备执行如权利要求1-14中任一项所述的方法。
  32. 一种计算机程序产品,其特征在于,当所述计算机程序产品在终端设备上运行时,使得所述终端设备执行如权利要求1-14中任一项所述的方法。
PCT/CN2020/129647 2019-11-25 2020-11-18 一种构建应用程序资源包的方法、构建装置及终端设备 WO2021104117A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911167399.1 2019-11-25
CN201911167399.1A CN112835610A (zh) 2019-11-25 2019-11-25 一种构建应用程序资源包的方法、构建装置及终端设备

Publications (1)

Publication Number Publication Date
WO2021104117A1 true WO2021104117A1 (zh) 2021-06-03

Family

ID=75922463

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/129647 WO2021104117A1 (zh) 2019-11-25 2020-11-18 一种构建应用程序资源包的方法、构建装置及终端设备

Country Status (2)

Country Link
CN (1) CN112835610A (zh)
WO (1) WO2021104117A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114443117B (zh) * 2021-08-17 2023-08-22 荣耀终端有限公司 一种定制包的处理方法及电子设备
CN113703815B (zh) * 2021-10-29 2022-02-11 腾讯科技(深圳)有限公司 离线资源更新方法、装置、终端和存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739812A (zh) * 2018-12-29 2019-05-10 北京金山安全软件有限公司 一种显示资源文件的方法及装置
CN110232051A (zh) * 2019-05-29 2019-09-13 吉旗(成都)科技有限公司 应用程序重复资源处理方法及装置
US10467001B2 (en) * 2015-01-12 2019-11-05 Microsoft Technology Licensing, Llc Enhanced compression, encoding, and naming for resource strings

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10467001B2 (en) * 2015-01-12 2019-11-05 Microsoft Technology Licensing, Llc Enhanced compression, encoding, and naming for resource strings
CN109739812A (zh) * 2018-12-29 2019-05-10 北京金山安全软件有限公司 一种显示资源文件的方法及装置
CN110232051A (zh) * 2019-05-29 2019-09-13 吉旗(成都)科技有限公司 应用程序重复资源处理方法及装置

Also Published As

Publication number Publication date
CN112835610A (zh) 2021-05-25

Similar Documents

Publication Publication Date Title
WO2021083378A1 (zh) 一种加速应用程序启动的方法及电子设备
CN109766036B (zh) 消息处理方法及电子设备
WO2020108356A1 (zh) 一种应用显示方法及电子设备
WO2021082835A1 (zh) 启动功能的方法及电子设备
WO2020093988A1 (zh) 一种图像处理方法及电子设备
WO2021159746A1 (zh) 文件共享方法、系统及相关设备
CN114556294A (zh) 一种主题切换方法以及主题切换装置
WO2021258814A1 (zh) 视频合成方法、装置、电子设备及存储介质
CN113568634B (zh) 应用优化的处理方法及处理装置
CN113704205B (zh) 日志存储的方法、芯片、电子设备和可读存储介质
CN113805797B (zh) 网络资源的处理方法、电子设备及计算机可读存储介质
WO2021185352A1 (zh) 一种版本升级方法及相关装置
CN112947947A (zh) 安装包的下载方法、分发方法、终端设备、服务器及系统
WO2021073337A1 (zh) 安装插件的方法、装置和存储介质
WO2021104117A1 (zh) 一种构建应用程序资源包的方法、构建装置及终端设备
WO2023273543A1 (zh) 一种文件夹管理方法及装置
CN115333941A (zh) 获取应用运行情况的方法及相关设备
WO2021190524A1 (zh) 截屏处理的方法、图形用户接口及终端
WO2020192716A1 (zh) 一种系统语言的切换方法及相关装置
CN114546511A (zh) 插件管理方法、系统及装置
CN115119048A (zh) 一种视频流处理方法及电子设备
WO2021238376A1 (zh) 功能包的加载方法、装置、服务器和电子设备
CN114489469B (zh) 一种数据读取方法、电子设备及存储介质
CN113485709B (zh) 应用优化方法、装置以及电子设备
CN112783418B (zh) 一种存储应用程序数据的方法及移动终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20892858

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20892858

Country of ref document: EP

Kind code of ref document: A1