A method for restoring factory settings, electronic equipment and medium

By pausing threads in smart wearable devices and executing data clearing functions in sequence, the problem of uncontrolled threads seizing the central processor is solved, ensuring the stability and success rate of restoring factory settings.

CN117093413BActive Publication Date: 2024-09-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310851562.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-11
Publication Date
2024-09-27
Estimated Expiration
2043-07-11

AI Technical Summary

Technical Problem

When a smart wearable device is restored to factory settings, uncontrolled threads seize the central processor or operate the file system, causing the factory settings to time out or even fail.

Method used

After receiving the factory reset message, the thread of the electronic device is paused, and the data is cleared sequentially according to the data clearing function corresponding to the thread to restore the factory settings.

Benefits of technology

It solves the problem of uncontrolled threads preempting the central processor or operating the file system due to the multi-thread execution method, resulting in factory reset timeout or even failure, ensuring the stability and success rate of factory reset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117093413B
    Figure CN117093413B
Patent Text Reader

Abstract

A method for restoring factory settings, an electronic device and a medium, relating to the field of data processing technology. The method for restoring factory settings comprises: after receiving a message for restoring factory settings, pausing the thread of the electronic device; and executing data clearing in sequence according to the data clearing function corresponding to the thread, so as to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly executing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly suspended, the registered data clearing function is uniformly triggered, and the data clearing is performed in sequence, thereby solving the problem of uncontrolled threads occupying the central processing unit or operating the file system due to the use of a multi-threaded execution method, and then causing the factory settings restoration to time out or even fail.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method for restoring factory settings, an electronic device, and a medium. Background Art

[0002] Factory settings refer to the default state of electronic devices such as smart wearable devices when they leave the factory, such as the default start interface, standby mode, operation shortcut keys, etc. Current electronic devices all have the function of restoring factory settings, which can restore the personalized settings of electronic devices to the default state when they leave the factory.

[0003] Taking smart wearable devices as an example, when the smart wearable system is restored to factory settings, the system will run multiple threads at the same time to implement multi-threaded execution, thereby speeding up the restoration of factory settings.

[0004] However, only a few threads can use the factory reset framework, and the rest of the threads are not controlled by the factory reset. Uncontrolled threads may seize the CPU of the smart wearable device or operate the file system of the smart wearable device when performing the factory reset, causing the factory reset to time out or even fail. Summary of the invention

[0005] The purpose of the present application is to provide a method for restoring factory settings, an electronic device and a medium, which can solve the problem of factory reset timeout or even failure caused by uncontrolled threads occupying the central processing unit or operating the file system.

[0006] In the first aspect, the present application discloses a method for restoring factory settings, which is applied to electronic devices such as wearable smart watches and wearable smart headphones. The method for restoring factory settings includes: after receiving a message for restoring factory settings, pausing the thread of the electronic device; and performing data clearing in sequence according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly performing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly suspended, the registered data clearing function is uniformly triggered, and the data clearing is performed in sequence, thereby solving the problem of uncontrolled threads occupying the central processor or operating the file system due to the use of a multi-threaded execution method, and then the factory settings restoration timeout or even failure occurs.

[0007] In some possible implementations, after receiving the message to restore factory settings, pausing the thread of the electronic device includes: after receiving the message to restore factory settings, pausing the static thread and / or dynamic thread of the electronic device; performing data clearing in sequence according to the data clearing function corresponding to the thread to restore factory settings includes: performing data clearing in sequence according to the callback function corresponding to the static thread, and / or, performing data clearing in sequence according to the standard function corresponding to the dynamic thread to restore factory settings. Thus, after uniformly pausing the static thread and dynamic thread of the electronic device, uniformly triggering the callback function corresponding to the registered static thread and the standard function corresponding to the dynamic thread, and performing data clearing in sequence, the problem of factory reset timeout or even failure caused by uncontrolled threads occupying the central processor or operating the file system can be solved.

[0008] In some possible implementations, the electronic device includes a factory reset framework, which includes: a device management task node, a human-computer interaction page node, and a thread node, wherein the device management task node is used to manage the thread of the electronic device, the human-computer interaction page node is used to display the human-computer interaction page of the electronic device, and the thread node is used to execute the thread of the electronic device; after receiving the factory reset message, pausing the thread of the electronic device includes: after receiving the factory reset message sent by the factory end, the device management task node sends a pause instruction to the thread node, so that the thread node pauses the thread of the electronic device; or, after receiving the factory reset operation, the human-computer interaction page node sends a pause instruction to the thread node, so that the thread node pauses the thread of the electronic device. Thus, when it is necessary to perform factory-level factory reset and user-level factory reset, a method of uniformly pausing the electronic device thread, uniformly triggering the registered data clearing function, and performing data clearing in sequence can be adopted, thereby solving the problem of uncontrolled threads occupying the central processor or operating the file system due to the use of a multi-threaded execution method, and then causing the factory reset timeout or even failure.

[0009] In some possible implementations, data clearing is performed in sequence according to the data clearing function corresponding to the above-mentioned thread to restore factory settings, including: the device management task node performs data clearing in sequence according to the data clearing function corresponding to the thread to restore factory settings.

[0010] In some possible implementations, the device management task node sequentially performs data clearing according to the data clearing function corresponding to the above-mentioned thread to restore factory settings, including: after the above-mentioned thread node suspends the thread of the above-mentioned electronic device, the above-mentioned thread node sends a pause completion instruction to the above-mentioned device management task node; determines whether the number of the above-mentioned pause completion instructions received by the above-mentioned device management task node is equal to the number of the above-mentioned thread nodes; if so, the above-mentioned device management task node sequentially performs data clearing according to the data clearing function corresponding to the above-mentioned thread to restore factory settings. Therefore, after uniformly suspending the threads of electronic devices, the method of uniformly triggering the registered data clearing function and sequentially performing data clearing is adopted, thereby solving the problem of uncontrolled threads occupying the central processor or operating the file system due to the use of a multi-threaded execution method, which leads to timeout or even failure of restoring factory settings.

[0011] In some possible implementations, the thread node is a static thread node. Before the device management task node receives a factory reset message sent by the factory, the method further includes: the electronic device registers a callback function corresponding to the static thread node; after the device management task node receives the factory reset message sent by the factory, it sends a pause instruction to the thread node so that the thread node pauses the thread of the electronic device, including: after the device management task node receives the factory reset message sent by the factory, it sends a pause instruction to the static thread node so that the static thread node pauses the static thread of the electronic device; the data clearing function corresponding to the thread is executed in sequence to restore the factory settings, including: after the static thread node suspends the static thread of the electronic device, the static thread node sends a pause completion instruction to the device management task node; it is determined whether the number of the pause completion instructions received by the device management task node is equal to the number of the static thread nodes; if so, the device management task node executes data clearing in sequence according to the callback function corresponding to the static thread to restore the factory settings. Therefore, after uniformly pausing the static threads and dynamic threads of the electronic device, the callback functions corresponding to the registered static threads and the standard functions corresponding to the dynamic threads are uniformly triggered, and the method of clearing data is performed in sequence, thereby solving the problem of timeout or even failure of restoring to factory settings due to uncontrolled threads occupying the central processing unit or operating the file system.

[0012] In some possible implementations, the callback function includes any one or more of an audio callback function, an upgrade callback function, a security callback function, a near field communication callback function, an application callback function, a positioning callback function, a Bluetooth callback function, a device callback function, and a communication callback function.

[0013] In some possible implementations, the thread node also includes a dynamic thread node. Before the device management task node receives the factory reset message sent by the factory end, the method also includes: when creating the dynamic thread node, the electronic device registers a standard function corresponding to the dynamic thread node; after receiving the factory reset message, the method also includes: the device management task node sends a stop instruction to the dynamic thread node, so that the dynamic thread node performs data clearing according to the standard function corresponding to the dynamic thread node to restore the factory settings. Thus, after uniformly pausing the static thread and dynamic thread of the electronic device, uniformly triggering the callback function corresponding to the registered static thread and the standard function corresponding to the dynamic thread, and sequentially performing the data clearing method, it is possible to solve the problem of factory reset timeout or even failure caused by uncontrolled threads occupying the central processor or operating the file system.

[0014] In some possible implementations, the method also includes: after the dynamic thread node clears the dynamic thread data of the electronic device, the dynamic thread node sends a stop completion instruction to the device management task node; the above-mentioned judgment whether the number of the above-mentioned pause completion instructions received by the above-mentioned device management task node is equal to the number of the above-mentioned static thread nodes includes: judging whether the number of the above-mentioned stop completion instructions received by the above-mentioned device management task node is equal to the number of the above-mentioned dynamic thread nodes; if so, judging whether the number of the above-mentioned pause completion instructions received by the above-mentioned device management task node is equal to the number of the above-mentioned static thread nodes.

[0015] In some possible implementations, the method further includes: the electronic device destroying the dynamic thread node.

[0016] In some possible implementations, after the device management task node receives the factory reset message sent by the factory, it sends a pause instruction to the thread node, including: after the device management task node receives the factory reset message sent by the factory, it sends a screen off instruction to the human-computer interaction page node; after the human-computer interaction page node executes the screen off operation according to the screen off instruction, it sends a pause instruction to the thread node.

[0017] In some possible implementations, after receiving the factory reset message sent by the factory, the device management task node sends a screen-off instruction to the human-computer interaction page node, including: the device management task node receives the factory reset message sent by the factory, the factory reset message includes: a factory reset instruction, a device identity instruction and a first encryption value, the first encryption value is a value obtained by encrypting the factory reset instruction and the device identity according to a first encryption algorithm or a first key; the device management task node verifies the first encryption value; if the first encryption value is verified, the device management task node sends a screen-off instruction to the human-computer interaction page node. Based on this, by performing security verification on the factory reset message, it is possible to avoid the problem of information leakage and economic loss to the owner when the electronic device is out of the control of the owner and others restore the factory settings.

[0018] In some possible implementations, the device management task node verifies the first encrypted value, including: the device management task node verifies whether the device identity in the factory reset message is consistent with the local device identity; if so, the device management task node verifies the first encrypted value. Based on this, by performing security verification on the factory reset message, it is possible to avoid the problem of information leakage and economic loss to the owner due to others restoring the factory settings of the electronic device when it is out of the owner's control.

[0019] In some possible implementations, the device management task node verifies the first encrypted value, including: the device management task node decrypts the first encrypted value according to the first decryption algorithm or the second key to obtain the corresponding device identity; the device management task node determines whether the device identity obtained after decryption is consistent with the device identity in the factory reset message; if so, the device management task node determines that the first encrypted value has been verified. Based on this, by performing security verification on the factory reset message, it is possible to avoid the problem of information leakage and economic loss to the owner when the electronic device is out of the control of the owner and others restore the factory settings.

[0020] In some possible implementations, the device management task node verifies the first encrypted value, including: the device management task node encrypts the factory reset instruction and the device identity according to the second encryption algorithm or the second key to obtain the second encrypted value; the device management task node determines whether the first encrypted value is consistent with the second encrypted value; if so, the device management task node determines that the first encrypted value is verified. Based on this, by performing security verification on the factory reset message, it is possible to avoid the problem of information leakage and economic loss to the owner when the electronic device is out of the control of the owner and others restore the factory settings.

[0021] In some possible implementations, the method further includes: the device management task node deletes the application partition in the application disk. Therefore, after performing the factory reset, the device management node needs to delete the application partition to ensure the deletion of the user's personalized data.

[0022] In a second aspect, the present application discloses an electronic device, including a processor and a memory; the memory is used to store computer execution commands; the processor is used to execute the computer execution commands stored in the memory, so that the processor executes the factory reset method as in the first aspect.

[0023] In a third aspect, the present application discloses a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed, the factory reset method in the first aspect is implemented.

[0024] In a fourth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the factory reset method in the first aspect.

[0025] In a fifth aspect, the present application discloses a device for restoring factory settings, which includes a pause module and a clear module. Specifically, the pause module is used to pause the thread of the electronic device after receiving the message for restoring factory settings; the clear module is used to perform data clearing in sequence according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly performing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly paused, the registered data clearing function is uniformly triggered, and the data is cleared in sequence, thereby solving the problem of uncontrolled threads occupying the central processing unit or operating the file system due to the use of a multi-threaded execution method, and then causing the factory settings restoration to time out or even fail.

[0026] Compared with the prior art, this application has the following beneficial effects:

[0027] The present application discloses a method for restoring factory settings, an electronic device, and a medium. The method for restoring factory settings includes: after receiving a message for restoring factory settings, pausing the thread of the electronic device; and sequentially executing data clearing according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly executing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly suspended, the registered data clearing function is uniformly triggered, and the data clearing is performed sequentially, thereby solving the problem of uncontrolled threads occupying the central processing unit or operating the file system due to the use of a multi-threaded execution method, and then the factory settings restoration timeout or even failure occurs. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A signaling diagram for an existing factory-level factory reset;

[0029] Figure 2 A signaling diagram for an existing user-level factory reset;

[0030] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0031] Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0032] Figure 5A A schematic diagram of a wearable smart watch system setting menu provided in an embodiment of the present application;

[0033] Figure 5B A schematic diagram of restoring factory settings of a wearable smart watch provided in an embodiment of the present application;

[0034] Figure 5C A schematic diagram of a power-off reminder for a wearable smart watch provided in an embodiment of the present application;

[0035] Fig. 6A A schematic diagram of restoring factory settings of a wearable smart headset provided in an embodiment of the present application;

[0036] Figure 6B A schematic diagram of another wearable smart headset restoring factory settings provided in an embodiment of the present application;

[0037] Figure 7 A signaling diagram for factory-level restoration of factory settings provided in an embodiment of the present application;

[0038] Figure 8 A signaling diagram for restoring factory settings at a user level provided in an embodiment of the present application;

[0039] Fig. 9A signaling diagram for restoring factory settings of a registration callback function provided in an embodiment of the present application;

[0040] Fig.10 Another signaling diagram for restoring factory settings by a registration callback function provided in an embodiment of the present application;

[0041] Fig.11 A schematic diagram of a device for restoring factory settings provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The terms "first", "second", "third", etc. in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.

[0043] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

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

[0045] User-level factory restore is a low-level format initiated by the user. It can only format the user's installed software and usage data, but cannot format the operating system, etc.

[0046] Factory reset is an advanced format initiated by the factory. In addition to formatting the user's installed software and usage data, it can also format the operating system so that the phone only retains the necessary software and operating system when it leaves the factory.

[0047] Taking smart wearable devices as an example, when the smart wearable system is restored to factory settings, the system will run multiple threads at the same time to implement multi-threaded execution, thereby speeding up the restoration of factory settings.

[0048] For some specific implementations, see Figure 1 , which is a signaling diagram of an existing factory-level restoration to factory settings. Figure 1 The device management task node (Device), the human-computer interaction page node (User Interface, UI) and all thread nodes are located in the factory reset framework in the underlying software service framework in the electronic device framework layer. Exemplarily, the thread nodes may include health management thread nodes, communication thread nodes, Bluetooth thread nodes, etc.

[0049] Specifically, the existing factory-level method for restoring factory settings includes:

[0050] S11: The device management task node receives a factory reset instruction issued by the factory.

[0051] Factory-level restoration of factory settings requires that the factory end first send a factory restoration instruction to the device management task node of the factory restoration framework of the electronic device, and the factory restoration instruction is used to instruct the electronic device to restore the factory settings.

[0052] S12: The device management task node sends a screen-off instruction to the human-computer interaction screen node.

[0053] After the device management task node receives the factory reset instruction sent by the factory, the device management task node can send a screen-off instruction to the human-computer interaction screen node. The screen-off instruction is used to instruct the electronic device to turn off the screen in order to clean up the data.

[0054] S13: The human-computer interaction page node performs a screen-off operation.

[0055] In some specific implementations, after receiving the screen-off instruction, the human-computer interaction page node may directly execute the screen-off operation, or may first display a shutdown prompt on the display screen of the electronic device and then execute the screen-off operation.

[0056] It should be noted that when the screen is turned off, the data on the human-computer interaction page of the electronic device also needs to be cleaned up.

[0057] S14: The human-computer interaction page node sends a screen-off completion instruction to the device management task node.

[0058] After the human-computer interaction page node completes the screen-off operation of the electronic device, a screen-off completion instruction can be sent to the device management task node to notify the device management task node that the above screen-off operation has been successfully performed.

[0059] S15: The device management task node sends a data cleanup instruction to all thread nodes.

[0060] After the device management task node receives the screen-off completion instruction sent by the human-computer interaction page node, it sends a cleanup data instruction to all thread nodes. The cleanup data instruction is used to instruct the electronic device to clean up data, that is, to perform a factory reset operation.

[0061] It is understandable that the factory reset framework contains multiple thread nodes, such as a health management thread node, a communication thread node, a Bluetooth thread node, etc. The device management task node needs to send a cleanup data instruction to all thread nodes in turn.

[0062] S16: The device management task node and all thread nodes perform a data cleanup operation.

[0063] S17: All thread nodes send a data cleanup completion instruction to the device management task node.

[0064] It can be understood that after all thread nodes have completed data cleaning, they can uniformly send a data cleaning completion instruction to the device management task node, so that the device management task node can know that data cleaning is completed after receiving the data cleaning completion instruction; it can also be that each thread node sends a data cleaning completion instruction to the device management task node after completing data cleaning. When the number of data cleaning completion instructions received by the device management task node is equal to the number of thread nodes, the device management task node can know that data cleaning is completed.

[0065] S18: The device management task node restarts the system.

[0066] After the device management task node learns that the data cleaning is completed, it can restart the system. After the system is restarted, the electronic device will complete the factory-level restoration operation.

[0067] It can be learned from the above-mentioned existing factory-level method of restoring factory settings that in order to speed up the process of restoring factory settings, the electronic device will simultaneously cause the device management task node, the human-computer interaction page node and all thread nodes to perform data cleaning operations, that is, run multiple threads at the same time to achieve multi-threaded execution.

[0068] For other specific implementations, see Figure 2 , which is a signaling diagram of an existing user-level factory reset. It should be noted that the existing steps S22 to S26 of the user-level factory reset are the same as the existing steps S14 to S18 of the factory-level factory reset, which will not be described in detail.

[0069] Specifically, the existing method for restoring factory settings at the user level includes:

[0070] S21: The human-computer interaction page node receives a factory reset operation.

[0071] Electronic devices usually provide a system setting menu, in which a factory reset option is provided. When the human-computer interaction page node detects the start operation of the factory reset option, it obtains the instruction to start the factory reset, and then performs step S22, i.e., the subsequent operation.

[0072] It should be noted that when receiving the factory reset operation, it is necessary to simultaneously clear the data on the human-computer interaction page of the electronic device and turn off the display screen of the electronic device.

[0073] S22: The human-computer interaction page node sends a screen-off completion instruction to the device management task node.

[0074] S23: The device management task node sends a data cleanup instruction to all thread nodes.

[0075] S24: The device management task node and all thread nodes perform a data cleanup operation.

[0076] S25: All thread nodes send a data cleanup completion instruction to the device management task node.

[0077] S26: All thread nodes send a data cleanup completion instruction to the device management task node.

[0078] Similar to the above-mentioned existing factory-level method of restoring factory settings, in order to speed up the process of restoring factory settings, the electronic device will simultaneously cause the device management task node, the human-computer interaction page node and all thread nodes to perform data cleaning operations, that is, run multiple threads at the same time to achieve multi-threaded execution.

[0079] However, among all thread nodes, only a few thread nodes can use the factory reset framework, and the rest of the thread nodes are not subject to factory reset control. Uncontrolled thread nodes may seize the CPU of the smart wearable device or operate the file system of the smart wearable device when performing factory reset, causing the factory reset to time out or even fail.

[0080] In view of this, the present application discloses a method for restoring factory settings, an electronic device, and a medium. After receiving a message for restoring factory settings, the thread of the electronic device is suspended; data clearing is performed in sequence according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly performing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly suspended, the registered data clearing function is uniformly triggered, and data clearing is performed in sequence, thereby solving the problem of uncontrolled threads occupying the central processing unit or operating the file system due to the use of a multi-threaded execution method, and then causing the factory settings restoration to time out or even fail.

[0081] See also Figure 3 , which is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. First, an exemplary electronic device 100 provided in an embodiment of the present application is introduced.

[0082] In some embodiments, the electronic device 100 may be a wearable electronic device such as a wearable sports watch, a wearable smart watch, a wearable bracelet, a wearable audio headset, etc.; it may also be a mobile phone powered by multiple batteries, a laptop computer, a tablet computer, an augmented reality (AR) device, a virtual reality (VR) device, and a vehicle-mounted device, etc. It should be noted that the embodiment of the present application does not impose any special restrictions on the specific type of the electronic device 100.

[0083] like Figure 3 As shown, the electronic device 100 may include a processor 110, an internal memory 120, an antenna 1, an antenna 2, a mobile communication module 130, a wireless communication module 140, an audio module 150, a display screen 160, etc. The audio module 150 may include a speaker 150A, a receiver 150B, a microphone 150C, an earphone interface 150D, etc.

[0084] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device 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.

[0085] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, in the present application, the processor 110 can suspend the thread of the electronic device after receiving the factory reset message; and perform data clearing in sequence according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when the factory reset is required, it is not directly executed by multiple threads at the same time to restore the factory reset, but a method of uniformly suspending the electronic device thread, uniformly triggering the registered data clearing function, and performing data clearing in sequence is adopted, thereby solving the problem of uncontrolled threads occupying the central processor or operating the file system due to the use of a multi-threaded execution method, and then timeout or even failure of the factory reset.

[0086] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0087] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0088] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0089] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 may be coupled to a charger, a flashlight, etc. through different I2C bus interfaces.

[0090] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 150 via the I2S bus to achieve communication between the processor 110 and the audio module 150. In some embodiments, the audio module 150 can transmit an audio signal to the wireless communication module 140 via the I2S interface to achieve the function of answering a call through a Bluetooth headset connected to the electronic device 100.

[0091] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 140. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 140 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 150 can transmit an audio signal to the wireless communication module 140 through the UART interface to implement the function of playing music through a Bluetooth headset connected to the electronic device 100.

[0092] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 160. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the display screen 160 can communicate via the DSI interface to implement the display function of the electronic device 100.

[0093] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the display screen 160, the wireless communication module 140, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0094] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0095] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 130, wireless communication module 140, modem processor and baseband processor.

[0096] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0097] The internal memory 120 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 120. The internal memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 120, and / or the instructions stored in the memory provided in the processor.

[0098] The mobile communication module 130 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 130 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 130 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 130 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 130 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 130 can be set in the same device as at least some of the modules of the processor 110.

[0099] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor displays an image or video through the display screen 160. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 130 or other functional modules.

[0100] The wireless communication module 140 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 140 can be one or more devices integrating at least one communication processing module. The wireless communication module 140 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 140 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0101] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 130, and the antenna 2 is coupled to the wireless communication module 140, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).

[0102] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 150, the speaker 150A, the receiver 150B, the microphone 150C, the headphone jack 150D, and the application processor.

[0103] The audio module 150 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 150 can also be used to encode and decode audio signals. In some embodiments, the audio module 150 can be arranged in the processor 110, or some functional modules of the audio module 150 can be arranged in the processor 110.

[0104] The speaker 150A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 150A.

[0105] The receiver 150B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 150B close to the human ear.

[0106] Microphone 150C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 150C to input the sound signal into microphone 150C. The electronic device 100 can be provided with at least one microphone 150C. In other embodiments, the electronic device 100 can be provided with two microphones 150C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 150C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0107] The earphone interface 150D is used to connect a wired earphone and can be a USB interface, or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0108] The electronic device implements the display function through a GPU, a display screen 160, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 160 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0109] The display screen 160 is used to display images, videos, etc. The display screen 160 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 160, where N is a positive integer greater than 1.

[0110] A series of graphical user interfaces (GUIs) can be displayed on the display screen 160 of the electronic device, and these GUIs are the main screen of the electronic device. Generally speaking, the size of the display screen 160 of the electronic device is fixed, and only limited controls can be displayed on the display screen 160 of the electronic device. A control is a GUI element, which is a software component included in an application program, and controls all data processed by the application program and interactive operations on the data. Users can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.

[0111] In addition, an operating system is running on the above components, such as the iOS operating system developed by Apple, the Android open source operating system developed by Google, and the Windows operating system developed by Microsoft. Application programs can be installed and run on the operating system.

[0112] The operating system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.

[0113] See also Figure 4, which is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application. The present application embodiment takes the Android system of layered architecture as an example to exemplarily illustrate the software structure of the electronic device 100.

[0114] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer (Applications, APP), framework layer (Framework, FWK), internal library layer and kernel layer (Kernel).

[0115] The application layer may include a series of application packages. In some embodiments, the application layer may include third-party applications, communication applications, health, wallets and other applications.

[0116] The framework layer provides an application programming interface (API) and a programming framework for the application program of the application layer, and the framework layer may include some predefined functions. In some specific implementations, the framework layer may include a UI architecture, sports health services, underlying software services, and hardware services. Specifically, the factory reset framework corresponding to the factory reset method provided in the present application is stored in the underlying software service module of the framework layer.

[0117] The internal library defines the interface of the hardware "driver" to reduce the coupling between the Android operating system and the hardware. In some specific implementations, the internal library layer includes the basic library, algorithm library and protocol stack. Specifically, the protocol stack refers to the sum of the protocols at each layer in the network, which vividly reflects the process of data transmission in a network: from the upper layer protocol to the lower layer protocol, and then from the lower layer protocol to the upper layer protocol.

[0118] The kernel layer is responsible for managing the system's threads, memory, device drivers, files, and network systems, and determines the system's performance and stability. In some specific implementations, the kernel layer includes a hardware abstraction layer (HAL) and a hardware driver layer.

[0119] It should be noted that although the embodiment of the present application is described using the Android system as an example, its basic principles are also applicable to electronic devices 100 based on operating systems such as iOS and Windows.

[0120] When the electronic device 100 is a wearable smart watch, the user level restores the factory settings. Figure 5A, this figure is a schematic diagram of a wearable smart watch system setting menu provided in an embodiment of the present application. It is necessary to first enter the system setting menu page 501 of the electronic device 100.

[0121] The system setting menu page 501 includes a variety of setting options, such as software update options, language and input method options, factory reset options 502, date and time options, etc. The user can perform a startup operation on the option, such as clicking, long pressing, sliding, etc. After receiving the user's startup operation, the electronic device 100 can enter the corresponding setting page.

[0122] See also Figure 5B , which is a schematic diagram of restoring factory settings of a wearable smart watch provided in an embodiment of the present application. After the user performs a startup operation on the factory settings restore option 502, the factory settings restore page 503 can be entered. In the factory settings restore page 503, there are a "yes" option 504 and a "no" option. If the user performs a startup operation on the "yes" option 504, such as clicking, long pressing, sliding, etc., the electronic device 100 will restore the factory settings; if the user performs a startup operation on the "no" option, the electronic device 100 will automatically return to the system settings menu page 501.

[0123] After the electronic device 100 is restored to factory settings, the electronic device 100 can directly turn off the screen to clean up data, or it can first display a shutdown prompt and then perform the screen turning off operation. Figure 5C , which is a schematic diagram of a shutdown reminder for a wearable smart watch provided in an embodiment of the present application. The shutdown reminder page can be set by the user, and can be an icon set by the user, or can be a text set by the user; in addition, the shutdown reminder page can also be an official reminder page set by a technician. It should be noted that this application does not limit the specific shutdown reminder.

[0124] When the electronic device 100 is a wearable smart headset and performs a user-level factory reset, since the wearable smart headset has no display screen, then, in a specific implementation, see Fig. 6A , which is a schematic diagram of restoring factory settings of a wearable smart headset provided in an embodiment of the present application. The user can initiate a factory settings restore instruction by clicking a physical button 601 on the smart wearable headset. After receiving the factory settings restore instruction, the human-computer interaction page node of the smart wearable headset can directly broadcast and notify all thread nodes of the smart wearable headset, so that all thread nodes perform subsequent factory settings restore operations.

[0125] In another specific implementation, see Figure 6B, which is a schematic diagram of another wearable smart headset restoring factory settings provided by an embodiment of the present application. After the user connects the wearable smart headset to another electronic device 200 via Bluetooth or WIFI, the user can restore the factory settings of the wearable smart headset on the electronic device 200.

[0126] It should be noted that there may be other methods of restoring factory settings, which are not limited in this application.

[0127] See also Figure 7 , which is a signaling diagram for factory-level restoration of factory settings provided in an embodiment of the present application. It should be noted that, Figure 7 The device management task node (Device), the human-computer interaction page node (User Interface, UI) and all thread nodes are located in the factory reset framework in the underlying software service framework in the electronic device framework layer.

[0128] The method includes:

[0129] S71: The device management task node receives a factory reset message sent by the factory.

[0130] The factory reset message may include at least a factory reset instruction, a device identity, and a first encrypted value, wherein the factory reset instruction is an instruction for instructing the electronic device to restore its factory settings; the device identity refers to the identity of the electronic device 100, which is used to represent a unique target electronic device; the first encrypted value may be the value obtained by encrypting the factory reset instruction and the device identity according to a preset first encryption algorithm or a preset first key.

[0131] After receiving the factory reset message sent by the factory, the device management task node of the electronic device first needs to confirm whether the device identity in the factory reset message is consistent with the local device identity of the electronic device. If the two are consistent, the first encrypted value in the factory reset message can be verified.

[0132] In some specific implementations, the electronic device may first decrypt the first encrypted value in the factory reset message according to a preset first decryption algorithm or a preset second key to obtain a corresponding device identity. Subsequently, the decrypted device identity is compared with the device identity in the factory reset message. If the two are consistent, it is determined that the first encrypted value has been verified, and the device management task node may execute step S72 and subsequent operations.

[0133] In some other specific implementations, the electronic device may first encrypt the factory reset instruction and the device identity in the factory reset message according to a preset second encryption algorithm or a preset second key to obtain a corresponding second encrypted value. Subsequently, the first encrypted value and the second encrypted value in the factory reset message are compared. If the two are consistent, it is determined that the first encrypted value has been verified, and the device management task node may execute step S72 and subsequent operations.

[0134] It should be noted that there may be other methods for security verification of the factory reset message, such as forcing the user to set a lock screen password when the electronic device is turned on for the first time. After the device management task node of the electronic device receives the factory reset message, it notifies the user to enter the lock screen password, and determines whether the lock screen password entered by the user is consistent with the lock screen password set for the first time. If the two are consistent, execute step S72 and subsequent operations, etc. This application does not limit this.

[0135] Based on this, by performing security verification on the factory reset message, it is possible to avoid the problem that when the electronic device is out of the owner's control, others restore the factory settings, which may cause information leakage and economic losses to the owner.

[0136] It should be noted that the reception of the above-mentioned factory reset message is not limited by the communication mode, for example, the single board end of the wearable watch device is the port communication mode, and the whole device end is the Bluetooth communication mode. This application does not limit the specific communication mode.

[0137] S72: The device management task node sends a screen-off instruction to the human-computer interaction page node.

[0138] After the device management system node of the electronic device receives the factory restore message sent by the factory, the device management task node will send a screen-off instruction to the human-computer interaction page node. The screen-off instruction is used to instruct the electronic device to turn off the screen for subsequent data cleaning.

[0139] S73: The human-computer interaction page node performs a screen-off operation.

[0140] When the human-computer interaction page node receives the screen-off instruction, it can control the display screen to be in the screen-off state through the serial peripheral interface (SPI). When the electronic device 100 is in the screen-off state, the connection with the display screen is disconnected.

[0141] In some specific implementations, after receiving the screen-off instruction, the human-computer interaction page node may directly perform the screen-off operation, or may first display a shutdown prompt on the display screen of the electronic device and then perform the screen-off operation. Figure 5C After the general shutdown prompt, execute the screen-off operation.

[0142] It should be noted that this application does not limit the specific shutdown prompt. It can be set by a technician during the production test process, or it can be set by the user later. This application does not limit the specific setting method.

[0143] S74: The human-computer interaction page node sends a pause instruction to all thread nodes.

[0144] A thread is the smallest unit that the system can use to schedule operations. A thread is contained in a process and is the actual operation unit in the process. A process can contain multiple threads, and a thread is the smallest unit of resource scheduling.

[0145] Thread nodes may include health management thread nodes, communication thread nodes, Bluetooth thread nodes, music thread nodes, etc. Exemplarily, the electronic device 100 can count the user's exercise mode, exercise steps, exercise time, etc. through the health management thread node; the electronic device 100 can perform communication transmission on the network through the communication thread node; the electronic device 100 can connect to other electronic devices through Bluetooth through the Bluetooth thread node; the electronic device 100 can play music, display lyrics, etc. through the music thread node. It should be noted that this application does not limit the specific thread nodes and the functions of the thread nodes.

[0146] After the human-computer interaction page node completes the screen-off operation, a pause instruction may be sent to all thread nodes.

[0147] In some specific implementations, the human-computer interaction page node may send a pause instruction to all thread nodes, such as a health management thread node, a communication thread node, etc., in turn.

[0148] In some other specific implementations, the human-computer interaction page node may first send a pause instruction to a general thread node, and the general thread node may first suspend all services, and then the general thread node may send a pause instruction to all thread nodes in sequence. It should be noted that the specific method for sending the pause instruction is not limited in this application.

[0149] S75: All thread nodes suspend services.

[0150] All thread nodes will suspend their services after receiving the pause command. For example, if the thread node is a health management service node, then it will suspend the statistics of the user's exercise mode, exercise steps, exercise time and other services; if the thread node is a communication thread node, then it will suspend the execution of communication transmission on the network and other services; if the thread node is a Bluetooth thread node, then it will suspend the Bluetooth connection with other electronic devices and other services; if the thread node is a music thread node, then it will suspend the music playback, lyrics display and other services.

[0151] S76: All thread nodes send a pause completion instruction to the device management task node.

[0152] When all thread nodes have suspended their services, a suspension completion instruction may be sent to the device management task node.

[0153] In one possible implementation, after each thread node completes suspending the service, it may send a suspension completion instruction to the device management task node in sequence. After the device management task node receives suspension completion instructions equal to the number of thread nodes, it executes step S77 and subsequent operations.

[0154] In another possible implementation, each thread node can send a pause completion instruction to a general thread node after the suspension of the service is completed. After the general thread node receives the same number of pause completion instructions as the number of thread nodes, it will send a pause completion instruction to the device management task node to inform the device management task node that the suspension has been completed and that step S77 and subsequent operations can be executed. It should be noted that the specific method for sending the pause completion instruction is not limited in this application.

[0155] S77: The device management task nodes execute data clearing in sequence.

[0156] When the device management task node receives the pause completion instruction sent by all thread nodes, the device management task node can perform data clearing in sequence according to the data clearing functions registered by all thread nodes, that is, perform the factory reset operation.

[0157] S78: The device management task node re-updates and restarts the system.

[0158] After the device management task node learns that the data cleaning is completed, it can restart the system. After the system is restarted, the electronic device will complete the factory-level restoration operation.

[0159] See also Figure 8, which is a signaling diagram of a user-level factory reset provided in an embodiment of the present application. It should be noted that steps S82 to S87 of the user-level factory reset provided in the embodiment of the present application are the same as steps S73 to S78 of the factory-level factory reset provided in the embodiment of the present application, and will not be described in detail.

[0160] The method includes:

[0161] S81: The human-computer interaction page node receives a factory reset operation.

[0162] The difference from the factory-level factory reset method provided in the embodiment of the present application is that when restoring the factory settings at the factory level, the device management task node needs to receive the factory reset message sent by the factory, and then the electronic device, based on the factory reset message, causes the human-computer interaction page node of the electronic device to perform a screen-off operation, and causes all thread nodes to suspend services, and then restore the factory settings. When restoring the factory settings at the user level, it is in response to the user's operation on the electronic device, causing all thread nodes to suspend services, and then restore the factory settings.

[0163] It should be noted that the electronic device can be an electronic device with a touch display screen such as a wearable smart watch, or it can be an electronic device without a touch display screen such as a wearable smart headset. This application does not limit this.

[0164] If the electronic device is a smart wearable watch, in some specific implementations, see Figure 5A The user can enter the system setting menu 501 of the electronic device 100, and perform a touch operation such as clicking, long pressing, sliding, etc. on the restore factory settings option 502 in the system setting menu 501 to enter the reference Figure 5B The factory reset page 503 is displayed. Subsequently, the user can also perform a touch operation on the "Yes" option 504 in the factory reset page 503, that is, initiate the factory reset operation.

[0165] In another possible implementation, the smart wearable watch can also be configured with a physical button for restoring factory settings, and the user can determine whether to initiate the factory settings restore operation by comparing the actual number of times the user triggers the physical button and the set number of times the trigger is the same. For example, the user can set that if the physical button is pressed 3 times within 5 seconds, the factory settings restore operation is initiated. It should be noted that this application does not limit the specific number of physical buttons and the method of restoring factory settings.

[0166] If the electronic device is a wearable smart headset, in some specific implementations, see Fig. 6A, the user can initiate the factory reset operation by triggering the physical button 601 on the wearable smart headset. In other words, the wearable smart headset can determine whether the user initiates the factory reset operation by comparing whether the actual number of times the user triggers the physical button 601 is the same as the set number of times the user triggers the physical button 601.

[0167] In another possible implementation, see Figure 6B The smart wearable headset can also receive a factory reset instruction sent by another electronic device 200 through a WIFI wireless connection or a Bluetooth wireless connection, and execute a screen-off operation and restore the factory settings according to the factory reset instruction.

[0168] Then, the smart wearable headset will continue to integrate a Bluetooth module and / or a WIFI module, wherein the wireless communication connection based on Bluetooth technology is simple and fast to establish, but the maximum wireless communication distance is short, and the distance limit between the smart wearable headset and another electronic device 200 is large, and the wireless communication connection based on WIFI technology is relatively slow to establish, but the maximum wireless communication distance is long, and the distance limit between the smart wearable headset and another electronic device 200 is small. Therefore, the user can choose whether to make a wireless connection through WIFI or through Bluetooth according to the actual situation. This application does not limit this.

[0169] S82: The human-computer interaction page node performs a screen-off operation.

[0170] S83: The human-computer interaction page node sends a pause instruction to all thread nodes.

[0171] S84: All thread nodes suspend services.

[0172] S85: All thread nodes send a pause completion instruction to the device management task node.

[0173] S86: The device management task nodes execute data clearing in sequence.

[0174] S87: The device management task node re-updates and restarts the system.

[0175] After the device management task node learns that the data cleaning is completed, the system can be restarted. After the system is restarted, the electronic device will perform the operation of restoring the factory settings at the user level.

[0176] Therefore, in the factory-level factory reset method and the user-level factory reset method provided in the embodiments of the present application, all thread nodes uniformly suspend the service after the electronic device turns off the screen due to receiving the factory reset message, and send a pause completion instruction to the device management task node after the service is suspended, so that the device management task node can uniformly clear data according to the callback function, thereby completing the factory reset. In this way, the time difference caused by the different priorities between the thread nodes is avoided, and the problems of factory reset timeout or even failure caused by the mutual occupation of the central processor when processing files and the operation of the file system of the electronic device are avoided.

[0177] Next, the above data clearing process is explained in more detail.

[0178] See also Fig. 9 , which is a signaling diagram of a registration callback function restoring factory settings provided by an embodiment of the present application. It should be noted that, Fig. 9 The method for registering a callback function and the method for completing factory reset based on the callback function are executed in the context of all threads being static tasks.

[0179] It should be noted that each time the electronic device is turned on, it is necessary to first register a callback function corresponding to the static thread node for restoring factory settings, also known as a data clearing function, that is, a function that the electronic device needs to execute when restoring to the factory to clear data.

[0180] Exemplarily, the above-mentioned callback functions may include an audio callback function (AUDIOSVC_FactoryResetManager), an upgrade callback function (OTA_ClearData), a security callback function (SecflashResetCallback), a near field communication callback function (NfcFactoryResetCallback), an application callback function (APP_FactoryResetManager), a positioning callback function (SAP_FactoryResetCb), a Bluetooth callback function (McBtManagerFactoryReset), a device callback function (DM_RepNVResumeFactoryType), a communication callback function (PHAST_ClearData), etc.

[0181] Specifically, the audio callback function can be used to clear audio information such as downloaded songs, recently played songs, lyrics, albums and posters; the upgrade callback function can be used to clear upgrade information such as upgrade installation package and upgrade time; the security callback function can be used to clear security information such as application lock, payment protection center account, anti-fraud account, etc.; the near-field communication callback function can be used to clear near-field communication information such as NFC sensing and default payment application; the application callback function can be used to clear application information such as application installation package, application download information, and application version; the positioning callback function can be used to clear positioning information such as motion positioning and GPS information; the Bluetooth callback function can be used to clear Bluetooth information such as Bluetooth device name, Bluetooth received files, and paired devices; the device callback function can be used to clear device information such as device configuration, device version, and device identity; the communication callback function can be used to clear communication information such as communication protocol.

[0182] It should be noted that the above callback function can be set by technical personnel during the production test process, or it can be updated after the subsequent electronic equipment system is upgraded. This application does not limit the setting update time of the callback function, the specific number and type of callback functions.

[0183] The method includes:

[0184] S91: The device management task node (device_task) receives a factory reset message.

[0185] It can be understood that the factory reset message here can be either a factory reset message sent by the factory to the electronic device, or a factory reset operation sent by the user and received by the electronic device.

[0186] It should be noted that the function corresponding to receiving the factory setting restoration message may be DM_FactoryResetReq.

[0187] S92: The device management task node sends a pause instruction to all static thread nodes.

[0188] It is understandable that the pause instruction can be issued by the device management task node or the human-computer interaction page node. This application does not limit this and only takes the device management task node sending a pause instruction to all thread nodes as an example for subsequent explanation.

[0189] All static thread nodes include music thread nodes, positioning thread nodes, upgrade thread nodes and other static thread nodes, etc. Exemplarily, the device management task node can send a pause instruction to static thread nodes such as music thread node (audio task), positioning thread node (sap task), upgrade thread node (otatask), etc.

[0190] It should be noted that the function corresponding to the pause instruction may be MC_PROP_DM_FACTORY_RESET.

[0191] S93: All static thread nodes suspend services.

[0192] Exemplarily, when the music thread node receives a pause instruction, the music thread node may pause the service of playing music. Exemplarily, the function of pausing the service of the music thread node may be AUDIOSVC_FactoryResetProc().

[0193] When the positioning thread node receives the pause instruction, the positioning thread node may pause the motion positioning service. Exemplarily, the function for suspending the service of the positioning thread node may be SAP_FactoryResetDoneNotify.

[0194] When the upgrade thread node receives the pause instruction, the upgrade thread node may suspend the system upgrade service. Exemplarily, the function for suspending the service of the upgrade thread node may be OTA_ResetFactoryMsgHandle.

[0195] S94: The device management task node starts a timer.

[0196] After the device management task node sends a pause instruction to all static thread nodes, the device management task node starts a timer to start a countdown. The reason for starting the timer is that if the factory reset is not completed at the end of the countdown, the factory reset time is too long, indicating that the factory reset has failed and the system needs to be restarted.

[0197] It should be noted that the function corresponding to the start timer may be DM_FactoryReset.

[0198] Exemplarily, the countdown time can be set to 10 seconds, that is, if the factory reset is not completed after 10 seconds, the factory reset time is too long, indicating that the factory reset has failed. It should be noted that the countdown time can also be set to 5 seconds, 15 seconds, etc., and the application does not limit the specific time.

[0199] It should be noted that the execution time of the above step S93 and step S94 is not in any particular order, and they are almost executed at the same time. This application does not make any limitation on this.

[0200] S95: All static thread nodes send a pause completion instruction to the device management task node.

[0201] When all static thread nodes have suspended their services, a suspension completion instruction may be sent to the device management task node.

[0202] S96: The device management task node determines whether it has received the same number of pause completion instructions as all static thread nodes. If so, execute S97.

[0203] When the number of the pause completion instructions received by the device management task node is equal to the number of all static thread nodes, it can be explained that all static thread nodes have sent the pause completion instructions to the device management task node.

[0204] It should be noted that the judgment function may be MC_PROP_DM_FACTORY_RESET_DONE.

[0205] In some specific implementations, the device management task node may also store the flag of the static thread node, and the flag may be used to determine whether the corresponding operation has been executed, practiced, or occurred. For example, a binary flag may be used, where a flag of 1 indicates that the operation has been executed, practiced, or occurred, and a flag of 0 indicates that the operation has not been executed, practiced, or occurred. As shown in Table 1, this table is a schematic table of flags provided in an embodiment of the present application.

[0206] Table 1

[0207] Static thread node name Music Thread Node Locating thread nodes Upgrading Thread Nodes Flags 1 1 0

[0208] As shown in the table, since the flag bit of the music thread node is 1, it means that the music thread node has sent a pause completion instruction to the device management task node; similarly, since the flag bit of the positioning thread node is 1, it means that the positioning thread node has sent a pause completion instruction to the device management task node; since the flag bit of the upgrade thread node is 0, it means that the upgrade thread node has not sent a pause completion instruction to the device management task node.

[0209] Thus, it can be known whether a specific static thread node sends a pause completion instruction to the device management task node.

[0210] S97: The device management task node executes the function callbacks corresponding to the static thread nodes in sequence.

[0211] After all thread nodes have sent a pause completion instruction to the device management task node, the device management task node interface executes the function callbacks corresponding to the static thread nodes in sequence.

[0212] In a specific implementation method, if the device management thread node has received the pause completion instruction sent by the music thread node, the positioning thread node, and the upgrade thread node, then the device management task node will execute the function callbacks corresponding to the music thread node, the positioning thread node, and the upgrade thread node in sequence, that is, the audio callback function (AUDIOSVC_FactoryResetManager), the upgrade callback function (OTA_ClearData), and the positioning callback function (SAP_FactoryResetCb) will be executed in sequence.

[0213] It is understandable that the above-mentioned audio callback function, upgrade callback function, and positioning callback function are the callback functions for restoring factory settings that are first registered when the electronic device is turned on for the first time, that is, the functions that the electronic device needs to execute when restoring to factory settings.

[0214] It should be emphasized that the device management task node executes the function callbacks corresponding to the static thread node in sequence, that is, single-threaded execution is performed. This avoids the time difference caused by different priorities among the static thread nodes, and the problem of factory reset timeout or even failure caused by mutual occupation of the central processor when processing files.

[0215] S98: The device management task node clears the timer.

[0216] After the device management task node executes the function callback corresponding to the thread node in sequence, the timer started in step S94 can be stopped, indicating that the factory settings are restored.

[0217] It should be noted that the function corresponding to clearing the timer may be osTimerDelete.

[0218] S99: The device management task node deletes the application partition.

[0219] In order to allow users to better control their files and reduce clutter, the electronic device 100 may be granted partitioned access rights to external storage devices, namely, application scoped storage.

[0220] Specifically, the user can store his / her own personalized data in the application partition of the APP disk to perform application partition storage. After performing the factory reset, the device management node needs to delete the application partition to ensure the deletion of the user's personalized data.

[0221] It should be noted that the function corresponding to deleting the application partition may be ResumeFactory.

[0222] S910: The device management task node reports a message that the factory settings are restored successfully to the cloud.

[0223] After the factory settings are restored successfully, the device management task node reports the factory settings restoration success message to the cloud.

[0224] It should be noted that the function corresponding to reporting the factory reset success message to the cloud may be ReplyResetResult.

[0225] It should be noted that, with the increase in threads, the threads in the electronic device 100 have evolved from being all static threads to having both static threads and dynamic threads.

[0226] Specifically, the difference between dynamic threads and static threads is that static threads use static memory when they are created, and are threads that are already created when the computer is turned on; while dynamic threads use dynamic memory when they are created, and are not threads that are already created when the computer is turned on, but threads that need to be created in real time. For example, the recording saving thread is a dynamic thread, which is a thread that is triggered only after a call is made.

[0227] However, the dynamic thread cannot receive the pause instruction sent by the device management task node, so if there are dynamic threads among all thread nodes, it is necessary to execute the following another registration callback function method.

[0228] See also Fig.10 , this figure is another signaling diagram for restoring factory settings through a registration callback function provided in an embodiment of the present application.

[0229] It should be noted that the method of registering a callback function can be executed in the background of both static threads and dynamic threads in all threads.

[0230] It should be noted that when the electronic device is turned on for the first time, it is also necessary to first register the callback function corresponding to the static thread node for restoring factory settings.

[0231] The method includes:

[0232] S101: A dynamic thread node (dynamic task) registers a standard function when a thread is created.

[0233] The standard function refers to the function that the dynamic thread node needs to execute when the electronic device is restored to factory settings. The standard function indicates which files the electronic device needs to delete when restoring the factory settings. After the dynamic thread node executes the standard function, the factory settings are restored.

[0234] It should be noted that the function corresponding to the registration standard function may be DM_SetResetNotifyCB.

[0235] S102: The device management task node (device_task) receives a factory reset message.

[0236] This step S102 is the same as step S91, and will not be described again. It should be noted that the function corresponding to receiving the factory reset message may be DM_FactoryResetReq.

[0237] S103: The device management task node sends a pause instruction to all static thread nodes.

[0238] This step S103 is the same as step S92, and will not be described again. It should be noted that the function corresponding to the pause instruction may be MC_PROP_DM_FACTORY_RESET.

[0239] S104: The device management task node starts a timer.

[0240] This step S104 is the same as step S94, and will not be described again. It should be noted that the function corresponding to the start timer may be DM_FactoryReset.

[0241] S105: The device management task node obtains the dynamic thread node name and the corresponding standard function.

[0242] After the device management task node starts the timer, it will obtain the name of the dynamic thread node and the standard function corresponding to the dynamic thread node.

[0243] It should be noted that the function corresponding to obtaining the name of the dynamic thread may be DM_ResetCBNotify.

[0244] S106: The device management task node sends a factory reset instruction to the dynamic thread node.

[0245] After the device management task node obtains the name of the dynamic thread node and its corresponding standard function, it can send a factory reset instruction to the dynamic thread node. The factory reset instruction is used to notify the dynamic thread node that it needs to pause the thread progress and execute the standard function to prepare for restoring the factory settings.

[0246] It should be noted that if there are multiple dynamic thread nodes in the electronic device, the device management task node needs to send the factory reset instruction to the dynamic thread nodes in sequence, rather than sending the factory reset instruction to the dynamic thread nodes at the same time. The purpose of sending the factory reset instruction to the dynamic thread nodes in sequence is to perform single-thread execution, thereby avoiding the time difference caused by different priorities between the dynamic thread nodes, and the problem of factory reset timeout or even failure caused by mutual occupation of the central processor when processing files.

[0247] S107: All static thread nodes suspend services.

[0248] This step S107 is the same as step S93 and will not be repeated here.

[0249] Exemplarily, when the music thread node receives a pause instruction, the music thread node may pause the service of playing music. Exemplarily, the function of pausing the service of the music thread node may be AUDIOSVC_FactoryResetProc().

[0250] When the positioning thread node receives the pause instruction, the positioning thread node may pause the motion positioning service. Exemplarily, the function for suspending the service of the positioning thread node may be SAP_FactoryResetDoneNotify.

[0251] When the upgrade thread node receives the pause instruction, the upgrade thread node may suspend the system upgrade service. Exemplarily, the function for suspending the service of the upgrade thread node may be OTA_ResetFactoryMsgHandle.

[0252] S108: All static thread nodes send a pause completion instruction to the device management task node.

[0253] This step S108 is the same as step S95 and will not be repeated here.

[0254] It should be noted that the function corresponding to the static thread node sending the pause completion instruction to the device management task node may be MC_PROP_DM_FACTORY_RESET_DONE.

[0255] S109: The dynamic thread node executes a standard function to restore factory settings.

[0256] Exemplarily, if the dynamic thread is answering a call, after the dynamic thread node receives the factory reset instruction, it immediately hangs up the call and executes the standard function obtained in S101 to restore the factory reset.

[0257] It should be noted that the function corresponding to restoring the factory settings of the dynamic thread node may be DM_CurTaskResetCB.

[0258] S110: The dynamic thread node sends a recovery completion instruction to the device management task node.

[0259] When all dynamic thread nodes are restored to factory settings, a restoration completion instruction can be sent to the device management task node.

[0260] It should be noted that the function corresponding to the dynamic thread node sending the recovery completion instruction to the device management task node may be MC_PROP_DM_RESET_CPLT.

[0261] S111: The device management task node determines whether it has received the same number of pause completion instructions as all static thread nodes. If so, execute S112.

[0262] This step S111 is the same as step S96 and will not be repeated here.

[0263] S112: The device management task node executes the function callbacks corresponding to the static thread nodes in sequence.

[0264] This step S112 is the same as step S97 and will not be repeated here.

[0265] It should be emphasized that the device management task node executes the function callbacks corresponding to the static thread node in sequence, that is, single-threaded execution is performed. This avoids the time difference caused by different priorities among the static thread nodes, and the problem of factory reset timeout or even failure caused by mutual occupation of the central processor when processing files.

[0266] S113: The device management task node clears the timer.

[0267] This step S113 is the same as step S98 and will not be repeated here.

[0268] It should be noted that the function corresponding to clearing the timer may be osTimerDelete.

[0269] S114: The device management task node deletes the application partition.

[0270] This step S114 is the same as step S99 and will not be repeated here.

[0271] It should be noted that the function corresponding to deleting the application partition may be ResumeFactory.

[0272] S115: The device management task node reports a message that the factory settings have been restored successfully to the cloud.

[0273] It should be noted that the function corresponding to reporting the factory reset success message to the cloud may be ReplyResetResult.

[0274] S116: Dynamic thread node thread destruction.

[0275] If the thread is an infinite loop thread, for example, a wearable smart watch can also continuously receive and display information from the electronic device, there is no need to execute step S116; if the thread is not an infinite loop thread, for example, a wearable smart watch can answer a call, and when the call is hung up, it means that the thread ends, then the thread needs to be destroyed after the thread ends.

[0276] It should be noted that the function corresponding to the dynamic thread node thread destruction may be DM_RemoveResetNotifyCB.

[0277] It should be noted that the above method of restoring factory settings based on the registered callback function is a two-stage factory restoration. Fig. 9 The registered callback function shown executes the method of closing the business, closing the function, and closing the file in the method of restoring the factory settings. In the second stage, the operation of deleting the file is added on the basis of continuing the original logic, that is, thread destruction.

[0278] In summary, the embodiment of the present application provides a method for restoring factory settings, which includes: after receiving a message for restoring factory settings, pausing the thread of the electronic device; and executing data clearing in sequence according to the data clearing function corresponding to the thread to restore the factory settings. Therefore, when it is necessary to restore the factory settings, instead of directly executing the factory settings restoration in multiple threads at the same time, a method is adopted in which the threads of the electronic device are uniformly suspended, the registered data clearing function is uniformly triggered, and the data clearing is performed in sequence, thereby solving the problem of uncontrolled threads occupying the central processor or operating the file system due to the use of a multi-threaded execution method, and then causing the factory settings restoration to time out or even fail.

[0279] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed, each function or step performed by the electronic device 100 in the above method embodiment is implemented.

[0280] Another embodiment of the present application further provides a computer program product including instructions. When the computer program product is run on a computer or a processor, the computer or the processor executes one or more steps in any of the above methods.

[0281] Another embodiment of the present application also provides a device for restoring factory settings. Fig.11 , which is a schematic diagram of a factory reset device provided in an embodiment of the present application.

[0282] The factory reset device 110 includes a pause module and a clear module. Specifically, the pause module 111 is used to pause the thread of the electronic device after receiving the factory reset message; the clear module 112 is used to perform data clearing in sequence according to the data clearing function corresponding to the thread to restore the factory settings.

[0283] Therefore, when it is necessary to restore the factory settings, the factory settings are not restored directly by multiple threads at the same time. Instead, the electronic device threads are uniformly suspended, and the registered data clearing functions are uniformly triggered to clear the data in sequence. This solves the problem of uncontrolled threads occupying the central processing unit or operating the file system due to the use of a multi-threaded execution method, which leads to timeout or even failure of factory settings restoration.

Claims

1. A method for restoring factory settings, characterized in that: Applied to an electronic device, the electronic device includes a factory reset framework, the factory reset framework includes: a device management task node, a human-computer interaction page node and a thread node, the device management task node is used to manage the thread of the electronic device, the human-computer interaction page node is used to display the human-computer interaction page of the electronic device, the thread node is used to execute the thread of the electronic device, the method includes: After receiving the factory reset message sent by the factory end, the device management task node sends a pause instruction to the thread node, so that the thread node pauses the thread of the electronic device; or, after receiving the factory reset operation, the human-computer interaction page node sends a pause instruction to the thread node, so that the thread node pauses the thread of the electronic device; If the device management task node receives a pause completion instruction sent by all the thread nodes in the thread node, the device management task node executes data clearing of each thread in the thread of the electronic device in turn; wherein, the device management task node executes data clearing of the static thread in turn according to the callback function corresponding to the static thread, and / or, executes data clearing of the dynamic thread in turn according to the standard function corresponding to the dynamic thread, so as to restore the factory settings; the pause completion instruction is an instruction sent by the thread node to the device management node after pausing the thread of the electronic device.

2. The method according to claim 1, characterized in that The thread node is a static thread node. Before the device management task node receives a factory reset message sent by the factory end, the method further includes: The electronic device registers a callback function corresponding to the static thread node; After receiving the factory reset message sent by the factory end, the device management task node sends a pause instruction to the thread node so that the thread node pauses the thread of the electronic device, including: After receiving the factory reset message sent by the factory, the device management task node sends a pause instruction to the static thread node, so that the static thread node pauses the static thread of the electronic device.

3. The method according to claim 2, characterized in that The callback function includes any one or more of an audio callback function, an upgrade callback function, a security callback function, a near field communication callback function, an application callback function, a positioning callback function, a Bluetooth callback function, a device callback function and a communication callback function.

4. The method according to claim 2, characterized in that: The thread node also includes a dynamic thread node. Before the device management task node receives a factory reset message sent by the factory end, the method further includes: When creating the dynamic thread node, the electronic device registers a standard function corresponding to the dynamic thread node; After receiving the factory reset message, the method further includes: The device management task node sends a stop instruction to the dynamic thread node, so that the dynamic thread node executes data clearing according to the standard function corresponding to the dynamic thread node to restore the factory settings.

5. The method according to claim 4, characterized in that The method further comprises: After the dynamic thread node clears the dynamic thread data of the electronic device, the dynamic thread node sends a stop completion instruction to the device management task node; The determining whether the number of the pause completion instructions received by the device management task node is equal to the number of the static thread nodes includes: Determining whether the number of the stop completion instructions received by the device management task node is equal to the number of the dynamic thread nodes; If so, it is determined whether the number of the pause completion instructions received by the device management task node is equal to the number of the static thread nodes.

6. The method according to claim 4, characterized in that The method further comprises: The electronic device destroys the dynamic thread node.

7. The method according to claim 1, characterized in that After receiving the factory reset message sent by the factory end, the device management task node sends a pause instruction to the thread node, including: After receiving the factory reset message sent by the factory, the device management task node sends a screen-off instruction to the human-computer interaction page node; After the human-computer interaction page node executes the screen-off operation according to the screen-off instruction, it sends a pause instruction to the thread node.

8. The method according to claim 7, characterized in that After receiving the factory reset message sent by the factory end, the device management task node sends a screen-off instruction to the human-computer interaction page node, including: The device management task node receives a factory reset message sent by the factory end, wherein the factory reset message includes a factory reset instruction, a device identity instruction, and a first encrypted value, wherein the first encrypted value is a value obtained by encrypting the factory reset instruction and the device identity according to a first encryption algorithm or a first key; The device management task node verifies the first encrypted value; If the first encrypted value is verified successfully, the device management task node sends a screen-off instruction to the human-computer interaction page node.

9. The method according to claim 8, characterized in that The device management task node verifies the first encrypted value, including: The device management task node verifies whether the device identity in the factory reset message is consistent with the local device identity; If so, the device management task node verifies the first encrypted value.

10. The method according to claim 8, characterized in that The device management task node verifies the first encrypted value, including: The device management task node decrypts the first encrypted value according to the first decryption algorithm or the second key to obtain a corresponding device identity; The device management task node determines whether the device identity obtained after decryption is consistent with the device identity in the factory reset message; If so, the device management task node determines that the first encryption value verification is successful.

11. The method according to claim 8, characterized in that The device management task node verifies the first encrypted value, including: The device management task node encrypts the factory restore instruction and the device identity according to a second encryption algorithm or a second key to obtain a second encrypted value; The device management task node determines whether the first encrypted value is consistent with the second encrypted value; If so, the device management task node determines that the first encryption value verification is successful.

12. The method according to claim 1, characterized in that The method further comprises: The device management task node deletes the application partition in the application disk.

13. An electronic device, characterized in that: including a processor and a memory; The memory is used to store computer-executable instructions; The processor is configured to execute the computer-executable instructions stored in the memory, so that the processor executes the method according to any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the method according to any one of claims 1 to 12 is implemented.