A version upgrade method and related device
By dividing the user data space into two areas, the problems of long time-consuming version upgrade and data loss in the existing technology are solved, and a faster and safer version upgrade process is achieved.
Patent Information
- Application Number
- CN202010198332.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-19
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-03-19
AI Technical Summary
Existing version upgrade technology is time-consuming and requires moving the metadata storage area when shrinking or expanding user data space, posing the risk of data loss.
By dividing the user data space into two areas, user data space 1 and user data space 2, user data space 2 is logically located behind user data space 1, and system software space is adjacent to user data space 2. When upgrading, only Expand or shrink user data space 2, while user data space 1 position and size remain unchanged, without moving the metadata storage area or modifying its data block address.
This reduces the time for version upgrades, reduces the risk of data loss, and improves user experience.
Smart Images

Figure CN113495744B
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a version upgrade method and related devices. Background Art
[0002] The storage space of a mobile phone includes system software space and user data space. The user data space is used to store user data, such as videos, music, cache files, etc., and the system software space is used to store the installation data of the mobile phone operating system. In addition, the metadata storage area at the header of the user data space is used to store information such as file number, location, creation / modification time, etc. in the user data. The block addresses of all data blocks in the user data area of the user data space are offset addresses relative to the starting address of the metadata storage area. When the operating system of a mobile phone is upgraded, the size of the storage space occupied by the new version will usually expand or shrink relative to the current installed version of the mobile phone. When the mobile phone releases the first version, a certain amount of free space is usually reserved in the system software space to cope with the scenario where subsequent versions increase in size. When the size of the new version increases beyond the reserved space, that is, the storage space occupied by the new version is larger than the current system software space, it will cause the problem of not being able to upgrade.
[0003] At present, there are the following solutions to solve the above problems. When performing a version upgrade, if the storage space occupied by the new version is larger than the current system software space, the user data space can be reduced, thereby releasing part of the user data space to the system software space. However, in the above solution, reducing the user data space requires moving the metadata storage area, that is, changing the starting address of the metadata storage area. Therefore, the above solution needs to modify the block addresses of all data blocks in the user data area, resulting in very slow version upgrades of the above solution.
[0004] In summary, the current version upgrade technology is time-consuming. Summary of the invention
[0005] The embodiments of the present application provide a version upgrade method and related devices, which can effectively shorten the duration of version upgrade.
[0006] In a first aspect, the present application provides a version upgrade method, comprising: an electronic device receives update information, the update information including the capacity of a system software space of a new version of an operating system; wherein the storage space of the electronic device includes a system software space and a user data space, the user data space includes a first user data space and a second user data space, the second user data space is adjacent to the system software space in a physical space, the first user data space includes a metadata storage area and a data area, the metadata in the metadata storage area is used to manage data in the first user data space and the second user data space, the second user data space includes a first space, a starting address of the first space is the same as a starting address of the second user data space, and the second user data space includes a first space The first data block of the user data space is the next data block of the last data block of the first user data space; when the capacity of the new version of the system software space is greater than the current capacity of the system software space, and the free space in the data area of the user data space is greater than the first difference, the electronic device upgrades the operating system to the above-mentioned new version; the upgraded system software space includes the first space, the first difference is equal to the capacity of the new version of the system software space minus the current capacity of the system software space, the capacity of the first space is equal to the first difference, the first data block of the second space after the upgrade is the next data block of the last data block of the first user data space, and the second space is the remaining space in the second user data space before the upgrade except the first space.
[0007] In the embodiment of the present application, the user data space includes a first user data space and a second user data space, the first user data space includes a metadata storage area, the block address of the data block in the user data space is an offset address relative to the starting address of the metadata storage area, and the first data block of the second user data space on the logical address is the next data block of the last data block of the first user data space. During the version upgrade process of the electronic device, if the system software space is insufficient, part of the space of the second user data space can be allocated to the system software space. Since the starting address of the metadata storage area remains unchanged during the above-mentioned version upgrade process, the block address of the data block in the first user data space does not need to be changed. Implementing the embodiment of the present application can effectively shorten the duration of the version upgrade.
[0008] In one implementation, the system software space includes a third space, and the last data block of the third space is the last data block of the system software space. After the above-mentioned electronic device receives the update information, it also includes: when the capacity of the new version of the system software space is less than the current capacity of the system software space, the electronic device upgrades the operating system to the above-mentioned new version; the upgraded second user data space includes the third space, and the capacity of the third space is equal to the current capacity of the system software space minus the capacity of the new version of the system software space, and the first data block of the third space after the upgrade is the next data block of the last data block of the first user data space.
[0009] In the embodiment of the present application, during the version upgrade process of the electronic device, if there is extra free space in the system software space, the free space in the system software space can be allocated to the second user data space. Since the starting address of the metadata storage area remains unchanged during the version upgrade process, the block address of the data block in the first user data space does not need to be changed. The implementation of the embodiment of the present application can effectively reduce the duration of the version upgrade and improve the user experience.
[0010] In one implementation, the data area of the first user data space includes a fourth space, the fourth space does not occupy physical space, the last data block of the fourth space is the last data block of the first user data space, and the metadata storage area includes a first parameter, the first parameter is used to characterize the capacity of the fourth space, and the capacity of the fourth space is less than the current capacity of the system software space.
[0011] In one implementation, before the above-mentioned electronic device upgrades the operating system to a new version, it also includes: the electronic device increases the fourth space and the system software space; the increased system software space includes the first space, the increased capacity of the fourth space is equal to the capacity of the first space, the fifth space is the increased fourth space, and after the fourth space is increased, the last data block of the first user data space is the last data block of the fifth space.
[0012] In an embodiment of the present application, during the version upgrade process of the electronic device, if the system software space is insufficient, the first space of the second user data space can be divided into the system software space, and the fourth space in the first user data space can be increased. The fourth space does not occupy actual physical space and can be understood as a virtual space. Since the increased capacity of the fourth space is equal to the capacity of the first space, the offset address of the data block of the second space other than the first space in the second user data space relative to the metadata storage area will not change, and therefore, there is no need to modify the block address of the second space. It can be understood that moving the metadata storage area and modifying the block address of the data block of the user data space will involve the risk of losing all or part of the user data. The implementation of the embodiment of the present application can further shorten the duration of version upgrades, reduce the risk of data loss, and improve user experience.
[0013] In one implementation, after the electronic device receives the update information, it also includes: the electronic device shrinks the fourth space and the system software space; the shrunken system software space does not include the third space, the reduced capacity of the fourth space is equal to the capacity of the third space, the sixth space is the shrunken fourth space, and after shrinking the fourth space, the last data block of the first user data space is the last data block of the sixth space.
[0014] In the embodiment of the present application, during the version upgrade process of the electronic device, if there is extra free space in the system software space, the free space of the system software space can be allocated to the second user data space, and the fourth space in the first user data space can be reduced. Since the reduced capacity of the fourth space is equal to the capacity of the above-mentioned free space, the offset address of the data block in the original second user data space relative to the metadata storage area will not change, and therefore, there is no need to modify the block address of the data block in the original second user data space. Implementing the embodiment of the present application can further shorten the duration of version upgrades, reduce the risk of data loss, and improve user experience.
[0015] In one implementation, the electronic device increases the fourth space, including: the electronic device modifies the first parameter to the capacity of the fifth space.
[0016] In the embodiment of the present application, the capacity of the fourth space can be increased by modifying the first parameter, and the increased capacity of the fourth space is equal to the capacity of the first space, thereby ensuring that the block address of the data block of the second space does not change.
[0017] In one implementation, the electronic device shrinking the fourth space includes: the electronic device modifying the first parameter to be the capacity of the sixth space.
[0018] In the embodiment of the present application, the capacity of the fourth space can be reduced by modifying the first parameter, and the reduced capacity of the fourth space is equal to the capacity of the third space, thereby ensuring that the block address of the data block of the original second user data space does not change.
[0019] In one implementation, the metadata storage area includes data items S1 to S r , the above S1 to S r S1 to S y Used to identify the validity of the data block in the data area, S1 to S r S x+1 To S y Used to identify the validity of the data block of the fourth space, S1 to S r S y+1 To S r Used to identify the validity of the data block of the second user data space. r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents S i The data block identified is an invalid block, S i Equal to 0 represents S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the above S x+1 To S yare all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
[0020] In one implementation, after the electronic device increases the fourth space, the electronic device further includes: determining the S y+1 To S z All are 1, the above S y+1 To S z Used to characterize the validity of the newly added data blocks in the fourth space.
[0021] In the embodiment of the present application, before the electronic device upgrades the operating system to a new version, the data item S y+1 To S z Before the electronic device upgrades the operating system to a new version, in order to ensure that the block address of the data block in the new second user data space remains unchanged, the electronic device increases the capacity of the fourth space. y+1 To S z Corresponding to the logical data block, the electronic device converts the data item S y+1 To S z All are modified to 1, and the newly added data blocks used to mark the fourth space are all invalid data blocks.
[0022] In one implementation, the third space includes a data blocks, and after the electronic device reduces the fourth space, the electronic device further includes: the electronic device determines the S y-a+1 To S y are all 0, the above S y-a+1 To S y The validity of the data block used to characterize the third space.
[0023] In the embodiment of the present application, before the electronic device upgrades the operating system to a new version, the data item S y-a+1 To S y The data blocks used to identify the fourth space are all invalid data blocks. After the electronic device upgrades the operating system to a new version and reduces the system software space, in order to ensure that the block addresses of the data blocks in the original second user data space remain unchanged, the electronic device reduces the capacity of the fourth space. y-a+1 To S y Corresponding to the logical data block, the electronic device converts the data item S y+1 To S z All are modified to 0, and are used to identify that the data blocks in the third space are all valid data blocks.
[0024] In one implementation, the update information also includes the starting address of the second user data space of the new version and the capacity of the second user data space of the new version. The storage space of the electronic device also includes a partition table, which includes a first address parameter, a first capacity parameter and a second capacity parameter. The first address parameter is used to characterize the starting address of the second user data space, and the first capacity parameter and the second capacity parameter are respectively used to characterize the capacity of the system software space and the second user data space.
[0025] In one implementation, before the above-mentioned electronic device upgrades the operating system to a new version, it also includes the electronic device modifying the first capacity parameter to the first capacity, modifying the second capacity parameter to the capacity of the second user data space of the new version, and modifying the first address parameter to the starting address of the second user data space of the new version, and the starting address of the second user data space of the new version is the same as the starting address of the second space.
[0026] In one implementation, after the above-mentioned electronic device receives the update information, it also includes: the electronic device modifies the first capacity parameter to the first capacity, modifies the second capacity parameter to the capacity of the second user data space of the new version, modifies the first address parameter to the starting address of the second user data space of the new version, and the starting address of the second user data space of the new version is the same as the starting address of the third space.
[0027] In a second aspect, an embodiment of the present application provides an electronic device, including: one or more processors, a memory, a touch screen, and one or more buttons; the memory, the touch screen, and the one or more buttons are coupled to the one or more processors, the memory is used to store computer program codes, the computer program codes include computer instructions, and the one or more processors execute the computer instructions to perform:
[0028] Receive update information, the update information including the capacity of the system software space of the new version of the operating system; wherein the storage space of the electronic device includes the system software space and the user data space, the user data space includes the first user data space and the second user data space, the second user data space is adjacent to the system software space in the physical space, the first user data space includes a metadata storage area and a data area, the metadata in the metadata storage area is used to manage the data in the first user data space and the second user data space, the second user data space includes the first space, the starting address of the first space is the same as the starting address of the second user data space, and the first data block of the second user data space is the next data block of the last data block of the first user data space; when the capacity of the new version of the system software space is greater than the current capacity of the system software space, and the free space of the data area of the user data space is greater than the first difference, the operating system is upgraded to the above-mentioned new version; the upgraded system software space includes the first space, the first difference is equal to the capacity of the new version of the system software space minus the current capacity of the system software space, the capacity of the first space is equal to the first difference, the first data block of the second space after the upgrade is the next data block of the last data block of the first user data space, and the second space is the remaining space in the second user data space before the upgrade except the first space.
[0029] In one implementation, the system software space includes a third space, and the last data block of the third space is the last data block of the system software space. After receiving the update information, the processor is also used to: when the capacity of the new version of the system software space is less than the current capacity of the system software space, upgrade the operating system to the above new version; the upgraded second user data space includes the third space, and the capacity of the third space is equal to the current capacity of the system software space minus the capacity of the new version of the system software space; the first data block of the third space after the upgrade is the next data block of the last data block of the first user data space.
[0030] In one implementation, the data area of the first user data space includes a fourth space, the fourth space does not occupy physical space, the last data block of the fourth space is the last data block of the first user data space, and the metadata storage area includes a first parameter, the first parameter is used to characterize the capacity of the fourth space, and the capacity of the fourth space is less than the current capacity of the system software space.
[0031] In one implementation, before upgrading the operating system to a new version, the processor is also used to: increase the fourth space and the system software space; the increased system software space includes the first space, the increased capacity of the fourth space is equal to the capacity of the first space, the fifth space is the increased fourth space, and after the fourth space is increased, the last data block of the first user data space is the last data block of the fifth space.
[0032] In one implementation, after receiving the update information, the processor is also used to: reduce the fourth space and the system software space; the reduced system software space does not include the third space, the reduced capacity of the fourth space is equal to the capacity of the third space, the sixth space is the reduced fourth space, and after reducing the fourth space, the last data block of the first user data space is the last data block of the sixth space.
[0033] In one implementation, the increasing of the fourth space includes: modifying the first parameter to be the capacity of the fifth space.
[0034] In one implementation, the shrinking of the fourth space includes: modifying the first parameter to be the capacity of the sixth space.
[0035] In one implementation, the metadata storage area includes data items S1 to S r , the above S1 to S r S1 to S y Used to identify the validity of the data block in the data area, S1 to S r S x+1 To S y Used to identify the validity of the data block of the fourth space, S1 to S r S y+1 To S r Used to identify the validity of the data block of the second user data space. r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents S i The data block identified is an invalid block, S i Equal to 0 represents S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the above S x+1 To S y are all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
[0036] In one implementation, after increasing the fourth space, the processor is further configured to: determine the S y+1 To S z All are 1, the above S y+1 To S z Used to characterize the validity of the newly added data blocks in the fourth space.
[0037] In one implementation, the third space includes a data blocks. After the fourth space is reduced, the processor is further configured to: determine the S y-a+1 To S yare all 0, the above S y-a+1 To S y The validity of the data block used to characterize the third space.
[0038] In one implementation, the update information also includes the starting address of the second user data space of the new version and the capacity of the second user data space of the new version. The storage space of the electronic device also includes a partition table, which includes a first address parameter, a first capacity parameter and a second capacity parameter. The first address parameter is used to characterize the starting address of the second user data space, and the first capacity parameter and the second capacity parameter are respectively used to characterize the capacity of the system software space and the second user data space.
[0039] In one implementation, before upgrading the operating system to a new version, the processor is also used to: modify the first capacity parameter to the first capacity, modify the second capacity parameter to the capacity of the second user data space of the new version, modify the first address parameter to the starting address of the second user data space of the new version, and the starting address of the second user data space of the new version is the same as the starting address of the second space.
[0040] In one implementation, after receiving the update information, the processor is also used to: modify the first capacity parameter to the first capacity, modify the second capacity parameter to the capacity of the second user data space of the new version, modify the first address parameter to the starting address of the second user data space of the new version, and the starting address of the second user data space of the new version is the same as the starting address of the third space.
[0041] In a third aspect, an embodiment of the present application provides a computer storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a version upgrade method provided by any one of the implementation methods of the first aspect of the embodiment of the present application.
[0042] In a fourth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes a version upgrade method provided by any one of the implementation methods of the first aspect of the embodiment of the present application.
[0043] It can be understood that the electronic device provided by the second aspect, the computer storage medium provided by the third aspect, and the computer program product provided by the fourth aspect are all used to execute the version upgrade method provided by the second aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the version upgrade method provided by the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application;
[0046] Figures 3 to 5 An exemplary graphical user interface provided for embodiments of the present application;
[0047] Figure 6 A schematic diagram of the structure of a storage space provided in an embodiment of the present application;
[0048] Figure 7 A schematic diagram of the structure of a user data space provided in an embodiment of the present application;
[0049] Figure 8 A schematic diagram of the structure of another user data space provided in an embodiment of the present application;
[0050] Fig. 9 A schematic diagram of the structure of a storage space in a version upgrade process provided in an embodiment of the present application;
[0051] Fig.10 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0052] Fig.11 A schematic diagram of the structure of another storage space provided in an embodiment of the present application;
[0053] Fig.12 A schematic diagram of the structure of another user data space provided in an embodiment of the present application;
[0054] Fig.13 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0055] Fig.14 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0056] Fig.15 A schematic diagram of a process for upgrading a version provided in an embodiment of the present application;
[0057] Figure 16 to Figure 17 An exemplary graphical user interface for version upgrade provided in an embodiment of the present application;
[0058] Fig.18 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0059] Fig.19 An exemplary graphical user interface for version upgrade provided in an embodiment of the present application;
[0060] Fig. 20 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0061] Fig.21 A schematic diagram of the structure of another storage space provided in an embodiment of the present application;
[0062] Fig. 22 A flowchart of another version upgrade method provided in an embodiment of the present application;
[0063] Fig.23 A schematic diagram of the structure of another storage space in a version upgrade process provided in an embodiment of the present application;
[0064] Fig.24 A schematic diagram of the structure of another storage space during a version upgrade process provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0066] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0067] Below, the electronic devices involved in the embodiments of the present application are first introduced. The present application does not specifically limit the types of electronic devices mentioned, and the electronic device 100 can be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer (laptop). Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with iOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer (laptop) with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present application, the electronic device may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel), or a smart TV, etc.
[0068] See also Figure 1 , Figure 1 A schematic structural diagram of an exemplary electronic device 100 provided in an embodiment of the present application is shown.
[0069] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0070] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0071] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0072] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0073] NPU can use Convolutional Neural Networks (CNN) to perform artificial intelligence operations. For example, using CNN models to do a lot of information recognition and information screening can achieve situational intelligence training and recognition.
[0074] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0075] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0076] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0077] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0078] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0079] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0080] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0081] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can 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, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0082] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0083] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0084] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0085] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0086] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0087] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0088] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0089] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0090] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0091] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0092] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0093] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0094] In some embodiments of the present application, the interface content currently output by the system is displayed on the display screen 194. For example, the interface content is an interface provided by an instant messaging application.
[0095] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0096] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0097] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal 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 other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0098] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0099] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0100] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0101] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0102] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0103] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0104] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0105] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0106] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0107] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0108] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0109] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. In some optional embodiments of the present application, the pressure sensor 180A can be used to capture the pressure value generated when the user's finger part contacts the display screen, and transmit the pressure value to the processor so that the processor can identify which finger part the user uses to input the user operation.
[0110] There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. Capacitive pressure sensors can be at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed. In some optional embodiments of the present application, the pressure sensor 180A can transmit the detected capacitance value to the processor so that the processor identifies which finger part (knuckle or fingertip, etc.) the user inputs the user operation. In some optional embodiments of the present application, the pressure sensor 180A may also calculate the number of touch points based on the detected signal, and transmit the calculated value to the processor so that the processor can recognize whether the user inputs the user operation through a single finger or multiple fingers.
[0111] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0112] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0113] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0114] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching, pedometers, etc. In some optional embodiments of the present application, the acceleration sensor 180E can be used to capture the acceleration value generated when the user's finger part contacts the display screen, and transmit the acceleration value to the processor so that the processor can identify which finger part the user uses to input the user operation.
[0115] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0116] 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 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the display screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0117] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0118] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0119] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0120] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch operation refers to the operation of the user's hand, elbow, stylus, etc. contacting the display screen 194. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0121] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
[0122] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0123] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0124] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0125] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, 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.
[0126] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0127] Figure 2 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0128] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0129] The application layer can include a series of application packages.
[0130] like Figure 2 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0131] In the present application, the application layer may also add a floating launcher component, which is used as the default display application in the floating window mentioned above and provides the user with an entry to other applications.
[0132] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0133] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, an activity manager, and the like.
[0134] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the display screen, capture the display screen, etc. In this application, based on Android's native PhoneWindow, a FloatingWindow can be expanded to specifically display the above-mentioned floating window, so as to distinguish it from an ordinary window. The window has the property of being displayed in the top layer of a series of windows. In some optional embodiments, the window size can be given a suitable value according to the actual screen size and the optimal display algorithm. In some possible embodiments, the aspect ratio of the window can be defaulted to the screen aspect ratio of a conventional mainstream mobile phone. At the same time, in order to facilitate users to close, exit, and hide the floating window, an additional close button and a minimize button can be drawn in the upper right corner.
[0135] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0136] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying pictures. In this application, a button view for closing, minimizing, etc. on the floating window can be added accordingly and bound to the FloatingWindow in the above-mentioned window manager.
[0137] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0138] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0139] The notification manager enables the application to display notification information in the status bar 207, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the completion of downloads, message reminders, etc. The notification manager can also be a notification that appears in the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the display screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0140] The activity manager is used to manage the running activities in the system, including processes, applications, services, tasks, etc. In this application, an activity task stack specifically used to manage the application activity displayed in the floating window can be added to the activity manager module to ensure that the application activity and task in the floating window will not conflict with the application displayed in full screen on the screen.
[0141] In this application, the application framework layer can also add a motion detector component (motion detector) to perform logical judgment on the input events obtained and identify the type of input events. For example, through the touch coordinates included in the input event, the timestamp of the touch operation and other information, it can be judged that the input event is a knuckle touch event or a fingertip touch event. At the same time, the motion detection component can also record the trajectory of the input event, determine the gesture rules of the input event, and respond to different operations according to different gestures.
[0142] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0143] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0144] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0145] The system library can include multiple functional modules, such as input manager, input dispatcher, surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0146] The input manager is responsible for obtaining event data from the underlying input driver, parsing and encapsulating it, and then passing it to the input dispatch manager.
[0147] The input dispatch manager is used to store window information. After receiving an input event from the input manager, it will search for a suitable window among the windows it stores and dispatch the event to this window.
[0148] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0149] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0150] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0151] A 2D graphics engine is a drawing engine for 2D drawings.
[0152] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0153] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.
[0154] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer to capture static images or videos through the camera 193.
[0155] The following introduces some exemplary graphical user interfaces for version upgrades of operating systems provided in embodiments of the present application.
[0156] Figure 3 An exemplary user interface 10 on the electronic device 100 for displaying applications installed on the electronic device 100 is exemplarily shown.
[0157] The user interface 10 may include: a status bar 201, a calendar indicator 202, a weather indicator 203, a tray 204 with common application icons, a navigation bar 205, and other application icons. Among them:
[0158] The status bar 201 may include: one or more signal strength indicators 201A of mobile communication signals (also known as cellular signals), an operator name (e.g., "China Mobile") 201B, one or more signal strength indicators 201C of wireless fidelity (Wi-Fi) signals, a battery status indicator 201D, and a time indicator 201E.
[0159] The calendar indicator 202 may be used to indicate the current time, such as date, day of the week, hour and minute information, etc.
[0160] The weather indicator 203 may be used to indicate weather type, such as cloudy to sunny, light rain, etc., and may also be used to indicate information such as temperature.
[0161] The tray 204 with commonly used application icons may display: a phone icon 204A, a contact icon 204B, a text message icon 204C, and a camera icon 204D.
[0162] The navigation bar 205 may include system navigation keys such as a return key 205A, a home screen key 205B, and a multitasking key 205C. When it is detected that the user clicks the return key 205A, the electronic device 100 may display the previous page of the current page. When it is detected that the user clicks the home screen key 205B, the electronic device 100 may display the main interface. When it is detected that the user clicks the multitasking key 205C, the electronic device 100 may display the task that the user recently opened. The naming of each navigation key may also be other, and this application does not limit this. Not limited to virtual keys, each navigation key in the navigation bar 205 may also be implemented as a physical key.
[0163] Other application icons may include, for example, an icon 206 for mutual transmission, an icon 207 for gallery, an icon 208 for music, an icon 209 for applications, an icon 210 for mailboxes, an icon 211 for cloud sharing, an icon 212 for memos, and an icon 213 for settings. The user interface 10 may also include a page indicator 214. Other application icons may be distributed across multiple pages, and the page indicator 216 may be used to indicate which page the user is currently browsing. The user may swipe left and right on the area of other application icons to browse application icons on other pages.
[0164] In some embodiments, Figure 3 The exemplary user interface 10 shown may be a home screen. It is understood that Figure 3 The user interface on the electronic device 100 is merely illustrated as an example and should not constitute a limitation on the embodiments of the present application.
[0165] For example, Figure 4 As shown, the user can click on an icon set on the user interface 10 , and the electronic device 100 detects the user operation. In response to the user operation, the electronic device 100 displays the set user interface 11 .
[0166] The user interface 11 may include: a status bar 301, a navigation bar 302, an application title bar 303, a search box 304, a "Login to Huawei Account" entry 305, a "Wireless and Network" entry 306, a "Device Connection" entry 307, a "Apps and Notifications" entry 308, a "Battery" entry 309, a "Display" entry 310, a "Sound" entry 311, a "Storage" entry 312, a "Security and Privacy" entry 313, a "User and Account" entry 314, and a "System Update" entry 315. Among them:
[0167] The application title bar 303 may be used to indicate that the current page is used to display the setting interface of the electronic device 100. The application title bar 303 may be in the form of text information "settings", an icon or other forms.
[0168] The search box 304 may be used to search for setting items matching characters input by the user.
[0169] The “Log in to Huawei account” entry 305 can receive a user operation (eg, a touch operation). In response to the detected user operation, the electronic device 100 can display a user interface for logging in to a Huawei account.
[0170] Any one of the “Wireless and Network” entry 306, the “Device Connection” entry 307, the “Apps and Notifications” entry 308, the “Battery” entry 309, the “Display” entry 310, the “Sound” entry 311, the “Context Intelligence” entry 312, the “Security and Privacy” entry 313, and the “Users and Accounts” entry 314 may receive a user operation (e.g., a touch operation). In response to the detected user operation, the electronic device 100 may display a setting interface for the entry, which may include one or more setting items.
[0171] The “system update” entry 315 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display a system update setting interface.
[0172] For example, Figure 5 As shown, the user can click on the “system update” item 315 , and in response to the detected user operation, the electronic device 100 displays the setting user interface 12 .
[0173] The user interface 12 may include: a status bar 401, an application title bar 402, a check update control 403, a "new version" item 405, and a "current version" item 405. Among them:
[0174] The check update control 403 can receive a user operation (eg, a touch operation), and in response to the detected user operation, if the current operating system version is not a new version, the electronic device 100 can update the current version to the new version.
[0175] The “New Version” entry 404 may receive a user operation (eg, a touch operation). In response to the detected user operation, the electronic device 100 may display detailed information of the new version, such as the version number, which functions are optimized in the version, and the like.
[0176] The “current version” entry 405 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display detailed information of the current version.
[0177] Usually, after a period of use, the operating system will gradually reveal some vulnerabilities and defects. These vulnerabilities and defects cannot meet the growing needs of users, so it is necessary to regularly or irregularly repair and correct the vulnerabilities and defects of the software itself. In this way, a new version of the operating system is produced to meet new needs. The version upgrade of the operating system refers to improving the vulnerabilities of the operating system, or adding new application functions to the operating system to make the operating system more perfect and easy to use.
[0178] It is worth noting that the success of version upgrades depends on hardware support. For example, the hardware must have sufficient storage space to accommodate the new version of the operating system.
[0179] The following describes the storage space layout of electronic devices. The storage space of electronic devices mainly includes system software space and user data space.
[0180] like Figure 6 As shown, in an embodiment of the present application, a partition table is also included before the system software space. Among them, the partition table is used to store some partition parameters of the storage space, including the starting address of the system software space and the user data space, and the size of the system software space and the user data space. The system software space is used to store relevant data of the operating system installed on the electronic device. The user data space is used to store user data, such as applications, videos, caches and other files. For example, the sizes of the system software space and the user data space are 6GB and 128GB respectively.
[0181] It can be understood that the storage space of the electronic device can be divided into multiple areas, and the partition table is used to record the starting position of each area in the multiple areas and the space size of each area.
[0182] In the embodiment of the present application, the user data space adopts a new open source flash friendly file system (F2FS). Figure 7 The figure shows a schematic diagram of the structure of F2FS provided by an embodiment of the present application. F2FS divides the entire volume into a large number of segments, each segment includes 512 consecutive blocks, the size of each block is fixed at 4KB, and the size of each segment is fixed at 2MB. Each segment contains a segment summary block metadata structure, which describes the owner of each block in the segment, that is, the file to which the block belongs and the offset of the block within the file to which it belongs. A segment summary block can completely store the summary information of 512 blocks.
[0183] The user data space mainly includes the metadata storage area and the data area. Among them, the data area is used to store files and directory structures and their index data. The metadata storage area is used to store information data for managing the data in the data area, such as the file's unique number, location, creation / modification time, etc. These data can be called metadata. The metadata storage area contains the following five parts: superblock (SB), checkpoint (CP), segment information table (SIT), node address table (NAT), and segment summary area (SSA).
[0184] SB describes the file system, the size of the blocks and segments, the root number (i.e. the node number of the root directory file (Node Number), which is fixed at 3), and how much space is allocated to SB, CP, SIT, NAT, and SSA.
[0185] CP contains writable information, which is used to store the total amount of free space, the total amount of stored user data, the address of the next segment to which data will be written, and other modifiable information.
[0186] SIT is mainly used to track whether the data blocks in the data area are valid (including the number of valid blocks in each Segment and the validity of the data blocks). Each 4k SIT Blcok represents the validity of 55 2M Segment areas. If it is determined that there is no valid data in a Segment based on the information in the SIT, the Segment can be recycled, or it can be cleaned when there is little valid data in the Segment.
[0187] It can be understood that if a data block has stored valid user data or is a damaged data block, the data block is an invalid block and new data cannot be written into it; if a data block does not store user data and is not damaged, the data block is a valid block and new data can be written into it.
[0188] For example, Figure 8 As shown, if the data area contains n data blocks D1 to D n , then SIT contains data items S1 to S n Among them, Figure 8 The data item S shown i It is used to identify the validity of the data block Di, i is a positive integer greater than zero and less than or equal to n. iis equal to 1, indicating that the data block Di is an invalid block; if the data item S in SIT i is equal to 0, it means that the data block D i is a valid block.
[0189] It should be noted that, in order to facilitate information management, when a file is stored in the user data space, not only the content of the file is stored, but also the attributes of the file, such as the file size, creation time, block address of the data block where the file content is stored, etc. The block address of a data block refers to the offset address of the data block relative to the start address of the metadata storage area. Therefore, there are two types of data blocks storing the file in the data area, one data block is used to store the attributes of the file, and the other data block is used to store the content of the file.
[0190] NAT records the block address table of data blocks (hereinafter referred to as node blocks for ease of description) corresponding to all nodes in the data area. Each file stored in the data area has a unique node number (Node number) and node block, and the node block is used to store the attributes of the file. Each table entry in NAT is called a Natentry, and each Natentry contains a node number and the block address of the node block of the file corresponding to the node number. The block address table of all node blocks is mapped by NAT, which means that the location of each node is converted by the NAT table. Each 4K NAT Blcok can record the address block information of 455 nodes. It can be understood that the block address of the node block is an offset address relative to the starting address of the metadata storage area.
[0191] SSA contains the owner information of all data and node blocks stored in the data area, and records the offset of each block in the managed segment relative to the node block of the file to which it belongs.
[0192] It should be noted that the size of a data block is 4KB, that is, the length of the data block can be expressed as 0x1000. If the block number of a data block relative to the starting block of the metadata storage area is 0x00009100, then the block address of the data block is 0x009100000. In the embodiment of the present application, for the convenience of description, the block address of the data block can refer to the offset block number relative to the starting block of the metadata storage area, or it can be the offset address relative to the starting address of the metadata storage area, which is not specifically limited here.
[0193] When the operating system of an electronic device is upgraded, the storage space occupied by the new version will usually increase or decrease relative to the currently installed version of the mobile phone. Figure 6As shown, when an electronic device releases its first version, it usually reserves a certain amount of free space in the system software space to cope with the scenario where subsequent versions increase in size. When the size of the new version exceeds the reserved space, that is, the storage space occupied by the new version is larger than the system software space, it will cause the problem of being unable to upgrade. At present, in order to solve the above problem, there are the following solutions: when performing a version upgrade, if the storage space occupied by the new version is larger than the system software space, the user data space can be reduced, thereby releasing part of the user data space to the system software space, such as Fig. 9 In addition, if the storage space occupied by the new version is smaller than the system software space, the system software space can also be reduced, thereby releasing part of the system software space for user data space, such as Fig.10 shown.
[0194] Depend on Fig. 9 and Fig.10 It can be seen that since the metadata storage area is located at the head of the user data space, whether the user data space is expanded or reduced, the metadata storage area needs to be moved. Since the block addresses of the data blocks in the data area are all offset addresses relative to the starting address of the metadata storage area, it is necessary to traverse and modify the block addresses of all data blocks recorded in NAT. This solution has the following two defects.
[0195] Defect 1: Currently, the user data space is large (e.g., 128GB, 256GB) and contains a lot of data. Since shrinking or expanding the user data space requires modifying the block addresses of all data blocks in the data area recorded in NAT, the above solution is very time-consuming. For example, a version upgrade may take up to several hours.
[0196] Defect 2: If there are critical abnormal bad blocks in the user data space, there is a risk of losing all or part of the user data by moving the metadata and modifying the block addresses of all data blocks.
[0197] To solve the above defects, the embodiment of the present application provides a version upgrade method. First, the structure of the storage space used by the version upgrade method provided in the embodiment of the present application is introduced.
[0198] like Fig.11As shown, in an embodiment of the present application, the user data space is divided into two areas, namely user data space 1 and user data space 2. In terms of physical position, user data space 2 is located between the system software space and user data space 1, that is, user data space 2 is adjacent to the system software space. In terms of logical position, user data space 2 is located after user data space 1, that is, the first data block of user data space 2 is the next data block of the last data block of user data space 1. In an embodiment of the present application, user data space 1 and user data space 2 are uniformly managed by a file system, and the upper-level application only sees one file system, that is, there is only one user data space for the upper-level application. User data space 1 includes a metadata storage area and a data area. The metadata storage area at the header of user data space 1 uniformly manages the user data in user data space 1 and user data space 2.
[0199] In the embodiment of the present application, user data space 1 may also be referred to as a first user data space, and user data space 2 may also be referred to as a second user data space, which is not specifically limited here.
[0200] For example, the structure of the user data space is as follows: Fig.12 As shown. Fig.12 It can be seen that if user data space 1 contains data blocks D1 to D x , then the SIT contains data blocks D1 to D x The corresponding data items S1 to S x , where data item Si can be used to identify whether data block Di is valid, i is a positive integer greater than zero and less than or equal to x. If user data space 2 contains data block D x+1 To D n , then SIT contains the data block D x+1 To D n The corresponding data items S x+1 To S n .Depend on Fig.12 It can be seen that the logical position of user data space 2 is located after user data space 1, and the block address of the last data block of user data space 1 is continuous with the block address of the first data block of user data space 2. For example, if the block address of the last data block of user data space 1 is block 1000, the block address of the first data block of user data space 2 is block 1001.
[0201] against Fig.11 The parameters stored in the partition table before the user data space and the system software space shown include the starting addresses of the system software space, user data space 1 and user data space 2, and the capacities of the system software space, user data space 1 and user data space 2.
[0202] In the version upgrade method provided in the embodiment of the present application, based on Fig.12 As shown in the user data space structure, when performing a version upgrade, if the storage space occupied by the new version is larger than the system software space, the user data space 2 can be reduced to the second space, and the first space at the head of the user data space 2 can be released to the system software space, such as Fig.13 If the storage space occupied by the new version is smaller than the system software space, the system software space can also be reduced to release the third space at the end of the system software space to the user data space 2, as shown in Fig.14 shown.
[0203] Depend on Fig.13 and Fig.14 It can be seen that in the version upgrade method provided in the embodiment of the present application, when it is necessary to expand or reduce the user data space, only the user data space 2 needs to be expanded or reduced. The position and size of the user data space 1 remain unchanged, and there is no need to move the metadata storage area, and there is no need to modify the offset address of the data block in the user data space 1. Therefore, this method can reduce the duration of version upgrades and reduce the risk of data loss.
[0204] based on Fig.12 The user data space structure shown in the figure is Fig.15 is a schematic flow chart of a version update method provided in an embodiment of the present application. Fig.15 As shown, the version update method provided in the embodiment of the present application includes but is not limited to steps S201 to S205. The possible implementation of the method embodiment is further described below.
[0205] S201. An electronic device receives an update instruction, where the update instruction is used to instruct to update a current version of an operating system to a new version.
[0206] In some embodiments of the present application, before the electronic device receives an update instruction from the user, it receives update information of a new version sent by the server, and the update information of the new version may include the capacity of the system software space of the new version.
[0207] In some embodiments of the present application, the update information of the new version may include the capacity of the system software space of the new version, the capacity of the user data space 1 of the new version, the capacity of the user data space 2 of the new version, the starting address of the system software space of the new version, the starting address of the user data space 1 of the new version, and the starting address of the user data space 2 of the new version.
[0208] In some embodiments of the present application, the update information of the new version may include the version number of the new version.
[0209] It is understandable that the update information of the new version may refer to the installation package of the new version of the operating system. The installation package may include all files installed by the new version. Relative to the current version, the installation package may also include all patch packages installed by the new version, that is, some files installed by the new version.
[0210] For example, Fig.16 As shown, the user clicks on the update control 403. In response to detecting the above user operation, the electronic device changes the content of the title bar to "System Updating" and executes step S202.
[0211] In some embodiments of the present application, the user triggers an update instruction by clicking an update control.
[0212] The updating instruction is not limited to being triggered by the user's finger clicking the updating control 403, and the updating instruction may also be triggered by other user operations, which are not specifically limited here.
[0213] For example, users can trigger update instructions through gestures.
[0214] Specifically, the first user operation may also be a specific gesture made by the user within the acquisition range of the camera, for example, the above gesture is "making a V shape with the user's hand". The electronic device 100 may collect the gesture input by the user through the camera, and compare the collected gesture with the pre-stored gesture. If the collected gesture is consistent with the pre-stored gesture shape, step S202 is executed.
[0215] For another example, a user can trigger an update instruction through voice.
[0216] Specifically, the electronic device 100 can collect the voice input by the user through the microphone. For example, if the specific content of the voice is "Please upgrade the operating system", the specific content of the collected voice "Please upgrade the operating system" is compared with the pre-stored voice keyword "Upgrade the operating system". If the keywords are consistent and the matching degree of the voice features exceeds a certain threshold, step S202 is executed.
[0217] In some embodiments of the present application, the user may pre-set the automatic upgrade of the operating system version, that is, when the electronic device receives the update information of the new version sent by the server, the electronic device executes step S202.
[0218] S202: The electronic device determines whether the capacity of the new version of the system software space is greater than the current capacity of the system software space.
[0219] It can be understood that when an electronic device downloads update information of a new version, the capacity of the system software space of the new version can be known.
[0220] In the embodiment of the present application, "the capacity of a space" refers to the size of the space occupied by the space.
[0221] S203. When the capacity of the new version of the system software space is greater than the current capacity of the system software space, the electronic device determines whether the total amount of free space in the data area of the user data space is greater than a first difference, where the first difference is the difference between the capacity of the new version of the system software space and the current capacity of the system software space; if greater, execute step S204; if less than or equal to, generate a first prompt message, which is used to remind the user that the storage space is insufficient and the system update has failed.
[0222] It can be understood that if the electronic device determines that the capacity of the new version of the system software space is greater than the current capacity of the system software space, the electronic device can release part of the space at the header of the user data space (i.e., the first space) to the system software space. Before releasing, the electronic device needs to move the valid data in the above-mentioned first space to the remaining data area of the user data space except the first space. The remaining data area of the user data space includes the data area in user data space 2 except the first space and the data area of user data space 1. Therefore, after the electronic device determines that the capacity of the new version of the system software space is greater than the current capacity of the system software space, it is also necessary to determine whether the total amount of free space in the data area except the user data space is greater than or equal to the first difference, that is, whether there is enough space in the data area of the user data space to be released to the system software space, so as to facilitate the electronic device to perform system updates.
[0223] In some embodiments of the present application, the electronic device determines, based on the first difference, a first space to be released to the software space, and the capacity of the first space is equal to the first difference.
[0224] In some embodiments of the present application, the electronic device may obtain the total amount of free space in the data area of the user data space according to the total amount of free space recorded in the CP.
[0225] In some embodiments of the present application, the first prompt information may be presented in the form of text, image, animation, voice, etc.
[0226] For example, Fig.17 As shown, when the total amount of free space in the remaining data area is greater than the total amount of space required for valid data in the first space, the electronic device displays a prompt window 406, which may include a control 407 and a first prompt message. The first prompt message is presented in the form of text, and the content of the first prompt message may include "Insufficient storage space, system update failed!".
[0227] Control 407 may receive a user operation (eg, a touch operation), and in response to the detected user operation, electronic device 100 may close window 406 .
[0228] It is understandable that after the user learns that the system update failure is due to insufficient storage space, the user can clear the storage space to facilitate another system update.
[0229] That is, when the capacity of the new version of the system software space is greater than the current capacity of the system software space, and the total amount of free space in the data area of the user data space is greater than the first difference, the electronic device executes step S204.
[0230] S204. The electronic device moves valid user data in the first space at the header of the user data space 2 to a remaining data area, where the capacity of the first space is equal to the first difference, and the remaining data area is the remaining data area of the user data space excluding the first space.
[0231] In some embodiments of the present application, an electronic device moves valid user data in a first space to a remaining data area, including: the electronic device determines a first data block based on information in an SIT, where the first data block is the first free data block in the remaining data area; the electronic device writes data of a second data block in the first space to the first data block; the electronic device modifies a block address of a data block storing the first data from a block address of the second data block to a block address of the first data block.
[0232] It can be understood that the electronic device writes the data of the second data block into the first data block, that is, the electronic device determines the physical address of the first data block according to the block address of the first data block, and writes the data of the second data block into the storage location corresponding to the above physical address.
[0233] The implementation method of moving the valid user data in the first space to the remaining data area is not limited to the above, and there may be other moving methods, which are not specifically limited here.
[0234] It should be noted that the second data block may be a node block storing file attributes, or a data block storing file contents.
[0235] In some embodiments of the present application, if the above-mentioned second data block is a node block storing file attributes, the above-mentioned electronic device modifies the block address of the data block storing the first data from the block address of the second data block to the block address of the first data block, including: the electronic device queries the SSA for the first file number of the file to which the first data in the second data block belongs according to the block address of the second data block; the electronic device queries the NAT for the first table entry recording the first file number, and the above-mentioned first table entry records the block address of the node block of the file to which the first data belongs; since the block address of the above-mentioned node block is the same as the block address of the second data block, the electronic device determines that the second data block is a node block; the electronic device modifies the block address of the node block in the first table entry to the block address of the first data block.
[0236] In some embodiments of the present application, if the second data block may be a data block storing file content, the electronic device modifies the block address of the data block storing the first data from the block address of the second data block to the block address of the first data block, including: the electronic device queries the SSA for the first file number of the file to which the first data in the second data block belongs according to the block address of the second data block; the electronic device queries the NAT for the first table entry recording the first file number, the first table entry records the block address of the node block of the file to which the first data belongs, the block address of the node block is different from the block address of the second data block, the first data is the file content, and the node block records the block address of the data block storing the first data; the electronic device modifies the block address of the data block storing the first data in the node block to the block address of the first data block.
[0237] S205: The electronic device releases the first space to the system software space.
[0238] In some embodiments of the present application, the electronic device releases the first space to the system software space, including: the electronic device modifies the first capacity parameter in the partition table to the capacity of the new version of the system software space, modifies the second capacity parameter to the capacity of the new version of the user data space 2, and modifies the first address parameter to the starting address of the new version of the user data space 2 in the user data space 2; the starting address of the new version of the user data space 2 is equal to the starting address of the second space, the capacity of the new version of the system software space is equal to the space capacity of the original software version plus the capacity of the first space, and the capacity of the new version of the user data space 2 is equal to the capacity of the second space. The second space is the remaining space in the user data space 2 after removing the first space. The first capacity parameter in the partition table is used to indicate the capacity of the system software space, the second capacity parameter is used to indicate the capacity of the user data space 2, and the second address parameter is used to indicate the starting address of the user data space 2.
[0239] It can be understood that by modifying the partition parameters in the partition table, the starting position and space capacity of each partition can be changed.
[0240] S206: The electronic device modifies a block address of a data block in a second space, where the second space is the remaining space in the user data space 2 except the first space.
[0241] In some embodiments of the present application, Fig.18 As shown, the user data space 2 includes a first space and a second space, and the first space includes a user data block D x+1 To D y , the second space includes user data block D y+1 To D n , data item S in SIT x+1 To S y Used to identify data block Dx+1 To D y If the space required for the software version upgrade is larger than the current system software space, during the version upgrade, the electronic device can release the first space of the user data space 2 to the system software space. After releasing the first space to the system software space, the electronic device needs to modify the block address of the data block in the second space recorded in NAT. In addition, the data item S x+1 To S y No longer used to indicate the data block D in the first space x+1 To D y The validity of the data item S x+1 Applicable to indicate D y+1 The validity of data item S x+2 Applicable to indicate D y+2 Therefore, the electronic device also needs to modify the corresponding SIT data items according to the validity of the data blocks in the second space.
[0242] It should be noted that after the electronic device modifies the block address of the data block in the second space, Fig.18 As shown, the data item S x+1 To S n The first ny data items in are used to identify the validity of the data block in the second space. The data item S x+1 To S n The last yx data items in the data block are in an idle state and no longer indicate the validity of the data block. The electronic device can delete the last yx data items.
[0243] It can be understood that the block addresses of the data blocks in the user data space are offset addresses relative to the start address of the metadata storage area. After the first space is released to the system software space, the data blocks in the first space no longer belong to the user data space 2. The first data block in the second space becomes the first data block in the user data space 2, and the first data block in the second space becomes the next data block of the last data block in the user data space 1 in terms of the logical address. Therefore, after the first space is released to the system software space, the block addresses of the data blocks in the second space recorded in the NAT need to be modified.
[0244] It can be understood that if the first data block in the second space stores data, the physical storage location of the data does not change. Modifying the block address of the first data block can satisfy the mapping relationship between the logical location and the physical location of the data block after releasing the first space.
[0245] In some embodiments of the present application, the first space includes F data blocks, and the above-mentioned modification of the block address of the data block in the second space recorded in NAT includes: the electronic device queries the second file number of the file to which the second data in the third data block of the second space belongs in SSA; the electronic device queries the second table item with the second file number recorded in NAT, and the second table item records the block address of the node block of the file to which the third data block belongs; if the block address of the above-mentioned node block is the same as the block address of the third data block, then the third data block is determined to be a node block, and the electronic device shifts the block address of the node block in the second table item forward by F blocks; if the block address of the above-mentioned node block is not the same as the block address of the third data block, then the block address of the data block storing the second data is recorded in the above-mentioned node block, and the electronic device queries the node block according to the block address of the above-mentioned node block, and shifts the block address of the data block of the second data stored in the node block forward by F blocks. For example, if the original block address of the third data block is 1000 blocks offset relative to the starting block of the metadata storage area, the block address of the third data block is modified to 1000-F blocks.
[0246] It can be understood that the electronic device modifies the block addresses of the data blocks in the second space recorded in the NAT, that is, traverses and modifies the block addresses of the data blocks containing valid data in the second space.
[0247] S207: The electronic device upgrades the current version of the operating system to a new version, and the upgraded system software space includes the first space.
[0248] For example, Fig.19 As shown, the user clicks the update control 403. In response to detecting the above user operation, the electronic device changes the content of the title bar to "System Updating" and performs a version upgrade. After the version upgrade is successful, a window 408 is displayed, and the window 408 includes a second prompt message. The content of the second prompt message may include "System Update Successful". The version upgrade method proposed in the embodiment of the present application greatly reduces the duration of the version upgrade. Fig.19 The version upgrade process shown may take only tens of seconds.
[0249] In some embodiments of the present application, after step S202, the version update method provided by the embodiments of the present application may further include steps S208 to S210.
[0250] S208: When the capacity of the new version of the system software space is smaller than the current capacity of the system software space, the electronic device upgrades the current version of the operating system to the new version.
[0251] S209 , the electronic device releases the third space at the end of the system software space to the user data space 2 .
[0252] In an embodiment of the present application, the upgraded user data space 2 includes a third space, the capacity of the third space is equal to the capacity of the original system software space minus the capacity of the new version of the system software space, and the first data block of the third space after the upgrade is the next data block of the last data block of the user data space 2.
[0253] In some embodiments of the present application, the electronic device releases the third space at the end of the system software space to the user data space, including: the electronic device modifies the first capacity parameter in the partition table to the capacity of the new version of the system software space, modifies the second capacity parameter to the capacity of the new version of the user data space 2, modifies the second address parameter to the starting address of the new version of the user data space 2, the starting address of the new version of the user data space 2 is equal to the starting address of the third space, and the capacity of the new version of the user data space 2 is equal to the capacity of the original user data space 2 plus the capacity of the third space.
[0254] It should be noted that since the software version installation data is written in order from front to back in the system software space, the third space does not store valid software version installation data. Therefore, the electronic device can directly release the third space at the end of the system software space to the user data space without cleaning up the data in the third space.
[0255] In the embodiment of the present application, when the capacity of the new version of the system software space is less than the current capacity of the system software space, the electronic device can release the free space in the free system software space to the user data space immediately after the version is upgraded; the electronic device can also release the free space in the free system software space to the user data space only after the version is upgraded and the available space of the user data space is insufficient. The embodiment of the present application does not specifically limit this.
[0256] S210: The electronic device modifies block addresses of data blocks in the first space and the second space.
[0257] In some embodiments of the present application, Fig. 20 As shown, the user data space 2 includes a user data block D x+1 To D y If the space required for the software version upgrade is smaller than the current system software space, after the version upgrade, the third space in the system software space can be released to the user data space 2. If the third space includes data block D g To D g +a, the new user data space 2 will include D x+1 To D y , and D g To D g+a, and the electronic device needs to modify the block address of the data block in the original user data space 2 recorded in the NAT, and the original user data space 2 includes the first space and the second space.
[0258] It can be understood that after the electronic device releases the third space in the system software space to the user data space 2, the first block of the third space becomes the first block of the expanded user data space 2, and the first data in the third space on the logical address becomes the next data block of the last data block in the user data space 1. In order to meet the continuity of the block number in the block address table, the offset address of the data block in the original user data space 2 needs to be added to the total number of data blocks in the third space. Therefore, the block addresses of the data blocks in the first space and the second space recorded in the NAT need to be modified. For example, Fig. 20 As shown, the third space contains a data blocks, and the original block address of the first data block in the first space of the user data space 2 is offset by 1000 blocks relative to the starting block of the metadata storage area. Then the block address of the first data block in the above first space is modified to 1000+a blocks.
[0259] In some embodiments of the present application, the above-mentioned modification of the block addresses of the data blocks in the first space and the second space recorded in the NAT can refer to the modification of the block addresses of the data blocks in the second space recorded in the NAT in the aforementioned embodiment, which will not be repeated here.
[0260] In some embodiments of the present application, Fig. 20 As shown, the user data space 2 includes a first space and a second space, and the first space includes a user data block D x+1 To D y , the second space includes user data block D y+1 To D n , data item S in SIT x+1 To S y Used to identify data block D x+1 To D y After the electronic device releases the third space to the user data space 2, the electronic device needs to modify the block addresses of the data blocks in the first space and the second space. In addition, the data item S x+1 To S x+a No longer used to indicate data block D x+1 To D x+a The validity of data item S x+1 To S x+a The data block D used to indicate the third space g To D g+a In addition, the data item S x+a+1 Will be used to indicate data block D x+1 The validity of data item S x+a+2 Will be used to indicate data block D x+2Therefore, the electronic device also needs to modify the corresponding SIT data items according to the validity of the data blocks of the first space and the second space.
[0261] It can be understood that the data item S n Will be used to indicate data block D n-a To ensure the effectiveness of the data item Sn in SIT, it is necessary to add data item S after data item Sn in SIT. n+1 To S n+a , data item S n+1 To S n+a Used to indicate data block D n-a+1 To D n effectiveness.
[0262] Fig.13 The version upgrade method shown does not need to move the metadata storage area, and does not need to modify the offset address of the data block in the user data space 1, which can reduce the duration of the version upgrade and reduce the risk of data loss. However, the above method needs to modify the block address of the data block in the original user data space 2. This is because in terms of logical position, the user data space 2 and the user data space 1 are logically continuous.
[0263] therefore, Fig.13 The time consumption of the version upgrade method shown still needs to be further optimized, and there is still a risk of user data loss during the version upgrade process. In order to further reduce the time of version upgrade and avoid the risk of data loss, the embodiment of the present application also provides a version upgrade method.
[0264] First, another structure of user data space to which the method is applied is introduced. In the embodiment of the present application, a virtual invalid data area is added to the user data space. The virtual invalid data area is a virtual logical space and does not occupy an actual physical space. The virtual invalid data area contains a virtual data block. The virtual invalid data area is after user data space 1 and before user data space 2 in terms of logical address. For example, Fig.21 As shown, user data space 1 includes user data blocks D1 to D x , data blocks D1 to D x The corresponding block addresses are d1 to d x ; The virtual invalid data area includes the virtual data block D x+1 To D y , data block D x+1 To D y The corresponding block addresses are d x+1 to d y ; User data space 2 contains user data block D y+1 To D r , data block D y+1 To D r The corresponding block addresses are dy+1 to d r In addition, if Fig.21 As shown, the SIT also contains virtual data blocks D x+1 To D y The corresponding data item S x+1 To S y , data item S x+1 To S y All are marked as invalid.
[0265] In the embodiment of the present application, the starting address and the virtual space capacity of the virtual invalid data area can be recorded in the SB or CP. Accordingly, by modifying the space capacity of the virtual invalid data area recorded in the SB or CP, the size of the virtual invalid data area can be changed.
[0266] It should be noted that, since the data blocks in the virtual invalid data area are all marked as invalid data blocks, the virtual invalid data area will not be written. In addition, since the virtual invalid data area is a virtual logical space and does not occupy actual physical space, the virtual invalid data area cannot store data, and the virtual invalid data area cannot be read. Therefore, the space used by the user data returned by the upper layer needs to be reduced by the space size of the virtual invalid data area. In the embodiment of the present application, the initial space size of the virtual invalid data area is usually less than or equal to the initial size of the system software space.
[0267] It can be understood that the virtual invalid data area is a concept introduced for ease of understanding and does not exist in the actual physical space.
[0268] based on Fig.21 The user data space structure shown in the figure is Fig. 22 FIG. 1 is a schematic flow chart of another version update method provided in an embodiment of the present application. Fig. 22 As shown, the version update method provided in the embodiment of the present application includes but is not limited to steps S301 to S307. The possible implementation of the method embodiment is further described below.
[0269] S301. An electronic device receives an update instruction, where the update instruction is used to instruct to update a current version of an operating system to a new version.
[0270] S302: The electronic device determines whether the capacity of the new version of the system software space is greater than the current capacity of the system software space.
[0271] S303. When the capacity of the new version of the system software space is greater than the current capacity of the system software space, the electronic device determines whether the total amount of free space in the data area of the user data space is greater than a first difference, where the first difference is the difference between the capacity of the new version of the system software space and the current capacity of the system software space; if greater, execute step S204; if less than or equal to, generate a first prompt message, which is used to remind the user that the storage space is insufficient and the system update has failed.
[0272] S304. The electronic device moves valid user data in the first space at the header of the user data space 2 to a remaining data area, where the capacity of the first space is equal to the first difference, and the remaining data area is the remaining data area of the user data space excluding the first space.
[0273] S305: The electronic device releases the first space to the system software space.
[0274] S306. Increase the virtual invalid data area, set the data item used to identify the validity of the first space data block to an invalid mark, and the increased capacity of the virtual invalid data area is equal to the capacity of the first space.
[0275] In some embodiments of the present application, Fig.23 As shown, the user data space 2 includes a first space and a second space, and the first space includes a user data block D y+1 To D z , the second space includes user data block D z+1 To D r , data item S in SIT y+1 To S z Used to identify data block D y+1 To D z If the space required for the software version upgrade is larger than the current system software space, during the version upgrade, the electronic device can release the first space of the user data space 2 to the system software space. After releasing the first space to the system software space, the electronic device increases the space capacity of the virtual invalid data area, and the increased space capacity of the virtual invalid data area is equal to the capacity of the first space. The data block D in the first space y+1 To D z The corresponding SIT data item S y+1 To S z All are set to 1. Data item S x+1 To S y No longer used to indicate the validity of the data block in the first space, the data item S y+1 To S z It can be used to indicate the validity of the newly added data block in the virtual invalid data area.
[0276] It can be understood that the block addresses of the data blocks in the user data space are all offset addresses relative to the starting address of the metadata storage area. After the first space is released to the system software space, the data blocks in the first space no longer belong to the user data space 2. The first data block in the second space becomes the first data block in the user data space 2, and the first data block in the second space becomes the next data block of the last data block in the virtual invalid data area in terms of the logical address. In order not to change the offset address of the data block in the second space relative to the starting address of the metadata storage area, the electronic device increases the space capacity of the virtual invalid data area, and the increased space capacity of the virtual invalid data area is equal to the capacity of the first space, that is, the total amount of virtual data blocks added in the virtual invalid data area is equal to the total amount of data blocks in the first space. In this way, it can be ensured that the block addresses of the data blocks in the second space will not change, and after the electronic device releases the first space to the system software space, there is no need to modify the block addresses of the data blocks in the second space.
[0277] That is to say, after the electronic device increases the virtual invalid data area, it determines S y+1 To S z Both are 1, S y+1 To S z It can be used to characterize the validity of the newly added data blocks in the virtual invalid data area.
[0278] S307: The electronic device upgrades the current version of the operating system to a new version, and the upgraded system software space includes the first space.
[0279] In an embodiment of the present application, the virtual invalid data area can also be understood as a part of the user data space 1, and the last data block of the virtual invalid data area is the last data block of the user data space 1, and the capacity of the user data space 1 is smaller than the current capacity of the system software space.
[0280] In the embodiment of the present application, the virtual invalid data area may also be referred to as the fourth space at the end of the user data space 1.
[0281] In some embodiments of the present application, before an electronic device updates a current version of an operating system to a new version, the electronic device increases the virtual invalid data area and the system software space, and the increased system software space includes a first space, and the increased capacity of the virtual invalid data area is equal to the first difference; the fifth space is the increased virtual invalid data area, and after the virtual invalid data area is increased, the last data block of the user data space 1 is the last data block of the fifth space.
[0282] In some embodiments of the present application, the virtual invalid data area is increased, that is, the space capacity of the virtual invalid data area recorded in the metadata storage area is modified to the capacity of the fifth space.
[0283] In the embodiment of the present application, the specific implementation method of steps S301 to S305 can refer to the optional embodiments of steps S201 to S205, which will not be repeated here.
[0284] In some embodiments of the present application, after step S302, the version update method provided by the embodiments of the present application may further include steps S308 to S309.
[0285] S308: When the capacity of the new version of the system software space is smaller than the current capacity of the system software space, the electronic device updates the current version of the operating system to the new version.
[0286] S309: The electronic device releases the third space at the end of the software version to the user data space 2, and reduces the virtual invalid data area, the reduced capacity of the virtual invalid data area being equal to the capacity of the third space.
[0287] like Fig.24 As shown, if the third space includes data block D g To D g+1 , the electronic device converts the data item S corresponding to the virtual data block in SIT x+1 To S y The last term in S y-a+1 To S y ) data item is set as valid flag, data item S y-a+1 To S y Will be used to identify data block D g To D g+1 effectiveness.
[0288] In some embodiments of the present application, Fig.24 As shown, the user data space 2 includes a user data block D y+1 To D r If the space required for the software version upgrade is smaller than the current system software space, after the version upgrade, the third space in the system software space can be released to the user data space 2. If the third space includes data block D g To D g+a , then the new user data space 2 will include D y+1 To D r , and D g To D g+a After releasing the third space in the system software space to the user data space 2, the electronic device reduces the space capacity of the virtual invalid data area, and the reduced space capacity of the virtual invalid data area is equal to the capacity of the third space. The SIT data item S corresponding to the last a data blocks in the virtual invalid data area is y-a+1 To S y are all set to 0. The data item S corresponding to the last a data blocks mentioned above y-a+1 To S yNo longer used to indicate the validity of data blocks in the virtual invalid data area, data item S y-a+1 To S y Will be used to indicate the validity of the data block of the third space.
[0289] It can be understood that after the electronic device releases the third space in the system software space to the user data space 2, the first block of the third space becomes the first block of the expanded user data space 2, and the first data in the third space on the logical address becomes the next data block of the last data block in the virtual invalid data area. In order not to change the offset address of the data block of the original user data space 2 relative to the starting address of the metadata storage area, the electronic device reduces the space capacity of the virtual invalid data area, and the reduced space capacity of the virtual invalid data area is equal to the capacity of the third space, that is, the total amount of virtual data blocks reduced in the virtual invalid data area is equal to the total amount of data blocks in the third space. In this way, it can be ensured that the block address of the data block in the original user data space 2 will not change, and after the electronic device releases the third space to the user data space 2, there is no need to modify the block address of the data block in the original user data space 2. The original user data space 2 refers to the original user data space 2 before release.
[0290] That is, after the electronic device reduces the virtual invalid data area, it determines S y-a+1 To S y Both are 1, S y-a+1 To S y It can be used to characterize the validity of data blocks in the third space.
[0291] In an embodiment of the present application, the virtual invalid data area can also be understood as a part of the user data space 1, and the last data block of the virtual invalid data area is the last data block of the user data space 1, and the capacity of the user data space 1 is smaller than the current capacity of the system software space.
[0292] In some embodiments of the present application, after the electronic device receives update information, the electronic device shrinks the virtual invalid data area and the system software space. The shrunken system software space does not include the third space, and the shrunken capacity of the virtual invalid data area is equal to the capacity of the third space; the sixth space is the shrunken virtual invalid data area, and after the virtual invalid data area is shrunken, the last data block of the first user data space is the last data block of the sixth space.
[0293] In some embodiments of the present application, the virtual invalid data area is reduced, that is, the space capacity of the virtual invalid data area recorded in the metadata storage area is modified to the capacity of the sixth space.
[0294] To sum up, when implementing the embodiments of the present application, there is no need to move the metadata storage area, nor to modify the offset addresses of the data blocks of user data space 1 and user data space 2, which greatly reduces the duration of version upgrades and the risk of data loss, and effectively improves the user experience.
[0295] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0296] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0297] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.
[0298] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A version upgrade method, It is characterized in that include: An electronic device receives update information, wherein the update information includes the capacity of a system software space of a new version of an operating system; wherein the storage space of the electronic device includes the system software space and a user data space, the user data space includes a first user data space and a second user data space, the second user data space is adjacent to the system software space in a physical space, the first user data space includes a metadata storage area and a data area, the metadata in the metadata storage area is used to manage data in the first user data space and the second user data space, the second user data space includes a first space, a starting address of the first space is the same as a starting address of the second user data space, and a first data block of the second user data space is a next data block of a last data block of the first user data space; When the capacity of the new version of the system software space is greater than the current capacity of the system software space, and the free space in the data area of the user data space is greater than the first difference, the electronic device upgrades the operating system to the new version; the upgraded system software space includes the first space, the first difference is equal to the capacity of the new version of the system software space minus the current capacity of the system software space, the capacity of the first space is equal to the first difference, the first data block of the second space after the upgrade is the next data block of the last data block of the first user data space, and the second space is the remaining space in the second user data space before the upgrade except the first space.
2. The method according to claim 1, It is characterized in that The system software space includes a third space, the last data block of the third space is the last data block of the system software space, and after the electronic device receives the update information, the electronic device further includes: When the capacity of the new version of the system software space is smaller than the current capacity of the system software space, the electronic device upgrades the operating system to the new version; the second user data space after the upgrade includes the third space, the capacity of the third space is equal to the current capacity of the system software space minus the capacity of the new version of the system software space, and the first data block of the third space after the upgrade is the next data block of the last data block of the first user data space.
3. The method according to claim 1 or 2, It is characterized in that The data area of the first user data space includes a fourth space, the fourth space does not occupy physical space, the last data block of the fourth space is the last data block of the first user data space, the metadata storage area includes a first parameter, the first parameter is used to characterize the capacity of the fourth space, and the capacity of the fourth space is less than the current capacity of the system software space.
4. The method according to claim 3, It is characterized in that Before the electronic device upgrades the operating system to the new version, the electronic device further includes: The electronic device increases the fourth space and the system software space; the increased system software space includes the first space, the increased capacity of the fourth space is equal to the capacity of the first space, the fifth space is the increased fourth space, and after the fourth space is increased, the last data block of the first user data space is the last data block of the fifth space.
5. The method according to claim 3, It is characterized in that After the electronic device receives the update information, the electronic device further includes: The electronic device reduces the fourth space and the system software space; the reduced system software space does not include the third space, the last data block of the third space is the last data block of the system software space, the reduced capacity of the fourth space is equal to the capacity of the third space, the sixth space is the reduced fourth space, and after reducing the fourth space, the last data block of the first user data space is the last data block of the sixth space.
6. The method according to claim 4, It is characterized in that The electronic device enlarges the fourth space, including: The electronic device modifies the first parameter to the capacity of the fifth space.
7. The method according to claim 5, It is characterized in that The electronic device reduces the fourth space, including: The electronic device modifies the first parameter to the capacity of the sixth space.
8. The method according to claim 4, It is characterized in that The metadata storage area includes data items S 1 To S r , the S 1 To S r S 1 To S y The S 1 To S in Sr x+1 To S y The S 1 To S r S y+1 To S r is used to identify the validity of the data block of the second user data space, the S 1 To S r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents the S i The data block identified is an invalid block, and the S i Equal to 0 represents the S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the S x+1 To S y are all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
9. The method according to claim 8, It is characterized in that After the electronic device increases the fourth space, the electronic device further includes: The electronic device determines the S y+1 To S z are all 1, the S y+1 To S z Used to characterize the validity of the newly added data block in the fourth space.
10. The method according to claim 5, It is characterized in that The metadata storage area includes data items S 1 To S r , the S 1 To S r S 1 To S y The S 1 To S in Sr x+1 To S y The S 1 To S r S y+1 To S r is used to identify the validity of the data block of the second user data space, the S 1 To S r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents the S i The data block identified is an invalid block, and the S i Equal to 0 represents the S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the S x+1 To S y are all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
11. The method according to claim 10, It is characterized in that The third space includes a data blocks, and after the electronic device reduces the fourth space, the electronic device further includes: The electronic device determines the S y-a+1 To S y are all 0, the S y-a+1 To S y Used to characterize the validity of the data block of the third space.
12. An electronic device, It is characterized in that include: One or more processors, memory, touch screen, one or more buttons; The memory, the touch screen, and the one or more buttons are coupled to the one or more processors, the memory is used to store computer program codes, the computer program codes include computer instructions, and the one or more processors execute the computer instructions to perform: receiving update information, the update information including the capacity of the system software space of the new version of the operating system; wherein the storage space of the electronic device includes the system software space and the user data space, the user data space includes a first user data space and a second user data space, the second user data space is adjacent to the system software space in the physical space, the first user data space includes a metadata storage area and a data area, the metadata in the metadata storage area is used to manage the data in the first user data space and the second user data space, the second user data space includes a first space, the starting address of the first space is the same as the starting address of the second user data space, and the first data block of the second user data space is the next data block of the last data block of the first user data space; When the capacity of the new version of the system software space is greater than the current capacity of the system software space, and the free space in the data area of the user data space is greater than the first difference, the operating system is upgraded to the new version; the upgraded system software space includes the first space, the first difference is equal to the capacity of the new version of the system software space minus the current capacity of the system software space, the capacity of the first space is equal to the first difference, the first data block of the second space after the upgrade is the next data block of the last data block of the first user data space, and the second space is the remaining space in the second user data space before the upgrade except the first space.
13. The electronic device according to claim 12, It is characterized in that The system software space includes a third space, the last data block of the third space is the last data block of the system software space, and the processor is further configured to: When the capacity of the new version of the system software space is smaller than the current capacity of the system software space, the operating system is upgraded to the new version; the second user data space after the upgrade includes the third space, the capacity of the third space is equal to the current capacity of the system software space minus the capacity of the new version of the system software space, and the first data block of the third space after the upgrade is the next data block of the last data block of the first user data space.
14. The electronic device according to claim 12 or 13, It is characterized in that The data area of the first user data space includes a fourth space, the fourth space does not occupy physical space, the last data block of the fourth space is the last data block of the first user data space, the metadata storage area includes a first parameter, the first parameter is used to characterize the capacity of the fourth space, and the capacity of the fourth space is less than the current capacity of the system software space.
15. The electronic device according to claim 14, It is characterized in that Before upgrading the operating system to the new version, the processor is further configured to: Increase the fourth space and the system software space; the increased system software space includes the first space, the increased capacity of the fourth space is equal to the capacity of the first space, the fifth space is the increased fourth space, and after increasing the fourth space, the last data block of the first user data space is the last data block of the fifth space.
16. The electronic device according to claim 14, It is characterized in that After receiving the update information, the processor is further configured to: Reduce the fourth space and the system software space; the reduced system software space does not include the third space, the last data block of the third space is the last data block of the system software space, the reduced capacity of the fourth space is equal to the capacity of the third space, the sixth space is the reduced fourth space, and after reducing the fourth space, the last data block of the first user data space is the last data block of the sixth space.
17. The electronic device according to claim 15, It is characterized in that The increasing the capacity of the fourth space includes: Modify the first parameter to the capacity of the fifth space.
18. The electronic device according to claim 16, It is characterized in that It is characterized in that The reducing the fourth space includes: Modify the first parameter to the capacity of the sixth space.
19. The electronic device according to claim 15, It is characterized in that The metadata storage area includes data items S 1 To S r , the S 1 To S r S 1 To S y The S 1 To S in Sr x+1 To S y The S 1 To S r S y+1 To S r is used to identify the validity of the data block of the second user data space, the S 1 To S r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents the S i The data block identified is an invalid block, and the S i Equal to 0 represents the S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the S x+1 To S y are all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
20. The electronic device according to claim 19, It is characterized in that After increasing the fourth space, the processor is further configured to: determine the S y+1 To S z are all 1, the S y+1 To S z Used to characterize the validity of the newly added data block in the fourth space.
21. The electronic device according to claim 16, It is characterized in that The metadata storage area includes data items S 1 To S r , the S 1 To S r S 1 To S y The S 1 To S in Sr x+1 To S y The S 1 To S r S y+1 To S r is used to identify the validity of the data block of the second user data space, the S 1 To S r S y+1 To S z Used to identify the validity of the data block of the first space; wherein, S i Equal to 1 represents the S i The data block identified is an invalid block, and the S i Equal to 0 represents the S i The data block represented is a valid block, i is a positive integer greater than zero and less than or equal to r, and the S x+1 To S y are all equal to 1, x, y, z and r are all positive integers, x is greater than 1, y is greater than x, z is greater than y, and r is greater than z.
22. The electronic device according to claim 21, It is characterized in that The third space includes a data blocks, and after reducing the fourth space, the processor is further configured to: Determine the S y-a+1 To S y are all 0, the S y-a+1 To S y Used to characterize the validity of the data block of the third space.
23. A computer storage medium, It is characterized in that The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 11.
24. A computer program product, It is characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 11.
