CN112783418B - Method for storing application program data and mobile terminal - Google Patents

Method for storing application program data and mobile terminal Download PDF

Info

Publication number
CN112783418B
CN112783418B CN201911062009.4A CN201911062009A CN112783418B CN 112783418 B CN112783418 B CN 112783418B CN 201911062009 A CN201911062009 A CN 201911062009A CN 112783418 B CN112783418 B CN 112783418B
Authority
CN
China
Prior art keywords
data
mobile terminal
application
physical address
external memory
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201911062009.4A
Other languages
Chinese (zh)
Other versions
CN112783418A (en
Inventor
薛春
纪程
石亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201911062009.4A priority Critical patent/CN112783418B/en
Publication of CN112783418A publication Critical patent/CN112783418A/en
Application granted granted Critical
Publication of CN112783418B publication Critical patent/CN112783418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

A method for storing application program data and a mobile terminal relate to the technical field of communication, can reduce the storage space of an external memory occupied by an application program, and improves user experience, and the method comprises the following steps: in the process that the mobile terminal starts the first application, a reading request of first data is obtained, wherein the first data is all or part of data required for starting the first application; determining a first physical address corresponding to the first data according to the reading request; reading first data from an external memory according to a first physical address; compressing the first data into second data, writing the second data into an external memory corresponding to a second physical address with continuous addresses, and modifying the first physical address corresponding to the first data into a corresponding second physical address; subsequently, when the first application is restarted, if the first data is not cached in the memory, the second data can be read into the memory according to the second physical address corresponding to the first data.

Description

Method for storing application program data and mobile terminal
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method for storing application data and a mobile terminal.
Background
With the development of electronic technology, more and more applications can be installed on a terminal. Accordingly, the terminal needs to store more and more data of the application programs, and occupies more and more storage space of the terminal. Therefore, how to save the storage space of the terminal has become an urgent problem to be solved.
Disclosure of Invention
According to the method for storing the application program data and the mobile terminal, the storage space occupied by the application program is reduced by compressing part of data in the external memory when the application program runs.
In order to achieve the above object, the embodiments of the present application provide the following technical solutions:
in a first aspect, the present application provides a method, including: in response to receiving a first instruction for starting the first application, the mobile terminal starts the first application; the method comprises the steps that a mobile terminal obtains a first reading request for accessing first data, wherein the first data are all or part of data required by the mobile terminal for starting a first application; the mobile terminal determines a first physical address corresponding to the first data according to the first reading request, wherein the first physical address corresponds to a group of storage addresses in an external memory; the mobile terminal reads first data from an external memory according to a first physical address, compresses the first data into second data, writes the second data into a storage space corresponding to a second physical address in the external memory, and modifies the relationship of the first data corresponding to the first physical address into the relationship of the first data corresponding to the second physical address; wherein the second physical address corresponds to a set of consecutive memory addresses in the external memory; the mobile terminal releases the storage space in the external memory corresponding to the first physical address; responding to a second instruction for starting the first application received by the mobile terminal, and starting the first application again by the mobile terminal; if the mobile terminal does not access the first data in the internal memory, the mobile terminal determines a second physical address corresponding to the first data according to a second reading request for accessing the first data; and the mobile terminal reads the second data into the internal memory according to the second physical address.
Therefore, the mobile terminal compresses the first data in the process of starting the first application into the second data and stores the second data in the external memory, so that the storage space of the external memory occupied by the first application is reduced, and the utilization rate of the external memory is improved.
And the second data is stored in the continuous address space of the external memory, so that when the first application reads the second data, the second data can be read intensively and used for displaying the main interface of the first application. The second data is read in a centralized manner, so that the times of reading the data from the external memory by the first application can be reduced, the data reading speed of the first application can be improved, and the running speed of the first application can be ensured.
In a possible implementation manner, the determining, by the mobile terminal, the first physical address corresponding to the first data according to the first read request includes: when the mobile terminal runs the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first read request.
Since the first read request of the first data is acquired during the process of starting the first application when the mobile terminal is in use, in order to avoid influencing the running speed of the first application, the mobile terminal may suspend execution of subsequent steps after acquiring the first read request of the first data. And then performing subsequent steps (for example, acquiring a logical address of the first data according to the first read request, acquiring a first physical address according to the logical address, and the like) at other times when the operating system is idle. For example: and executing subsequent steps when the first application does not execute read-write operation on the external memory. Or, when the first application does not frequently perform the read-write operation on the internal memory, the subsequent steps are performed.
In a possible implementation manner, determining, by a mobile terminal, a first physical address corresponding to first data according to a first read request includes: and after the mobile terminal exits the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first reading request.
After the mobile terminal exits from the first application, the logical address of the first data is obtained according to the first read request, the first physical address is obtained according to the logical address, and the like, so that the starting and running speed of the first application can be prevented from being influenced.
In one possible implementation manner, at least part of the memory addresses in the set of memory addresses in the external memory corresponding to the first physical address are not consecutive.
In a possible implementation manner, the first data is an executable file that needs to be called to start the first application, and/or a data fragment in the executable file.
This is because the compression of the executable file among the files required for running the application is optimal and a high compression rate can be achieved. According to the analysis, the higher the compression rate of the associated data is, the more beneficial the reduction of the reading times of the application program from the external memory is, and the speed of the application program for reading the data is improved, so that the first screen time is reduced, and the user experience is improved.
In a possible implementation manner, a method for a mobile terminal to obtain a first read request for accessing first data includes: a virtual file system VFS in a mobile terminal acquires a first read request for accessing first data from an internal memory.
When the mobile terminal starts the first application, the services of the application layer and the framework layer send data required for calling and starting the first application to the VFS. Thus, the VFS may obtain the data needed to invoke the launch of the first application. In the application, the whole process from the time when the mobile terminal receives the instruction for starting the first application to the time when the mobile terminal completely displays the first application main interface can be regarded as the process for starting the first application. Also, the called data (including various types of files such as executable files, resource files, and the like) acquired from the VFS in this process is the first data. That is to say, the first data is all files called by the mobile terminal in the process of starting the first application, including executable files, resource files and the like. Or, the called executable files acquired from the VFS in the process are all the first data. That is to say, the first data is all executable files called by the mobile terminal in the process of starting the first application.
In a possible implementation, the method further includes: the mobile terminal records the size of the second data; the mobile terminal reads the second data into the internal memory according to the second physical address, and the method comprises the following steps: and sequentially reading the second data from the external memory into the internal memory according to the second physical address and the size of the second data.
In the method, when the file system allocates a continuous address space in the external memory for the second data, the file system may record a start address of the second data and a size of the second data. Thus, when the file system needs to read the second data from the external memory sequentially, the second data can be read into the internal memory at one time according to the start address and the size of the second data. In some cases, when the size of the second data is large, the file system cannot read the second data at one time, and the second data may be read in multiple times. It can be understood that the file system may reduce the number of times of reading the second data as much as possible, so as to increase the speed of reading the second data and increase the starting speed of the first application.
In a possible implementation manner, the mobile terminal starts the first application at least once before receiving the first instruction for starting the first application.
In some examples, the data invoked when the first application is launched for the first time after installation of the first application may be different from the data invoked when the first application is launched for the second time and thereafter. This is because the interface displayed when the first application is started for the first time may be different from the interface displayed when the first application is started later, for example, basic settings for the first application may be required when the first application is started for the first time. In addition, the calling executable may be optimized the first time the first application is launched, e.g. more executables may be generated from some executables. When the first application is started again, the optimized executable files can be directly called, and the like. Thus, this step may also be performed during a second or more than second boot-up after installation of the first application.
In a possible implementation, the method further includes: the mobile terminal reads other data of the first application except the second data in the external memory into the internal memory; compressing other data of the first application except the second data, and writing the compressed data into an external memory; modifying the physical address corresponding to other data except the second data of the first application; and releasing the storage space in the external memory corresponding to the first application except the second data before compression.
In some examples of this embodiment, when the first data is all data that is called when the mobile terminal displays the main interface, the other data except the first data in the first application is data that needs to be called when the mobile terminal displays other interfaces. It can be understood that, based on the read-ahead mechanism of the file system, after the main interface of the first application is displayed, the mobile terminal reads data of other interfaces in advance. That is, the mobile terminal has started to pre-read data of the other interface when the user does not select to display the other interface. Therefore, compared with the prior art, the read-ahead mechanism makes the extra required decompression time of the mobile terminal when reading other data imperceptible for the user, i.e. the user experience is not affected.
In a second aspect, a method of storing application data, comprises: in response to receiving a first instruction for starting the first application, the mobile terminal starts the first application; in the process that the mobile terminal starts the first application, the mobile terminal obtains a first reading request for accessing first data, wherein the first data is all or part of data required by the mobile terminal to start the first application; the mobile terminal determines a first physical address corresponding to the first data according to the first read request, wherein the first physical address corresponds to a group of storage addresses in an external memory; the mobile terminal reads first data from the external memory according to the first physical address, rewrites the first data into a storage space corresponding to the second physical address in the external memory, and modifies the relationship of the first data corresponding to the first physical address into a relationship corresponding to the second physical address; wherein the second physical address corresponds to a set of consecutive memory addresses in the external memory; the mobile terminal releases the storage space in the external memory corresponding to the first physical address; responding to a second instruction for starting the first application received by the mobile terminal, and starting the first application again by the mobile terminal; if the mobile terminal does not access the first data in the internal memory, the mobile terminal determines a second physical address corresponding to the first data according to a second reading request for accessing the first data; and the mobile terminal reads the first data into the internal memory according to the second physical address.
The method of this aspect is different from the method of the first aspect in that after the mobile terminal reads the first data, the first data is compressed, and the first data is directly rewritten into the address continuous external storage space. Compared with the prior art, the first application still occupies the same amount of space in the external memory. However, because the first data is in the continuous address space, when the first application needs to read the first data from the external memory, the reading times can be effectively reduced by adopting a random reading or sequential reading mode, which is beneficial to improving the speed of loading the main interface by the first application. And, also be favorable to promoting the utilization ratio of memory.
In a possible implementation, the method further includes: recording the size of the first data;
the mobile terminal reads the first data into the internal memory according to the second physical address, and the method comprises the following steps: and sequentially reading the first data from the external memory into the internal memory according to the second physical address and the size of the first data.
In a possible implementation manner, the determining, by the mobile terminal, the first physical address corresponding to the first data according to the first read request includes: when the mobile terminal runs the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first reading request.
In a possible implementation manner, determining, by a mobile terminal, a first physical address corresponding to first data according to a first read request includes: and after the mobile terminal exits the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first reading request.
In a possible implementation manner, the first data is an executable file that needs to be called to start the first application, and/or a data fragment in the executable file.
In a possible implementation manner, a method for a mobile terminal to obtain a first read request for accessing first data includes: a virtual file system VFS in a mobile terminal acquires a first read request for accessing first data from an internal memory.
In one possible implementation manner, the mobile terminal starts the first application at least once before receiving a first instruction for starting the first application.
In a third aspect, a mobile terminal is provided, including: a processor, a memory and a touch screen, the memory and the touch screen being coupled to the processor, the memory being adapted to store computer program code, the computer program code comprising computer instructions that, when read by the processor from the memory, cause the mobile terminal to perform the method as described in the above aspects and in any one of the possible implementations.
In a fourth aspect, an apparatus is provided, where the apparatus is included in a mobile terminal, and the apparatus has a function of implementing the behavior of the mobile terminal in any method of the foregoing aspects and possible implementations. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module or unit corresponding to the above functions. For example, a receiving module or unit, an obtaining module or unit, a determining module or unit, and a compressing module or unit, etc.
A fifth aspect provides a computer readable storage medium comprising computer instructions which, when executed on a terminal, cause the terminal to perform the method as described in the above aspect and any one of the possible implementations.
A sixth aspect provides a computer program product for causing a computer to perform the method as described in the above aspects and any one of the possible implementations when the computer program product runs on the computer.
In a seventh aspect, a chip system is provided, which includes a processor, and when the processor executes instructions, the processor performs the method as described in the foregoing aspect and any one of the possible implementations.
Drawings
Fig. 1 is a first schematic structural diagram of a mobile terminal according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a mobile terminal according to an embodiment of the present application;
fig. 3 is a first flowchart illustrating a method for storing application data according to an embodiment of the present disclosure;
fig. 4A is a schematic structural diagram of a mobile terminal according to an embodiment of the present application;
fig. 4B is a schematic diagram illustrating a method for storing application data according to an embodiment of the present application;
fig. 5 is a schematic diagram of a storage space in an external memory according to an embodiment of the present application;
fig. 6 is a second flowchart illustrating a method for storing application data according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a chip system according to an embodiment of the present disclosure.
Detailed Description
In the description of the embodiments of the present application, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of the present application, "a plurality" means two or more unless otherwise specified.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
When an Application (APP) is installed, the mobile terminal reads an installation package of the APP from an external storage (for example, a flash memory, an SD card, or the like, which may be referred to as "external storage" for short) into an internal storage (which may be referred to as "internal storage" for short), decompresses the installation package in the internal storage, and then writes the decompressed file back to the external storage. That is, after the application is installed, the decompressed file is stored in the external memory, that is, the data that the application needs to access when running. Note that, for an application program that has been already installed before shipment from the factory of the mobile terminal, data that the application program accesses during operation is also stored in the external memory.
For example, the data that the application program may access when running may include configuration files (e.g., android manifest. Xml), executable files, resource files, and resource index lists (e.g., resources.
The configuration file includes configuration information of the application program, and the operating system of the mobile terminal needs to run a code, a display interface, and the like of the application program according to the configuration information.
The resource index list is an important file generated when the resource file is compiled. And the application program indexes the resource file corresponding to the configuration of the mobile terminal according to the resource index list. The mobile terminal may be configured with different language settings, different sizes of the mobile terminal screen, etc.
An executable file refers to a file that can be loaded for execution by an operating system. For example: in the android system, the executable files may include apk files, odex files, dex files, art files, etc., which may all be recognized and run by the Dalvik and art virtual machines of the android system.
It is conceivable that, when more applications are installed on the mobile terminal, more data is required for the applications to run, and the space occupied by the external memory is larger. Therefore, the embodiment of the application provides a method for compressing data required by the running of an application program, which can reduce the space occupied by the data of the application program in an external memory and improve the space occupancy rate of the external memory.
It will be readily appreciated that after compressing the data required by the application program at runtime, the compressed data may additionally need to be decompressed at runtime of the application program, i.e. more time is required for compression. Therefore, according to the technical scheme provided by the embodiment of the application, when the data required by the application program running is compressed, the efficiency of the application program for reading the data from the external memory is also improved, so that the overall running speed of the application program is ensured.
We note that when reading data from the external memory while running an application, a random read (random read) approach is used. This is because data required for the application program to run is distributed discretely in the external memory. For example: when the application program displays a certain interface, the storage address of the data required to be called in the external memory is discontinuous. Therefore, the mobile terminal needs to perform multiple read accesses when displaying a certain interface.
In particular, the file system in a mobile terminal is particularly used for organizing, managing and storing data (also called files) on an external memory (SD card or flash memory) of the mobile terminal. The file system logically divides the external memory into a plurality of physical blocks (blocks) and manages the external memory at a granularity of the physical blocks. For example: the file system records an identification of a physical block storing data, i.e., a physical address (physical address). The file system may read the data from the external memory via the physical address. In fact, the mobile terminal may not have to be concerned with the actual specific address of the data on the external memory. For most file systems, each physical block size is the same, and one physical block size may be 4KB. Currently, the external memory of the mobile terminal mostly adopts a flash memory. Since flash memory has special physical characteristics, the smallest physical unit of operation of the file system to the flash memory is a flash page, one flash page is typically 16K or 32K, which corresponds to 4 or 8 physical blocks.
The following description takes an example in which the minimum operation unit of the file system to the external memory is 4 physical blocks.
For example: table one shows an example of a segment of memory space of an external memory. It can be seen that the segment of memory space includes physical blocks 1# to 8#. Suppose that an application needs to call data (discrete distribution) of physical block # 1 and physical block # 5 when displaying a certain interface. Then, when the application displays the interface, the application executes two read operations, which are: reading data of physical blocks 1# to 4# into an internal memory according to a read request for accessing the physical block 1# for the first time; the data of physical blocks 5# to 8# are read into the internal memory in accordance with the read request for accessing physical block 5# for the second time. It can be noted that 6 physical blocks of the 8 physical blocks read this time are useless for displaying the interface. On one hand, the times of reading data by the file system are increased, the time of reading data by the file system is prolonged, and the running speed of the application program is influenced. On the other hand, the data of the 6 physical blocks which are read in more occupy the storage space of the internal memory, and the utilization rate of the internal memory is influenced.
Watch 1
1# 2# 3# 4# 5# 6# 7# 8#
Therefore, the embodiment of the present application proposes to identify data that needs to be called when a certain application is started or data that needs to be called when a certain application interface is displayed (which may be referred to as corresponding associated data), compress the associated data, and allocate a storage space with continuous addresses to the compressed associated data, that is, the physical addresses of the associated data are continuous. Data other than the associated data that needs to be called when the application displays other interfaces may be referred to as non-associated data. It will be appreciated that the associated data and the non-associated data are relative to a particular context of the application, such as a launch context or display of an application interface. That is, the associated data determined for one scene of the application may be non-associated data for another scene of the application. The non-associated data determined for one context of the application may be associated data for another context of the application. The identification method will be described in detail below, and will not be described here.
In this way, since the physical addresses of the compressed associated data are continuous, when the application calls the associated data from the external memory through the file system, the associated data can be read in intensively, so that reading of non-associated data is avoided or reading of less non-associated data is realized. Therefore, the method is beneficial to reducing the times of reading data by the application program, improving the data reading speed of the application program and ensuring the running speed of the application program. In addition, when the application program displays the interface, reading-in or reading-in of less non-associated data is avoided, and utilization rate of the memory is improved.
For example: in contrast to the example shown in table one, in the present application, data that needs to be called when an application displays a certain interface, such as data of physical block # 1 and physical block # 5, is first identified. The data of physical block # 1 and physical block # 5 are then compressed and consecutive physical addresses are assigned to the compressed data. Assuming that the compression rate of the employed compression algorithm is 40%, the 8KB data of the physical block 1# and the physical block 5# are compressed into 4.8KB, and the compressed 4.8KB data are stored in a continuous address space, for example, in the physical block 9# and the physical block 10#. Physical block # 1 and physical block # 5 may then be released, i.e., physical block # 1 and physical block # 5 are marked as unoccupied for subsequent reclamation. In one example, the interface may be randomly readable when the application is displaying the interface. Since the compressed data is stored in the physical block 9# and the physical block 10#, the amount of data read by the file system performing one read operation is smaller. Therefore, the file system performs a read operation to read the data of the physical blocks 9# to 12# once (wherein the physical blocks 11# and 12# are not shown in the figure). In another example, when the application program is displaying the interface, a sequential read (sequential read) mode may be used, and the data in the physical block 9# and the physical block 10# may be read only by performing a read operation once.
Watch two
1# 2# 3# 4# 5# 6# 7# 8# 9# 10#
Another example is: by using the same method as the example shown in table two, it can be determined that when the data amount of the associated data of a certain scene of the application program is different, the number of times of the read operation that needs to be performed and the number of the physical blocks that need to be read are respectively used, as shown in table three.
Watch III
Figure BDA0002258210390000061
Figure BDA0002258210390000071
As shown in table three, when the associated data is physical block # 1 and physical block # 5, two read operations need to be performed when the prior art is adopted, specifically: reading data of physical blocks 1# to 4# into an internal memory according to a read request for accessing the physical block 1# for the first time; the data of physical blocks 5# to 8# are read into the internal memory in accordance with the read request for accessing physical block 5# for the second time.
When the random reading method is adopted, the associated data are firstly identified as the physical block 1# and the physical block 5#, and then the associated data are compressed to a continuous address space. Taking the compression rate of 50% as an example, the physical block 1# and the physical block 5# are compressed into one physical block (for example, denoted as physical block 9 #). At this time, the mobile terminal may perform a read operation to read in physical blocks 9# to 12#. The data of physical block 9# is referred to as the data of original physical blocks 1# and 5#. Due to the characteristic of random reading, the mobile terminal reads 4 physical blocks at a time when executing a read operation, and therefore, also reads data of the physical blocks 10# to 12#.
When another sequential reading method of the present application is adopted, the associated data is also identified as the physical block 1# and the physical block 5# first, and then the associated data is compressed into a continuous address space. Taking the compression rate of 50% as an example, the physical block 1# and the physical block 5# are compressed into one physical block (for example, denoted as physical block 9 #). At this time, the mobile terminal may perform a read request to directly read into the physical block 9#. The data of physical block 9# is referred to as the data of original physical blocks 1# and 5#. Due to the characteristic of sequential reading, when the mobile terminal executes one-time reading operation, the required data can be read in at one time directly according to the size of the data in the reading request. Therefore, the mobile terminal reads only the required physical block 9# at this time.
When the associated data is physical block # 1, physical block # 5, and physical block # 9, when the prior art is adopted, three read operations need to be performed, specifically: reading data of physical blocks 1# to 4# into an internal memory according to a read request for accessing the physical block 1# for the first time; reading the data of the physical blocks 5# to 8# into the internal memory according to the read request for accessing the physical block 5# for the second time; the third time, the data of the physical blocks 9# to 12# are read into the internal memory in accordance with the read request for accessing the physical block 9#.
When the random reading method is adopted, the associated data are firstly identified as the physical block 1#, the physical block 5# and the physical block 9#, and then the associated data are compressed to a continuous address space. Taking the compression rate of 50% as an example, the physical blocks 1# and 5# are compressed into one physical block (for example, denoted as physical block 9 #), and the physical block 9# is compressed into another physical block (for example, denoted as physical block 10 #). At this time, the mobile terminal may perform a read operation to read in physical blocks 9# to 12#. The data of the physical blocks 9# and 10# are referred to as the data of the original physical blocks 1# and 5#. It should be noted that, due to the random reading characteristic, the mobile terminal may also read the data of the physical blocks 11# to 12#.
When another sequential reading method of the present application is adopted, the associated data is also identified as the physical block 1#, the physical block 5# and the physical block 9#, and then the associated data is compressed into a continuous address space. Taking the compression rate of 50% as an example, the physical blocks 1# and 5# are compressed into one physical block (for example, denoted as physical block 9 #), and the physical block 9# is compressed into another physical block (for example, denoted as physical block 10 #). At this time, the mobile terminal may perform a read request to directly read in the physical blocks 9# and 10#. The data of the physical blocks 9# and 10# are referred to as the data of the original physical blocks 1# and 5#. Due to the characteristic of sequential reading, only the required physical blocks 9# and 10# are read when the mobile terminal executes the read request.
When the associated data is physical block # 1, physical block # 5, physical block # 9 and physical block # 13, the following is repeated.
Therefore, when the amount of the related data called is larger when the application program is started or when an application program interface is displayed, and the position in the external memory is more discrete, the method provided by the embodiment of the application program is more favorable for reducing the reading operation times of the application program, is more favorable for reducing the speed of reading the data from the external memory by the application program, and ensures the running speed of the application program.
Furthermore, when the amount of the associated data called by the application program when displaying a certain page is larger, the method provided by the embodiment of the application program is more favorable for saving the storage space of the external memory and improving the utilization rate of the external memory.
In addition, when the larger the amount of associated data called by the application program when displaying a certain page is, the more discrete the position in the external memory is, the method provided by the embodiment of the present application is also more beneficial to reducing the non-associated data read by the application program when displaying the interface, and improving the utilization rate of the internal memory.
It can be understood that, when the compression rate used for compressing the associated data is higher, it is more beneficial to reduce the number of read operations of the application program, increase the speed of reading data from the external memory by the application program, and increase the running speed of the application program. In addition, when the compression rate is higher, the storage space of the external memory is saved, and the utilization rate of the external memory and the internal memory is improved.
In some embodiments of the present application, data to be called when the application program main interface is displayed, that is, associated data of the main interface, may be identified, and the associated data is compressed in a continuous address space in the external memory. When the mobile terminal starts (launch) the application program, if it is determined that the memory does not have the associated data of the main interface, the associated data of the main interface can be collectively read from the external memory and displayed.
According to the analysis, the method provided by the embodiment of the application can reduce the storage space of the external memory occupied by the associated data of the main interface of the application program, and can also ensure the speed of reading the associated data from the external memory by the subsequent application program, namely ensure the time (which can be called the first screen time) from the time when the application program receives the start instruction to the time when the main interface is completely displayed. The first screen time is the most intuitive index for the user to perceive the running speed of the application program. Therefore, ensuring the first screen time of the application program is significant for improving user experience.
Furthermore, since the data called when the application displays the main interface is usually fixed, or most of the data is fixed, the file in which the data associated with the main interface is recognized and compressed is also fixed, and it is not necessary to recognize the data associated with the main interface and compress the data a plurality of times.
Furthermore, the executable file required to be called when the main interface of the application program is displayed can be identified, and the executable file required to be called by the main interface is determined as the associated data of the main interface. This is because the compression of the executable file among the files required to run the application is most effective and a higher compression rate can be achieved. According to the analysis, the higher the compression rate of the associated data is, the more beneficial the compression rate is to reduce the times of reading the data from the external memory by the application program and improve the data reading speed of the application program, so that the first screen time is reduced and the user experience is improved.
For example, the mobile terminal in the present application may be a mobile phone, a tablet computer, a Personal Computer (PC), a Personal Digital Assistant (PDA), a smart watch, a netbook, a wearable electronic device, an Augmented Reality (AR) device, a Virtual Reality (VR) device, an in-vehicle device, a smart car, a smart audio, a robot, and the like, and the specific form of the mobile terminal is not particularly limited in the present application.
Fig. 1 shows a schematic configuration of a mobile terminal 100.
The mobile terminal 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the mobile terminal 100. In other embodiments of the present application, the mobile terminal 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), among others. The different processing units may be separate devices or may be integrated into one or more processors.
The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, the processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, a charger, a flash, a camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the mobile terminal 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 through an I2S bus, enabling communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through the I2S interface, so as to implement a function of receiving a call through a bluetooth headset.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate over a CSI interface to implement the camera functions of mobile terminal 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement a display function of the mobile terminal 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the mobile terminal 100, and may also be used to transmit data between the mobile terminal 100 and peripheral devices. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other mobile terminals, such as AR devices and the like.
It should be understood that the connection relationship between the modules according to the embodiment of the present invention is only illustrative, and is not limited to the structure of the mobile terminal 100. In other embodiments of the present application, the mobile terminal 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the mobile terminal 100. The charging management module 140 may also supply power to the mobile terminal through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In other embodiments, the power management module 141 may be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
The wireless communication function of the mobile terminal 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the mobile terminal 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied on the mobile terminal 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the mobile terminal 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, the antenna 1 of the mobile terminal 100 is coupled to the mobile communication module 150 and the antenna 2 is coupled to the wireless communication module 160 so that the mobile terminal 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), wideband Code Division Multiple Access (WCDMA), time division code division multiple access (time-division multiple access, TD-SCDMA), long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The mobile terminal 100 implements a display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the mobile terminal 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The mobile terminal 100 may implement a photographing function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
The ISP is used to process the data fed back by the camera 193. For example, when a user takes a picture, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, an optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and converting into an image visible to the naked eye. The ISP can also carry out algorithm optimization on noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the mobile terminal 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the mobile terminal 100 selects a frequency bin, the digital signal processor is used to perform fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The mobile terminal 100 may support one or more video codecs. In this way, the mobile terminal 100 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. The NPU may implement applications such as intelligent recognition of the mobile terminal 100, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory, such as a Micro SD card, to extend the storage capability of the mobile terminal 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
In the embodiment of the present application, the file after the application program is installed may be stored in the external memory. Thus, when the memory 121 does not have data cached therein that is needed for the operation of the application program, the corresponding data can be read from the external memory. It should be noted that, unlike the prior art, in the embodiment of the present application, at least part of data stored in the external memory by the application program is compressed, which is beneficial to saving the storage space of the external memory.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, and the like) required by at least one function, and the like. The storage data area may store data (e.g., audio data, a phonebook, etc.) created during use of the mobile terminal 100, and the like. The processor 110 executes various functional applications of the mobile terminal 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
In the embodiment of the present application, the internal memory 121 may be used as a cache of the external memory. For example, in the Linux-based memory management mechanism, a page cache (page cache) in the internal storage 121 essentially keeps a certain copy of a part of data in the external storage in the internal storage 121, so that an application program can quickly read the data in the external storage. Page caching is a page-based, file-oriented caching mechanism.
The mobile terminal 100 may implement an audio function through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into analog audio signals for output, and also used to convert analog audio inputs into digital audio signals. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into a sound signal. The mobile terminal 100 may listen to music through the speaker 170A or listen to a hands-free call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the mobile terminal 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the human ear.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or sending voice information, the user can input a voice signal to the microphone 170C by uttering a voice signal close to the microphone 170C through the mouth of the user. The mobile terminal 100 may be provided with at least one microphone 170C. In other embodiments, the mobile terminal 100 may be provided with two microphones 170C to implement a noise reduction function in addition to collecting sound signals. In other embodiments, the mobile terminal 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association) standard interface of the USA.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a wide variety, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The mobile terminal 100 determines the intensity of the pressure according to the change in the capacitance. When a touch operation is applied to the display screen 194, the mobile terminal 100 detects the intensity of the touch operation according to the pressure sensor 180A. The mobile terminal 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 180B may be used to determine a motion attitude of the mobile terminal 100. In some embodiments, the angular velocity of the mobile terminal 100 about three axes (i.e., x, y, and z axes) may be determined by the gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects a shake angle of the mobile terminal 100, calculates a distance to be compensated for by the lens module according to the shake angle, and allows the lens to counteract the shake of the mobile terminal 100 through a reverse movement, thereby achieving anti-shake. The gyroscope sensor 180B may also be used for navigation, somatosensory gaming scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, the mobile terminal 100 may calculate altitude, aid in positioning and navigation, from barometric pressure values measured by the barometric pressure sensor 180C.
The magnetic sensor 180D includes a hall sensor. The mobile terminal 100 may detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the mobile terminal 100 is a folder, the mobile terminal 100 may detect the opening and closing of the folder according to the magnetic sensor 180D. And then according to the opening and closing state of the leather sheath or the opening and closing state of the flip cover, the automatic unlocking of the flip cover is set.
The acceleration sensor 180E may detect the magnitude of acceleration of the mobile terminal 100 in various directions (generally, three axes). The magnitude and direction of gravity may be detected when the mobile terminal 100 is stationary. The method can also be used for identifying the gesture of the mobile terminal, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The mobile terminal 100 may measure the distance by infrared or laser. In some embodiments, the scene is photographed and the mobile terminal 100 may range using the distance sensor 180F to achieve fast focus.
The proximity light sensor 180G 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 mobile terminal 100 emits infrared light to the outside through the light emitting diode. The mobile terminal 100 detects infrared reflected light from a nearby object using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the mobile terminal 100. When insufficient reflected light is detected, the mobile terminal 100 may determine that there is no object near the mobile terminal 100. The mobile terminal 100 may utilize the proximity sensor 180G to detect that the user holds the mobile terminal 100 close to the ear for talking, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in a holster mode, a pocket mode automatically unlocks and locks the screen.
The ambient light sensor 180L is used to sense the ambient light level. The mobile terminal 100 may adaptively adjust the brightness of the display screen 194 according to the perceived ambient light level. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the mobile terminal 100 is in a pocket to prevent accidental touches.
The fingerprint sensor 180H is used to collect a fingerprint. The mobile terminal 100 may implement fingerprint unlocking, access to an application lock, fingerprint photographing, fingerprint answering of an incoming call, etc. using the collected fingerprint characteristics.
The temperature sensor 180J is used to detect temperature. In some embodiments, the mobile terminal 100 executes a temperature handling policy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the mobile terminal 100 performs a reduction in performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, the mobile terminal 100 heats the battery 142 when the temperature is below another threshold to avoid an abnormal shutdown of the mobile terminal 100 due to low temperature. In other embodiments, when the temperature is lower than a further threshold, the mobile terminal 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
The touch sensor 180K is also called a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation acting thereon or nearby. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on the surface of the mobile terminal 100 at a different position than the display screen 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the human voice vibrating a bone mass. The bone conduction sensor 180M may also contact the human pulse to receive the blood pressure pulsation signal. In some embodiments, the bone conduction sensor 180M may also be disposed in a headset, integrated into a bone conduction headset. The audio module 170 may analyze a voice signal based on the vibration signal of the bone mass vibrated by the sound part acquired by the bone conduction sensor 180M, so as to implement a voice function. The application processor can analyze heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so that the heart rate detection function is realized.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The mobile terminal 100 may receive a key input, and generate a key signal input related to user setting and function control of the mobile terminal 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be attached to and detached from the mobile terminal 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The mobile terminal 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The same SIM card interface 195 can be inserted with multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The mobile terminal 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the mobile terminal 100 employs eSIM, namely: an embedded SIM card. The eSIM card may be embedded in the mobile terminal 100 and may not be separated from the mobile terminal 100.
The software system of the mobile terminal 100 may employ a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of the mobile terminal 100.
Fig. 2 is a block diagram of a software configuration of the mobile terminal 100 according to the embodiment of the present invention.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.
The application layer may include a series of application packages.
As shown in fig. 2, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc.
In an embodiment of the present application, the application package may include a first application. The first application may be an application pre-installed before the mobile terminal 100 leaves a factory, or may be an application installed by a user through an application market or in another manner after the mobile terminal 100 leaves the factory. The first application example is: browser applications, multimedia applications, huashi mall, and the like.
By adopting the method provided by the embodiment of the application, the occupied storage space of the first application in the external memory can be reduced. In some examples, the first screen time of the first application can be reduced, and the user experience is improved.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 2, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
Content providers are used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and answered, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide a communication function of the mobile terminal 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scrollbar text in a status bar at the top of the system, such as a notification of a running application in the background, or a notification that appears on the screen in the form of a dialog window. For example, text information is prompted in the status bar, a prompt tone is given, the mobile terminal vibrates, an indicator light flashes, and the like.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
The kernel layer also includes a Virtual File System (VFS) and a file system (file system). The VFS is an external interface of the Linux file system, that is, the upper layer application accesses data in the file system through the VFS. File systems, which may also be referred to as file management systems, are systems for organizing and allocating space on a file storage device (e.g., external storage), for storing files, and for protecting and retrieving stored files. The mobile terminal 100 may support multiple types of file systems, such as: fourth generation extended file systems (ext 4), flash friendly file systems (F2 FS), and the like.
In the prior art, a process of starting a first application calling data by a mobile terminal is as follows: after receiving the command for starting the first application, the mobile terminal can access the data required by starting the first application in the internal memory through the VFS. Typically, the VFS receives a command (typically a plurality of commands, which may also be referred to as read requests) to call the first application data, including a logical address (address) to call the data. The logical address of the data may be understood as an identifier for marking the data in the first application, and may include a file index number (inode number) and a file logical page number (local page number). Further, the VFS may look up the address of the data in the internal memory based on the logical address of the data in order to read out the data and operate. If some data is not cached in the internal memory, the VFS sends a read request of missing data to the file system. The file system reads the missing data from the external memory to the internal memory so that the mobile terminal runs the data and starts the first application.
In the embodiment of the present application, in the process of starting the first application by the mobile terminal, the following steps are further additionally performed: a command to initiate invocation of first application data is obtained from the VFS. Then, a logical address of data to be called for starting the first application is obtained from the obtained instruction for calling the first application, and all or part of data corresponding to the logical address is determined as associated data, namely the first data. Subsequently, the VFS transmits the determined logical address of the first data to the file system. The file system searches a physical address (i.e. a first physical address) corresponding to the first data according to the logical address of the first data, i.e. an address of the first data in the external memory. At least part of the first physical address is discontinuous. Then, the file system may read the first data from the external memory according to the determined first physical address and compress the first data into the second data. Then, the file system allocates a continuous storage address (i.e., a second physical address) in the external memory for the second data, and writes the second data back to the external memory corresponding to the second physical address. In addition, the file system releases the storage space in the external memory corresponding to the first physical address.
At this time, the file system also modifies the relationship between the logical address of the first data and the first physical address into the relationship between the logical address of the first data and the second physical address. It can be understood that, when the mobile terminal needs to access the first data again, the file system determines a second physical address according to the logical address of the first data, and reads and decompresses the second data into the internal memory according to the second physical address. Obviously, the decompressed content of the second data is the same as the content of the first data.
It should be understood that the functional division between the VFS and the file system is merely an example, and the embodiment of the present application is not limited to the specific main body for performing each function. For example, at the kernel layer, part of the functions in the VFS and/or the file system may be shared by other existing modules or newly created modules. For example, the memory management module or the newly built module in the kernel layer may execute a command for calling the first application starting time data from the mobile terminal acquired by the VFS, and determine the logical address of the first data according to the command; compressing the first data; decompress the second data, etc.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
As shown in fig. 3, a flowchart of a method for storing application data provided in the embodiment of the present application may be applied to the mobile terminal 100, and the method specifically includes the following steps:
s301, in response to receiving the instruction of starting the first application, the mobile terminal starts the first application.
The first application may be an application preset before the mobile terminal 100 leaves a factory, may also be an application installed by a user through downloading in an application market, and may also be an application installed by the user directly through an installation package, which is not limited in this embodiment of the present application.
The instruction for starting the first application may be an operation of the user to open the first application, for example, clicking an application icon corresponding to the first application on a display 192 (typically, a touch screen) of the mobile terminal 100, inputting a voice command, pressing a key 190 or a combination of keys 190 on the mobile terminal 100 (the pressing operation corresponds to a shortcut for opening the first application), a preset blank space gesture, and the like. In another example, the mobile terminal 100 may also automatically launch the first application. For example: and when the mobile terminal detects a preset event, the first application can be automatically started. That is, the embodiment of the present application does not limit a start scenario of the first application.
S302, in the process that the mobile terminal starts the first application, the VFS of the mobile terminal obtains a command for calling the first data.
The first data may be part or all of data for starting the first application.
Referring to the schematic structural diagram of the mobile terminal shown in fig. 4A, when the mobile terminal starts the first application, the services of the application layer and the framework layer send data required for invoking the start of the first application to the VFS. Thus, the VFS may obtain the data needed to invoke the launch of the first application. In the application, the whole process from the time when the mobile terminal receives the instruction for starting the first application to the time when the mobile terminal completely displays the first application main interface can be regarded as the process for starting the first application. Also, the called data (including various types of files such as executable files, resource files, and the like) acquired from the VFS in this process is the first data. That is to say, the first data is all files called by the mobile terminal in the process of starting the first application, including executable files, resource files and the like. Or, the called executable files acquired from the VFS in the process are all the first data. That is, the first data is all executable files called in the process of starting the first application by the mobile terminal. As described above, the compression ratio of the executable file is better, so that the compression of the executable file is more beneficial to saving the storage space of the external memory, improving the running speed of the first application, reducing the first screen time of the first application, and improving the user experience.
It should be noted that in some examples, the data invoked when the first application is launched for the first time after installation of the first application may be different from the data invoked when the first application is launched for the second time and thereafter. This is because the interface displayed when the first application is started for the first time may be different from the interface displayed when the first application is started later, for example, basic settings for the first application may be required when the first application is started for the first time. In addition, the calling executable may be optimized the first time the first application is launched, e.g. more executables may be generated from some executables. When the first application is started again subsequently, the optimized executable files can be directly called, and the like. Thus, this step may also be performed during a second or more than second boot-up after installation of the first application.
Of course, the logic address for retrieving the first data from the VFS is taken as an example for illustration, and based on the inventive concept of the present application, the logic address for retrieving the first data from other modules in the mobile terminal, which can be considered by those skilled in the art, is also covered in the protection scope of the present application.
And S303, the VFS acquires the logic address of the first data according to the command for calling the first data and sends the logic address to the file system of the mobile terminal.
The command for calling the first data by the VFS comprises a logic address of the first data. Specifically, the instruction to call the first data may be, for example, an instruction such as sys _ read (), mmap (), or the like. The parameters of the logical address of the first data may include a file index number (inode number), a file logical page number (local page number), and the like.
S304, the file system acquires a first physical address of the first data according to the logical address of the first data.
The first physical address corresponds to a group of storage addresses in the external memory allocated by the file system for the first data, and at least part of the storage addresses in the group of storage addresses are discontinuous. In one example, where the first data comprises a plurality of files and/or data segments in a file, the first physical address may be one or more starting addresses assigned by the file system for the respective files and/or data segments in the file. That is, the file system reads each file or data fragment in the file according to the start address of each file in combination with the random reading performance of the file system (reading fixed-size file pages at a time).
Referring to fig. 4a, after the vfs sends the logical address of the first data to the file system, the file system may find the physical address corresponding to the logical address of the first data, that is, the first physical address of the first data, according to the address mapping maintained by the file system. For example, according to the index number and the logical page number of the first data, a corresponding physical page number (physical page number) is found, which is the first physical address.
From a large amount of experimental data, we observed that the memory addresses of the first data in the external memory are generally not contiguous. It is easily understood that, when the first data is data of a main interface displayed for the first application, the data of the main interface may include various types of files such as an executable file and a resource file. When packaging the first application installation package, the first application developer generally processes the first application installation package according to different types of files respectively, and finally packages the processed multiple types of files together. Then, the mobile terminal 100 decompresses the installation package and writes it back to the external memory when installing the first application. Even when the decompressed installation packages are sequentially written into the external memory, the decompressed files are arranged roughly in accordance with the file types. If the decompressed installation package is randomly written into the external memory, the arrangement sequence of the decompressed files in the external memory is unpredictable. Therefore, the first data is distributed in the external memory substantially discontinuously, i.e. part of the addresses in the first physical address are not consecutive.
S305, the file system reads the first data from the external memory according to the first physical address and compresses the first data into second data.
S306, the file system allocates a second physical address with continuous addresses for the second data, and writes the second data into a storage space corresponding to the second physical address in the external memory.
With reference to fig. 4A, in steps S305 to S306, after the file system reads the first data from the external memory to a page cache (page cache) of the internal memory 121 through a device driver (e.g., ioctl interface) according to the first physical address, the first data may be compressed in the page cache to obtain the second data. The compression algorithm that can be used in the present application is LZ4, LZO, or other compression methods. The file system then assigns a new set of contiguous storage addresses for the second data. The new set of consecutive memory addresses corresponds to the second physical address. In one example, the file system records a size of the second data, the second physical address being a starting address of a new set of consecutive storage addresses. That is, the file system writes the second data back to the external memory through the device driver according to the size of the second data and the second physical address. In another example, the second physical address includes a start address and an end address of a new set of consecutive memory addresses. That is, the file system writes the second data back to the external memory through the device driver according to the second physical address.
It should be noted that when the file system originally accesses the first data, the first physical address is found according to the logical address of the first data, and the first data is read from the external memory according to the first physical address. In the application, the first data is compressed into the second data, and the second data is written back to the storage space corresponding to the second physical address. The file system also needs to modify the relationship between the first data and the first physical address into the relationship between the first data and the second physical address. Therefore, when the mobile terminal needs to access the first data again, the file system determines a second physical address according to the logical address of the first data, reads in and decompresses the second data into the internal memory according to the second physical address, and obtains the first data. In one example, when the second physical address includes a start address of the second data storage, the modified correspondence relationship further includes a size of the second data. That is, the first data corresponds to the second physical address and the size of the second data. In another example, when the second physical address includes a start address and an end address of the second data store, the modified correspondence may include only the second physical address. That is, the first data corresponds to the second physical address.
In some examples, to avoid affecting the running speed of the first application, the mobile terminal may suspend performing subsequent steps after acquiring the logical address of the first data or acquiring the first physical address of the first data. And then perform subsequent steps at other times when the operating system is idle. For example: and executing subsequent steps when the first application does not execute read-write operation on the external memory. Or, when the first application does not frequently perform the read-write operation on the internal memory, the subsequent steps are performed. Alternatively, the subsequent steps are performed after the first application exits. For example, as shown in fig. 4B, at time T1, the mobile terminal receives an operation of the user to open the application 1. At the time T2, the mobile terminal completely displays the main interface of the application 1. And between the time T1 and the time T2, the mobile terminal acquires an instruction for calling the first data for starting the application 1. Assume that at time T4 the mobile terminal exits application 1. Then, as shown in the figure, the mobile terminal may perform the above step S303 and the following steps after the application 1 exits the application 1. Alternatively, the application terminal may execute the above step S303 and the subsequent steps when the operating system is idle while the application 1 is running.
In other examples, before performing step S304, the mobile terminal may also determine whether the first data is stored in the internal memory according to the obtained logical address of the first data. If the first data is stored in the internal memory, the first data stored in the internal memory may be directly compressed, that is, step S306 is executed. If the internal memory does not store the first data, the physical address of the first data needs to be acquired, so that the first data can be conveniently read from the external memory, that is, step S304 is executed. The embodiment of the present application does not limit this.
In this way, when the first application is started again by the following mobile terminal 100, and the first application does not inquire the first data in the internal memory 121, the second physical address may be inquired according to the logical address of the first data, and the second data may be read from the external memory according to the second physical address, so as to start the first application and display the main interface of the first application.
In one example, the first application may read the second data from the external memory into the page buffer by using a random reading method, and decompress the second data (for example, call a read end function to decompress). The second data are stored in the continuous address space of the external memory, so when the first application reads the second data, the second data can be read in a centralized manner, the number of times of reading the data from the external memory by the first application can be reduced, the data reading speed of the first application can be improved, and the running speed of the first application can be ensured.
In another example, the first application may employ a sequential read method. In the method, when the file system allocates a continuous address space in the external memory for the second data, the file system may record the second data according to a start address of the second data and a size of the second data. Thus, when the file system needs to read the second data from the external memory sequentially, the second data can be read into the internal memory at one time according to the start address and the size of the second data. In some cases, when the size of the second data is large, the file system cannot read the second data at one time, and the second data may be read in multiple times. It can be understood that the file system may reduce the number of times of reading the second data as much as possible to increase the speed of reading the second data and increase the speed of displaying the main interface by the first application.
For example: referring to fig. 5, a segment of memory space in the external memory is shown. It can be seen that the segment of memory space includes physical block # 1 through physical block # 16. The physical blocks 1# to 12# store data of the first application. Physical blocks 13# through 16# are empty. Each physical block is 4KB in size. It should be noted that, in reality, the address of the data of the first application in the external storage space may be discontinuous, and this is only used to illustrate the change before and after compression by the embodiment of the present application.
It is assumed that the physical blocks 1#, 2#, 5#, 9# to 11# are identified as first data of the first application. The first data (24 KB) is compressed, for example with a compression of 50%, resulting in the second data (12 KB), and the second data is written back into the contiguous address space of the external memory space. For example, the second data is written back to physical block # 13 to physical block # 15. The first data may be deleted from the external memory space. Comparing before and after compression, the first application occupies 12 physical blocks in 16 physical blocks of the segment of storage space. After compression, the first application occupies 9 physical blocks out of 16 physical blocks of the segment of storage space. Obviously, the first application after compression occupies less storage space of the external memory.
When the first application is started again, if the internal memory has no first data, the second data can be read from the external memory into the internal memory.
For example: when the mobile terminal 100 reads the second data by using the random reading method, it is only necessary to perform a read operation once to read the data in the physical blocks 13# to 16#. However, in the prior art, when the first data is to be read from the external memory, three read operations are required, i.e., reading the physical blocks 1# to 4#, reading the physical blocks 5# to 8#, and reading the physical blocks 9# to 12#. Obviously, the embodiment of the present application may reduce the number of times the mobile terminal 100 reads the external memory.
Another example is: when the mobile terminal 100 reads the second data by using the sequential reading method, the data in the physical blocks 13# to 15# are read at a time according to the start address of the physical address of the second data and the size of the second data, and the number of times the mobile terminal 100 reads the external memory may also be reduced.
As can be seen from the above, since the mobile terminal 100 compresses the first data in the first application into the second data, and stores the second data in the external memory, the storage space of the external memory occupied by the first application is reduced, and the utilization rate of the external memory is improved.
And the second data is stored in the continuous address space of the external memory, so that when the first application reads the second data, the second data can be read intensively and used for displaying the main interface of the first application. The second data is read in a centralized manner, so that the times of reading the data from the external memory by the first application can be reduced, the data reading speed of the first application can be improved, and the running speed of the first application can be ensured.
In other embodiments of the present application, the mobile terminal may also compress data of the first application other than the first data stored in the external memory. In this way, the first application can further reduce the memory space in the external memory occupied by the first application.
In some examples of this embodiment, when the first data is all data that is called when the mobile terminal displays the main interface, the other data in the first application except the first data is data that needs to be called when the mobile terminal displays other interfaces. It can be understood that, based on the read-ahead mechanism of the file system, after the main interface of the first application is displayed, the mobile terminal reads data of other interfaces in advance. That is, the mobile terminal has started to pre-read data of the other interface when the user does not select to display the other interface. Therefore, compared with the prior art, the read-ahead mechanism makes the extra required decompression time of the mobile terminal when reading other data imperceptible for the user, i.e. the user experience is not affected.
It should be noted that all or part of the data in the first application except the first data may be compressed, which is not limited in the embodiments of the present application, and a specific compression method is also not limited.
In other examples of the embodiment, when the first data is an executable file called when the mobile terminal displays the main interface, in order not to affect the speed of the first application for displaying the main interface, other data in the first application except for the data for displaying the main interface may be compressed. Likewise, the first application can further reduce the memory space in the external memory occupied by the first application, and the user experience is not influenced.
It should be noted that all or part of the data in the first application except the main interface may be compressed, which is not limited in the embodiment of the present application, and a specific compression method is also not limited.
In some embodiments of the present application, after the mobile terminal recognizes the first data of the first application and reads the first data into the internal memory, the first data may be directly allocated to a new physical address, such as a third physical address, in the external memory without being compressed. Wherein the third physical address is a consecutive address. And then, the first data is written back to the address space corresponding to the third physical address in the external memory again. That is, as shown in fig. 6, the present embodiment also provides a method for storing application data, including steps S301 to S304, and steps S601 and S602.
S601, the file system reads the first data from the external memory according to the first physical address.
In this step, reference may be made to the description of the relevant content in step S305, which is not described herein again.
S602, the file system allocates a third physical address with continuous addresses for the first data, and writes the first data into a storage space corresponding to the third physical address in the external memory.
Illustratively, the file system reallocates the storage space with continuous addresses, i.e. the storage space corresponding to the third physical address, for the identified first data in the external memory, and writes the first data back to the newly allocated storage space. Then, the storage space in which the first data is originally stored, that is, the storage space in the external memory corresponding to the first physical address is released. In this embodiment, the first application data stored in the external memory is sorted, and the first data is stored in the continuous address space in the external memory. Compared with the prior art, the first application still occupies the same amount of space in the external memory. However, because the first data is in the continuous address space, when the first application needs to read the first data from the external memory, the reading times can be effectively reduced by adopting a random reading or sequential reading mode, which is beneficial to improving the speed of loading the main interface by the first application. And moreover, the utilization rate of the memory is also favorably improved.
In still other embodiments of the present application, based on the inventive concepts provided by the embodiments of the present application, a developer of an application may also package first data (e.g., data required by a main interface) together when packaging an installation package of the application. When the application program is installed, the first data may be written back to the continuous address space in the external memory after the installation package is decompressed. Therefore, when the subsequent application program is started and the data required by the main interface is read from the external memory, the data required by the main interface can be read in a centralized manner, the times of reading the data from the external memory by the application program can be reduced, the running speed of the application program is favorably improved, and the utilization rate of the internal memory is improved.
Embodiments of the present application further provide a chip system, as shown in fig. 7, the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 may be interconnected by wires. For example, the interface circuit 1102 may be used to receive signals from other devices, such as a memory of the mobile terminal 100. Also for example, the interface circuit 1102 may be used to send signals to other devices, such as the processor 1101. Illustratively, the interface circuit 1102 may read instructions stored in the memory and send the instructions to the processor 1101. The instructions, when executed by the processor 1101, may cause the mobile terminal to perform the various steps performed by the mobile terminal 100 (e.g., a handset) in the embodiments described above. Of course, the chip system may further include other discrete devices, which is not specifically limited in this embodiment of the present application.
It is to be understood that the above-mentioned terminal and the like include hardware structures and/or software modules corresponding to the respective functions for realizing the above-mentioned functions. Those of skill in the art will readily appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
In the embodiment of the present application, the terminal and the like may be divided into functional modules according to the method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, the division of the modules in the embodiment of the present invention is schematic, and is only one logic function division, and another division manner may be available in actual implementation.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application, in essence or part of the technical solutions contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: flash memory, removable hard drive, read only memory, random access memory, magnetic or optical disk, and the like.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A method of storing application data, comprising:
in response to receiving a first instruction for starting a first application, starting the first application by the mobile terminal;
in the process that the mobile terminal starts the first application, the mobile terminal also obtains a first reading request for accessing first data, wherein the first data is all or part of data required by the mobile terminal to start the first application;
after the mobile terminal exits the first application, or when the operating system of the mobile terminal is in an idle state, the mobile terminal further performs the following operations:
the mobile terminal determines a corresponding first physical address of the first data according to the first read request, wherein the first physical address corresponds to a group of storage addresses in an external memory;
the mobile terminal reads the first data from the external memory according to the first physical address, compresses the first data into second data, writes the second data into a storage space corresponding to a second physical address in the external memory, and modifies the relationship of the first data corresponding to the first physical address into the relationship of the first data corresponding to the second physical address; wherein the second physical address corresponds to a set of consecutive memory addresses in the external memory;
the mobile terminal releases the storage space in the external memory corresponding to the first physical address;
responding to a second instruction for starting the first application received by the mobile terminal, and starting the first application again by the mobile terminal;
if the mobile terminal does not access the first data in the internal memory, the mobile terminal determines the second physical address corresponding to the first data according to a second reading request for accessing the first data;
and the mobile terminal reads the second data into the internal memory according to the second physical address.
2. The method according to claim 1, wherein the determining, by the mobile terminal, the first physical address corresponding to the first data according to the first read request includes:
and when the mobile terminal runs the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first reading request.
3. The method according to claim 1, wherein the determining, by the mobile terminal, the first physical address corresponding to the first data according to the first read request includes:
and after the mobile terminal exits from the first application, the mobile terminal determines a corresponding first physical address of the first data according to the first read request.
4. The method according to any of claims 1-3, wherein at least a portion of a set of memory addresses in the external memory corresponding to the first physical address is non-contiguous.
5. The method according to any of claims 1-3, wherein the first data is an executable file that needs to be called to launch the first application, and/or a data fragment in an executable file.
6. The method according to any of claims 1-3, wherein the obtaining of the first read request for accessing the first data by the mobile terminal comprises:
the virtual file system VFS in the mobile terminal acquires a first read request for accessing first data from an internal memory.
7. The method according to any one of claims 1-3, further comprising:
the mobile terminal records the size of the second data;
the mobile terminal reads the second data into the internal memory according to the second physical address, and the method comprises the following steps:
and sequentially reading the second data from the external memory into the internal memory according to the second physical address and the size of the second data.
8. A method according to any of claims 1-3, characterized in that the mobile terminal has started a first application at least once before receiving a first instruction to start the first application.
9. The method according to any one of claims 1-3, further comprising:
the mobile terminal reads other data of the first application except the second data in the external memory into the internal memory;
compressing other data of the first application except the second data, and writing the compressed data into the external memory; modifying the physical address corresponding to other data of the first application except the second data;
and releasing the storage space in the external memory corresponding to the first application except the second data before compression.
10. A mobile terminal, comprising: a processor, a memory and a touch screen, the memory and the touch screen being coupled to the processor, the memory for storing computer program code, the computer program code comprising computer instructions which, when read by the processor from the memory, cause the mobile terminal to carry out the method of storing application data according to any of claims 1-9.
11. A computer-readable storage medium comprising computer instructions which, when run on a terminal, cause the terminal to perform a method of storing application data according to any one of claims 1-9.
12. A chip system comprising one or more processors, the one or more processors when executing instructions to perform a method of storing application data according to any one of claims 1 to 9.
CN201911062009.4A 2019-11-01 2019-11-01 Method for storing application program data and mobile terminal Active CN112783418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911062009.4A CN112783418B (en) 2019-11-01 2019-11-01 Method for storing application program data and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911062009.4A CN112783418B (en) 2019-11-01 2019-11-01 Method for storing application program data and mobile terminal

Publications (2)

Publication Number Publication Date
CN112783418A CN112783418A (en) 2021-05-11
CN112783418B true CN112783418B (en) 2023-03-31

Family

ID=75747309

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911062009.4A Active CN112783418B (en) 2019-11-01 2019-11-01 Method for storing application program data and mobile terminal

Country Status (1)

Country Link
CN (1) CN112783418B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113885785B (en) * 2021-06-15 2022-07-26 荣耀终端有限公司 Data deduplication method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000163302A (en) * 1997-09-30 2000-06-16 Sony Corp External storage device, data processor, and data processing method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1055280A (en) * 1996-08-12 1998-02-24 Kyushu Nippon Denki Software Kk Cartridge software read method
CN101135978B (en) * 2007-03-02 2011-01-19 中兴通讯股份有限公司 Compression version application program generating, executing method and apparatus and applications method and system
JP4886866B2 (en) * 2010-02-10 2012-02-29 株式会社バッファロー Method for speeding up access to main storage device and storage device system
CN104657362B (en) * 2013-11-18 2018-07-10 深圳市腾讯计算机系统有限公司 Data storage, querying method and device
CN105204781B (en) * 2015-09-28 2019-04-12 华为技术有限公司 Compression method, device and equipment
CN107122209A (en) * 2017-04-18 2017-09-01 努比亚技术有限公司 Accelerator and method that terminal starts

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000163302A (en) * 1997-09-30 2000-06-16 Sony Corp External storage device, data processor, and data processing method

Also Published As

Publication number Publication date
CN112783418A (en) 2021-05-11

Similar Documents

Publication Publication Date Title
CN112783564B (en) Method for accelerating starting of application program and electronic equipment
WO2021159746A1 (en) File sharing method and system, and related device
CN113553130B (en) Method for executing drawing operation by application and electronic equipment
CN114461588B (en) Method for adjusting pre-reading window and electronic equipment
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
WO2021093626A1 (en) Memory management method and electronic device
WO2021185352A1 (en) Version upgrade method and related apparatus
CN112947947A (en) Downloading method and distribution method of installation package, terminal equipment, server and system
CN112437341B (en) Video stream processing method and electronic equipment
CN112783418B (en) Method for storing application program data and mobile terminal
CN114253737B (en) Electronic device, memory recovery method thereof and medium
CN112835610A (en) Method and device for constructing application program resource package and terminal equipment
CN114461589B (en) Method for reading compressed file, file system and electronic equipment
CN114489469B (en) Data reading method, electronic equipment and storage medium
CN113590346B (en) Method and electronic equipment for processing service request
CN113485969B (en) Storage fragmentation method and device, terminal and computer storage medium
CN114691248B (en) Method, device, equipment and readable storage medium for displaying virtual reality interface
WO2021238376A1 (en) Function pack loading method and apparatus, and server and electronic device
CN113467821A (en) Application program repairing method, device, equipment and readable storage medium
CN116627855B (en) Memory processing method and related device
WO2023109569A1 (en) File storage method, file access method, electronic device, and storage medium
WO2024045841A1 (en) Storage method and apparatus, and electronic device
CN116266159A (en) Page fault exception handling method and electronic equipment
CN114168115A (en) Communication system, application downloading method and device
CN117632446A (en) Method for managing memory and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant