A device restart method, terminal device and related medium

By receiving system file update instructions in the terminal device, installing the second system file, and selecting the target version number based on the restart information for security verification, the problem of restart failure after system update is solved, and the normal restart of the terminal device and the improvement of user experience is achieved.

CN119065898BActive Publication Date: 2025-05-09HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411555904.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-05-09
Estimated Expiration
2044-11-04

AI Technical Summary

Technical Problem

After the terminal device system is updated, abnormal startup may occur during the restart process, resulting in rollback failure and the terminal device cannot be turned on, affecting the user experience.

Method used

By receiving system file update instructions, obtaining and installing the second system file, determining the verification key, and flexibly selecting the target version number based on the restart information for security verification, ensuring that the terminal device can restart smoothly.

Benefits of technology

It solves the problem of restart failure caused by failure of security verification, ensures that the terminal device can restart normally after the system is updated, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065898B_ABST
    Figure CN119065898B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method for restarting a device, a terminal device, and related media, the method may include: receiving an update instruction for a system file, obtaining and installing a second system file based on the update instruction; in response to the completion of the installation of the second system file, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation; determining a target version number based on the restart information corresponding to the restart operation, the target version number being a historical version number or a current version number; performing a security check based on the verification key and the target version number; and starting multiple target processes in the terminal device in a preset order when the security check passes. By implementing the method of the embodiment of the present application, when the terminal device restarts based on the upgraded system file, the target version number can be determined from the historical version number and the current version number based on the restart information, which helps to avoid the situation where the security check fails due to system rollback, and ensures the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method for restarting a device, a terminal device, and related media. Background Art

[0002] By updating or upgrading system files, terminal devices can achieve the purpose of obtaining new functions and / or fixing known program errors, which helps to improve the operating performance and security performance of terminal devices. For example, the new version of the system file (which can be understood as the system file obtained when the terminal device performs a system update or upgrade) usually optimizes the underlying code of the historical version of the system file, which helps to improve the overall operating efficiency of the terminal device, thereby achieving the effect of improving the operating performance of the terminal device; the new version of the system file can also repair security vulnerabilities in the historical version of the system file, prevent malware or hackers from exploiting these security vulnerabilities to attack the terminal device, and help protect the user's privacy and data security; the new version of the system file can also enable the terminal device to have new functions, which helps to improve the user experience, etc.

[0003] After the new version of the system file is installed on the terminal device, the terminal device will update the key in the storage space based on the new version of the system file, and restart based on the new version of the system file. If an abnormal startup occurs during the restart process (for example, some processes cannot be started normally due to incompatibility with the new version of the system file), the rollback mechanism of the terminal device will be triggered. When the rollback mechanism is triggered, the terminal device will restart for the second time based on the historical version of the system file. Since the historical version of the system file does not match the key, the terminal device will fail to roll back, resulting in the terminal device being unable to boot, which seriously affects the user experience. Therefore, how to ensure that the terminal device successfully completes the restart after the system update is a problem that technicians in this field urgently need to solve. Summary of the invention

[0004] In a first aspect, the present application provides a method for restarting a device, a terminal device, and related media. The method is applied to a terminal device, and the system file currently running on the terminal device is a first system file. The method may include:

[0005] receiving an update instruction for a system file, and acquiring and installing a second system file based on the update instruction, wherein the second system file has a different version number from the first system file;

[0006] In response to the second system file being installed, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation;

[0007] Determine a target version number based on the restart information corresponding to the restart operation, where the target version number is a historical version number or a current version number, where the historical version number is the version number corresponding to the system file running on the terminal device before the current restart, and the current version number is the version number corresponding to the system file running on the terminal device during the current restart;

[0008] Perform security verification based on the verification key and target version number;

[0009] When the security check passes, multiple target processes in the terminal device are started in a preset order.

[0010] By implementing the method provided in the first aspect, the terminal device can obtain and install the second system file based on the update instruction of the system file (wherein, before receiving the update instruction of the system file, the first system file is running on the terminal device). Further, after the second system file is installed, the terminal device can determine the verification key based on the second system file and trigger the restart operation. Further, the terminal device can flexibly determine the target version based on the restart information corresponding to the restart operation, which helps to solve the problem of restart failure caused by failure of security verification. Among them, the target version can be a historical version and or a current version, the historical version number can be understood as the version number corresponding to the system file running by the terminal device before this restart, and the current version number can be understood as the version number corresponding to the system file running by the terminal device during this restart. In the prior art, if the terminal device is in the process of performing a restart operation based on the second system file, and some processes are abnormally started, the rollback mechanism will be triggered (it can be understood that the terminal device needs to roll back the running system file to the previous version, such as the above-mentioned first system file, and perform a restart operation based on the first system file). Furthermore, when the terminal device performs a restart operation based on the first system file, it needs to perform a security check. Since the version number of the running system file (which can be understood as the version number corresponding to the first system file) read is different from the verification key (which can be understood as the version number corresponding to the second system file), the terminal device determines that it has not passed the security check, and then shuts down, causing the user to be unable to use the terminal device normally, seriously affecting the user's experience. The difference is that the method of the embodiment of the present application no longer simply performs a security check based on the version number of the running system file corresponding to the restart operation and the verification key, but flexibly selects the target version number based on the restart information, which helps to pass the security check when the terminal device performs a rollback operation, so that the terminal device can successfully restart, thereby ensuring that the user can use the terminal device normally.

[0011] Implementing the method provided in the first aspect, in some embodiments, the restart information may include an update flag bit, a rollback flag bit, and a version flag bit;

[0012] The update flag is used to indicate whether the terminal device is performing a system file update operation;

[0013] The rollback flag is used to indicate whether the terminal device performs a system rollback operation;

[0014] The version flag is used to indicate whether the terminal device runs different versions of system files in two adjacent restart processes.

[0015] By implementing the method provided in the above embodiment, the terminal device can determine the target version number based on the states corresponding to the update flag, the rollback flag, and the version flag. Specifically, the update flag can be used to indicate whether the terminal device performs a system file update operation, the rollback flag can be used to indicate whether the terminal device performs a system rollback operation, and the version flag can be used to indicate whether the terminal device runs different versions of system files in two adjacent restart processes.

[0016] In some other embodiments of implementing the method provided in the first aspect, determining the target version number based on the restart information may include:

[0017] When the update flag, rollback flag, and version flag respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of system files have been run in two adjacent restart processes, the historical version number is determined as the target version number.

[0018] In some other embodiments of the method provided in the first aspect, determining the target version number based on the restart information may further include:

[0019] When the update flag indicates that the terminal device has not performed a system file update operation, the current version number is determined as the target version number;

[0020] Alternatively, when the rollback flag indicates that the terminal device has not performed a system rollback operation, the current version number is determined as the target version number;

[0021] Alternatively, when the version flag indicates that the terminal device does not respectively run different versions of system files in two adjacent restart processes, the current version number is determined as the target version number.

[0022] In some other embodiments of the method provided in the first aspect, in response to the second system being installed, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation may include:

[0023] In response to the second system file being installed, determining a verification key based on a version number corresponding to the second system file;

[0024] Adjust the update flag to a state indicating that the terminal device has performed a system file update operation;

[0025] Restart the terminal device based on the second system file.

[0026] By implementing the method provided in the above embodiment, the terminal device can adjust the update flag to a state indicating that the terminal device has performed a system file update operation when the second system file is installed, which helps the terminal device to subsequently select an appropriate target version number based on the restart information. Further, the terminal device can perform a restart operation based on the second system file, and the system update can be considered completed after the terminal device completes the restart operation.

[0027] In some other embodiments of the method provided in the first aspect, when the verification key is the same as the version number corresponding to the target version number, it is determined that the security verification has passed.

[0028] By implementing the method provided in the above embodiment, the terminal device determines that the condition for the system to pass the security check is that the verification key is the same as the version number corresponding to the target version number. By performing a security check, it helps to ensure the integrity and security of system file data during the system upgrade process.

[0029] In some other embodiments of implementing the method provided in the first aspect, restarting the terminal device based on the second system file may include:

[0030] Determine the version number corresponding to the second system file as the first current version number, and determine the version number corresponding to the first system file as the first historical version number;

[0031] Determine the target version number as the first current version number based on the restart information;

[0032] Based on the verification key and the first current version number, determining that a first security verification is passed, the first security verification being a security verification corresponding to restarting the terminal device based on the second system file;

[0033] Based on the second system file, multiple target processes are started in a preset order.

[0034] By implementing the method provided in the above embodiment, in the process of restarting the terminal device based on the second system, since the update flag, rollback flag, and version flag are respectively in the state indicating that the terminal device has performed a system file update operation, has not performed a rollback operation, and has not run different versions of system files in two adjacent restart processes, the first current version number can be determined as the target version number (which can be understood as determining the version number corresponding to the second system file as the target version number), thereby facilitating passing this security check and ensuring that the terminal device can be restarted smoothly. After determining that the security check has passed, multiple target processes can be started in a preset order based on the second system file, and after all target processes are started, this restart operation can be considered completed.

[0035] Implementing the method provided in the first aspect, in some other embodiments, the method may further include:

[0036] If, in the process of starting multiple target processes in a preset order based on the second system file, the number of process restarts exceeds a preset value, a system rollback operation is triggered, and the rollback flag is adjusted to a state indicating that the terminal device has performed a system rollback operation;

[0037] Restart the terminal device based on the first system file.

[0038] When the method provided in the above embodiment is implemented, in the process of restarting the terminal device based on the second system file, if an abnormal startup occurs, a system rollback operation will be triggered. Specifically, in the process of starting multiple target processes in a preset order based on the second system file, if the number of process restarts exceeds the preset value, it can be regarded as an abnormal startup, so it is necessary to trigger a system rollback operation to ensure that the terminal device can be normally started and convenient, so that the user can use the terminal device normally. Specifically, the above-mentioned system rollback operation can be understood as restarting the terminal device based on the first system file, and can also be understood as allowing the terminal device to run the first system file. Among them, after triggering the system rollback operation, the terminal device will adjust the rollback flag to a state indicating that the terminal device has performed a system rollback operation, which helps the terminal device to reasonably select the target version number based on the restart information later, thereby ensuring that the terminal device can be normally started.

[0039] In some other embodiments of implementing the method provided in the first aspect, restarting the terminal device based on the first system file may include:

[0040] Determine the version number corresponding to the first system file as the second current version number, and determine the version number corresponding to the second system file as the second historical version number;

[0041] The version flag is adjusted to indicate that the terminal device runs different versions of the system file in two consecutive restart processes;

[0042] Determine that the target version number is the second historical version number;

[0043] Based on the verification key and the second historical version number, determining that a second security verification has been passed, the second security verification being a security verification corresponding to restarting the terminal device based on the first system file;

[0044] Based on the first system file, multiple target processes are started in a preset order.

[0045] By implementing the method provided in the above embodiment, in the process of restarting the terminal device based on the first system, since the update flag, rollback flag, and version flag are respectively in the state indicating that the terminal device has performed a system file update operation and a rollback operation, different versions of the system file are respectively run in two adjacent restart processes, so the second historical version number can be determined as the target version number (it can be understood that the version number corresponding to the second system file is determined as the target version number), which helps to pass this security check and ensure that the terminal device can be restarted smoothly. After determining that the security check has passed, multiple target processes can be started in a preset order based on the first system file. After all target processes are started, this restart operation can be considered completed.

[0046] Implementing the method provided in the first aspect, in some other embodiments, the method may further include:

[0047] In response to the completion of the startup of multiple target processes, the update flag is adjusted to a state indicating that the terminal device has not performed a system file update operation, the rollback flag is adjusted to a state indicating that the terminal device has not performed a system rollback operation, and the version flag is adjusted to a state indicating that the terminal device has not run different versions of system files in two adjacent restart processes.

[0048] By implementing the method provided in the above embodiment, after all target processes are started (or it can be understood as after the terminal device is restarted), the terminal device can adjust the new flag to a state indicating that the terminal device has not performed a system file update operation, adjust the rollback flag to a state indicating that the terminal device has not performed a system rollback operation, and adjust the version flag to a state indicating that the terminal device has not run different versions of system files in two adjacent restart processes. This helps to select a reasonable target version number based on the restart information when the device is restarted next time, thereby ensuring that the terminal device can restart smoothly.

[0049] In a second aspect, an embodiment of the present application provides a terminal device, which may include: an interaction module, a communication module, and a processing module;

[0050] An interactive module, which can be used to receive update instructions for system files;

[0051] A communication module, which can be used to obtain and install a second system file based on the update instruction, the second system file having a different version number from the first system file;

[0052] The processing module may be used to determine the verification key based on the second system file in response to the completion of the installation of the second system file, and trigger the terminal device to perform a restart operation;

[0053] The processing module may also be used to determine a target version number based on the restart information corresponding to the restart operation, where the target version number is a historical version number or a current version number, where the historical version number is a version number corresponding to the system file running on the terminal device before the current restart, and the current version number is a version number corresponding to the system file running on the terminal device during the current restart;

[0054] The processing module can also be used to perform security verification based on the verification key and the target version number;

[0055] The processing module can also be used to start multiple target processes in the terminal device in a preset order when the security check passes.

[0056] Implementing the method provided in the second aspect, in some embodiments, the restart information may include an update flag bit, a rollback flag bit, and a version flag bit;

[0057] The update flag is used to indicate whether the terminal device is performing a system file update operation;

[0058] The rollback flag is used to indicate whether the terminal device performs a system rollback operation;

[0059] The version flag is used to indicate whether the terminal device runs different versions of the system file terminal in two consecutive restart processes.

[0060] Implement the method provided in the second aspect. In other embodiments, when the update flag, rollback flag, and version flag respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of the system files have been run during two adjacent restart processes, the historical version number is determined as the target version number.

[0061] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0062] The processing module may also be used to determine the current version number as the target version number when the update flag indicates that the terminal device has not performed a system file update operation;

[0063] Alternatively, the processing module may also be configured to determine the current version number as the target version number when the rollback flag indicates that the terminal device has not performed a system rollback operation;

[0064] Alternatively, the processing module may also be configured to determine the current version number as the target version number when the version flag indicates that the terminal device does not respectively run different versions of system files in two adjacent restart processes.

[0065] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0066] The processing module may also be used to determine the verification key based on the version number corresponding to the second system file in response to the second system file being installed;

[0067] The processing module may also be used to adjust the update flag to a state indicating that the terminal device has performed a system file update operation;

[0068] The processing module can also be used to restart the terminal device based on the second system file.

[0069] In some other embodiments of the method provided in the second aspect, when the verification key is the same as the version number corresponding to the target version number, it is determined that the security verification has passed.

[0070] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0071] The processing module may also be used to determine the version number corresponding to the second system file as the first current version number, and determine the version number corresponding to the first system file as the first historical version number;

[0072] The processing module may also be used to determine the target version number as the first current version number based on the restart information;

[0073] The processing module may also be used to determine that a first security check has been passed based on the verification key and the first current version number, where the first security check is a security check corresponding to restarting the terminal device based on the second system file;

[0074] The processing module can also be used to start multiple target processes in a preset order based on the second system file.

[0075] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0076] If, in the process of starting multiple target processes in a preset order based on the second system file, the number of process restarts exceeds a preset value, the processing module can also be used to trigger a system rollback operation and adjust the rollback flag to a state indicating that the terminal device has performed a system rollback operation;

[0077] The processing module can also be used to restart the terminal device based on the first system file.

[0078] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0079] The processing module may also be used to determine the version number corresponding to the first system file as the second current version number, and determine the version number corresponding to the second system file as the second historical version number;

[0080] The processing module may also be used to adjust the version flag to a state indicating that the terminal device runs different versions of the system file in two adjacent restart processes;

[0081] The processing module may also be used to determine that the target version number is the second historical version number;

[0082] The processing module may also be used to determine that a second security check has been passed based on the verification key and the second historical version number, where the second security check is a security check corresponding to restarting the terminal device based on the first system file;

[0083] The processing module can also be used to start multiple target processes in a preset order based on the first system file.

[0084] In some other embodiments of implementing the method provided in the second aspect, the electronic terminal device may further include:

[0085] The processing module can also be used to adjust the update flag to a state indicating that the terminal device has not performed a system file update operation, adjust the rollback flag to a state indicating that the terminal device has not performed a system rollback operation, and adjust the version flag to a state indicating that the terminal device has not run different versions of the system file in two adjacent restart processes in response to the completion of the startup of multiple target processes.

[0086] In a third aspect, an embodiment of the present application provides a terminal device, which may include one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the method described in the first aspect and any possible implementation method of the first aspect is executed.

[0087] In a fourth aspect, an embodiment of the present application provides a chip, comprising a logic circuit and an interface, wherein the logic circuit and the interface are coupled; the interface is used to input and / or output code instructions, and the logic circuit is used to execute the code instructions so that the method in the first aspect or any possible implementation of the first aspect is executed.

[0088] In a fifth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a terminal device, execute the method described in the first aspect and any possible implementation manner of the first aspect.

[0089] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when executed on a terminal device, enables the terminal device to execute the method described in the first aspect and any possible implementation manner of the first aspect.

[0090] It can be understood that the terminal devices provided in the second and third aspects, the chip provided in the fourth aspect, the computer-readable storage medium provided in the fifth aspect, and the computer program product provided in the sixth aspect are all related to the method for restarting a device provided in the first aspect, and can be used to execute the method provided in the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the method for restarting a device in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0091] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0092] Figure 1 This is a schematic diagram of a restart process after a device performs a system update provided in an embodiment of the present application;

[0093] Figure 2 This is a schematic diagram of a scenario of device restart provided in an embodiment of the present application;

[0094] Figure 3 It is a flowchart of a method for restarting a device provided in an embodiment of the present application;

[0095] Figure 4 This is a schematic diagram of a scenario for storing system files provided by an embodiment of the present application;

[0096] Figure 5 is a schematic diagram of another scenario of device restart provided in an embodiment of the present application;

[0097] Figure 6 This is a flowchart of another method for restarting a device provided in an embodiment of the present application;

[0098] Figure 7 It is a verification process framework diagram for a rollback mechanism provided in an embodiment of the present application;

[0099] Figure 8 It is a timing diagram of a verification process for a rollback mechanism provided in an embodiment of the present application;

[0100] Fig. 9 It is a schematic diagram of the composition of a terminal device provided in an embodiment of the present application;

[0101] Fig.10 It is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;

[0102] Fig.11 It is a software structure block diagram provided in an embodiment of the present application. DETAILED DESCRIPTION

[0103] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear contrary indication in the context. It should also be understood that 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 kind of association relationship describing the 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" refers to two or more than two.

[0104] 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.

[0105] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on the terminal device and finally presented as content that the user can recognize. The commonly used form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of a terminal device.

[0106] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:

[0107] (1) Application layer, application framework layer, hardware abstraction layer, and kernel layer

[0108] The application layer (Application), application framework layer (Android Framework), hardware abstraction layer (Hardware Abstraction Layer) and kernel layer (Linux Kernel) are the four layers in the Android system architecture. Among them:

[0109] The application layer includes system-built-in applications and non-system-level applications, which are usually developed based on the Java language and are mainly responsible for direct interaction with users.

[0110] The application framework layer is the foundation of Android application development. This layer is written in Java code and provides developers with the APIs they need to develop applications. Many core applications also use this layer to implement their core functions. This layer simplifies the reuse of components. Developers can directly use the components it provides to quickly develop applications, or they can implement personalized expansion through inheritance. Specifically, the application framework layer can include multiple parts such as activity manager, window manager, content provider, view system, package manager, phone manager, resource manager, location manager, notification manager, etc.

[0111] The hardware abstraction layer encapsulates the underlying hardware driver and provides a general interface for calling the driver to the application framework layer. Manufacturers only need to implement the corresponding interface according to the specification and store it in a specific directory in the form of a shared library. The upper layer only needs to load this shared library and find the pointer to the device corresponding to the corresponding module. After obtaining the pointer to the entire device, it can operate the underlying hardware.

[0112] The kernel layer provides underlying drivers for various hardware of the terminal device (display driver, keyboard driver, Flash memory driver, camera driver, audio driver, Bluetooth driver, Wi-Fi driver, Binder IPC driver, power management (PowerManagement)). The kernel exists as an abstract layer between hardware and software, with powerful memory management and process management, permission-based security mode, and support for shared libraries. In the present application method, the operation process of the terminal device presenting the application startup animation to the user is mainly related to the display driver.

[0113] See also Figure 1 , Figure 1 A schematic diagram of the restart process of a device after a system update is provided in an embodiment of the present application.

[0114] like Figure 1 As shown, the process may include:

[0115] S101: The terminal device performs a system update, and the version number corresponding to the updated new version system file is different from the version number corresponding to the old version system file currently running on the terminal device.

[0116] Optionally, the terminal device 100 may perform a system update in a manner of Hota upgrade, and the update type may be a small system update.

[0117] Among them, a small system update mainly refers to a small-scale update of the operating system of the terminal device 100, which is mainly used to fix some minor problems that occur during the use of the terminal device 100, such as software crashes, adaptation problems, etc., and to update the system with security patches. The memory occupied by a small system update is small, usually only a few hundred megabytes.

[0118] Compared with a major system update, a minor system update does not add too many new features, but mainly optimizes and repairs the existing system. A major system upgrade will add more new features, which may have higher requirements on the hardware of the terminal device 100. It is necessary to consider whether the hardware of the terminal device 100 can support these new features.

[0119] S102: In the process of performing a restart operation based on the new version system file, the version number corresponding to the new version system file is stored in keyblob.

[0120] S103: The terminal device encounters an abnormal startup situation during the process of performing a restart operation based on the new version system file.

[0121] Exemplarily, the abnormal startup situation may be a zygote crush failure or the like.

[0122] S104: After multiple unsuccessful startup attempts, a rollback mechanism is triggered, so that the terminal device performs a restart operation based on the old version of the system file.

[0123] S105: During the process of performing the restart operation based on the old version system file, the terminal device reads the version number corresponding to the old version system file.

[0124] S106: Since the version number obtained from the old version system file is smaller than the version number stored in the keyblob, the terminal device cannot complete the restart operation based on the old version system file.

[0125] S107: The terminal device cannot be powered on.

[0126] To explain in more detail Figure 1 For the corresponding implementation examples, see Figure 2 , Figure 2 A schematic diagram of a device restart scenario provided in an embodiment of the present application.

[0127] like Figure 2 As shown, assuming that the system file currently running on the terminal device 100 is the first system file (which can be understood as the above-mentioned old version system file), after the terminal device 100 receives the system update information sent by the cloud server 200, it can generate and display an update reminder pop-up window based on the system update information. Among them, the system update information can be used to notify the terminal device 100 that the existing updated version of the system file can be used for updating, and the reminder pop-up window can be used to remind the user to allow the terminal device 100 to perform the system update operation. Optionally, the user can input an update instruction to the terminal device 100 by clicking the "Update" button in the update reminder pop-up window. Optionally, in response to the update instruction, the terminal device 100 can obtain a second system file (which can be understood as the above-mentioned new version system file) from the cloud server 200 and install the second system file, wherein the version number corresponding to the second system file is different from the version number corresponding to the first system file, and it can also be understood that the second system file can be an optimized version of the first system file.

[0128] Optionally, after the second system file is installed, the terminal device 100 can set the verification key corresponding to the security verification to the version number corresponding to the second system file. Further, the terminal device 100 needs to perform a restart operation based on the second system file, and after the restart operation is completed, the system update operation is considered to be completed.

[0129] Specifically, during the process of the terminal device 100 restarting based on the second system file, if there is an abnormal startup, the system rollback mechanism will be triggered. Further, after the system rollback mechanism is triggered, the terminal device 100 needs to perform a restart operation based on the first system file, so as to achieve the purpose of starting the terminal device 100, so that the user can use the terminal device 100 normally. Among them, during the process of starting multiple target processes in the terminal device 100 based on the second system file, if the number of times some processes are started exceeds the preset value, it can be considered that these processes have abnormal startup.

[0130] Optionally, before the terminal device 100 restarts based on the first system file, the terminal device 100 needs to perform a security check. Only when the security check passes can the terminal device 100 perform a restart operation based on the first system file. When the terminal device 100 performs a security check, the terminal device 100 reads the current version number (which can be understood as the version number corresponding to the system version running when the terminal device 100 restarts this time), and performs a security check based on the current version number and the verification key. Since the current version number is different from the version number corresponding to the verification key, it is confirmed that the security check fails (for example, a security service keystore error will appear), which will cause the userdata decryption to fail, making the terminal device 100 unable to boot, thereby causing the user to be unable to use the terminal device 100 normally, seriously affecting the user's experience.

[0131] Therefore, in order to ensure that the terminal device 100 can restart normally after the system is updated, so as to ensure that the user can use the terminal device 100 normally, the embodiment of the present application provides a method for restarting the device. By implementing the method of the embodiment of the present application, when the terminal device restarts based on the upgraded system file, the target version number can be determined from the historical version number and the current version number based on the restart information, which helps to avoid the situation where the security check fails due to system rollback, and ensures the user experience.

[0132] See also Figure 3 , Figure 3 A flowchart of a method for restarting a device provided in an embodiment of the present application.

[0133] like Figure 3 As shown, the method may include:

[0134] S301: receiving an update instruction for a system file, and acquiring and installing a second system file based on the update instruction.

[0135] Optionally, the second system file has a different version number from the first system file. Exemplarily, assuming that the version of the first system file that the terminal device 100 runs before receiving the system file update instruction is OS18.0.1, the version of the second system file that the terminal device 100 obtains from the cloud server may be OS18.0.2, wherein OS18.0.1 may be understood as the version number corresponding to the first system file, and OS18.0.2 may be understood as the version number corresponding to the second system file.

[0136] It should be noted that the terminal device 100 may also be referred to as user equipment (UE), user terminal, access terminal device, UE unit, UE station, mobile device, UE terminal device, mobile terminal, wireless communication device, UE agent or UE device, etc. Its specific form may be a personal computer, a handheld or wearable device, or other intelligent terminal device that requires a device to run a system, which is an entity on the user side for receiving or transmitting signals. It may be a handheld or wearable device, and its specific form may be a laptop computer, a desktop computer, a mobile phone, a tablet computer, a smart watch or other wearable device, etc. The specific structure of the terminal device 100 may refer to Figures 9 to 11 The relevant content will not be elaborated here.

[0137] Among them, combined Figure 1 , Figure 2 In the embodiments thereof, before the restart operation is performed based on the second system file, the system file running on the terminal device 100 is the first system file. Optionally, the terminal device 100 can store a copy of the first system file in two different locations in the storage space, which helps to run the terminal device 100 based on another copy of the first system file when the data of a copy of the first system file is damaged, thereby ensuring that the user can use the first terminal device normally. For example, see Figure 4 , Figure 4 A schematic diagram of a storage system file scenario provided by an embodiment of the present application. Figure 4 As shown, it is assumed that there are a first area 401 and a second area 402 in the storage space of the terminal device 100, and a first system file is stored in the first area 401 and the second area 402 respectively.

[0138] Optionally, after the terminal device 100 obtains the second system file, the second system file can be installed or stored in the second area 402, and the first system file in the second area 402 can be deleted. It can be understood that after the second system file is installed, the terminal device 100 can store the first system file and the second system file at the same time.

[0139] S302: In response to the second system file being installed, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation.

[0140] Exemplarily, the terminal device 100 can determine the verification key based on the version number of the second system file, and save the verification key in the keyblob. Optionally, the verification key can be the version number corresponding to the second system file, or a string generated based on the version number of the second system file, etc. This application does not limit the specific composition form of the verification key, which can be set by technicians according to actual conditions.

[0141] Optionally, before the terminal device 100 completes the installation of the second system file, the verification key stored in the keyblob of the terminal device 100 is the version number corresponding to the first system file. However, after the terminal device 100 completes the installation of the second system file and performs a restart operation based on the second system file, the terminal device 100 reads that the version number of the currently running system file is the version number corresponding to the second system file, which is different from the verification key stored in the keyblob, so the version flag can be set to 1. Further, since the terminal device 100 can determine the verification key based on the version number of the second system file during the process of performing the restart operation based on the second system file (it can be understood that the verification key in the keyblob is changed from the version number corresponding to the first system file to the version number corresponding to the second system file), after the verification key is updated, since the version number corresponding to the system file currently running by the terminal device 100 is the same as the verification key, the version flag can be set to 0. Among them, the meaning represented by the above-mentioned version flag being 1 or 0 can refer to step S303 and its related embodiments, and will not be repeated here.

[0142] S303: Determine a target version number based on the restart information corresponding to the restart operation.

[0143] Optionally, the restart information may include an update flag, a rollback flag, and a version flag. The update flag may be used to indicate whether the terminal device performs a system file update operation, the rollback flag may be used to indicate whether the terminal device performs a system rollback operation, and the version flag may be used to indicate whether the terminal device runs different versions of system files in two adjacent restart processes.

[0144] Exemplarily, the embodiment of the present application may set the name of the update flag to HotaFlag, wherein when When , it can indicate that the terminal device 100 has performed a system file update operation; when When , it can indicate that the terminal device 100 has not performed a system file update operation. Or, when When , it can indicate that the terminal device 100 has performed a system file update operation; when , it may indicate that the terminal device 100 has not performed a system file update operation.

[0145] For example, the embodiment of the present application may set the name of the rollback flag to Rollback, where When , it can indicate that the terminal device 100 has performed a system rollback operation; when When , it can indicate that the terminal device 100 has not performed a system rollback operation. Or, when When , it can indicate that the terminal device 100 has performed a system rollback operation; when , it may indicate that the terminal device 100 has not performed a system rollback operation.

[0146] For example, the embodiment of the present application may set the name of the version flag to PatchlevelChange, where When , it can mean that the terminal device runs different versions of system files in two consecutive restart processes; when , which may indicate that the terminal device does not run different versions of system files in two consecutive restart processes. Or, when When , it can mean that the terminal device runs different versions of system files in two consecutive restart processes; when , which may indicate that the terminal device does not run different versions of system files in two adjacent restart processes.

[0147] Optionally, whenever the terminal device 100 completes the restart operation, the update flag HotaFlag, rollback flag Rollback and version flag PatchlevelChange will be set to 0 or false, so that the terminal device 100 can select a suitable target version number during the next restart operation, which helps the terminal device 100 to start normally during the update operation, so that the user can use the terminal device 100 normally and ensure the user experience.

[0148] Optionally, the target version number may be a historical version number or a current version number. The historical version number is the version number corresponding to the system file that the terminal device was running before this restart, and the current version number is the version number corresponding to the system file that the terminal device is running during this restart. Exemplarily, if the system file that the terminal device 100 is running before performing a restart operation based on the second system file is a first system file, then it can be determined that the version number corresponding to the first system file is the historical version number, and the version number corresponding to the second system file can be determined to be the current version number. Optionally, if the terminal device 100 starts abnormally during the process of performing a restart operation based on the second system file, and triggers a system rollback mechanism, the terminal device 100 needs to perform a restart operation again based on the first system file, wherein, during the process of performing a restart operation again based on the first system file, it can be determined that the version number corresponding to the second system file is the historical version number, and the version number corresponding to the first system file can be determined to be the current version number.

[0149] In some possible implementations, determining the target version number based on the restart information may include:

[0150] When the update flag, rollback flag, and version flag respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of system files have been run in two adjacent restart processes, the historical version number is determined as the target version number.

[0151] For example, when , and When the terminal device 100 determines the historical version number as the target version number. , and When the terminal device 100 is restarted based on the second system file, it can be understood that an abnormal startup occurs during the restart of the terminal device 100 based on the second system file. At this time, the rollback mechanism is triggered, and when the restart operation is performed again based on the first system file, Figure 1 Therefore, when performing a restart operation based on the first system file, the terminal device 100 cannot perform a security check based on the current version number and the verification key, but needs to perform a security check based on the historical version number and the verification key, so as to ensure that the terminal device 100 successfully performs a restart operation based on the first system file, so that the user can use the terminal device 100 normally. , and When the terminal device 100 needs to determine the historical version number as the target version number.

[0152] In some other possible implementations, determining the target version number based on the restart information may further include:

[0153] When the update flag indicates that the terminal device has not performed a system file update operation, the current version number is determined as the target version number;

[0154] Alternatively, when the rollback flag indicates that the terminal device has not performed a system rollback operation, the current version number is determined as the target version number;

[0155] Alternatively, when the version flag indicates that the terminal device does not respectively run different versions of system files in two adjacent restart processes, the current version number is determined as the target version number.

[0156] Exemplarily, if any one or more of HotaFlag, Rollback, and PatchlevelChange are 0 or false, the terminal device 100 needs to determine the current version number as the target version number.

[0157] In some other possible implementations, in combination with the above content, in response to the second system file being installed, determining the verification key based on the second system file, and triggering the terminal device to perform a restart operation may include:

[0158] In response to the second system file being installed, determining a verification key based on a version number of the second system file;

[0159] Adjust the update flag to a state indicating that the terminal device has performed a system file update operation;

[0160] Restart the terminal device based on the second system file.

[0161] Exemplarily, when the terminal device 100 completes the installation of the second system file, it can be regarded that the terminal device 100 has performed a system file update operation, so the update flag HotaFlag can be set to 1, which is used to indicate that the terminal device has performed a system file update operation, which helps the terminal device 100 to subsequently select a suitable target version number based on the restart information, and ensure that the first system file can successfully pass the security check when executing the system rollback mechanism, thereby helping the user to use the terminal device 100 normally.

[0162] S304: Perform security verification based on the verification key and the target version number.

[0163] Optionally, when the verification key is identical to the version number corresponding to the target version number, it is determined that the security verification has passed.

[0164] Exemplarily, when the target version number and the verification key are both the second system file, it can be considered that the security check of the restart operation has passed; when the target version number and the verification key are both the first system file, it can also be considered that the security check of the restart operation has passed.

[0165] S305: When the security check passes, multiple target processes in the terminal device are started in a preset order.

[0166] Optionally, the target process can be understood as a key process in the terminal device 100, such as a systemserver process, etc. This application does not impose any restrictions here, and the target process can be set by technical personnel according to actual conditions.

[0167] Among them, after each of the multiple target processes in the terminal device 100 is successfully started, it can be considered that the terminal device 100 has been restarted, and the terminal device 100 can present the desktop main interface to the user for the user to use related functions. Optionally, if an abnormal startup occurs during the process of starting multiple target processes in sequence, the system rollback mechanism will be triggered, and the terminal device 100 needs to be restarted again based on the historical version system file.

[0168] Exemplarily, among the above-mentioned multiple target processes, if one or some of the target processes fail to start at the first time, the terminal device 100 will continue to start the above-mentioned one or some of the target processes based on the system file. Furthermore, when the number of times the above-mentioned one or some of the target processes are started exceeds the preset value, it can be considered that the above-mentioned one or some of the target processes are abnormally started. Exemplarily, during the process of the terminal device 100 performing a restart operation, if the first process fails to start at the first time, the terminal device 100 will try to start the first process again, and when the first process is started continuously or fails to start for more than 3 times, it can be considered that the first process is abnormally started, and it can also be considered that the terminal device 100 has abnormal operation during the restart operation.

[0169] In some possible implementations, in combination with the above content, restarting the terminal device based on the second system file may include:

[0170] Determine the version number corresponding to the second system file as the first current version number, and determine the version number corresponding to the first system file as the first historical version number;

[0171] Determine the target version number as the first current version number based on the restart information;

[0172] Based on the verification key and the first current version number, determining that a first security verification is passed, the first security verification being a security verification corresponding to restarting the terminal device based on the second system file;

[0173] Based on the second system file, multiple target processes are started in a preset order.

[0174] Exemplarily, since the system file run by the terminal device 100 before performing a restart operation based on the second system file is the first system file, the first historical version number can be determined as the version number corresponding to the first system file; since the terminal device 100 is performing a restart operation based on the second system file, the first current version number can be determined as the version number corresponding to the second system file.

[0175] Exemplarily, in combination with the above content, when the terminal device 100 performs a restart operation based on the second system file, only the update flag bit , and Rollback and PatchlevelChange are both equal to 0, so the target version number is determined to be the first current version number (which can be understood as the version number corresponding to the second system file). Further, since the first current version number is the same as the version number corresponding to the verification key, it can be considered that the first security verification has been passed, so the terminal device 100 can start multiple target processes in a preset order based on the second system file.

[0176] In some other possible implementations, the method may further include:

[0177] If, in the process of starting multiple target processes in a preset order based on the second system file, the number of process restarts exceeds a preset value, a system rollback operation is triggered, and the rollback flag is adjusted to a state indicating that the terminal device has performed a system rollback operation;

[0178] Restart the terminal device based on the first system file.

[0179] Exemplarily, after triggering a system rollback operation, the terminal device 100 may set the rollback flag Rollback to 1 or true, to indicate that the terminal device 100 has performed a system rollback operation.

[0180] For example, if there is no abnormal startup in the process of starting multiple target processes in a preset order based on the second system file (it can be understood that the terminal device 100 starts multiple target processes in a preset order based on the second system file), it can be understood that the terminal device 100 has completed the restart operation, and the terminal device 100 needs to adjust the update flag to a state indicating that the terminal device has not performed a system file update operation, such as setting HotaFlag to 0 or false, so that the terminal device 100 can select a suitable target version number during the next restart operation, which helps the terminal device 100 to start normally during the update operation, so that the user can use the terminal device 100 normally and ensure the user experience.

[0181] Optionally, combined Figure 4 In the embodiments thereof, after the terminal device 100 completes the restart operation based on the second system file, the second system file can be stored in the first area 401, and the first system file in the first area 401 can be deleted. It can be understood that after the terminal device 100 completes the restart operation based on the second system file, two copies of the second system file can be stored in the terminal device 100 at the same time.

[0182] In some other possible implementations, restarting the terminal device based on the first system file may include:

[0183] Determine the version number corresponding to the first system file as the second current version number, and determine the version number corresponding to the second system file as the second historical version number;

[0184] The version flag is adjusted to indicate that the terminal device runs different versions of the system file in two consecutive restart processes;

[0185] Determine that the target version number is the second historical version number;

[0186] Based on the verification key and the second historical version number, determining that a second security verification has been passed, the second security verification being a security verification corresponding to restarting the terminal device based on the first system file;

[0187] Based on the first system file, multiple target processes are started in a preset order.

[0188] Exemplarily, since the system file run by the terminal device 100 before performing a restart operation based on the first system file is the second system file, the second historical version number can be determined as the version number corresponding to the second system file; since the terminal device 100 is performing a restart operation based on the first system file, the second current version number can be determined as the version number corresponding to the first system file.

[0189] For example, after receiving the user's update instruction, the terminal device 100 performs the first restart operation based on the second system file, and the second restart operation is performed based on the first system file. It can be understood that the terminal device 100 runs different versions of system files in two adjacent restart processes, so the version flag PatchlevelChange needs to be set to 1 or true.

[0190] Exemplarily, since HotaFlag, Rollback, and PatchlevelChange in the current restart information are all equal to 1, it can be determined that the target version number is the second historical version number (which can be understood as the version number corresponding to the second system file). Further, since the second historical version number is the same as the version number corresponding to the verification key, it can be considered that the second security verification is passed, so the terminal device 100 can start multiple target processes in a preset order based on the first system file.

[0191] For example, see Figure 5 , Figure 5 A schematic diagram of another device restart scenario provided in an embodiment of the present application. Figure 5 As shown, if the terminal device 100 starts abnormally during the process of restarting based on the second system file, the terminal device 100 will perform a system rollback operation and restart again based on the first system file. Further, after the terminal device 100 completes the restart operation based on the first system file, a normal operation interface (such as a desktop main interface) can be presented to the user so that the user can use various functions on the terminal device 100 normally.

[0192] In some other possible implementations, the method may further include:

[0193] In response to the completion of the startup of multiple target processes, the update flag is adjusted to a state indicating that the terminal device has not performed a system file update operation, the rollback flag is adjusted to a state indicating that the terminal device has not performed a system rollback operation, and the version flag is adjusted to a state indicating that the terminal device has not run different versions of system files in two adjacent restart processes.

[0194] Exemplarily, if there is no abnormal startup in the process of starting multiple target processes in a preset order based on the first system file (it can be understood that the terminal device 100 completes the startup of multiple target processes in a preset order based on the first system file), it can be understood that the terminal device 100 has completed the restart operation, and the terminal device 100 needs to adjust the update flag to a state indicating that the terminal device has not performed a system file update operation, such as setting HotaFlag to 0 or false; adjust the rollback flag to a state indicating that the terminal device has not performed a system rollback operation, such as setting Rollback to 0 or false; and adjust the version flag to a state indicating that the terminal device did not run different versions of the system file in two adjacent restart processes, such as setting PatchlevelChange to 0 or false, so that the terminal device 100 can select a suitable target version number during the next restart operation, which helps the terminal device 100 to start normally during the update operation, so that the user can use the terminal device 100 normally and ensure the user experience.

[0195] See also Figure 6 , Figure 6 A schematic diagram of another method for restarting a device provided in an embodiment of the present application. Figure 6 As shown, the method may include:

[0196] S601: Receive a new version of the system file push, perform a system upgrade, and set an upgrade flag.

[0197] Exemplarily, the system upgrade may be in the form of a Hota upgrade, and the name of the upgrade flag may be HotaFlag.

[0198] Among them, the new version system file has an updated version number patchlevel compared to the old version system file currently running on the terminal device 100.

[0199] Optionally, after setting HotaFlag, the terminal device 100 may set the value of HotaFlag to 1 or true.

[0200] S602: After the new version system file is upgraded and installed, a restart operation is performed based on the new version system file.

[0201] S603: In the version reading phase, the version number can be read from the mirror file of the new version system file, and the current version number and the historical version number are set to store two variables before and after each update.

[0202] Exemplarily, the current version number PatchlevelCurrent can be set to the version number corresponding to the new version system file, and the historical version number PatchlevelPrevious can be set to the version number corresponding to the old version system file.

[0203] S604: Determine whether the three conditions of system upgrade, rollback, and version number change are met at the same time.

[0204] If the answer is yes, execute step S605: transfer the historical version number.

[0205] If the judgment is no, execute step S606: pass the current version number.

[0206] S607: The version number stored in the memory is updated to the version number of the new version system file, that is, the current version number.

[0207] Exemplarily, the version number stored in the memory can be understood as the patchlevel stored in the keyblob.

[0208] S608: During the process of executing the restart operation based on the new version system file, the terminal device does not start up due to some reason, and the terminal device continues to restart based on the new version system file.

[0209] For example, the aforementioned certain reason may be a reason such as zygote crush.

[0210] S609: During the restart process, the terminal device cannot be turned on because the previous fault still exists. The terminal device needs to continue to restart based on the new version of the system file. After multiple restart failures, the rollback mechanism is triggered and the device rollback flag is set, and the terminal device rolls back to the old version of the system file.

[0211] S610: Determine whether the three conditions of system upgrade, rollback, and version number change are met at the same time.

[0212] If the judgment is no, execute step S611: pass the current version number.

[0213] If the answer is yes, execute step S612: transfer the historical version number.

[0214] S613: The version number stored in the memory is also a historical version number.

[0215] S614: After passing the security check, the terminal device starts normally based on the old version system file.

[0216] The present application embodiment will be combined with Figure 7 Give an example Figure 3 and Figure 6 The execution space corresponding to each step of the method. See Figure 7 , Figure 7 A verification process framework diagram for a rollback mechanism provided in an embodiment of the present application.

[0217] like Figure 7 As shown, the terminal device 100 may include a user space, a kernel layer (Kernel layer) and a version reading layer (Bootloader layer). Among them, the above-mentioned situation in which the terminal device 100 fails to boot due to abnormal process startup occurs in the user space. Optionally, the Kernel layer of the terminal device 100 may perform the steps of "updating the version number in the memory" (which can be understood as updating the patchlevel in the keyblob, or updating the verification key) and "verifying the version number" (which can be understood as security verification). Optionally, the Bootloader layer of the terminal device 100 may perform the steps of "saving the current version number and the historical version number" (which can be understood as determining the current version number and the historical version number), "setting the version flag bit" (which can be understood as setting PatchlevelChange), "setting the rollback flag bit" (which can be understood as setting Rollback) and "judging each flag bit" (which can be understood as determining the target version number based on the restart information).

[0218] See also Figure 8 , Figure 8 A timing diagram of a verification process for a rollback mechanism provided in an embodiment of the present application.

[0219] like Figure 8 As shown, in the system upgrade (such as Hota upgrade) stage, the steps may include: the terminal device performs system upgrade, and restarts after the upgrade is completed. Optionally, the upgrade flag is set to 1 (such as setting HotaFlag to 1). It can be understood that the upgrade is completed when the new version system file is installed.

[0220] Optionally, for the restart phase with the new version system file: in the version reading phase after restart, the terminal device can save the current version number and the historical version number, and set the version flag to 1 (such as setting PatchlevelChange to 1); in the kernel phase after restart, the terminal device can update the version number in the memory (such as updating the patchlevel in the keyblob); if a failure occurs during the restart process (such as zygote crush), causing the terminal device to fail to boot, the phone will roll back to the old version of the system file.

[0221] Optionally, for the startup phase of rolling back to the old version of the system files: when the mobile phone rolls back to the old version of the system files, the terminal device can set the rollback flag Rollback to record the rollback operation; when the terminal device starts up based on the old version of the system files, the terminal device can determine whether the upgrade flag, rollback flag and version flag are all 1 at the same time, and pass the historical version number when it is judged to be yes; when the terminal device successfully starts up based on the old version of the system files, since the patchlevel in the keyblob is consistent with PatchlevelPrevious, it is determined that the security verification is successful, and therefore the terminal device can successfully start up based on the old version of the system files.

[0222] It can be seen that by implementing the method of the embodiment of the present application, when the terminal device is restarted based on the upgraded system file, the target version number can be determined from the historical version number and the current version number based on the restart information, which helps to pass the security check when the terminal device performs a rollback operation, so that the terminal device can be successfully restarted, thereby ensuring that the user can use the terminal device normally and improving the user experience.

[0223] See also Fig. 9 , Fig. 9 A schematic diagram of the composition of a terminal device provided in an embodiment of the present application. Fig. 9 As shown, the terminal device 100 may include: an interaction module 910, a communication module 920 and a processing module 930;

[0224] The interaction module 910 may be used to receive an update instruction for a system file;

[0225] The communication module 920 may be used to obtain and install a second system file based on the update instruction, where the second system file has a different version number from the first system file;

[0226] The processing module 930 may be used to determine a verification key based on the second system file in response to the second system file being installed, and trigger the terminal device to perform a restart operation;

[0227] The processing module 930 may also be used to determine a target version number based on the restart information corresponding to the restart operation, where the target version number is a historical version number or a current version number, where the historical version number is a version number corresponding to the system file running on the terminal device before the current restart, and the current version number is a version number corresponding to the system file running on the terminal device during the current restart;

[0228] The processing module 930 may also be used to perform security verification based on the verification key and the target version number;

[0229] The processing module 930 may also be used to start multiple target processes in the terminal device in a preset order when the security check passes.

[0230] In some possible implementations, the restart information may include an update flag, a rollback flag, and a version flag;

[0231] The update flag is used to indicate whether the terminal device is performing a system file update operation;

[0232] The rollback flag is used to indicate whether the terminal device performs a system rollback operation;

[0233] The version flag is used to indicate whether the terminal device runs different versions of the system file terminal in two consecutive restart processes.

[0234] In other possible implementations, when the update flag, rollback flag, and version flag respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of system files have been run during two adjacent restart processes, the historical version number is determined as the target version number.

[0235] In some other possible implementations, the electronic terminal device may further include:

[0236] The processing module 930 may also be used to determine the current version number as the target version number when the update flag indicates that the terminal device has not performed a system file update operation;

[0237] Alternatively, the processing module 930 may also be configured to determine the current version number as the target version number when the rollback flag indicates that the terminal device has not performed a system rollback operation;

[0238] Alternatively, the processing module 930 may also be configured to determine the current version number as the target version number when the version flag indicates that the terminal device does not respectively run different versions of system files in two adjacent restart processes.

[0239] In some other possible implementations, the electronic terminal device may further include:

[0240] The processing module 930 may also be used to determine the verification key based on the version number corresponding to the second system file in response to the second system file being installed.

[0241] The processing module 930 may also be used to adjust the update flag to a state indicating that the terminal device has performed a system file update operation;

[0242] The processing module 930 may also be used to restart the terminal device based on the second system file.

[0243] In some other possible implementations, when the verification key is identical to the version number corresponding to the target version number, it is determined that the security verification has passed.

[0244] In some other possible implementations, the electronic terminal device may further include:

[0245] The processing module 930 may also be used to determine the version number corresponding to the second system file as the first current version number, and determine the version number corresponding to the first system file as the first historical version number;

[0246] The processing module 930 may also be used to determine the target version number as the first current version number based on the restart information;

[0247] The processing module 930 may also be used to determine that a first security check has been passed based on the verification key and the first current version number, where the first security check is a security check corresponding to restarting the terminal device based on the second system file;

[0248] The processing module 930 may also be used to start multiple target processes in a preset order based on the second system file.

[0249] In some other possible implementations, the electronic terminal device may further include:

[0250] If, in the process of starting multiple target processes in a preset order based on the second system file, the number of process restarts exceeds a preset value, the processing module 930 may also be used to trigger a system rollback operation and adjust the rollback flag to a state indicating that the terminal device has performed a system rollback operation;

[0251] The processing module 930 may also be used to restart the terminal device based on the first system file.

[0252] In some other possible implementations, the electronic terminal device may further include:

[0253] The processing module 930 may also be used to determine the version number corresponding to the first system file as the second current version number, and determine the version number corresponding to the second system file as the second historical version number;

[0254] The processing module 930 may also be used to adjust the version flag to a state indicating that the terminal device runs different versions of the system file in two adjacent restart processes;

[0255] The processing module 930 may also be used to determine that the target version number is a second historical version number;

[0256] The processing module 930 may also be used to determine that a second security check has been passed based on the verification key and the second historical version number, where the second security check is a security check corresponding to restarting the terminal device based on the first system file;

[0257] The processing module 930 may also be used to start multiple target processes in a preset order based on the first system file.

[0258] In some other possible implementations, the electronic terminal device may further include:

[0259] The processing module 930 can also be used to adjust the update flag to a state indicating that the terminal device has not performed a system file update operation, adjust the rollback flag to a state indicating that the terminal device has not performed a system rollback operation, and adjust the version flag to a state indicating that the terminal device has not run different versions of the system file in two adjacent restart processes in response to the completion of the startup of multiple target processes.

[0260] For further information, see Fig.10 , Fig.10 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application.

[0261] The terminal device 100 may include a processor 101, a memory 102, a wireless communication module 103, a mobile communication module 104, an antenna 103A, an antenna 104A, a power switch 105, a sensor module 106, a focus motor 107, a camera 108, a display screen 109, etc. Among them, the sensor module 106 may include a gyroscope sensor 106A, an acceleration sensor 106B, an ambient light sensor 106C, an image sensor 106D, a distance sensor 106E, etc. Among them, the wireless communication module 103 may include a WLAN communication module, a Bluetooth communication module, etc. The above multiple parts can transmit data through a bus.

[0262] The processor 101 may include one or more processing units, for example, the processor 101 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0263] The memory 102 may be used to store computer executable program codes, and the executable program codes may include instructions. The processor 101 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the memory 102. The memory 102 may include a program storage area and a data storage area. In a specific implementation, the memory 102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.

[0264] The wireless communication function of the terminal device 100 can be implemented through the antenna 103A, the antenna 104A, the mobile communication module 104, the wireless communication module 103, the modem processor and the baseband processor.

[0265] Antenna 103A and antenna 104A can be used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0266] The mobile communication module 104 can provide wireless communication solutions including 2G / 3G / 4G / 5G etc. applied on the terminal device 100 .

[0267] The wireless communication module 103 can provide wireless communication solutions including wireless local area networks (WLAN), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. applied on the terminal device 100.

[0268] The gyro sensor 106A may be used to determine the motion posture of the terminal device 100 .

[0269] The acceleration sensor 106B can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes).

[0270] The terminal device 100 can realize the shooting function through the ISP, the camera 108, the video codec, the GPU, the display screen 109 and the application processor.

[0271] The terminal device 100 can realize the display function through a GPU, a display screen 109, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 109 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 101 may include one or more GPUs, which execute program instructions to generate or change display information.

[0272] The display screen 109 is used to display images, videos, etc. The display screen 109 includes a display panel. In some embodiments, the terminal device 100 may include 1 or N display screens 109, where N is a positive integer greater than 1.

[0273] The structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal 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.

[0274] In the embodiments of the present application:

[0275] Any one or more of the wireless communication module 103 , the mobile communication module 104 , the sensor module 106 , the focus motor 107 , the camera 108 , etc. may be used to detect the current environmental characteristics of the terminal device 100 .

[0276] The display screen 109 is used to display the user interface provided by the terminal device 100, such as a shooting interface or an album interface. The user interface displayed by the display screen 109 can refer to the UI embodiment described above.

[0277] For details of the operations performed by each component in the terminal device 100, please refer to the relevant description of the above method embodiment.

[0278] The software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The present application embodiment takes a mobile operating system with a layered architecture as an example to exemplify the software structure of the terminal device 100.

[0279] For further information, see Fig.11 , Fig.11 This is a software structure diagram provided by the embodiment of the present application. Fig.11 The layered architecture shown divides the software into several layers. Each layer has a clear role and division of labor, and the layers can communicate through software interfaces.

[0280] In some embodiments, the system of the terminal device 100 can be divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the system runtime layer, the hardware abstraction layer (HAL) and the kernel layer. The description of each of the above layers is as follows:

[0281] The application layer may include a series of application packages. For example, the application packages of the application layer may include applications such as camera, gallery, calendar, call, map, navigation, browser, video, music, and short message.

[0282] The application framework layer can provide an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer can include some predefined functions.

[0283] Exemplarily, the application framework layer may include an activity manager, a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and an accelerated graphics port (AGP), etc. Among them:

[0284] The activity manager can be used to manage the individual application lifecycles as well as general navigation back functionality.

[0285] The window manager can be used to manage window programs. For example, the window manager can obtain the display screen size of the terminal device 100, lock the screen, capture the screen, and determine whether there is a status bar.

[0286] Content providers can be used to store and retrieve data and make the data accessible to applications so that different applications can access or share data. For example, the data may include videos, images, audio, calls made and received, browsing history and bookmarks, and phone books.

[0287] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A 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 images.

[0288] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including answering a call, hanging up a call, etc.).

[0289] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.

[0290] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager can be used to notify download completion, 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, the terminal device vibrates, the indicator light flashes, etc.

[0291] AGP in the application framework layer can be used to improve the rendering performance of the graphics card, such as providing the graphics card with more cache capacity to achieve faster image processing speed.

[0292] The system runtime layer can include system libraries and Android runtime. Among them:

[0293] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the 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 object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0294] The system library can be understood as the support of the application framework, and is an important link between the application framework layer and the kernel layer. The system layer can include multiple functional modules, such as surface managers, media libraries, 3D graphics processing libraries (such as OpenGL ES), 2D graphics engines (such as SGL), etc. Among them:

[0295] The surface manager can be used to manage the display subsystem, for example, when the terminal device 100 executes multiple applications, it is responsible for managing the interaction between display and access operations. The surface manager can also be used to provide fusion of two-dimensional and three-dimensional layers for multiple applications.

[0296] The media library can support 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.

[0297] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.

[0298] A two-dimensional graphics engine can be understood as a drawing engine for two-dimensional drawing.

[0299] The hardware abstraction layer provides standard interfaces, such as the HAL interface definition language (HIDL) interface or the Android interface definition language (AIDL) interface.

[0300] The kernel layer can be understood as an abstract layer between hardware and software. The kernel layer may include system services such as security, memory management, process management, power management, network protocol management, and driver management. Among them, the kernel layer may include drivers. Exemplarily, the drivers may include display drivers, camera drivers, audio drivers, and sensor drivers. Optionally, the kernel layer may also be called an Android kernel or kernel program. Exemplarily, the hardware layer of the terminal device 100 may include a touch panel (TP), a liquid crystal display (LCD), and the like.

[0301] In some embodiments, the kernel layer can be understood as kernel state, and the other four layers (ie, application layer, application framework layer, system runtime layer, and HAL) can be understood as user state.

[0302] It is understandable that multiple applications that may exist in the application layer have video recording and / or playback functions. For example, if a camera has a video recording function, applications such as gallery, navigation, and browser may have a video playback function. Furthermore, based on the length, resolution, and shooting parameters of the video, the recording and / or playback of the video may be affected. The shooting parameters may include aperture value, shutter speed, sensitivity, exposure, focal length, depth of field, and the like.

[0303] For example, the video recording and / or playback related parameters supported by various applications can be stored in a sensor binary file (sensor bin), and the sensor bin file can be stored in an external memory, such as a disk or a hard disk. When a user uses a specific application to record and / or play a video, the application can read the video recording and / or playback related parameters into the memory so that the user can use the application normally and ensure the user experience.

[0304] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0305] The present application also provides a terminal device, which may include: a memory and a processor. The memory may be used to store a computer program; the processor may be used to call the computer program in the memory, so that the terminal device executes the method executed by the terminal device side in any of the above embodiments.

[0306] The present application also provides a chip system, which includes at least one processor for implementing the functions involved in the terminal device side in any of the above embodiments.

[0307] In some possible designs, the chip system also includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.

[0308] The chip system may be composed of the chip, or may include the chip and other discrete devices.

[0309] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.

[0310] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.

[0311] Exemplarily, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0312] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which, when executed, enables a computer to execute the method executed by the terminal device side in any of the above embodiments.

[0313] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the terminal device side in any of the above embodiments.

[0314] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0315] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.

[0316] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0317] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0318] In short, the above is only an embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of this application shall be included in the protection scope of this application.

Claims

1. A method for restarting a device, characterized in that: Applied to a terminal device, the system file currently running on the terminal device is a first system file, and the method includes: receiving an update instruction for a system file, and acquiring and installing a second system file based on the update instruction, wherein the second system file has a different version number from the first system file; In response to the second system file being installed, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation; Determine a target version number based on the restart information corresponding to the restart operation, the restart information including an update flag, a rollback flag, and a version flag, the target version number is a historical version number or a current version number, the historical version number is a version number corresponding to the system file running on the terminal device before the current restart, and the current version number is a version number corresponding to the system file running on the terminal device during the current restart; Performing a security verification based on the verification key and the target version number; When the security check passes, multiple target processes in the terminal device are started in a preset order; The determining the target version number based on the restart information corresponding to the restart operation includes: When the update flag, the rollback flag, and the version flag respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of system files are respectively run in two adjacent restart processes, the historical version number is determined as the target version number; When the update flag, the rollback flag, and the version flag respectively indicate that the terminal device performs an update operation and does not perform a system rollback operation, and does not run different versions of system files in two adjacent restart processes, the current version number is determined as the target version number.

2. The method according to claim 1, characterized in that The update flag is used to indicate whether the terminal device performs a system file update operation; The rollback flag is used to indicate whether the terminal device performs a system rollback operation; The version flag is used to indicate whether the terminal device runs different versions of system files respectively during two adjacent restart processes.

3. The method according to claim 2, characterized in that In response to the second system file being installed completely, determining a verification key based on the second system file, and triggering the terminal device to perform a restart operation, includes: In response to the second system file being installed, determining the verification key based on a version number corresponding to the second system file; Adjusting the update flag to a state indicating that the terminal device has performed a system file update operation; Restart the terminal device based on the second system file.

4. The method according to claim 3, characterized in that When the verification key is identical to the version number corresponding to the target version number, it is determined that the security verification has passed.

5. The method according to claim 4, characterized in that The restarting the terminal device based on the second system file includes: Determine the version number corresponding to the second system file as the first current version number, and determine the version number corresponding to the first system file as the first historical version number; Determine, based on the restart information, that the target version number is the first current version number; Based on the verification key and the first current version number, determining that a first security verification is passed, where the first security verification is a security verification corresponding to restarting the terminal device based on the second system file; Based on the second system file, the multiple target processes are started in a preset order.

6. The method according to claim 5, characterized in that The method further comprises: If, in the process of starting the multiple target processes in a preset order based on the second system file, the number of process restarts exceeds a preset value, a system rollback operation is triggered, and the rollback flag is adjusted to a state indicating that the terminal device has performed a system rollback operation; Restart the terminal device based on the first system file.

7. The method according to claim 6, characterized in that The restarting the terminal device based on the first system file includes: Determine the version number corresponding to the first system file as the second current version number, and determine the version number corresponding to the second system file as the second historical version number; Adjusting the version flag to a state indicating that the terminal device runs different versions of the system file in two adjacent restart processes; Determine, based on the restart information, that the target version number is the second historical version number; Based on the verification key and the second historical version number, determining that a second security verification is passed, where the second security verification is a security verification corresponding to restarting the terminal device based on the first system file; Based on the first system file, the multiple target processes are started in a preset order.

8. The method according to any one of claims 2 to 7, characterized in that: The method further comprises: In response to the completion of starting the multiple target processes, the update flag is adjusted to a state indicating that the terminal device has not performed a system file update operation, the rollback flag is adjusted to a state indicating that the terminal device has not performed a system rollback operation, and the version flag is adjusted to a state indicating that the terminal device has not run different versions of system files in two adjacent restart processes.

9. A terminal device, characterized in that: The system file currently running on the terminal device is the first system file; The terminal device includes: an interaction module, a communication module and a processing module; The interaction module is used to receive an update instruction for a system file; The communication module is used to obtain and install a second system file based on the update instruction, wherein the second system file has a different version number from the first system file; The processing module is configured to, in response to the completion of the installation of the second system file, determine a verification key based on the second system file, and trigger the terminal device to perform a restart operation; The processing module is further used to determine a target version number based on the restart information corresponding to the restart operation, the restart information including an update flag, a rollback flag, and a version flag, the target version number is a historical version number or a current version number, the historical version number is a version number corresponding to the system file running on the terminal device before the current restart, and the current version number is a version number corresponding to the system file running on the terminal device during the current restart; The processing module is further used to perform security verification based on the verification key and the target version number; The processing module is further used to start multiple target processes in the terminal device in a preset order when the security check passes; The processing module is further configured to determine the historical version number as the target version number when the update flag bit, the rollback flag bit, and the version flag bit respectively indicate that the terminal device has performed a system file update operation and a system rollback operation, and different versions of system files have been run in two adjacent restart processes; The processing module is also used to determine the current version number as the target version number when the update flag, the rollback flag, and the version flag respectively indicate that the terminal device performs an update operation, does not perform a system rollback operation, and does not run different versions of system files in two adjacent restart processes.

10. A terminal device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions so that the method according to any one of claims 1 to 8 is executed.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the method according to any one of claims 1 to 8 is executed.

Citation Information

Patent Citations

  • Upgrading method and device of terminal equipment, equipment and storage medium

    CN111506326A

  • Reusable message flow between applications of a message broker integrated systems environment

    US20160294969A1