Patch installation method and device and storage medium

By detecting the upgrade status of the patch after the electronic device is restarted and displaying notifications, the problem of difficulty in determining the successful upgrade in multi-partition devices is solved, and the reliability of patch installation and normal operation of the device is achieved.

CN120276743AActive Publication Date: 2025-07-08HONOR DEVICE CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311856516.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-08
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

In the case where multiple partitions exist in the electronic device, it is difficult to determine whether the currently activated partition is upgraded successfully, resulting in the system crashing and unable to continue running when the patch installation fails.

Method used

After the electronic device restarts, detect the upgrade status of the patch and display notifications of successful or failed upgrades in the display interface, and roll back the failed partitions to ensure that the patch versions of all partitions are consistent.

Benefits of technology

Users can promptly know the patch installation status and roll back when it fails to ensure that the electronic equipment is operating normally and does not affect user use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276743A_ABST
    Figure CN120276743A_ABST
Patent Text Reader

Abstract

The invention provides a patch installation method and device and a storage medium, and is applied to the technical field of computers. After electronic equipment is restarted, the upgrade state of a patch is detected; when the upgrading state is upgrading ending, patch installation results of all the partitions are obtained; when the patch installation result of each partition indicates that the partition where the patch is successfully installed exists, displaying an upgrade notification of successful upgrade corresponding to the patch on a display interface; and when the patch installation result of each partition indicates that the partition with the successfully installed patch does not exist, displaying an upgrade notification of upgrade failure corresponding to the patch on a display interface, and performing rollback processing on the patch of each partition, so that the version of the patch of each partition is returned to the version before upgrade. According to the application, under the condition that a plurality of partitions exist in the electronic equipment, the patch installation result of each partition is obtained by calling the update engine module, and the upgrade notification corresponding to the patch installation result is displayed on the display interface, so that a user can conveniently obtain the patch installation result in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a patch installation method, device, and storage medium. Background Art

[0002] A patch package is a software update program used to repair vulnerabilities and problems in an electronic device's system. It usually contains a series of repair programs to optimize performance, address known security vulnerabilities, or other system errors.

[0003] Currently, the system storage space of an electronic device can be divided into multiple partitions. When a patch package to be installed is detected, the electronic device can use one of the partitions in the storage space to install the patch package to be installed to complete system upgrade, and the remaining partitions can be used to support the normal operation of the electronic device.

[0004] Since there are multiple partitions in the electronic device, even if there is a partition where the patch installation fails, the electronic device can still operate normally. In this case, it is difficult to determine whether the currently active partition has been successfully upgraded. Summary of the Invention

[0005] This application provides a patch installation method, device, and storage medium.

[0006] To achieve the above object, this application adopts the following technical solutions:

[0007] In a first aspect: This application provides a patch installation method. After the electronic device is restarted, the upgrade status of the patch is detected; when the upgrade status is upgrade completed, the patch installation results of each partition of the electronic device are obtained; when the patch installation results of each partition indicate that there is a partition where the patch is successfully installed, an upgrade notification corresponding to the patch and indicating successful upgrade is displayed on the display interface; when the patch installation results of each partition indicate that there is no partition where the patch is successfully installed, an upgrade notification corresponding to the patch and indicating failed upgrade is displayed on the display interface, and rollback processing is performed on the patches of each partition to roll back the patch version of each partition to the version before the upgrade.

[0008] The patch installation method provided by this application can display the upgrade notification corresponding to the patch on the display interface after obtaining the patch installation result, so that the user can know whether the patch is installed. In the case of patch installation failure, the user can reinstall the patch in a timely manner under the prompt. At the same time, by performing rollback processing on the patches of each partition, the electronic device can operate normally without affecting the user's use.

[0009] In a possible implementation, when the upgrade result is upgrade completed and the upgrade status is upgrade ended, determine the partition synchronization call status; when the partition synchronization call status is partition synchronization call successful, obtain the patch installation results of each partition of the electronic device as processing partition successful and upgrade successful, and the patch installation results of each partition indicate that the patches are installed successfully in each partition.

[0010] In a possible implementation, when the upgrade result is upgrade failed and the upgrade status is upgrade ended, determine the partition synchronization call status; when the partition synchronization call status is partition synchronization call successful, obtain the patch installation result file generated by the update engine module; parse the patch installation result file to obtain the patch installation results of each partition of the electronic device.

[0011] In a possible implementation, parse the patch installation result file according to the file format corresponding to the update engine module to obtain the patch installation results of each partition of the electronic device.

[0012] In a possible implementation, parse the patch installation result file to obtain the partition failure flag in the patch installation result file; according to the partition failure flag in the patch installation result file, obtain the patch installation results of each partition of the electronic device.

[0013] In a possible implementation, when there is a partition failure flag in the patch installation result file, obtain the patch installation results of each partition of the electronic device as processing partition failed and upgrade successful, and the patch installation results of each partition indicate that the patches are installed successfully in at least one partition and failed in at least one partition.

[0014] In a possible implementation, when there is no partition failure flag in the patch installation result file, determine that the patch installation results of each partition of the electronic device are upgrade failed, and the patch installation results of each partition indicate that there is no partition with successful patch installation.

[0015] In a possible implementation, when the upgrade status is upgrade ended, the patch installation results of each partition of the electronic device can be obtained based on the function of obtaining patch installation results. In the embodiments of the present application, the patch installation results can be directly obtained based on the function of obtaining patch installation results, without relying on parsing the patch installation result file in a conventional file format, realizing decoupling from the update engine module and improving the efficiency of obtaining patch installation results.

[0016] In a possible implementation, after the electronic device is restarted and before detecting the upgrade status of the patch, the patch can be decompressed to the target partition in each partition, and then in response to the installation instruction selected by the user, install the patch in the target partition; after the installation of the patch is completed, in response to the restart instruction of the user, restart the electronic device.

[0017] Second aspect: The present application provides an electronic device, which includes: a processor and a memory; the memory is used to store program codes and transmit the program codes to the processor; the processor is used to execute the steps of a patch installation method as described above according to the instructions in the program codes.

[0018] Third aspect: The present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a patch installation method as described above are implemented. Description of the Drawings

[0019] Figure 1 It is a flowchart of a patch installation method provided by an embodiment of the present application;

[0020] Figure 2 It is a schematic diagram of a system update prompt provided by an embodiment of the present application;

[0021] Figure 3 It is a schematic diagram of installing a patch provided by an embodiment of the present application;

[0022] Figure 4 It is a schematic diagram of partition synchronization provided by an embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of an upgrade result notification provided by an embodiment of the present application;

[0024] Figure 6 It is a flowchart of the first method for obtaining a patch installation result provided by an embodiment of the present application;

[0025] Figure 7 It is a flowchart of the second method for obtaining a patch installation result provided by an embodiment of the present application;

[0026] Figure 8 It is a software structure block diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments

[0027] Terms such as "first", "second", and "third" in the specification, claims, and drawings of the present application are used to distinguish different objects, rather than to limit a specific order.

[0028] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.

[0029] Whether it is a system or software, there will inevitably be many factors that are not taken into account by technicians during the development process. Over time, vulnerabilities may gradually emerge. When a vulnerability is discovered, in order to ensure the stability and security of the system or software, and at the same time not affect the user's use, corresponding patches can be compiled for the exposed vulnerabilities so as to use the patches to repair the corresponding vulnerabilities or perform system upgrades.

[0030] When installing a patch in an electronic device with only one storage space, if the patch installation fails, it may cause the system to crash and unable to continue running, affecting the user's use. To avoid the problem of system failure caused by patch installation failure, currently in some electronic devices, the storage space is divided into multiple partitions. When it is detected that there is a patch package to be installed, the electronic device can use one partition in the storage space to install the patch package to be installed to complete the system upgrade, and the remaining partitions can be used to support the normal operation of the electronic device. Since there are multiple partitions in the electronic device, even if there is a partition where the patch package installation fails, the electronic device can still run normally. In this case, it is difficult to determine whether the currently active partition has been successfully upgraded.

[0031] Based on this, the present application provides a patch installation method. After the software update application extracts the patch package to the target partition among multiple partitions, the electronic device is restarted, and the patch is loaded during the restart process of the electronic device. After the electronic device restarts, the software update application can obtain the patch installation result through the update engine module (update_engine). After the software update application obtains the patch installation result, it can notify the user of the message whether the patch is installed successfully, so as to prompt the user to reinstall the patch in time in case of patch installation failure.

[0032] In some embodiments, the electronic device may be a mobile phone, a tablet computer, a desktop type, a laptop, a notebook computer, an Ultra-mobile Personal Computer (UMPC), a handheld computer, a netbook, a Personal Digital Assistant (PDA), a wearable electronic device, a smart watch and other devices. The present application does not make special restrictions on the specific forms of the above electronic devices.

[0033] The following combines Figures 1-7 to introduce the patch installation method provided by the present application. As Figure 1 shown, this figure is a flowchart of a patch installation method provided by an embodiment of the present application, including S101 - S111.

[0034] S101. There is a patch package in the cloud server.

[0035] Patches are generally designed to fix vulnerabilities or to optimize the performance of electronic devices. For example, according to the size of their impact, they can be divided into patches for high-risk vulnerabilities, patches for software security updates, optional patches for high-risk vulnerabilities, and functional update patches.

[0036] S102: A software update application of the electronic device detects a patch package.

[0037] The software update application of the electronic device can detect in real time or periodically whether there is a patch package in the cloud server. When the software update application detects the patch package, S103 can be executed, and the software update application of the electronic device downloads the patch package.

[0038] After detecting the patch package, the software update application may download the patch package. Exemplarily, the software update application may download the patch package to a designated target partition so that the patch package can be loaded later.

[0039] There may be multiple partitions in the electronic device, and the target partition may be a system default partition or a partition pre-specified by the user. Whenever a new version of a patch package is available, the patch package may be downloaded to the target partition first, so that the patch installation is completed in the target partition first.

[0040] S104: The electronic device decompresses the patch package to obtain the decompressed patch package.

[0041] For example, after downloading the patch package, the software update application can decompress the patch package by calling the update engine module (update_engine) to obtain the decompressed patch package. Among them, update_engine is the core module in the patch installation process, which is mainly responsible for controlling the entire upgrade process.

[0042] S105: The update engine module notifies the system software update application that the decompression is complete. After receiving the message that the patch package decompression is complete, the system software update application may execute S106: restart the electronic device.

[0043] Exemplarily, in an embodiment of the present application, a system update window may be popped up in a display interface through a software update application to prompt a user to restart the electronic device, or the electronic device may be automatically restarted according to the user's settings.

[0044] like Figure 2As shown in the figure, this is a schematic diagram of a system update prompt provided by an embodiment of this application. When the software update application detects a patch package and decompresses the downloaded patch package to a specified target partition, a system update window 1101 can pop up on the display interface of the electronic device. In one example, the text prompt "An important patch is required. It is recommended to repair it as soon as possible" can be displayed in the system update window 1101 to prompt the user that there is a patch package to be installed. If the user is not convenient to install the patch package at present, the user can select the "Later" button 1102; if the user needs to install the patch package immediately, the user can select the "Install Now" button 1103.

[0045] Exemplarily, if the user selects the "Later" button 1102, the system update window 1101 will temporarily disappear. In one possible implementation, the software update application can detect whether the patch package is installed at intervals of a preset prompt time. When it detects that the patch package has not been installed, the system update window 1101 can be popped up again on the current display interface of the electronic device to prompt the user that the patch package has not been installed, and the user can re-select whether to install the patch package.

[0046] In one example, the preset prompt time can be selected by the user. Exemplarily, after the user selects the "Later" button 1102, a preset prompt time selection window can pop up on the display interface. Preset delayed prompt times are provided in the preset prompt time selection window for the user to select, and the user is also supported to customize the delayed prompt time.

[0047] In another example, the electronic device can determine the preset prompt time according to the type of the patch to prompt the user to restart the electronic device. Exemplarily, the patches can be divided into patches for high-risk vulnerabilities, patches for software security updates, optional high-risk vulnerability patches, and other and functional update patches, etc. Among them, high-risk vulnerabilities may be exploited by Trojans and viruses and should be repaired immediately; patches for software security updates are used to repair serious security vulnerabilities of some popular software and it is recommended to repair them immediately; optional high-risk vulnerability patches may cause the electronic device and software to malfunction after installation; other and functional update patches are mainly used to update the functions of the system or software.

[0048] The preset prompt time corresponding to the patch for high-risk vulnerabilities is the first interval time, the preset prompt time corresponding to the patch for software security updates is the second interval time, the preset prompt time corresponding to the optional high-risk vulnerability patch is the third interval time, and the preset prompt time corresponding to other and functional update patches is the fourth interval time. The electronic device can, based on the type of the patch, after the user selects the "Later" button 1102, prompt the user to restart the electronic device after an interval of the preset prompt time corresponding to the type of the patch. Exemplarily, since high-risk vulnerabilities may be exploited by Trojans and viruses, in order to complete the patch installation as soon as possible, compared with other types of patches, a smaller first interval time can be set to increase the frequency of prompting the user to restart the electronic device.

[0049] If the user selects the "Install Now" button 1103, the electronic device responds to the installation instruction selected by the user and can then display the installation progress interface 1201, as Figure 3 shown. This figure is a schematic diagram of installing a patch provided by an embodiment of the present application. Exemplarily, an installation progress ball 1202 is displayed in the installation progress interface 1201. When the installation progress shown by the installation progress ball 1202 reaches 100%, "Installation Complete" will be displayed inside the installation progress ball, and at the same time, an "Immediately Restart" button 1203 will be displayed below the installation progress ball 1202.

[0050] In a possible implementation manner, the user can click the "Immediately Restart" button 1203 to issue a restart instruction, triggering the electronic device to restart.

[0051] In a possible implementation manner, the electronic device can determine whether to restart the electronic device according to the time when the patch package is installed. Exemplarily, if the time when the patch package is installed belongs to the first time period, the electronic device automatically restarts; if the time when the patch package is installed belongs to the second time period, after the installation of the patch package is completed, the installation progress interface 1201 is exited, and the electronic device is automatically triggered to restart after entering the first time period. Among them, the first time period can be at night or a time period when the user uses the electronic device less frequently; the second time period can be during the day or a time period when the user uses the electronic device more frequently. It should be noted that the first time period and the second time period can also be set by the user according to their own needs, and the present application embodiment does not make specific limitations on the first time period and the second time period.

[0052] In a possible implementation, the electronic device can determine whether to restart the electronic device based on the time when the patch package is installed and the remaining battery power of the electronic device. Exemplarily, if the time when the patch package is installed belongs to the first time period and the remaining battery power of the electronic device is greater than the power threshold, the electronic device is restarted; if the time when the patch package is installed belongs to the first time period, but the remaining battery power of the electronic device is less than or equal to the power threshold, the electronic device is not restarted temporarily; if the time when the patch package is installed belongs to the second time period, after the installation of the patch package is completed, the installation progress interface 1201 is exited, and after entering the first time, it is detected whether the remaining battery power of the electronic device is greater than the power threshold. If the remaining battery power of the electronic device is greater than the power threshold, the electronic device is automatically triggered to restart. If the remaining battery power of the electronic device is less than or equal to the power threshold, the electronic device is not triggered to restart temporarily. Among them, the first time period can be at night or a time period when the user uses the electronic device less frequently; the second time period can be during the day or a time period when the user uses the electronic device more frequently.

[0053] During the restart process of the electronic device, patch loading will be performed. After the electronic device restarts, S107 can be executed, and the software update application calls the update engine module to trigger partition synchronization.

[0054] Among them, partition synchronization means that after a patch is installed in a partition of the electronic device, the patch is synchronized in other partitions to achieve the synchronization of the patch versions in each partition. update_engine can be used to check for updates and perform partition synchronization, and install new patches in each partition of the electronic device.

[0055] Exemplarily, taking the case where there are two storage spaces in the electronic device, namely storage space A and storage space B, which can also be called partition A and partition B. In this case, a system is installed on each storage space, one of the systems is in the active use state, and the other system is in the standby state.

[0056] As Figure 4 shown, this figure is a schematic diagram of a partition synchronization provided by an embodiment of the present application. Before installing the patch, the patch versions in partition A and partition B are both 1.0. In the case where the patch is installed in partition B first, partition B is the target partition, and partition A can be used as the partition in the active use state to support the normal operation of the system. After the installation of the patch in partition B is completed, the patch version of partition B is upgraded to 2.0, while the patch version of partition A remains 1.0. By restarting and loading the patch, after the electronic device restarts, partition B where the patch installation is completed can be used as the partition in the active use state, and the system is run based on partition B, and the patch is installed in partition A. Thus, without affecting the operation of the electronic device, the patch version of partition A can also be upgraded to 2.0 to achieve partition synchronization.

[0057] It should be noted that in the embodiments of the present application, the number of partitions is not specifically limited. The above is only described by taking the existence of two partitions in the system as an example.

[0058] S108. The software update application receives the callback information from the update engine module.

[0059] The software update application can obtain the patch installation result through the callback information of the update engine module. After obtaining the patch installation result, the software update application can send an upgrade notice corresponding to the patch based on the patch installation result. Exemplarily, the process of the software update application sending an upgrade notice based on the patch installation result can be implemented through S109 - S110.

[0060] S109. The software update application determines whether the patch is installed successfully based on the callback information.

[0061] If the patch installation results of each partition indicate that there is a partition where the patch is installed successfully, then execute S110. The software update application sends an upgrade success notice to prompt the user that the upgrade is successful and process the operations corresponding to the upgrade success. If the patches of all partitions are installed failed, that is, the patch installation results of all partitions indicate that there is no partition where the patch is installed successfully, then execute S111. The software update application sends an upgrade failure notice to prompt the user that the upgrade fails and process the operations corresponding to the upgrade failure.

[0062] Exemplarily, as Figure 5 shown, this figure is a schematic diagram of an upgrade result notice provided by the embodiments of the present application. When the software update application sends an upgrade success notice, a notice of successful system patch upgrade is displayed on the display interface; when the software update application sends an upgrade failure notice, a notice of failed system patch upgrade is displayed on the display interface. It should be noted that in the present application, the display position of the notice message on the display interface is not specifically limited. Figure 5 In, the notice message is displayed at the upper part of the display interface only as an example.

[0063] In the embodiments of the present application, after the electronic device restarts, it can obtain the patch installation result by reading the patch installation result file generated by the update engine module; it can also directly obtain the patch installation result by calling the patch installation result function provided by the update engine module. Next, for the above two methods of obtaining the patch installation result, the patch installation method provided by the embodiments of the present application will be introduced respectively.

[0064] Embodiment 1:

[0065] In the embodiments of the present application, after the electronic device restarts, the software update application can read the patch installation result file generated by the update engine module to obtain the patch installation result. AsFigure 6 As shown, this figure is a flowchart of the first method for obtaining the patch installation result provided by the embodiment of the present application.

[0066] S201. The software update application calls the update engine module to detect the upgrade status of the patch.

[0067] Exemplarily, after the electronic device is restarted, the software update application can start the software update process through the system startup broadcast. The software update application can detect whether there are unfinished upgrade tasks. Exemplarily, the software update application can detect the patch installation status stored in the database, and obtain whether there are unfinished upgrade tasks according to the patch installation status stored in the database.

[0068] When the software update application detects that there are unfinished upgrade tasks, it can trigger the update_engine service and call the bound update_engine service to wait for the patch installation result change notification, that is, wait for the upgrade end notification. When the software update application detects that the upgrade status is the end status, it can obtain the patch installation result by reading the patch installation result file.

[0069] In a possible implementation manner, when the upgrade status is upgrade end, if S202. The software update application detects that the upgrade result is upgrade completed, then execute S203. Determine whether the partition synchronization call is successful. When the upgrade result is upgrade completed, it means that there is no partition with patch installation failure, but there may be partitions without patch installation.

[0070] Exemplarily, when the upgrade result is upgrade completed, the target partitions in each partition have successfully installed the patch. In this case, it is necessary to determine whether the other partitions except the target partition have installed the patch. Then, after detecting that the upgrade result is upgrade completed, it can be determined whether the partition synchronization call is successful, that is, determine the partition synchronization call status, to judge whether the other partitions except the target partition have installed the patch.

[0071] If the partition synchronization call status is partition synchronization call successful, then execute S204. Return the information that the partition processing is successful and the upgrade is successful. When the upgrade result is upgrade completed, the successful partition synchronization call means that the patch packages in each partition of the electronic device have been installed, and the systems or software corresponding to each partition have been upgraded successfully. The software update application can report the patch installation result file to the server by reading the patch installation result file generated by the update engine module, so that it can be traced later.

[0072] The software update application can send an upgrade success notification based on the patch installation result that the partition processing is successful and the upgrade is successful, prompting the user that the upgrade is successful, such as Figure 5As shown, a notification of successful system patch upgrade is displayed on the display interface. Since the patch installation result has been obtained, the software update application can close the update_engine service.

[0073] When the upgrade result is upgrade completed, if the partition synchronization call status is partition synchronization call failed, it means that the partition synchronization call operation has not been performed. Taking the existence of partition A and partition B in the electronic device as an example, after the patch installation in partition B is successful, the upgrade completed result can be obtained. Partition B can run the system as an active partition, but the partition synchronization operation has not been performed, that is, the patch installation has not been performed in partition A. In this case, S205 can be executed to re-trigger the partition synchronization. Exemplarily, the IU pdateEngine.overwriteColdPatchPartitions instruction can be re-executed to trigger the partition synchronization to achieve the synchronization of the patch versions in each partition. After re-triggering the partition synchronization, S201 can be executed, and the software update application calls the update engine module to detect the upgrade status of the patch.

[0074] When the upgrade status is upgrade ended, if S206, the software update application detects that the upgrade result is upgrade failed, then S207 is executed to determine whether the partition synchronization call is successful. When it is detected that the upgrade result is upgrade failed, it means that the patch installation in at least one partition of the electronic device fails. This situation may be caused by the failure of the partition synchronization call or the failure of the patch installation in the target partition. In this case, to determine the reason for the upgrade failure, it is possible to determine whether the partition synchronization call is successful after the software update application detects that the upgrade result is upgrade failed.

[0075] When the upgrade result is upgrade failed, if the partition synchronization call status is partition synchronization call successful, then S208 is executed to read the patch installation result file of the patch and parse the patch installation result. After parsing the patch installation result, S209 is executed to determine whether there is a partition failure flag in the patch installation result file. Exemplarily, the partition failure flag can be the "702" flag.

[0076] In a possible implementation manner, the software update module can parse the patch installation result file according to the file format corresponding to the update engine module to obtain the patch installation results of each partition.

[0077] If there is a partition failure flag in the patch installation result file, then execute S210 and return the information indicating that the partition failure has been processed and the upgrade is successful. When the upgrade result is upgrade failure and the partition synchronization call is successful, it means that the partition synchronization call operation has been performed. If there is a partition failure flag in the patch installation result file, then the patch installation in the target partition of the corresponding electronic device is successful. However, after the partition synchronization call is executed, there are cases where the patch installation fails in other partitions. At this time, the obtained patch installation result indicates that the patch installation is successful in at least one partition and the patch installation fails in at least one partition.

[0078] Taking the example of an electronic device having partition A and partition B, when the patch installation in partition A is successful, after the partition synchronization call is successfully executed to install the patch in partition B, the patch installation in partition B fails. In this case, although there are partitions in the electronic device where the patch is not successfully installed, it does not affect the normal use of the electronic device. Thus, the information indicating that the upgrade is successful can still be returned.

[0079] The software update application can report the patch installation result file to the server by reading the patch installation result file. At the same time, the software update application can send an upgrade notification indicating that the upgrade is successful based on the patch installation result to prompt the user that the upgrade is successful. As Figure 5 shown, a notification indicating that the system patch upgrade is successful is displayed on the display interface. Since the patch installation result has been obtained, the software update application can close the update_engine service.

[0080] Since the patch installation in the target partition is successful, after the partition synchronization call is executed, there are cases where the patch installation fails in other partitions. Although the operation of the electronic device is not affected, because the patch versions of each partition are inconsistent, it may cause a failure during the next upgrade. To avoid affecting the operation of the electronic device, when the patch installation in the target partition is successful and there are cases where the patch installation fails in other partitions after the partition synchronization call is executed, S205 can be continuously executed to re-trigger the partition synchronization. Exemplarily, the IU pdateEngine.overwriteColdPatchPartitions instruction can be re-executed to trigger the partition synchronization to achieve the synchronization of the patch versions in each partition. After re-triggering the partition synchronization, S201 can be executed, and the software update application calls the update engine module to detect the upgrade status of the patch.

[0081] If there is no partition failure flag in the patch installation result file, then execute S211, partition synchronization rollback, and return an upgrade failure message. In the case where partition synchronization fails and the partition synchronization call is successful, if there is no partition failure flag in the patch installation result file, it means that the patch installation results of each partition in the electronic device indicate that there is no partition with successful patch installation. In this case, a partition synchronization rollback operation can be performed to roll back the patch versions of each partition to the versions before the upgrade.

[0082] The software update application can report the patch installation result file to the server by reading the patch installation result file, so that the error cause can be analyzed based on the patch installation result file subsequently. At the same time, the software update application sends an upgrade failure notification based on the patch installation result of upgrade failure to prompt the user that the upgrade has failed. Since the patch installation result has been obtained, the software update application can close the update_engine service. As Figure 5 shown, a notification of system patch upgrade failure is displayed on the display interface of the user's electronic device.

[0083] In the case where the upgrade result is upgrade failure, if the partition synchronization call status is partition synchronization call failure, then execute S205, re-trigger partition synchronization. For example, the IU pdateEngine.overwriteColdPatchPartitions instruction can be re-executed to trigger partition synchronization. After re-triggering partition synchronization, S201 can be executed, the software update application calls the update engine module to detect the upgrade status of the patch, and when the upgrade result is upgrade complete, obtain the upgrade result.

[0084] In the embodiment of the present application, after the software update application receives the patch package and downloads the patch package, it decompresses the patch package to the specified target partition by calling the update engine module. During the restart process of the electronic device, the patch is loaded. After restarting, the software update application calls the update engine module to detect the upgrade status of the patch. After detecting that the patch upgrade is completed, the software update application can determine whether the patch is installed successfully by parsing the patch installation result file provided by the update engine module and according to the content of the guiding format corresponding to the patch installation result file.

[0085] Embodiment 2:

[0086] In the method of obtaining the patch installation result by parsing the patch installation result file in Embodiment 1, it is necessary to agree on the file format and content of the patch installation result between the update_engine and the software update application, and it cannot be changed arbitrarily. This specific file format and content result in a relatively high coupling degree between the update engine module and the software update application. In this case, the modification of the business of one process may affect the adaptation work of another process, thereby increasing the test workload.

[0087] Based on this, in the second embodiment of this application, a patch installation method is provided. After the electronic device restarts, the software update application can directly obtain the patch installation result through the update engine module, and while obtaining the patch installation result, it can decouple the update engine module from the software update application, improving the efficiency of obtaining the patch installation result. As Figure 7 shown, this figure is the flowchart of the second method for obtaining the patch installation result provided by the embodiment of this application.

[0088] Different from the above-mentioned first embodiment, in the embodiment of this application, the system software update application prompts the user to restart the electronic device or automatically restarts the electronic device according to the user's settings. After the electronic device restarts, S301 can be executed. The software update application calls the update engine module (update_engine) to detect the upgrade status of the patch.

[0089] S302. The software update application obtains the message that the patch upgrade is completed. That is, after the software update application detects that the upgrade status is upgrade completed, S303. The software update application obtains the patch installation result based on the update engine module.

[0090] The software update application can detect in real time or at regular intervals whether the patch installation is completed through the update_engine service, that is, detect the upgrade status of the patch. After obtaining the message that the upgrade status of the patch is upgrade completed, the software update application obtains the patch installation result based on the update engine module by calling the function for obtaining the patch installation result. Exemplarily, the function for obtaining the patch installation result can be the getResult(type) function.

[0091] In the case where the partition synchronization is successful and the patch installation in each partition is successful, S304. The patch installation result obtained by the software update application is that the processing partition is successful and the upgrade is successful. S305. The software update application sends an upgrade success notification based on the patch installation result that the processing partition is successful and the upgrade is successful.

[0092] In the case where the patch installation result is that the processing partition is successful and the upgrade is successful, it means that the patch packages in each partition of the electronic device have been installed, and the systems or software corresponding to each partition have been upgraded successfully. The software update application can report the patch installation result file corresponding to the successful processing partition and successful upgrade.

[0093] The software update application can send an upgrade success notification based on the patch installation result that the processing partition is successful and the upgrade is successful, prompting the user that the upgrade is successful. Since the patch installation result has been obtained, the software update application can close the update_engine service.

[0094] When the partition processing fails and the patch upgrade of a certain partition fails, in S306, the patch installation result obtained by the software update application is that the partition processing fails and the upgrade is successful. In S307, the software update application sends an upgrade notification of successful upgrade based on the patch installation result that the partition processing fails and the upgrade is successful.

[0095] When the patch installation result is that the partition processing fails and the upgrade is successful, it means that the patch installation of a certain partition in the electronic device is successful. However, after the partition synchronization call is executed, there are cases where the patch installation fails in other partitions. In this case, the system can run based on the partition where the patch installation is successful without affecting the user's use of the electronic device. Furthermore, the software update application can send an upgrade notification of successful upgrade to prompt the user that the upgrade is successful.

[0096] At the same time, the software update application can report the patch installation result file corresponding to the partition processing failure and successful upgrade. Since the patch installation result has been obtained, the software update application can close the update_engine service.

[0097] If in S308, the patch installation result obtained by the software update application is upgrade failure, then S309, partition synchronization rollback is executed to return the information of upgrade failure. If the patch installation result is upgrade failure, it means that the patch installation of each partition in the electronic device fails. In this case, a partition synchronization rollback operation can be performed to roll back the patch version of each partition to the version before the upgrade.

[0098] The software update application can report the patch installation result file corresponding to the upgrade failure of the patch installation result, and send an upgrade notification of upgrade failure based on this patch installation result to prompt the user that the upgrade fails. Since the patch installation result has been obtained, the software update application can close the update_engine service.

[0099] In a possible implementation, the software update application can obtain the patch installation result identifier by calling getResult(type), and determine the patch installation result based on this patch installation result identifier. Exemplarily, when the patch installation result is that the partition processing is successful and the upgrade is successful, the corresponding patch installation result identifier is "700"; when the patch installation result is that the partition processing fails and the upgrade is successful, the corresponding patch installation result identifier is "70x"; when the patch installation result is upgrade failure, the corresponding patch installation result identifier is "709".

[0100] In the embodiments of the present application, the method of directly calling the function for obtaining the patch installation result provided by the update engine module to obtain the patch installation result is used to replace the method of obtaining the patch installation result by reading the patch installation result file written by the update engine module in the first embodiment. Compared with the method of obtaining the patch installation result by reading the patch installation result file, the method provided in the second embodiment does not require a fixed file format and does not require the update engine module to generate the patch installation result file in a timely manner.

[0101] In the second embodiment of the present application, the method of directly calling the function for obtaining the patch installation result provided by the update engine module to obtain the patch installation result realizes the decoupling between the software update application and the update engine module, avoids the interaction failure between the software update application and the update engine module due to file format changes or the update engine module not generating the patch installation result file in a timely manner, resulting in the failure to obtain the patch installation result, and improves the efficiency of obtaining the patch installation result.

[0102] Figure 8 It is a software structure block diagram of an electronic device provided by the embodiments of the present application.

[0103] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, and a kernel layer, etc.

[0104] The application layer may include a series of application packages. Such as Figure 8 shown, the application packages may include application programs such as a software update application and a cloud-side package management module.

[0105] The cloud-side package management module can provide system upgrade control and upgrade package management system for the terminal device. The software update application can interact with the cloud-side package management module to obtain information related to whether there is a new patch package.

[0106] The software update application can detect and download the patch package, where the patch package can be a patch package that matches the current system. After downloading the patch package, the software update application can verify the downloaded file and trigger the update_enigne to install the patch; provide a user experience (UX) interaction for system upgrade according to whether there is a new version of the patch, the download progress of the patch, and the installation status.

[0107] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the application programs in the application layer. The application framework layer includes some predefined functions. Such as Figure 2 shown, the application framework layer may include an update engine module, etc.

[0108] The update engine module is used to decompress the patch package to the corresponding partition, install the patch, perform partition synchronization, and detect the patch installation result, etc.

[0109] The kernel layer is the layer between the hardware and the software, and the kernel layer may include an operating system startup module.

[0110] The operating system startup module can be used to detect whether there is a patch package, and can perform system repair in the case where the patch content overwrites the original system information. The update engine module can interact with the operating system startup module to implement the detection of the patch installation result and generate a patch installation result file.

[0111] In the embodiments of the present application, the software update application can obtain the patch installation result through the update engine module. On the one hand, after the electronic device is restarted, the software update application can obtain the patch installation result by reading the patch installation result file generated by the update engine module; on the other hand, the software update application can directly obtain the patch installation result by calling the patch installation result function provided by the update engine module to prompt the user whether the patch installation is successful or failed.

[0112] This embodiment provides an electronic device, which includes a processor and a memory; the memory is used to store program codes and transmit the program codes to the processor; the processor is used to execute Figure 1 , Figure 6 and Figure 7 the relevant method steps in to implement the method in the above embodiments.

[0113] This embodiment also provides a computer-readable storage medium, which includes instructions. When the above instructions run on an electronic device, the electronic device is caused to execute Figure 1 , Figure 6 and Figure 7 the relevant method steps in to implement the method in the above embodiments.

[0114] As described above, only the specific embodiments of the present application are provided, 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 covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A patch installation method, characterized in that, including: After the electronic device restarts, detect the upgrade status of the patch; When the upgrade status is upgrade completed, obtain the patch installation results of each partition of the electronic device; When the patch installation results of each partition indicate that there is a partition where the patch is successfully installed, display an upgrade notification corresponding to the patch that has been successfully upgraded on the display interface; When the patch installation results of each partition indicate that there is no partition where the patch is successfully installed, display an upgrade notification corresponding to the patch that has failed to upgrade on the display interface, and roll back the patches of each partition to the version before the upgrade, so that the patch versions of each partition are rolled back to the version before the upgrade.

2. The method according to claim 1, wherein The upgrade result is upgrade completed. When the upgrade status is upgrade completed, obtaining the patch installation results of each partition of the electronic device includes: When the upgrade status is upgrade completed, determine the partition synchronization call status; When the partition synchronization call status is successful partition synchronization call, the obtained patch installation results of each partition of the electronic device are that the processing partition is successful and the upgrade is successful, and the patch installation results of each partition indicate that the patches are successfully installed in each partition.

3. The method according to claim 1, characterized in that, The upgrade result is upgrade failed. When the upgrade status is upgrade completed, obtaining the patch installation results of each partition of the electronic device includes: When the upgrade status is upgrade completed, determine the partition synchronization call status; When the partition synchronization call status is successful partition synchronization call, obtain the patch installation result file generated by the update engine module; Parse the patch installation result file to obtain the patch installation results of each partition of the electronic device.

4. The method according to claim 3, characterized in that, The parsing the patch installation result file to obtain the patch installation results of each partition of the electronic device includes: Parse the patch installation result file according to the file format corresponding to the update engine module to obtain the patch installation results of each partition of the electronic device.

5. The method according to claim 3, characterized in that, The parsing the patch installation result file to obtain the patch installation results of each partition of the electronic device includes: Parse the patch installation result file to obtain the partition failure flag in the patch installation result file; According to the partition failure flag in the patch installation result file, obtain the patch installation results of each partition of the electronic device.

6. The method according to claim 5, characterized in that, The obtaining the patch installation results of each partition of the electronic device according to the partition failure flag in the patch installation result file includes: When there is a partition failure flag in the patch installation result file, the obtained patch installation results of each partition of the electronic device are that the processing partition fails and the upgrade is successful, and the patch installation results of each partition indicate that the patches are successfully installed in at least one partition and the patches are not successfully installed in at least one partition.

7. The method according to claim 5, wherein The obtaining the patch installation results of each partition of the electronic device according to the partition failure flag in the patch installation result file includes: When there is no partition failure flag in the patch installation result file, determine that the patch installation results of each partition of the electronic device are upgrade failed, and the patch installation results of each partition indicate that there is no partition where the patch is successfully installed.

8. The method according to claim 1, characterized in that, When the upgrade status is upgrade completed, obtaining the patch installation results of each partition of the electronic device, including: When the upgrade status is upgrade completed, based on the function of obtaining patch installation results, obtaining the patch installation results of each partition of the electronic device.

9. The method according to any one of claims 1-8, characterized in that, Before detecting the upgrade status of the patch after the electronic device is restarted, including: After decompressing the patch to the target partition in each partition, in response to the installation instruction selected by the user, installing the patch in the target partition; After completing the installation of the patch, in response to the restart instruction of the user, restarting the electronic device.

10. An electronic device, characterized in that, The electronic device includes: a processor and a memory; The memory is used to store program codes and transmit the program codes to the processor; The processor is used to execute the steps of a patch installation method according to any one of claims 1-9 according to the instructions in the program codes.

11. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of a patch installation method according to any one of claims 1-9 are implemented.

Citation Information

Patent Citations

  • Table-per-partition

    CA2980898A1

  • FOTA (Firmware Over-The-Air) upgrade method and system

    CN106610840A

  • BMC firmware upgrading method and device, equipment and medium

    CN115421762A

  • System upgrading method and device, electronic equipment and storage medium

    CN115509578A

  • Cold patch upgrading method and device, storage medium and computer program product

    CN116069370A