CN116684520B - Shutdown method, electronic equipment, storage medium and chip - Google Patents

Shutdown method, electronic equipment, storage medium and chip Download PDF

Info

Publication number
CN116684520B
CN116684520B CN202211213010.4A CN202211213010A CN116684520B CN 116684520 B CN116684520 B CN 116684520B CN 202211213010 A CN202211213010 A CN 202211213010A CN 116684520 B CN116684520 B CN 116684520B
Authority
CN
China
Prior art keywords
shutdown
monitoring module
shutdown monitoring
module
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211213010.4A
Other languages
Chinese (zh)
Other versions
CN116684520A (en
Inventor
孙继龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211213010.4A priority Critical patent/CN116684520B/en
Publication of CN116684520A publication Critical patent/CN116684520A/en
Application granted granted Critical
Publication of CN116684520B publication Critical patent/CN116684520B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephone Function (AREA)

Abstract

The embodiment of the application is applied to the field of terminals, and provides a shutdown method and electronic equipment, wherein a kernel layer comprises a shutdown monitoring module, and the watchdog module of a system library is utilized to trigger the shutdown monitoring module to start timing after the watchdog module is stopped in the shutdown process, and the shutdown monitoring module triggers the system to reset and restart after the timing exceeds a preset time. Therefore, the shutdown monitoring module can monitor the shutdown process after the watchdog module stops running, if the shutdown jamming problem occurs in the shutdown process, the electronic equipment can trigger the system to automatically reset and restart after the preset time, the problem that the electronic equipment cannot be normally shutdown for a long time due to the shutdown jamming can be effectively avoided, and the user experience is improved.

Description

Shutdown method, electronic equipment, storage medium and chip
Technical Field
The present disclosure relates to the field of terminals, and more particularly, to a shutdown method and an electronic device in the field of terminals.
Background
The current electronic devices have the functions of startup and shutdown. In the shutdown process of an electronic device (for example, a mobile phone) based on an android system, the electronic device first shuts down the backlight, and then executes a subsequent shutdown process under the condition of a black screen.
However, in the shutdown process, shutdown jam (unable shutdown) may occur, resulting in poor user experience. For example, in a scenario where only power-off is performed, the electronic device consumes power until the power is 0, which eventually results in no power-on and poor user experience. For another example, in a scenario where the electronic device is restarted (the user starts to restart or restarts after the electronic device is automatically upgraded), the electronic device always turns off the screen, and the user does not start up for the electronic device by mistake, so that the user experience is poor.
Based on this, it is needed to provide a shutdown method to solve the problem that the electronic device cannot be shutdown for a long time due to shutdown jam of the electronic device, so as to improve the user experience.
Disclosure of Invention
The application provides a shutdown method and electronic equipment, which can solve the problem that the electronic equipment cannot be shut down for a long time due to shutdown blocking of the electronic equipment, and improve user experience.
In a first aspect, a shutdown method is provided, which is characterized in that the shutdown method is applied to a system including an application framework layer, a system library and a kernel layer, the application framework layer includes a watchdog module, and the kernel layer includes a shutdown monitoring module, and the method includes:
After the system library receives a shutdown instruction, stopping the operation of the watchdog module through the kernel layer;
after the watchdog module stops running, the shutdown monitoring module starts timing;
and after the timing of the shutdown monitoring module exceeds the preset time, if the shutdown is not completed, triggering the system to reset and restart by the shutdown monitoring module.
According to the electronic equipment provided by the embodiment of the application, the related shutdown monitoring module is operated in the kernel layer, and in the shutdown process, even if the process of the upper layer is killed, the shutdown monitoring module is still in operation, so that the shutdown process can be monitored for a long time; meanwhile, the watchdog module running in the system library is utilized, after the watchdog module is killed in the shutdown process, the watchdog module stops running and can trigger the shutdown monitoring module to start timing, and after the timing exceeds the preset time, the shutdown monitoring module triggers the system to reset and restart. Therefore, the shutdown monitoring module can monitor the shutdown process after the watchdog module stops running through the preset time, if the shutdown jamming condition occurs in the process, and the system is not shutdown after the preset time, the system is triggered to automatically reset and restart, the problem that the electronic equipment cannot be normally shutdown for a long time due to shutdown jamming can be effectively avoided, and the user experience is improved. In addition, the time for killing the watchdog module in the shutdown process is relatively forward, so that the shutdown monitoring module is more beneficial to monitoring the shutdown process for a longer time. It can be seen that, compared with the shutdown blocking problem that the prior art only can monitor the initialization (init) process, the embodiment of the application can monitor the shutdown blocking problem that appears in the shutdown process after the watchdog module stops running, and after the blocking problem appears, the device can reset in time and restart, thereby improving the user experience very well.
Optionally, the preset duration is a first duration; the method comprises the steps of,
after the timing of the shutdown monitoring module exceeds the preset time, if the system does not finish shutdown, the shutdown monitoring module triggers a system reset restart, including:
and under the condition that the shutdown monitoring module detects that the system performs data restoration, after the shutdown monitoring module counts the time exceeding the first time length, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart.
In the prior art, a shutdown monitoring thread in a system library can directly skip detection of whether data restoration is performed, so that the data restoration process becomes a dead zone. In the shutdown method provided by the embodiment of the application, the shutdown monitoring module can detect whether the system performs data restoration, and when the system performs data restoration, the preset time length counted by the shutdown monitoring module corresponds to the first time length, so that after the time length exceeds the first time length, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart, the scene of data restoration of the system can be effectively considered, and the user experience in the scene is improved.
Optionally, the method further comprises:
when the timing of the shutdown monitoring module is a second time length, the shutdown monitoring module detects whether the system performs data restoration, wherein the second time length is the time length of the timing of the shutdown monitoring module when the system does not perform data restoration, and the second time length is smaller than the first time length; the method comprises the steps of,
and under the condition that the shutdown monitoring module detects that the system performs data restoration, after the shutdown monitoring module counts the time exceeding the first time length, if the system does not complete shutdown, the shutdown monitoring module triggers system reset restart, including:
and under the condition that the shutdown monitoring module detects that the system performs data restoration, the shutdown monitoring module continues to count time, and after the count time exceeds the first time, if the system does not complete shutdown, the shutdown monitoring module triggers the system to reset and restart.
According to the shutdown method provided by the embodiment of the application, two preset durations are arranged in the system, namely, a first duration and a second duration, wherein the first duration is the duration counted by the shutdown monitoring module when the system performs data restoration, the second duration is the duration counted by the shutdown monitoring module when the system does not perform data restoration, the shutdown monitoring module can detect whether the system performs data restoration when the second duration is counted, and the shutdown monitoring module can continue to count until the count exceeds the first duration under the condition that the system performs data restoration is detected, and if the system does not finish shutdown, the shutdown monitoring module can trigger the system to reset and restart. Under the condition that the system performs data restoration, the event timed to the second time length is used as a trigger event for detecting whether the data restoration is performed or not, other time or time length is not required to be additionally set for triggering whether the data restoration is performed or not, the design of the system is effectively utilized, and the implementation process is convenient.
Optionally, the preset duration is a second duration; the method comprises the steps of,
after the timing of the shutdown monitoring module exceeds the preset time, if the system does not finish shutdown, the shutdown monitoring module triggers a system reset restart, including:
and under the condition that the shutdown monitoring module detects that the system does not carry out data restoration, after the shutdown monitoring module counts the time exceeding the second time, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart.
Optionally, after the system library receives the shutdown instruction, before stopping the operation of the watchdog module through the kernel layer, the method further includes:
the watchdog module periodically executes a watchdog feeding operation to trigger the shutdown monitoring module to execute a zero clearing operation on the zone bit; the method comprises the steps of,
after the watchdog module stops running, the shutdown monitoring module starts timing, and the shutdown monitoring module comprises:
and after the watchdog module stops running, the shutdown monitoring module counts time through the counting of the zone bit.
According to the shutdown method provided by the embodiment of the application, a flag bit is introduced into the kernel layer, the flag bit can be understood as a counter or a counter used for timing, and the product of the numerical value of the flag bit and the counted period duration is the timing duration of the shutdown monitoring module. The watchdog module is triggered to execute the zero clearing operation of the zone bit by using the watchdog feeding operation of the watchdog module, which means that the watchdog module is still in operation, and the watchdog module is not triggered to execute the zero clearing operation of the zone bit after no longer running, so that the shutdown monitoring module can periodically count on the zone bit to achieve the aim of timing monitoring, and the process is relatively simple and convenient to realize.
Optionally, the preset time period is longer than or equal to the time period of normal shutdown of the system.
Optionally, the preset duration is 30 minutes or 120 seconds.
In a second aspect, an electronic device is provided, which is configured to perform the method provided in the first aspect. In particular, the electronic device may comprise means for performing any one of the possible implementations of the first aspect described above.
In a third aspect, an electronic device is provided that includes a processor. The processor is coupled to the memory and operable to execute instructions in the memory to implement the method of any one of the possible implementations of the first aspect. Optionally, the electronic device further comprises a memory. Optionally, the electronic device further comprises a communication interface, and the processor is coupled to the communication interface.
In a fourth aspect, a computer readable storage medium is provided, on which a computer program is stored which, when executed by an electronic device, causes the electronic device to implement a method according to any one of the possible implementations of the first aspect.
In a fifth aspect, there is provided a computer program product comprising instructions which, when executed by a computer, cause an electronic device to implement a method as in any one of the possible implementations of the first aspect.
In a sixth aspect, there is provided a chip comprising: the device comprises an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, the processor is used for executing codes in the memory, and when the codes are executed, the processor is used for executing the method in any one of the possible implementation manners of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a software system of an electronic device according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a shutdown procedure provided in an embodiment of the present application.
Fig. 4 is an exemplary flowchart of a shutdown method provided by an embodiment of the present application.
Fig. 5 is another exemplary flowchart of a shutdown method provided by an embodiment of the present application.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the present application will be described below with reference to the accompanying drawings.
The method provided by the embodiment of the application can be applied to various electronic devices capable of networking communication, such as mobile phones, tablet computers, wearable devices, notebook computers, netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the application does not limit the specific types of the electronic devices.
Fig. 1 shows a schematic configuration of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the electronic device 100, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, such that the processor 110 communicates with the touch sensor 180K through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface to implement a function of answering a call through the bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect the processor 110 to peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (camera serial interface, CSI), display serial interfaces (display serial interface, DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the photographing functions of electronic device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display functionality of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MIPI interface, etc.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 150 of electronic device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that electronic device 100 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the detected opening and closing state of the leather sheath or the opening and closing state of the flip, the characteristics of automatic unlocking of the flip and the like are set.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, the electronic device 100 may range using the distance sensor 180F to achieve quick focus.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object in the vicinity of the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there is no object in the vicinity of the electronic device 100. The electronic device 100 can detect that the user holds the electronic device 100 close to the ear by using the proximity light sensor 180G, so as to automatically extinguish the screen for the purpose of saving power. The proximity light sensor 180G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In this embodiment, taking an Android system with a layered architecture as an example, a software structure of the electronic device 100 is illustrated.
Fig. 2 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into five layers, from top to bottom, an application layer 210, an application framework layer (frame) 220, an Android run time (Android run) 232, and a system library (native) 231, a hardware abstraction layer (hardware abstraction layer, HAL) 240, and a kernel layer (kernel) 250, respectively.
The application layer 210 may include a series of application packages. By way of example, the application package may include applications for cameras, gallery, calendar, phone calls, maps, navigation, WLAN, bluetooth, music, video, short messages, etc.
The application framework layer 220 provides an application programming interface (application programming interface, API) and programming framework for application programs of the application program layer. The application framework layer includes some predefined functions.
Illustratively, the application framework layer 220 may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is used to provide the communication functions of the electronic device 100. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
In this embodiment of the present application, the application framework layer 220 further includes a watchdog (watchdog) module 221, configured to periodically perform a watchdog feeding operation, so as to trigger the kernel layer 250 to perform a zero clearing operation on the flag bit, so that after the watchdog module 221 is killed in the initialization process, the shutdown monitoring module 250 of the kernel layer 250 can be triggered to perform timing, so as to trigger a reset restart of the system after the electronic device is not shutdown and the timing exceeds a preset duration.
android run 232 includes a core library and virtual machines. android run 232 is responsible for scheduling and management of the android system.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in virtual machines. The virtual machine executes java files of the application program layer and the application framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library 231 may include a plurality of functional modules. For example: surface manager (surface manager), media library (media library), three-dimensional graphics processing library (e.g., openGL ES), 2D graphics engine (e.g., SGL), initialization (init) module, etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The initialization (init) module is the first process of a user space in the Android system, is responsible for creating a plurality of key processes in the system, manages attribute services of the system, plays an important role in a startup and shutdown process, and aims at the problems that in the application, init is responsible for receiving, analyzing and transmitting a shutdown instruction in a shutdown process, backlight is called in the process, and active processes (including upper layer watchdog) running by the system are checked and killed, and resources are unloaded, data are restored and other services.
The hardware abstraction layer 240 is used to abstract hardware. For example, the hardware abstraction layer 240 may include a camera abstraction layer and other hardware device abstraction layers; the camera hardware abstraction layer may call a camera algorithm.
Kernel layer 250 is a layer between hardware and software. The kernel layer 250 contains at least a display driver, a camera driver, an audio driver, and a sensor driver.
In this embodiment, the kernel layer 250 further includes a shutdown monitoring module 251, which is configured to start timing after the upper watchdog module 221 stops executing the feeding operation, and trigger a system reset restart after the electronic device is not shutdown and the timing exceeds a preset duration.
It should be understood that the technical solution in the embodiment of the present application may be used in Android, IOS, hong meng, and other systems.
The embodiment of the application relates to a shutdown process, wherein the shutdown process can be a process of shutdown only, can be a shutdown process in a restarting process of electronic equipment, and can be a restarting process of active starting by a user, and can be a restarting process in an automatic upgrading process of the electronic equipment.
Fig. 3 is a schematic diagram of a shutdown procedure provided in an embodiment of the present application. When the electronic device is turned off, the user presses the power key, and the electronic device performs steps S310 to S350.
In S310, the electronic device turns off the backlight, and at this time, the electronic device is in a black screen state.
In S320, the initialization module in the system library executes the processes killing the upper layers (such as the application framework layer and the system library) through the kernel layer, so that each process stops running.
In S330, the electronic device performs scanning of data repair (fsck) during shutdown, i.e. checks whether the file in the electronic device is damaged, and if so, the initialization module may perform data repair. The duration of this process may be tens of minutes, more hours, as short as the number of files in the electronic device and the extent of damage.
Of course, if the file in the electronic device is not damaged or is damaged little, S330 may be skipped and S340 may be performed.
In S340, the electronic device performs kernel shutdown, after the initialization process is finished, the shutdown process of the kernel is invoked, after that, the shutdown enters a kernel stage, the kernel can complete unloading of some driving resources, and then the power supply system is invoked to perform power-down processing.
In S350, the electronic device performs an operation of powering down when power is off.
In the shutdown process, the shutdown jamming condition can occur, so that the user experience is poor. A mobile phone is taken as an example to describe different scenes.
For example, in a scene of only powering off, the mobile phone will turn off the backlight first, the user perceives that the mobile phone has been powered off, but if a status of power off blocking occurs in the power off process, the mobile phone will consume power until the electric quantity is 0, which finally results in no power on and poor user experience. In addition, the battery is charged slowly and is not charged in the early stage of the power consumption, the user perceives that the mobile phone is not started, the mobile phone is started after the mobile phone is fully charged, the problems of high power consumption and short standby time of the mobile phone can be brought to the user, and the user experience is poor.
For another example, in a scenario that the user performs a restarting operation on the mobile phone, the mobile phone still turns off the backlight first, but if the mobile phone is blocked by the shutdown, the mobile phone always turns off the black screen, so that the user perceives that the mobile phone is turned off, and the function experience is poor. And because the forced restarting key of the mobile phone is a combination key, part of users are unclear and can misuse the mobile phone not to start up, so that the reliability experience is very bad.
For another example, the mobile phone can automatically restart after automatically executing the upgrade, and if the situation of shutdown and locking occurs, the user can experience the experience of the two scenes under the condition of no upgrade perception.
Based on this, the embodiment of the application provides a shutdown method, in which a shutdown monitoring module is configured in a kernel layer, and a watchdog module of a system library is utilized, after a process on an upper layer is killed in a shutdown process, the watchdog module is stopped, after the watchdog module stops running, the shutdown monitoring module can be triggered to start timing, and after the timing exceeds a preset duration, the shutdown monitoring module triggers a system to reset and restart. Therefore, the shutdown monitoring module can monitor the shutdown process after the watchdog module stops running, if the shutdown blocking problem occurs in the shutdown process, the electronic equipment triggers the automatic system reset restart after the preset time length, the problem that the electronic equipment cannot be normally shutdown for a long time due to shutdown blocking can be effectively avoided, and the user experience is improved.
It should be understood that the above shutdown monitoring module triggers the automatic system reset and restart after the preset time period is executed under the condition that the electronic device is not shutdown yet, if the electronic device has completed shutdown within the preset time period, the electronic device can basically be considered to be in a dead-lock state, normal shutdown can be realized, and the automatic system reset and restart is not required naturally after the preset time period is exceeded.
Fig. 4 is an exemplary flowchart of a shutdown method 400 provided by an embodiment of the present application. The method 400 is performed by an electronic device, which may be the electronic device 100 shown in fig. 1.
The method 400 is applied to a system comprising an application framework layer, a system library and a kernel layer, wherein the application framework layer comprises a watchdog module, and the kernel layer comprises a shutdown monitoring module. The system may be an android system, for example. Illustratively, the system further comprises: an application program layer and a hardware abstraction layer. The descriptions of the various layers in the system may refer to the descriptions of fig. 2, and will not be repeated.
In S410, after receiving the shutdown instruction, the system library stops the operation of the watchdog module through the kernel layer.
The shutdown instruction is used for instructing the electronic device to execute Guan Jinliu to realize shutdown of the electronic device. Illustratively, the shutdown instruction includes internal information for indicating a type of shutdown, for example, a type of shutdown is restarted (reboot) or shutdown (shutdown). It should be understood that shutdown (shutdown) in the shutdown instruction indicates an event in which only shutdown is performed.
When the system is powered off, in the implementation, the user presses the power key, the application program layer detects the operation of pressing the power key by the user, and the power-off broadcast is sent to the application frame layer, wherein the power-off broadcast comprises the type of power-off, and after the application frame layer receives the power-off broadcast, the power-off instruction is sent to the system library. And after the system library receives the shutdown instruction, notifying the kernel layer to execute the operation of killing the upper-layer process or thread, including killing the watchdog module, so as to stop the operation of the watchdog module. It should be appreciated that the watchdog module may be a process or thread capable of running at the application framework layer.
The watchdog module is used for periodically executing the feeding operation when operating normally. After the watchdog module stops running, the watchdog module stops executing the feeding operation.
Illustratively, in an implementation, the kernel layer creates a device node (e.g., dev/RT monitor) within the application framework layer that can be accessed by the application framework layer for communication with upper layers to monitor whether the watchdog module is operating properly. While the watchdog module is running, the watchdog module will write marks of the machine monitoring module in the device node periodically (e.g. every 30 seconds), and this process can be understood as the watchdog operation performed by the watchdog module. On the contrary, when the watchdog module stops running, the watchdog module does not execute the feeding operation and can trigger the shutdown monitoring module of the kernel layer to time.
In S420, after the watchdog module stops running, the shutdown monitoring module starts timing.
After the watchdog module stops running, the watchdog module does not execute the feeding operation, namely, the node of the machine closing monitoring module is not written into the equipment node any more, and the machine closing monitoring module can be triggered to start timing so as to monitor the subsequent machine closing process.
In the embodiment of the present application, a flag bit (falg) is introduced in the kernel layer, and the flag bit can be understood as a counter or counter for timing. The product of the number of the flag bit and the counted period duration is the duration of the shutdown monitoring module timing.
In some embodiments, when the watchdog module operates normally, the watchdog module periodically performs a watchdog feeding operation to trigger the shutdown monitoring module of the kernel layer to perform a zero clearing operation on the flag bit. Because the shutdown monitoring module executes the zero clearing operation on the flag bit, the value recorded by the flag bit is 0.
And otherwise, after the watchdog module stops running, the watchdog module stops executing the feeding operation so as to trigger the shutdown monitoring module to time through the zone bit. Because the shutdown monitoring module does not execute the zero clearing operation on the flag bit, the shutdown monitoring module is triggered to count through the flag bit so as to monitor the shutdown process.
In an implementation, when the watchdog module is running, the watchdog module writes the node of the shutdown monitoring module into the device node periodically (for example, every 30 seconds), and since the device node is created by the kernel layer, the operation that the device node writes the node of the shutdown monitoring module triggers the shutdown monitoring module of the kernel layer to perform a zero clearing action on the flag bit. When the watchdog module stops running, the watchdog module does not execute the feeding operation, namely, the node of the machine closing monitoring module is not written into the equipment node any more, and the shutdown monitoring module is not triggered to execute the zero clearing operation on the zone bit, so that the shutdown monitoring module does not detect the operation that the watchdog module writes the node of the machine closing monitoring module into the equipment node within a specific time (the next period of the last period), and then clocks through the mark bit.
For example, taking the period of 30 seconds as an example, the shutdown monitoring module performs a zero clearing operation in the last 30 seconds, the watchdog module is killed, the operation is stopped, the dog feeding operation is not performed any more in the current 30 seconds, the shutdown monitoring module does not detect the operation that the watchdog module writes the node of the shutdown monitoring module in the equipment node in the current 30 seconds, then after the current 30 seconds are overtime, the shutdown monitoring module starts timing, the value 1 is recorded on the flag bit, after the next 30 seconds are overtime, the value on the flag bit is increased by 1 (changed into 2), and the value on the flag bit is increased by 1 in the next 30 seconds, and so on every time the period is longer than one period.
It should be noted that, in the mode that the shutdown control module counts and counts through the flag bit, the shutdown control module periodically performs the accumulation of the values on the flag bit, and the period duration of this process may be the same as or different from the period duration of the watchdog module periodically performing the watchdog feeding operation. For example, in the example of 30s period duration described above, the period durations of the two processes are the same. It can be appreciated that in the embodiment of the two processes with the same period duration, the complexity of the scheme can be reduced, and the implementation is convenient.
In S430, after the shutdown monitoring module counts more than the preset time, if the system does not complete shutdown, the shutdown monitoring module triggers a reset restart of the system.
The preset time length is the time length preset by the system, the preset time length takes the time length of normal shutdown of the electronic equipment as a reference, and the preset time length represents the time length of normal shutdown of the electronic equipment under the condition that data restoration is not carried out. It should be understood that the time period of normal shutdown of the electronic device described herein refers to the time period of shutdown when the electronic device does not have a stuck state.
In an example, the preset time period is greater than or equal to a time period during which the electronic device is normally powered off.
For example, the duration of a normal shutdown of the electronic device may be 100 seconds, 110 seconds, 120 seconds. For example, the preset duration may be 120 seconds, 130 seconds, 140 seconds, or the like.
If the time required by the electronic device for data restoration is considered, the preset time can be set longer. Because the time length for repairing the data is related to the number of files and the damage degree in the electronic equipment, the time length is tens of minutes and more than a few hours, and the user experience is affected when the electronic equipment is not started for a long time, the preset time length is not too long. For example, the preset time period may be 20 minutes, 25 minutes, 30 minutes, or the like.
It should be noted that, if the preset duration is exceeded, the data repair process is not completed yet, and when the system is triggered to reset and restart, the data repair is interrupted, but the files in the electronic device are not damaged continuously, and the system can repair damaged files continuously when the system is started next time.
In other examples, since the shutdown monitoring module begins to time after the watchdog module stops running, the preset duration may be greater than or equal to a first duration that is a difference between a duration of normal shutdown of the electronic device and a second duration that is a duration between a time when the electronic device starts shutdown and a time when the watchdog module stops running.
In an exemplary implementation, when the shutdown monitoring module counts through the flag bit, if the value of the flag bit reaches the threshold value, the shutdown monitoring module triggers the system to reset and restart. This threshold value is available by the quotient of the preset duration and the counted period duration. For example, if the preset duration is 120 seconds, and the counted period duration is 30 seconds, the threshold is 4, and when the value of the flag bit is increased to 4, the threshold is reached, so that the system reset restart is triggered.
In the prior art, a shutdown method is proposed, a shutdown monitoring thread is started in a system library to monitor the blocking condition of the shutdown process, and if the blocking condition of the shutdown occurs within a monitoring period, an electronic device (such as a mobile phone) can automatically reset and restart the system within 3 minutes. Therefore, the electronic equipment can not be in a shutdown and locking state all the time, and the user experience can be improved. However, the shutdown monitoring thread is only effective in the initialization (init) process (step S320 in fig. 3), that is, only shutdown blocking of the initialization process can be monitored, and shutdown blocking of other processes (steps S330 to S350 in fig. 3) cannot be monitored. If the shutdown blocking occurs in other processes, the problem that the screen is blocked and the user perceives that the machine is not started still occurs, and the user experience is poor. The reason is that the shutdown monitoring thread runs in the system library, and when executing step S320, the process of the upper layer (the system library and the application framework layer) is killed, including the shutdown monitoring thread, so that the shutdown monitoring thread is designed to monitor only the process of init processing shutdown, and the process of turning to the shutdown process of the kernel and the process of performing data repair subsequently cannot be monitored.
In the application, because the shutdown monitoring module runs in the kernel layer, even if the process on the upper layer is killed, the shutdown monitoring module is still running, so that the shutdown process can be monitored for a long time; meanwhile, the watchdog module is utilized to run, after the upper layer process is killed in the shutdown process, the watchdog module is stopped, the shutdown monitoring module can be triggered to start timing, and after the timing exceeds the preset duration, the shutdown monitoring module can trigger the system to reset and restart. Therefore, the shutdown monitoring module can monitor the shutdown process after the watchdog module stops running through the preset time, if the shutdown jamming condition occurs in the process, and the electronic equipment is not shutdown after the preset time, the system is triggered to automatically reset and restart, the problem that the electronic equipment cannot be normally shutdown for a long time due to shutdown jamming can be effectively avoided, and the user experience is improved. In addition, the time for killing the watchdog module in the shutdown process is relatively forward, so that the shutdown monitoring module is more beneficial to monitoring the shutdown process for a longer time. It can be seen that, compared with the shutdown blocking problem that the prior art only can monitor the initialization (init) process, the embodiment of the application can monitor the shutdown blocking problem that appears in the shutdown process after the watchdog module stops running, and after the blocking problem appears, the device can reset in time and restart, thereby improving the user experience very well.
For example, taking fig. 3 as an example, the time t1 is the time when the watchdog module is killed and stops running, and the transmission delay between the layers is ignored, it can be understood that, as long as the preset duration is set appropriately, the shutdown monitoring module can monitor the whole shutdown process after the watchdog module stops running, and the monitored duration can be greater than or equal to the time 1.
As described above, if the file in the electronic device is damaged, the system will perform data repair. In order to simultaneously consider the situation that the system performs data restoration and does not perform data restoration, so that the problem of shutdown blocking can be better solved under different situations, two preset time periods, namely a first time period and a second time period, can be arranged in the system, wherein the first time period is used for a scene of performing data restoration on the system, the second time period is used for a scene of not performing data restoration on the system, and the shutdown monitoring module is used for judging whether the system performs data restoration or not.
In some embodiments, when the shutdown monitoring module detects that the system performs data repair, after the shutdown monitoring module counts more than the first time period, if the system does not complete shutdown, the shutdown monitoring module triggers the reset restart of the system. The preset time length is a first time length.
Because the time length for repairing the data is related to the number of files and the damage degree in the electronic equipment, the time length is tens of minutes, and more than a few hours, the user experience is affected when the electronic equipment is not started for a long time, and therefore the first time length is not too long. Illustratively, the first duration is 30 minutes.
In other embodiments, when the shutdown monitoring module detects that the system does not perform data repair, the shutdown monitoring module counts the time exceeding the second time period, and if the system does not complete shutdown, the shutdown monitoring module triggers the reset restart of the system. The preset duration is the second duration. Illustratively, the second duration is 120 seconds.
The embodiment of the application can detect whether the system performs data recovery in the following way.
In an exemplary implementation, a new flag bit (different from the one used for timing above) may be introduced in the kernel layer, with different contents of the flag bit representing different states. One content of the flag bit (for example, the flag bit has a value of 0) is used to indicate a state that the system performs data repair, and the other content of the flag bit (for example, the flag bit has a value of 1) is used to indicate a state that the system does not perform data repair, for example, the default state of the flag bit is that the system does not perform data repair. If the initialization module performs data recovery, the initialization module writes a node in the equipment node, and can trigger the kernel layer to modify a default marking bit into a state that the system performs data recovery, so that the shutdown monitoring module can detect that the system performs data recovery. If the initialization module does not perform data recovery, the initialization module does not write nodes in the equipment nodes, and the marking bit keeps a default state, so that the shutdown monitoring module can detect that the system does not perform data recovery. The device node may be a device node of the watchdog module writing node described above, or may be a new device node, which is not limited herein.
In the prior art, the shutdown monitoring thread can directly skip the detection of whether to carry out data restoration, so that the data restoration process becomes a dead zone. In the shutdown method provided by the embodiment of the application, the shutdown monitoring module can detect whether the system performs data restoration, and when the system performs data restoration, the preset time length counted by the shutdown monitoring module corresponds to the first time length, so that after the time length exceeds the first time length, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart, the scene of data restoration of the system can be effectively considered, and the user experience in the scene is improved.
It should be understood that the above-described process of setting two preset durations and determining whether the system performs data restoration is merely exemplary, and should not be construed as limiting the embodiments of the present application.
In other embodiments, for example, only one time length may be set in the system, where the time length is the preset time length, and the shutdown monitoring module does not need to determine whether the system performs data restoration, and triggers a reset restart of the system if the time exceeds the preset time length. Of course, if the preset duration is set smaller, the embodiment may not consider the situation that the system performs data restoration, however, the influence on user experience is not very large, and data restoration in the next power-on process may also be performed.
In this embodiment of the present application, the shutdown monitoring module may detect whether the system performs data recovery at any time before the second time or during the second time, which is not limited in the embodiment of the present application.
In some embodiments, when the shutdown monitoring module counts a second time period, the shutdown monitoring module detects whether the system performs data repair, where the second time period is a time period corresponding to when the system does not perform data repair;
when the shutdown monitoring module detects that the system performs data restoration, the shutdown monitoring module continues to count time, and after the count time exceeds a first duration, if the system does not complete shutdown, the shutdown monitoring module triggers the reset restart of the system;
and under the condition that the shutdown monitoring module detects that the system library does not perform data recovery, if the system does not complete shutdown, the shutdown monitoring module triggers the system to reset and restart.
That is, the second time length corresponding to the data restoration is not used as a judging node, and when the shutdown monitoring module is timed to be the second time length, whether the system performs the data restoration is detected; under the condition that the system is detected to carry out data restoration, the shutdown monitoring module can continue to count time, and after the accumulated count time exceeds a first time length, if the system is not completely shutdown, the system is triggered to reset and restart; and under the condition that the system library is detected to be not subjected to data recovery, if the system is not completely shut down, directly triggering the system to reset and restart.
Taking the shutdown monitoring module to count by the flag bit for example, assume that the second duration is 120 seconds, the first duration is 30 minutes (1800 seconds), and the counted period duration is 30 seconds, then the threshold value corresponding to the second duration is 4, and the threshold value corresponding to the first duration is 60. When the number of the zone bit is increased to 4, the shutdown monitoring module detects whether the system performs data restoration, and when the system is detected to perform data restoration, the shutdown monitoring module continues to accumulate the number on the zone bit, and when the number of the zone bit is increased to 60, if the system is still not closed, the system is triggered to reset and restart; and under the condition that the system library is detected to be not subjected to data recovery, if the system is not completely shut down, directly triggering the system to reset and restart.
According to the shutdown method provided by the embodiment of the application, two preset durations are arranged in the system, namely, a first duration and a second duration, wherein the first duration is the duration counted by the shutdown monitoring module when the system performs data restoration, the second duration is the duration counted by the shutdown monitoring module when the system does not perform data restoration, the shutdown monitoring module can detect whether the system performs data restoration when the second duration is counted, and the shutdown monitoring module can continue to count until the count exceeds the first duration under the condition that the system performs data restoration is detected, and if the system does not finish shutdown, the shutdown monitoring module can trigger the system to reset and restart. Under the condition that the system performs data restoration, the event timed to the second time length is used as a trigger event for detecting whether the data restoration is performed or not, other time or time length is not required to be additionally set for triggering whether the data restoration is performed or not, the design of the system is effectively utilized, and the implementation process is convenient.
Fig. 5 is another exemplary flowchart of a shutdown method provided by an embodiment of the present application.
In S510, after receiving the shutdown instruction, the system library stops the operation of the watchdog module through the kernel layer.
In S520, after the watchdog module stops running, the shutdown monitoring module starts timing.
In S530, the shutdown monitoring module detects whether the timer is a second duration.
If the timing does not reach the second time length, continuing to detect the time length of the timing until the timing is the second time length; if the second time period is counted, S540 is performed.
In S540, if the shutdown monitoring module counts the second duration, the shutdown monitoring module detects whether the system performs data repair.
If the shutdown monitoring module detects that the system performs data restoration, S550 is executed; if the shutdown monitoring module detects that the system does not perform data repair, S560 is executed.
In S550, if the shutdown monitoring module detects that the system performs data repair, the shutdown monitoring module continues to count, and after the count exceeds the first time, if the system does not complete shutdown, the shutdown monitoring module triggers the reset restart of the system.
In S560, if the shutdown monitoring module detects that the system library does not perform data recovery, the shutdown monitoring module triggers a reset restart of the system if the system does not complete shutdown.
For a specific description of the above steps, reference may be made to the above related description, and no further description is given.
It should be understood that the sequence numbers of the above processes do not mean the order of execution, and the execution order of the processes should be determined by the functions and internal logic of the processes, and should not be construed as limiting the implementation process of the embodiments of the present invention.
The shutdown method provided by the embodiment of the present application is described in detail above with reference to fig. 4 to 5, and the electronic device provided according to the embodiment of the present application will be described below with reference to fig. 2 and 6.
Referring to fig. 2, the electronic device is installed with a system including an application framework layer including a watchdog module, a system library, and a kernel layer including a shutdown monitoring module, wherein,
the system library is used for stopping the operation of the watchdog module through the kernel layer after receiving a shutdown instruction;
the shutdown monitoring module is used for starting timing after the watchdog module stops running;
the shutdown monitoring module is also used for triggering the system to reset and restart if the system does not finish shutdown after the shutdown monitoring module counts more than a preset time.
Optionally, the preset duration is a first duration; and, the shutdown monitoring module is specifically configured to:
And under the condition that the shutdown monitoring module detects that the system performs data restoration, triggering the system to reset and restart after the shutdown monitoring module counts the time exceeding the first time length if the system does not complete shutdown.
Optionally, the shutdown monitoring module is further configured to:
detecting whether the system performs data restoration when the shutdown monitoring module counts to a second time length, wherein the second time length is the time length counted by the shutdown monitoring module when the system does not perform data restoration, and the second time length is smaller than the first time length; the method comprises the steps of,
the shutdown monitoring module is specifically used for: and continuing to count the time under the condition that the shutdown monitoring module detects that the system performs data restoration, and triggering the system to reset and restart if the system does not complete shutdown after the time exceeds the first time.
Optionally, the preset duration is a second duration; the method comprises the steps of,
the shutdown monitoring module is specifically used for: and under the condition that the shutdown monitoring module detects that the system does not carry out data restoration, triggering the system to reset and restart if the system does not finish shutdown after the shutdown monitoring module counts the time exceeding the second time length.
Optionally, the watchdog module is configured to periodically perform a watchdog feeding operation, so as to trigger the shutdown monitoring module to perform a zero clearing operation on the flag bit; the method comprises the steps of,
the shutdown monitoring module is specifically used for: :
and after the watchdog module stops running, timing by counting the zone bit.
Optionally, the preset time period is longer than or equal to the time period of normal shutdown of the system.
Optionally, the preset duration is 30 minutes or 120 seconds.
Fig. 6 is a schematic block diagram of an electronic device 600 provided in an embodiment of the present application. The electronic device 600 is configured to perform the steps and/or processes corresponding to the electronic device in the above-described embodiments of the method 400. The electronic device 400 may be the electronic device 100 of fig. 1 above.
The electronic device 600 includes a processor 610, a transceiver 620, and a memory 630. Wherein the processor 610, the transceiver 620 and the memory 630 communicate with each other via internal connection paths, the processor 610 may implement the functions of the processing unit 610 in various possible implementations of the electronic device 600. The memory 630 is used for storing instructions, and the processor 610 is used for executing instructions stored in the memory 630, or the processor 610 may invoke the stored instructions to implement the functionality of the processing unit 610 in the electronic device 600.
The memory 630 may optionally include read-only memory and random access memory and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store information of the device type. The processor 610 may be configured to execute instructions stored in a memory, and when the processor 610 executes instructions stored in the memory, the processor 610 is configured to perform the steps and/or processes of the method embodiments corresponding to the electronic device described above.
In one possible implementation, the electronic device 600 is configured to perform the respective processes and steps corresponding to the electronic device in the method 400.
The processor 1410 is configured to perform the steps of:
after a shutdown instruction is received, stopping the operation of the watchdog module through the kernel layer;
after the watchdog module stops running, starting timing;
and triggering the reset and restarting of the system if the system does not finish shutdown after the shutdown monitoring module counts more than a preset time.
It should be understood that, the specific process of each device performing the corresponding step in each method is described in detail in the above method embodiments, and for brevity, will not be described in detail herein.
It should be appreciated that in embodiments of the present application, the processor of the apparatus described above may be a central processing unit (central processing unit, CPU), which may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software elements in the processor for execution. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor executes instructions in the memory to perform the steps of the method described above in conjunction with its hardware. To avoid repetition, a detailed description is not provided herein.
Embodiments of the present application provide a computer program product, which when executed on an electronic device, causes the electronic device to perform the technical solutions in the foregoing embodiments. The implementation principle and technical effects are similar to those of the related embodiments of the method, and are not repeated here.
An embodiment of the present application provides a readable storage medium, where the readable storage medium contains instructions, where the instructions, when executed on an electronic device, cause the electronic device to execute the technical solution of the foregoing embodiment. The implementation principle and technical effect are similar, and are not repeated here.
The embodiment of the application provides a chip for executing instructions, and when the chip runs, the technical scheme in the embodiment is executed. The implementation principle and technical effect are similar, and are not repeated here.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions described in accordance with embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
It should be appreciated that reference throughout this specification to "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, various embodiments are not necessarily referring to the same embodiments throughout the specification. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application.
It should also be understood that, in this application, "when …," "if," and "if" all refer to that the UE or the base station will make a corresponding process under some objective condition, and are not limited in time, nor do they require that the UE or the base station must have a judgment action when it is implemented, nor are they meant to have other limitations.
Those of ordinary skill in the art will appreciate that: the first, second, etc. numbers referred to in this application are merely for convenience of description and are not intended to limit the scope of the embodiments of the present application, but also to indicate the sequence.
Elements referred to in the singular are intended to be used in this application to mean "one or more" rather than "one and only one" unless specifically indicated. In this application, unless specifically stated otherwise, "at least one" is intended to mean "one or more" and "a plurality" is intended to mean "two or more".
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: there are three cases where a alone exists, where a may be singular or plural, and where B may be singular or plural, both a and B exist alone.
The term "at least one of … …" or "at least one of … …" herein means all or any combination of the listed items, e.g., "at least one of A, B and C," may mean: there are six cases where a alone, B alone, C alone, a and B together, B and C together, A, B and C together, where a may be singular or plural, B may be singular or plural, and C may be singular or plural.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described embodiments of the electronic device are merely illustrative, e.g., the division of the modules is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
It should be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
In addition, the term "and/or" herein is merely an association relation describing an association object, and means that three kinds of relations may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application should be defined by the claims, and the above description is only a preferred embodiment of the technical solution of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (15)

1. The shutdown method is characterized by being applied to a system comprising an application framework layer, a system library and a kernel layer, wherein the application framework layer comprises a watchdog module, and the kernel layer comprises a shutdown monitoring module, and the method comprises the following steps:
the watchdog module periodically executes a watchdog feeding operation to trigger the shutdown monitoring module to execute a zero clearing operation on a zone bit for timing;
after receiving a shutdown instruction from the application framework layer, the system library informs the kernel layer to execute the operation of killing the upper layer process comprising the watchdog module;
the kernel layer kills an upper layer process comprising the watchdog module so as to stop the operation of the watchdog module;
after the watchdog module stops running, the shutdown monitoring module counts time through the counting of the zone bit;
and after the timing of the shutdown monitoring module exceeds a preset time, if the shutdown is not completed, triggering the system to reset and restart by the shutdown monitoring module.
2. The method of claim 1, wherein the preset duration is a first duration; the method comprises the steps of,
after the timing of the shutdown monitoring module exceeds the preset time, if the system does not finish shutdown, the shutdown monitoring module triggers a system reset restart, including:
And under the condition that the shutdown monitoring module detects that the system performs data restoration, after the shutdown monitoring module counts the time exceeding the first time length, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart.
3. The method according to claim 2, wherein the method further comprises:
when the timing of the shutdown monitoring module is a second time length, the shutdown monitoring module detects whether the system performs data restoration, wherein the second time length is the time length of the timing of the shutdown monitoring module when the system does not perform data restoration, and the second time length is smaller than the first time length; the method comprises the steps of,
and under the condition that the shutdown monitoring module detects that the system performs data restoration, after the shutdown monitoring module counts the time exceeding the first time length, if the system does not complete shutdown, the shutdown monitoring module triggers system reset restart, including:
and under the condition that the shutdown monitoring module detects that the system performs data restoration, the shutdown monitoring module continues to count time, and after the count time exceeds the first time, if the system does not complete shutdown, the shutdown monitoring module triggers the system to reset and restart.
4. The method of claim 1, wherein the preset duration is a second duration; the method comprises the steps of,
after the timing of the shutdown monitoring module exceeds the preset time, if the system does not finish shutdown, the shutdown monitoring module triggers a system reset restart, including:
and under the condition that the shutdown monitoring module detects that the system does not carry out data restoration, after the shutdown monitoring module counts the time exceeding the second time, if the system does not finish shutdown, the shutdown monitoring module triggers the system to reset and restart.
5. The method of any one of claims 1 to 4, wherein the predetermined period of time is greater than or equal to a period of time during which the system is normally shut down.
6. The method according to any one of claims 1 to 4, wherein the preset duration is 30 minutes or 120 seconds.
7. An electronic device, wherein the electronic device is provided with a system comprising an application framework layer, a system library and a kernel layer, the application framework layer comprises a watchdog module, the kernel layer comprises a shutdown monitoring module, wherein,
the watchdog module is used for periodically executing a feeding operation so as to trigger the shutdown monitoring module to execute a zero clearing operation on the zone bit for timing;
The system library is used for notifying the kernel layer to execute the operation of killing the upper layer process comprising the watchdog module after receiving a shutdown instruction from the application framework layer;
the kernel layer is used for killing an upper layer process comprising the watchdog module so as to stop the operation of the watchdog module;
the shutdown monitoring module is used for timing through counting the zone bit after the watchdog module stops running;
the shutdown monitoring module is also used for triggering the system to reset and restart if the system does not finish shutdown after the shutdown monitoring module counts more than a preset time.
8. The electronic device of claim 7, wherein the preset duration is a first duration; and, the shutdown monitoring module is specifically configured to:
and under the condition that the shutdown monitoring module detects that the system performs data restoration, triggering the system to reset and restart after the shutdown monitoring module counts the time exceeding the first time length if the system does not complete shutdown.
9. The electronic device of claim 8, wherein the shutdown monitoring module is further configured to:
Detecting whether the system performs data restoration when the shutdown monitoring module counts to a second time length, wherein the second time length is the time length counted by the shutdown monitoring module when the system does not perform data restoration, and the second time length is smaller than the first time length; the method comprises the steps of,
the shutdown monitoring module is specifically used for: and continuing to count the time under the condition that the shutdown monitoring module detects that the system performs data restoration, and triggering the system to reset and restart if the system does not complete shutdown after the time exceeds the first time.
10. The electronic device of claim 7, wherein the preset duration is a second duration; the method comprises the steps of,
the shutdown monitoring module is specifically used for: and under the condition that the shutdown monitoring module detects that the system does not carry out data restoration, triggering the system to reset and restart if the system does not finish shutdown after the shutdown monitoring module counts the time exceeding the second time length.
11. The electronic device of any one of claims 7-10, wherein the preset time period is greater than or equal to a time period during which the system is normally shut down.
12. The electronic device of any one of claims 7 to 10, wherein the preset duration is 30 minutes or 120 seconds.
13. An electronic device, comprising:
a memory for storing computer instructions;
a processor for invoking computer instructions stored in the memory to perform the method of any of claims 1-6.
14. A computer readable storage medium storing computer instructions for implementing the method of any one of claims 1 to 6.
15. A chip, the chip comprising:
a memory for storing instructions;
a processor for invoking and executing the instructions from the memory to cause an electronic device on which the chip system is mounted to perform the method of any of claims 1-6.
CN202211213010.4A 2022-09-30 2022-09-30 Shutdown method, electronic equipment, storage medium and chip Active CN116684520B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211213010.4A CN116684520B (en) 2022-09-30 2022-09-30 Shutdown method, electronic equipment, storage medium and chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211213010.4A CN116684520B (en) 2022-09-30 2022-09-30 Shutdown method, electronic equipment, storage medium and chip

Publications (2)

Publication Number Publication Date
CN116684520A CN116684520A (en) 2023-09-01
CN116684520B true CN116684520B (en) 2024-04-12

Family

ID=87784224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211213010.4A Active CN116684520B (en) 2022-09-30 2022-09-30 Shutdown method, electronic equipment, storage medium and chip

Country Status (1)

Country Link
CN (1) CN116684520B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000172384A (en) * 1998-12-03 2000-06-23 Clarion Co Ltd On-vehicle computer and its control method
CN102736958A (en) * 2012-05-30 2012-10-17 深圳市共进电子股份有限公司 Watchdog realizing method and system for monitoring a plurality of process systems
CN203366315U (en) * 2013-07-11 2013-12-25 龙芯中科技术有限公司 Watchdog circuit
CN104679601A (en) * 2013-11-28 2015-06-03 中国航空工业集团公司第六三一研究所 Watchdog starting method of interference preventing system
CN109062721A (en) * 2018-07-20 2018-12-21 北斗星通(重庆)汽车电子有限公司 A kind of method of house dog detection vehicle mounted multimedia crash reset
CN110502369A (en) * 2019-08-20 2019-11-26 京信通信***(中国)有限公司 A kind of method, apparatus and storage medium of equipment crash recovery
CN111814118A (en) * 2020-07-08 2020-10-23 广东小天才科技有限公司 Anti-cracking method and family education machine
CN113094196A (en) * 2021-03-25 2021-07-09 深圳凌特华盛科技有限公司 Intelligent watchdog device, method and system for preventing communication equipment from crashing

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000172384A (en) * 1998-12-03 2000-06-23 Clarion Co Ltd On-vehicle computer and its control method
CN102736958A (en) * 2012-05-30 2012-10-17 深圳市共进电子股份有限公司 Watchdog realizing method and system for monitoring a plurality of process systems
CN203366315U (en) * 2013-07-11 2013-12-25 龙芯中科技术有限公司 Watchdog circuit
CN104679601A (en) * 2013-11-28 2015-06-03 中国航空工业集团公司第六三一研究所 Watchdog starting method of interference preventing system
CN109062721A (en) * 2018-07-20 2018-12-21 北斗星通(重庆)汽车电子有限公司 A kind of method of house dog detection vehicle mounted multimedia crash reset
CN110502369A (en) * 2019-08-20 2019-11-26 京信通信***(中国)有限公司 A kind of method, apparatus and storage medium of equipment crash recovery
CN111814118A (en) * 2020-07-08 2020-10-23 广东小天才科技有限公司 Anti-cracking method and family education machine
CN113094196A (en) * 2021-03-25 2021-07-09 深圳凌特华盛科技有限公司 Intelligent watchdog device, method and system for preventing communication equipment from crashing

Also Published As

Publication number Publication date
CN116684520A (en) 2023-09-01

Similar Documents

Publication Publication Date Title
CN113704014B (en) Log acquisition system, method, electronic device and storage medium
CN114116191B (en) Memory cold page processing method and electronic equipment
CN114168065B (en) Method and device for adjusting memory configuration parameters
CN113704205A (en) Log storage method, chip, electronic device and readable storage medium
CN115333941B (en) Method for acquiring application running condition and related equipment
CN114077519B (en) System service recovery method and device and electronic equipment
CN115904297A (en) Screen display detection method, electronic device and storage medium
CN116389884B (en) Thumbnail display method and terminal equipment
CN116048831B (en) Target signal processing method and electronic equipment
CN114690849B (en) Clock offset determination method, device and storage medium
CN116684520B (en) Shutdown method, electronic equipment, storage medium and chip
CN113050864B (en) Screen capturing method and related equipment
CN116723384B (en) Process control method, electronic device and readable storage medium
CN115513571B (en) Control method of battery temperature and terminal equipment
CN116719376B (en) Voltage control method, device, equipment and storage medium
CN115952564B (en) Data writing method and terminal equipment
CN114077323B (en) Touch screen false touch prevention method of electronic equipment, electronic equipment and chip system
CN116795476B (en) Wallpaper deleting method and electronic equipment
CN115495716B (en) Local authentication method and electronic equipment
CN116233599B (en) Video mode recommendation method and electronic equipment
CN116709220B (en) Network connection method, network connection device, electronic equipment and computer readable storage medium
CN116049122B (en) Log information transmission control method, electronic device and storage medium
CN116662150B (en) Application starting time-consuming detection method and related device
CN115529379B (en) Method for preventing Bluetooth audio Track jitter, electronic equipment and storage medium
CN116089057B (en) Resource scheduling method, device, storage medium and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant