CN116263760A - File storage method, file access method, electronic device and storage medium - Google Patents

File storage method, file access method, electronic device and storage medium Download PDF

Info

Publication number
CN116263760A
CN116263760A CN202111539019.XA CN202111539019A CN116263760A CN 116263760 A CN116263760 A CN 116263760A CN 202111539019 A CN202111539019 A CN 202111539019A CN 116263760 A CN116263760 A CN 116263760A
Authority
CN
China
Prior art keywords
file
installation package
data
compressed
electronic device
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.)
Pending
Application number
CN202111539019.XA
Other languages
Chinese (zh)
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 Device Co Ltd
Original Assignee
Huawei Device 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 Device Co Ltd filed Critical Huawei Device Co Ltd
Priority to CN202111539019.XA priority Critical patent/CN116263760A/en
Priority to PCT/CN2022/136787 priority patent/WO2023109569A1/en
Publication of CN116263760A publication Critical patent/CN116263760A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1727Details of free space management performed by the file system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application provides a file storage method, a file access method, electronic equipment and a storage medium, and relates to the technical field of information, wherein the method comprises the following steps: acquiring an installation package file; decompressing the operation library compressed file in the installation package file to obtain an operation library file corresponding to the operation library compressed file; recording the corresponding relation and the first offset, and releasing one or more data blocks of the compressed file of the operation library in the installation package file; the corresponding relation is used for representing the corresponding relation between one or more data blocks of the operation library compressed file in the installation package file and the operation library file, and the first offset is used for representing the offset of one or more data blocks of the operation library compressed file in the installation package file. The method provided by the embodiment of the application can save the space occupied by the installation package file, thereby improving the storage efficiency.

Description

File storage method, file access method, electronic device and storage medium
Technical Field
The embodiment of the application relates to the technical field of information, in particular to a file storage method, a file access method, electronic equipment and a storage medium.
Background
With the development of mobile internet technology, terminal devices are indispensable in people's work, life and entertainment, and a great number of terminal device applications are continuously emerging. The application types are numerous, and the application covers the aspects of work and life such as office, entertainment, social, shopping, financial and the like. After a user uses the terminal equipment for a long time, a large number of applications are installed, and the comprehensive requirements of personal daily life and work are met. The application installed on the terminal equipment occupies a part of the storage space of the terminal equipment and stores various files required by the running of the application.
The Android system is a mobile operating system and is widely applied to terminal equipment such as mobile phones, tablets, televisions and the like. The terminal equipment comprises a storage device such as a flash memory and the like and is used for storing instructions and data files which are needed to be used in the running process of the application. The application program generally does not directly access the storage device, but sends requests of file creation, read-write operation to a file system module (such as f2fs and ext 4) in the operating system, and the file system further selects a data storage position to interact with the storage device. The file system uses an inode data structure to manage the saved files, one for each file. Each inode has a unique number. The inode has recorded therein a logical data block address on the storage device where file data is stored.
Android system interfaces running on terminal equipment such as mobile phones, flat panels and televisions are different, but the application installation modes all follow a common flow: the application developer issues an APK format installation package file, the terminal operating system unpacks the APK file, and files in the package are stored in the terminal equipment. An APK file is a packaged file based on the JAR format, which is designed and defined based on the compressed file format ZIP format of the mainstream. Thus, the APK file format is substantially similar to the ZIP compression packet format. The APK file contains various resource files required for running the application, including dex files for storing application instructions, runtime files (extension so files), and data files such as pictures and characters.
The Android system installs the application in the following flow approximately: the application installer of the system unpacks the APK file, stores the running library file stored in the package under the application installation directory, and simultaneously stores the APK file under the application installation directory. The APK file and the operation library file obtained by APK unpacking after installation are stored under the application installation catalog, and the operation library file repeatedly exists: the method is stored in the APK file in a compressed form, and each runtime library file exists independently outside the APK file. Because the content of the database file is frequently used in the starting and running processes of the application, the storage mode can enable the application program to directly read data without decompressing the APK package, thereby accelerating the running efficiency of the application. However, the repeated space usage of the runtime files wastes valuable memory space. Taking 40 applications with larger downloading amount as an example, the repeated storage of the running library files in the APK occupies more than 1GB of storage space in total, which is equivalent to more than 300 photo files with the size of 3 MB.
Disclosure of Invention
The embodiment of the application provides a file storage method, a file access method, electronic equipment and a storage medium, so as to provide a mode for storing an installation package file, and the occupied space of the installation package file in a terminal can be saved, thereby improving the storage efficiency.
In a first aspect, an embodiment of the present application provides a file storage method, including:
acquiring an installation package file;
decompressing the operation library compressed file in the installation package file to obtain an operation library file corresponding to the operation library compressed file;
recording the corresponding relation and the first offset, and releasing one or more data blocks of the compressed file of the operation library in the installation package file; the corresponding relation is used for representing the corresponding relation between one or more data blocks of the operation library compressed file in the installation package file and the operation library file, and the first offset is used for representing the offset of one or more data blocks of the operation library compressed file in the installation package file.
In the embodiment of the application, the position of the compressed file in the installation package is recorded, and after the compressed file is decompressed, the compressed file in the installation package is deleted, so that the occupied space of the installation package file in the terminal can be saved, and the storage efficiency can be improved.
In one possible implementation, the installation package file further includes a data compression file.
In one possible implementation, releasing one or more data blocks of the runtime compressed file in the installation package file includes:
releasing one or more data blocks of all the runtime compressed files in the installation package file.
In the embodiment of the application, the storage space can be saved greatly by releasing all the compressed files.
In one possible implementation, releasing one or more data blocks of the runtime compressed file in the installation package file includes:
releasing one or more data blocks of the partial runtime compressed file in the installation package file.
In the embodiment of the application, the compressed file can be deleted according to the requirement by releasing part of the compressed file, so that the flexibility can be improved.
In one possible implementation manner, the method further includes:
if one or more data blocks store data of the data compression file in the installation package file, the one or more data blocks are not released.
In the embodiment of the application, the data blocks comprising the data of the data compression file can be prevented from being deleted by mistake.
In one possible implementation manner, the method further includes:
Marking the installation package file subjected to data block release; wherein the flag is used to identify that the installation package file has been data block released.
In the embodiment of the application, the situation that the compressed file space cannot be accessed after being released can be avoided.
In a second aspect, an embodiment of the present application further provides a file access method, which is applied to an electronic device, where an application program is installed on the electronic device, and includes:
the application program sends an access request to a file system; the access request is used for accessing one or more released data blocks in the installation package file, and the access request comprises a second offset and a data length;
the file system queries a runtime library file corresponding to the released one or more data blocks;
the file system compresses the operation library file obtained by inquiry to obtain an accessed operation library compressed file;
the file system acquires the first offset, reads the first offset, the second offset and the data length from the compressed file of the accessed operation library, and returns the reading result to the application program.
In a third aspect, an embodiment of the present application provides a file storage device, including: a processor and a memory for storing a computer program; the processor is configured to execute a computer program for performing the method as described in the first aspect.
In a fourth aspect, an embodiment of the present application provides a file access device, including: a processor and a memory for storing a computer program; the processor is configured to run a computer program to perform the method as described in the second aspect.
In a fifth aspect, embodiments of the present application provide an electronic device, including:
a memory for storing computer program code, the computer program code comprising instructions that, when read from the memory by the electronic device, cause the electronic device to perform the method according to the first and second aspects.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, which when run on a computer, causes the computer to perform the methods according to the first and second aspects.
In a seventh aspect, embodiments of the present application provide a computer program for performing the methods of the first and second aspects when the computer program is executed by a computer.
In one possible implementation manner, the program in the seventh aspect may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in part or in whole on a memory not packaged with the processor.
Drawings
Fig. 1 is a schematic hardware structure of an electronic device according to an embodiment of the present application;
FIG. 2 is a flow chart of a file storage method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of file decompression and storage according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of data block release according to an embodiment of the present application;
FIG. 5 is a schematic diagram of partial data block release according to an embodiment of the present disclosure;
fig. 6 is a schematic software structure of an electronic device according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a method for accessing a file according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram of file compression according to an embodiment of the present disclosure;
FIG. 9 is a schematic structural diagram of a file storage device according to an embodiment of the present disclosure;
fig. 10 is a schematic structural diagram of a file access device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Wherein, in the description of the embodiments of the present application, "/" means or is meant unless otherwise indicated, for example, a/B may represent a or B; "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone.
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the embodiments of the present application, unless otherwise indicated, the meaning of "a plurality" is two or more.
With the development of mobile internet technology, terminal devices are indispensable in people's work, life and entertainment, and a great number of terminal device applications are continuously emerging. The application types are numerous, and the application covers the aspects of work and life such as office, entertainment, social, shopping, financial and the like. After a user uses the terminal equipment for a long time, a large number of applications are installed, and the comprehensive requirements of personal daily life and work are met. The application installed on the terminal equipment occupies a part of the storage space of the terminal equipment and stores various files required by the running of the application.
The Android system is a mobile operating system and is widely applied to terminal equipment such as mobile phones, tablets, televisions and the like. The terminal equipment comprises a storage device such as a flash memory and the like and is used for storing instructions and data files which are needed to be used in the running process of the application. The application program generally does not directly access the storage device, but sends requests of file creation, read-write operation to a file system module (such as f2fs and ext 4) in the operating system, and the file system further selects a data storage position to interact with the storage device. The file system uses an inode data structure to manage the saved files, one for each file. Each inode has a unique number. The inode has recorded therein a logical data block address on the storage device where file data is stored.
Android system interfaces running on terminal equipment such as mobile phones, flat panels and televisions are different, but the application installation modes all follow a common flow: the application developer issues an APK format installation package file, the terminal operating system unpacks the APK file, and files in the package are stored in the terminal equipment. An APK file is a packaged file based on the JAR format, which is designed and defined based on the compressed file format ZIP format of the mainstream. Thus, the APK file format is substantially similar to the ZIP compression packet format. The APK file contains various resource files required for running the application, including dex files for storing application instructions, runtime files (extension so files), and data files such as pictures and characters.
The Android system installs the application in the following flow approximately: the application installer of the system unpacks the APK file, stores the running library file stored in the package under the application installation directory, and simultaneously stores the APK file under the application installation directory. The APK file and the operation library file obtained by APK unpacking after installation are stored under the application installation catalog, and the operation library file repeatedly exists: the method is stored in the APK file in a compressed form, and each runtime library file exists independently outside the APK file. Because the content of the database file is frequently used in the starting and running processes of the application, the storage mode can enable the application program to directly read data without decompressing the APK package, thereby accelerating the running efficiency of the application. However, the repeated space usage of the runtime files wastes valuable memory space. Taking 40 applications with larger downloading amount as an example, the repeated storage of the running library files in the APK occupies more than 1GB of storage space in total, which is equivalent to more than 300 photo files with the size of 3 MB.
Based on the above-mentioned problems, the embodiment of the application proposes a file storage method, which is applied to the electronic device 100. The electronic device 100 may be a mobile terminal. A mobile terminal may also be called a terminal device, user Equipment (UE), access terminal, subscriber unit, subscriber station, mobile station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or User Equipment. The mobile terminal may also be a wearable device, e.g., a smart watch, smart bracelet, etc. The embodiment of the present application does not particularly limit the specific form of the electronic device 100 that performs the technical scheme.
An exemplary electronic device provided in the following embodiments of the present application is first described below in conjunction with fig. 1. Fig. 1 shows a schematic configuration of an electronic device 100.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge 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, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity 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 should be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors. In the embodiment of the present application, the processor 110 may receive an image code stream of the rear camera and output a preview image; when the touch sensor 180K detects a specific gesture, adjusting rendering parameters of the preview image or adjusting hardware parameters of the rear camera; and changing shooting parameters adjusted by the gestures on the small screen according to the gestures of the user recognized by the gesture recognition unit.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish 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 the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, such that the processor 110 communicates with the touch sensor 180K through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through 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 to implement a function of answering a call through the 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 for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with 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 an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect the processor 110 to peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (camera serial interface, CSI), display serial interfaces (display serial interface, DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the photographing functions of electronic device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display functionality of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or 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, an I2S interface, a UART interface, an MIPI interface, etc.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically 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 electronic device 100, and may also be used to transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present invention is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge 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 to power 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 configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 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 electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into 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 for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. 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 provided 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 the 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 transmits the demodulated low frequency baseband signal to the 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 sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images 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 module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the 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, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 150 of electronic device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that electronic device 100 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1. In an embodiment of the present application, the electronic device 100 may include a main screen and a small screen, where the main screen may be located on the front side of the electronic device 100, and the small screen may be located on the back side of the electronic device 100. The home screen may be used to display a window of the camera application and may be used to display a preview image. The small screen may be a small screen integrated on the back of the electronic device 100 that displays preview images when the user is self-portrait using a rear-facing camera. In a normal state (e.g., standby state), the small screen may display a clock.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the 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 the 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 onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 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 other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. 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 a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may 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 is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x, y, and z axes) may be determined by 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 the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the detected opening and closing state of the leather sheath or the opening and closing state of the flip, the characteristics of automatic unlocking of the flip and the like are set.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, the electronic device 100 may range using the distance sensor 180F to achieve quick 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 electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object in the vicinity of the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there is no object in the vicinity of the electronic device 100. The electronic device 100 can detect that the user holds the electronic device 100 close to the ear by using the proximity light sensor 180G, so as to automatically extinguish the screen for the purpose of saving power. The proximity light sensor 180G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as 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 for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194. In the embodiment of the present application, the touch sensor 180K may monitor the touch point on the small screen in real time, and perform gesture recognition according to the touch point, so as to determine a touch gesture.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. 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 electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
The file storage method provided in the embodiment of the present application will now be described with reference to fig. 2 to 4.
Fig. 2 is a schematic flow chart of an embodiment of a file storage method according to an embodiment of the present application, where the method includes:
step 201, obtaining an installation package file.
Specifically, the installation package file may be obtained by means of user downloading, user importing, and the like, and the installation package file may be an installation package supported by Android system (Android), for example, an apk file. The installation package file may be an installation package of an application program of the android system. The installation package may be a compressed file, and illustratively, the installation package may include a plurality of runtime library compressed files, wherein each runtime library compressed file may include compressed data corresponding to the runtime library compressed file. It will be appreciated that the installation package may also include other compressed files, such as data compression files for pictures, text, and the like. The installation package file may be stored on a storage device through a file system, where the storage device may be a storage medium such as a flash memory or a magnetic disk, and the type of the storage device is not particularly limited in the embodiments of the present application.
Step 202, decompressing the compressed data of the operation library file in the installation package file to obtain the operation library file.
Specifically, after the installation package file is acquired, the installation package file may be installed. In the installation process, the compressed data of the operation library file in the installation package file can be decompressed, so that the operation library file can be obtained. It will be appreciated that after the installation package file is decompressed, the installation package file and the decompressed runtime library file may be stored in a file system. It should be noted that other compressed files (for example, data compressed files such as pictures and text) in the installation package file may not be decompressed. Since the installation package file is also maintained in the file system, there may be duplicate runtime files stored in the file system at this time, for example, one runtime file exists in the installation package file in compressed form (the installation package file is stored in the file system), and one runtime file of the same content is independently stored in the file system in decompressed form. For example, assuming that the installation package file includes a runtime library compressed file a ', the runtime library compressed file a ' is obtained by compressing the runtime library file a, and when the runtime library compressed file a ' in the installation package file is decompressed, the runtime library file a can be obtained. At this time, duplicate runtime library files, for example, a runtime library compressed file a' and a runtime library file a, are stored in the file system.
Decompression of installation package files is now illustrated in connection with fig. 3. As shown in fig. 3, the installation package file 300 is stored in a file system, where the installation package file 300 includes three compressed runtime library files, namely, a first runtime library compressed file 301, a second runtime library compressed file 302, and a third runtime library compressed file 303. Next, the installation package file 300 is decompressed, so that three runtime library files, for example, a first runtime library file 301', a second runtime library file 302', and a third runtime library file 303', can be obtained, where the first runtime library file 301' is a runtime library file obtained by decompressing the first runtime library compressed file 301, the second runtime library file 302 'is a runtime library file obtained by decompressing the second runtime library compressed file 302, and the third runtime library file 303' is a runtime library file obtained by decompressing the third runtime library compressed file 303. At this time, the file system includes both compressed runtime library files (for example, a first runtime library compressed file 301, a second runtime library compressed file 302, and a third runtime library compressed file 303) and runtime library files (a first runtime library file 301', a second runtime library file 302', and a third runtime library file 303 ') obtained by decompression.
Step 203, recording the corresponding relation between one or more data blocks of the operation library compressed file in the installation package file and the operation library file, and the first offset of one or more data blocks of the operation library compressed file in the installation package file, and releasing one or more data blocks of the operation library compressed file in the installation package file.
Specifically, after the installation package file is decompressed to obtain the runtime package file, a correspondence between one or more data blocks of compressed data of the runtime package file in the installation package file and the runtime package file, and a first offset of one or more data blocks of compressed data of the runtime package file in the installation package file may be recorded. In specific implementation, each compressed file included in the apk file may be scanned according to a format definition of an installation package file (for example, the apk file), and whether the file is a runtime file with a so suffix may be determined according to a file name stored in metadata. For each runtime file, the installation directory of the application may be scanned for a corresponding independently stored runtime file (e.g., first runtime file 301', second runtime file 302', or third runtime file 303' in FIG. 3), and the correspondence between the compressed runtime file and the independently stored runtime file is recorded.
The information such as the correspondence relation and the first offset may be stored in metadata of the installation package file in the inode metadata area of the file system. The correspondence may be used to characterize a correspondence between one or more data blocks of compressed data of all the runtime files in the installation package file and the decompressed runtime file, for example, the correspondence may include an inode number of the runtime file corresponding to one or more data blocks of compressed data of the runtime file in the installation package file. The first offset is used to characterize an offset of a first byte of one or more data blocks of compressed data of the runtime file in the installation package file, for example, the first byte after the compression of the runtime file corresponds to a 1314 th byte of the installation package file.
It should be noted that, the corresponding relationship may record the inode number of the runtime file, where the runtime file may be a runtime file obtained by decompressing the same installation package file, or may be a runtime file with the same content after decompressing the installation package files of other applications. Some of the runtime libraries may be referenced by multiple applications, and thus, there may be runtime library files under the installation catalog of multiple applications that have the same content.
Then, after the information such as the correspondence relationship and the first offset of the one or more data blocks of the compressed data of the runtime library file in the installation package file is recorded, the one or more data blocks of the compressed data of the runtime library file in the installation package file may be released, so that the storage space of the electronic device 100 may be saved. In a specific implementation, the releasing operation may be to set the logical storage address of the corresponding one or more data blocks to 0 in the database index of the installation package file, and reclaim the data blocks, that is, empty the storage space occupied by the data blocks. It will be appreciated that when releasing one or more data blocks, one or more data blocks of compressed data of all of the runtime files in the installation package file may be released, or one or more data blocks of compressed data of a portion of the runtime files in the installation package file may be released.
An exemplary illustration is now provided in connection with fig. 4. As shown in fig. 4, the file system stores an installation package file 300, metadata 310 of the installation package file 300, and a decompressed file set 320. The installation package file 300 includes a plurality of released compressed data and other compressed data, for example, the released compressed data may include first released compressed data 401, second released compressed data 402, and third released compressed data 403, and the other compressed data may include fourth other compressed data 404. The first released compressed data 401 may be a compressed file obtained by releasing a data block in the first compression runtime file 301, the second released compressed data 402 may be a compressed file obtained by releasing a data block in the second compression runtime file 302, and the third released compressed data 403 may be a compressed file obtained by releasing a data block in the third compression runtime file 303. It will be appreciated that the released compressed data stores the compressed data of the runtime file, and the other compressed data stores the compressed data of the data file such as the picture and the text. The decompressed file set 320 includes decompressed runtime files, for example, a first runtime file 301', a second runtime file 302', and a third runtime file 303'. The metadata 310 includes information such as the correspondence 311 and the first offset 312. The correspondence 311 may include an inode number of the first runtime file 301' corresponding to the first release data block 401, an inode number of the first runtime file 302' corresponding to the second release data block 402, and an inode number of the first runtime file 303' corresponding to the third release data block 403. The first offset 312 may include an offset of a first byte of a data block of the first release compressed data 401 in the installation package file 300, an offset of a first byte of a data block of the second release compressed data 402 in the installation package file 300, and an offset of a first byte of a data block of the third release compressed data 403 in the installation package file 300.
Optionally, after recording the correspondence between one or more data blocks of the compressed data of the runtime file in the installation package file and the runtime file, and the first offset of one or more data blocks of the compressed data of the runtime file in the installation package file, the installation package file may be further marked to characterize that the installation package file is a space-saving installation package. Since the storage space is not released at this time, but in order to prevent the behavior of the application program accessing the installation package file while releasing the data block, the file system has not recognized that the installation package file needs special processing, and thus cannot return the compressed database file data, thereby affecting the execution of the application program, the installation package file may be marked first. By presetting the flag, the file system can respond to a read file request of an application even if the free space operation has not been completed.
In addition, when the file system releases one or more data blocks (for example, the compressed runtime file) in the installation package file, since one runtime file may occupy a plurality of consecutive data blocks, and one data block may contain data of different compressed files (for example, data of both the runtime compressed file and the data compressed file), if one data block contains data of different compressed files, the data block of the compressed data of the partially stored runtime file is not released, that is, the file system may release the partial data block of the compressed runtime file to be released, wherein the partial data block contains only the data of the compressed runtime file, does not contain the data of the compressed data file, and does not release the data block containing the data of both the compressed runtime file and the data of the compressed data file. For example, the file system may be configured to process an inode corresponding to an installation package file, and set a logical storage address record of a data block to be released to 0. Then the file system executes the data block recovery operation, so that the released data block can be used by other files, thereby completing space release and further improving space storage efficiency. It should be noted that memory devices typically divide memory cells (e.g., blocks of data) at a granularity of 612 bytes, 4KB, etc. A runtime compressed file may occupy a portion of a storage unit in an installation package file, and the same storage unit may also contain data of other compressed files in the installation package file, that is, in the same data block, may contain data of different compressed files (e.g., a runtime compressed file and a data compressed file). The embodiment of the application does not release the data blocks for partially storing the compressed file data of the operation library.
The manner in which the above-described portion is released will now be exemplarily described with reference to fig. 5. As shown in fig. 5, the runtime compressed file 510 may include four parts of data, such as a first part of data 511, a second part of data 512, a third part of data 513, and a fourth part of data 514, which occupy the first data block 501, the second data block 502, the third data block 503, and the fourth data block 504, respectively. It is understood that each data block may be a memory cell. The first data block 501 further includes a fifth portion 521 of the first other file, and the fourth data block 504 further includes a sixth portion 531 of the second other file, which may be a compressed file of pictures or text (i.e. a compressed file of a non-running library). Since the first data block 501 and the fourth data block 504 include not only the partial data (e.g., the first partial data 511 and the fourth partial data 514) of the compressed file 510 of the runtime library, but also the partial data of other files (e.g., the fifth partial data 521 of the first other file and the sixth partial data 531 of the second other file), the first other file and the second other file are not decompressed, which results in that the data cannot be restored after the fifth partial data 521 and the sixth partial data block 531 are released. Therefore, the data stored in the first data block 501 and the fourth data block 504 cannot be released, that is, the first data block 501 and the fourth data block 504 cannot be released, and only the data stored in the second data block 502 and the third data block 503 cannot be released, so that the release of the partial data blocks of the compressed file 510 of the runtime library can be completed.
It will be appreciated that the foregoing embodiments are illustrated in apk files of the android system, but are not limiting to embodiments of the present application, and in some embodiments, the present application is also applicable to other types of installation package files in the file field. Therefore, the embodiment of the present application does not specifically limit the type of the installation package file.
It should be noted that, in the application scenario of the embodiment of the present application, during the installation process of an application program, an installer may complete operations such as decompression of an installation package file (for example, an apk file), or a system may set up a background working thread, and trigger the above method when the system is idle.
The process of installation package file storage is described above by way of example with reference to fig. 2-5, followed by the process of access to installation package files by way of example with reference to fig. 6-8.
Fig. 6 is a software system architecture diagram of the electronic device 100. The application 600 runs on the electronic device 100, and the electronic device 100 may be equipped with an android system or an operating system based on android, and use apk format files as an application installation package, and after the application is installed, various files (for example, a runtime file) may be stored on the memory device 620. As shown in fig. 6, the storage device 620 is used to store instructions and data files that are needed during the running process of the application program. Specifically, the storage device 620 may store the installation package file (e.g., apk file) itself, as well as the runtime file from which the installation package file was decompressed. The operating system 610 may include a file system 611 and a compression unit 612. The compression unit 612 is configured to compress the runtime library file, so that the runtime library compressed file can be obtained. In addition, the application 600 typically does not directly access the storage device 620, but rather sends a request for a file creation, read and write operation to a file system 611 in the operating system 610. The type of the file system 611 may be f2fs or ext4, and it is understood that the type of the file system 611 may be other types, and the embodiment of the present application does not specifically limit the type of the file system 611. After receiving the above-mentioned request for creating, reading and writing operations, the file system 611 may further select a storage location of the data, and interact with the storage device 620, so that access of the application program may be completed.
Fig. 7 is a schematic flow chart of an embodiment of a file access method provided in the embodiment of the present application, where an application scenario shown in fig. 7 may be application sharing, for example, a user may share an installation package file to another user through an application sharing function in one application. Other application scenarios are possible, for example, a user may access one or more data blocks in an installation package file through an application. The following is an exemplary illustration of accessing one or more data blocks in an installation package file, but is not meant to limit embodiments of the present application. Comprising the following steps:
in step 701, application 600 sends an access request to file system 611 for accessing one or more data blocks that have been released in the installation package file.
In particular, application 600 may send an access request to file system 611 for accessing one or more data blocks that have been released in the installation package file. The access request may include a second offset and a data length of the one or more data blocks being accessed. The second offset is used for representing the offset of the accessed one or more data blocks in the installation package file, and the data length is used for representing the length of the accessed data.
In particular implementations, application 600 may access one or more released data blocks in the installation package file, where the released one or more data blocks may be a runtime compressed file. By way of example, the file system 611 may provide a file read interface, such as a read_data_page (file, offset, size), for transferring file data blocks within a specified range from a memory device to the DRAM, thereby enabling an application to read the file data blocks directly from the DRAM. It will be appreciated that the read operation of a normal file (including an installation package file) goes through the read_data_page interface described above, which is a generic interface.
In step 702, the file system 611 queries the runtime library file corresponding to the released data block being accessed.
Specifically, when the file system 611 receives the access request of the application 600, the second offset of the accessed one or more data blocks in the installation package file may be obtained, and a lookup may be performed in the logical address of the data block recorded in the metadata. If the logical address of the accessed one or more data blocks is 0, it is indicated that the accessed one or more data blocks have been released.
Since the accessed data block or blocks do not contain data (e.g., the data has been released), the file system 611 may query the runtime library file corresponding to the accessed released data block for retrieval of the accessed data. In particular implementations, the file system 611 may query the metadata of the accessed released data block for a correspondence and a first offset. The first offset is used for representing the offset of the compressed runtime file in the installation package file. By comparing the second offset in the access request with the first offset recorded in the metadata, for example, each runtime compressed file contains a first offset, the second offset may be compared with the first offset of each runtime compressed file one by one, and if any one of the runtime compressed files (for example, assuming that the compressed runtime file is a.so) matches the second offset, a corresponding relationship (for example, inode number) corresponding to the runtime compressed file (a.so) may be obtained, and a runtime file corresponding to the accessed released data block may be found by the inode number. When the file system 611 queries the inode number in the metadata, the corresponding runtime file may be obtained according to the inode number.
In step 703, the compression unit 612 compresses the accessed runtime library file to obtain the accessed runtime library compressed file.
Specifically, after the file system 611 acquires the inode number, the compression unit 612 may be instructed to compress the accessed runtime file, thereby obtaining an accessed runtime compressed file, which corresponds to the inode number described above. The compression unit 612 performs a compression algorithm (e.g., a deflate algorithm) that is consistent with the compression algorithm of the installation package file, so that it can be ensured that the compressed runtime library file obtained after the compression of the runtime library file is consistent with the compressed runtime library file in the installation package file, for example, the length and content of the file are consistent. After the accessed runtime library file is compressed, the compressed accessed runtime library compressed file obtained by the compression may be stored in a compressed data buffer, and it may be understood that the compressed data buffer may be used to store the compressed accessed runtime library compressed file obtained by the compression. Therefore, the application program does not need to compress each time of access, the efficiency reduction caused by repeated compression is avoided, the accessed operation library compressed file in the cache can be directly accessed and compressed, and the access efficiency can be improved.
It should be noted that, before executing step 703, for example, after the file system 611 obtains the inode number, it may also query whether the compressed data cache already has the accessed runtime compressed file corresponding to the inode number. If the compressed data cache already contains the accessed runtime library compressed file corresponding to the inode number, the accessed data may be directly obtained from the compressed data cache. If the compressed data cache does not have the accessed runtime compressed file corresponding to the inode number, step 703 may be further performed.
In step 704, the file system 611 reads the compressed file in the accessed runtime according to the first offset, the second offset, and the data length, and returns the read content to the application 600.
Specifically, after the compression unit 612 compresses the accessed runtime library file to obtain the accessed runtime library compressed file, the file system 611 may read the accessed runtime library compressed file according to the first offset, the second offset, and the data length, so that the read content may be obtained. In particular implementations, the file system 611 may read from the location of the second offset-first offset of the compressed file of the accessed runtime, and after reading the accessed data length, obtain the read content. The file system 611 may then return the read content to the application 600.
The above access procedure will now be exemplarily described with reference to fig. 8. As shown in fig. 8, the first runtime compressed file 810 in the installation package file includes four parts of data, which are seventh part of data 811, eighth part of data 812, ninth part of data 813, and tenth part of data 814, respectively. Wherein the seventh portion of data 811 occupies the fifth data block 801, the eighth portion of data 812 occupies the sixth data block 802, the ninth portion of data 813 occupies the seventh data block 803, and the tenth portion of data 814 occupies the eighth data block 804. The fifth data block 801 further includes eleventh portion data 815 of other runtime library files, and the eighth data block 804 further includes twelfth portion data 816 of other runtime library files. Therefore, the fifth data block 801 and the eighth data block 804 are not released. Assuming that the sixth data block 802 and the third data block 803 have been released, if the application accesses the sixth data block 802 at this time, the file system may determine the target runtime file 840 corresponding to the inode number by the second offset 820 in the access request, the first offset 830 in the metadata, and the first correspondence (inode number). It will be appreciated that the first runtime library compressed file 810 is a file stored in the installation package file after the runtime library file corresponding to the inode number is compressed, and the target runtime library file 840 is a file obtained by decompressing the first runtime library compressed file 810, and since a part of the data blocks in the first runtime library compressed file 810 are released, the application program cannot access the first runtime library compressed file 810, and at this time, the target runtime library file 840 needs to be compressed, so that the second runtime library compressed file 850 can be further obtained, and the second runtime library compressed file 850 can be an accessed runtime library compressed file. The compression algorithm performed by the data in the installation package file is consistent with the compression algorithm performed by the compression unit, and thus the second runtime library compressed file 850 is consistent with the length and content of the first runtime library compressed file 810. The file system may then read from the second runtime compressed file 850, e.g., may read from a third offset 860 in the second runtime compressed file 850, where the third offset 860 = the second offset 820-the first offset 830. And after reading the data length L, obtaining the read content, and returning the read content to the application program.
Fig. 9 is a schematic structural diagram of an embodiment of the document storage apparatus of the present application, and as shown in fig. 9, the document storage apparatus 90 may include: an acquisition module 91, a decompression module 92 and a release module 93; wherein, the liquid crystal display device comprises a liquid crystal display device,
an obtaining module 91, configured to obtain an installation package file;
the decompression module 92 is configured to decompress the operation library compressed file in the installation package file to obtain an operation library file corresponding to the operation library compressed file;
the releasing module 93 is configured to record the correspondence and the first offset, and release one or more data blocks of the compressed file of the runtime library in the installation package file; the corresponding relation is used for representing the corresponding relation between one or more data blocks of the operation library compressed file in the installation package file and the operation library file, and the first offset is used for representing the offset of one or more data blocks of the operation library compressed file in the installation package file.
In one possible implementation, the installation package file further includes a data compression file.
In one possible implementation, the releasing module 93 is further configured to release one or more data blocks of all the runtime library compressed files in the installation package file.
In one possible implementation, the releasing module 93 is further configured to release one or more data blocks of a part of the compressed file of the runtime library in the installation package file.
In one possible implementation, the releasing module 93 is further configured to not release the one or more data blocks if the one or more data blocks store the data of the data compressed file in the installation package file.
In one possible implementation manner, the file storage device 90 further includes:
the marking module is used for marking the installation package file subjected to the data block release; wherein the flag is used to identify that the installation package file has been data block released.
Fig. 10 is a schematic structural diagram of an embodiment of the document access apparatus of the present application, and as shown in fig. 10, the document storage apparatus 1000 may include: an access module 1010, a query module 1020, a compression module 1030, and a return module 1040; wherein, the liquid crystal display device comprises a liquid crystal display device,
an access module 1010, configured to send an access request to a file system by an application program; the access request is used for accessing one or more released data blocks in the installation package file, and the access request comprises a second offset and a data length;
a query module 1020 for querying, by the file system, a runtime library file corresponding to the released one or more data blocks;
The compression module 1030 is configured to compress the runtime library file obtained by the query by using the file system to obtain an accessed runtime library compressed file;
and a return module 1040, configured to obtain the first offset by the file system, read the first offset, the second offset, and the data length in the compressed file of the accessed runtime library, and return the read result to the application program.
From the foregoing description of the embodiments, it will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of functional modules is illustrated, and in practical application, the above-described functional allocation may be implemented by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to implement all or part of the functions described above. The specific working processes of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
The functional units in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform 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 disk, read-only memory, random access memory, magnetic or optical disk, and the like.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. A method of storing a file, the method comprising:
acquiring an installation package file;
decompressing the operation library compressed file in the installation package file to obtain an operation library file corresponding to the operation library compressed file;
recording the corresponding relation and the first offset, and releasing one or more data blocks of a compressed file of the operation library in the installation package file; the corresponding relation is used for representing the corresponding relation between one or more data blocks of the operation library compression file in the installation package file and the operation library file, and the first offset is used for representing the offset of one or more data blocks of the operation library compression file in the installation package file.
2. The method of claim 1, wherein the installation package file further comprises a data compression file.
3. The method of claim 1 or 2, wherein said releasing one or more data blocks of a runtime library compressed file in the installation package file comprises:
releasing one or more data blocks of all the runtime library compressed files in the installation package file.
4. The method of claim 1 or 2, wherein said releasing one or more data blocks of a runtime library compressed file in the installation package file comprises:
Releasing one or more data blocks of a part of the compressed file of the operation library in the installation package file.
5. The method according to claim 2, wherein the method further comprises:
and if the one or more data blocks store the data of the data compression file in the installation package file, the one or more data blocks are not released.
6. The method according to any one of claims 1-5, further comprising:
marking the installation package file subjected to data block release; the mark is used for identifying that the installation package file has released the data block.
7. A file access method applied to an electronic device, wherein the electronic device is provided with an application program, the method comprising:
the application program sends an access request to a file system; the access request is used for accessing one or more released data blocks in the installation package file, and the access request comprises a second offset and a data length;
the file system queries a running library file corresponding to the released one or more data blocks;
the file system compresses the operation library file obtained by the inquiry to obtain an accessed operation library compressed file;
And the file system acquires a first offset, reads the first offset, the second offset and the data length from the accessed running library compressed file, and returns a reading result to the application program.
8. An electronic device, comprising: a memory for storing computer program code comprising instructions that, when read from the memory by the electronic device, cause the electronic device to perform the method of any one of claims 1-6 or the method of claim 7.
9. A computer readable storage medium comprising computer instructions which, when run on a computer, cause the computer to perform the method of any of claims 1-7.
CN202111539019.XA 2021-12-15 2021-12-15 File storage method, file access method, electronic device and storage medium Pending CN116263760A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111539019.XA CN116263760A (en) 2021-12-15 2021-12-15 File storage method, file access method, electronic device and storage medium
PCT/CN2022/136787 WO2023109569A1 (en) 2021-12-15 2022-12-06 File storage method, file access method, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111539019.XA CN116263760A (en) 2021-12-15 2021-12-15 File storage method, file access method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN116263760A true CN116263760A (en) 2023-06-16

Family

ID=86723611

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111539019.XA Pending CN116263760A (en) 2021-12-15 2021-12-15 File storage method, file access method, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN116263760A (en)
WO (1) WO2023109569A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289374B (en) * 2011-08-31 2017-06-30 南京中兴新软件有限责任公司 A kind of method and device for building multi-platform software running environment
CN104133695A (en) * 2014-07-15 2014-11-05 珠海金山网络游戏科技有限公司 Manufacture and application method of software client side
JP5925280B2 (en) * 2014-11-04 2016-05-25 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, program, and tape device for erasing files written on tape
CN106325896B (en) * 2015-06-18 2021-05-11 腾讯科技(深圳)有限公司 Shared function library file processing method and device for installation package
CN110941597B (en) * 2018-09-21 2023-10-31 北京奇虎科技有限公司 Method and device for cleaning decompressed file, computing equipment and computer storage medium

Also Published As

Publication number Publication date
WO2023109569A1 (en) 2023-06-22

Similar Documents

Publication Publication Date Title
CN113254409B (en) File sharing method, system and related equipment
CN115757193B (en) Memory management method and electronic equipment
CN114490174B (en) File system detection method, electronic device and computer readable storage medium
CN114116191A (en) Memory cold page processing method and electronic equipment
CN113973398B (en) Wireless network connection method, electronic equipment and chip system
CN114880251B (en) Memory cell access method, memory cell access device and terminal equipment
CN113126948B (en) Audio playing method and related equipment
CN113901485B (en) Application program loading method, electronic device and storage medium
CN114466238B (en) Frame demultiplexing method, electronic device and storage medium
CN116828100A (en) Bluetooth audio playing method, electronic equipment and storage medium
CN116939559A (en) Bluetooth audio coding data distribution method, electronic equipment and storage medium
CN115878500A (en) Memory recovery method and device, electronic equipment and readable storage medium
CN114116610A (en) Method, device, electronic equipment and medium for acquiring storage information
CN116263760A (en) File storage method, file access method, electronic device and storage medium
CN116048769B (en) Memory recycling method and device and terminal equipment
CN116048772B (en) Method and device for adjusting frequency of central processing unit and terminal equipment
CN115993592B (en) Bluetooth ranging method, electronic equipment and storage medium
CN114329595B (en) Application program detection method, device, storage medium and program product
CN116719376B (en) Voltage control method, device, equipment and storage medium
CN115529379B (en) Method for preventing Bluetooth audio Track jitter, electronic equipment and storage medium
CN115460445B (en) Screen projection method of electronic equipment and electronic equipment
CN115941836B (en) Interface display method, electronic equipment and storage medium
CN113704209B (en) Data sharing method, electronic device and storage medium
CN114520870B (en) Display method and terminal
CN114915747B (en) Video call method, electronic device and readable storage medium

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