CN114489825A - Electronic equipment and shutdown method thereof - Google Patents

Electronic equipment and shutdown method thereof Download PDF

Info

Publication number
CN114489825A
CN114489825A CN202210385581.XA CN202210385581A CN114489825A CN 114489825 A CN114489825 A CN 114489825A CN 202210385581 A CN202210385581 A CN 202210385581A CN 114489825 A CN114489825 A CN 114489825A
Authority
CN
China
Prior art keywords
electronic equipment
usb
electronic device
shutdown
mobile phone
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.)
Granted
Application number
CN202210385581.XA
Other languages
Chinese (zh)
Other versions
CN114489825B (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 CN202210385581.XA priority Critical patent/CN114489825B/en
Publication of CN114489825A publication Critical patent/CN114489825A/en
Application granted granted Critical
Publication of CN114489825B publication Critical patent/CN114489825B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/442Shutdown
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus
    • G06F13/1668Details of memory controller
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4081Live connection to bus, e.g. hot-plugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Telephone Function (AREA)

Abstract

A shutdown method of electronic equipment and the electronic equipment relate to the technical field of terminals, ensure that the electronic equipment is in a shutdown state before being put in storage, and improve the shutdown efficiency of the electronic equipment. The electronic equipment is connected with external equipment for testing the electronic equipment through a universal serial bus interface (USB), and the shutdown method comprises the following steps: after receiving a shutdown instruction, the electronic equipment responds to the shutdown instruction, and acquires a USB state value; the shutdown instruction is used for indicating the electronic equipment to shut down, and when the electronic equipment determines that the state values of the USB acquired within the first preset time are the first preset values, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is disconnected, and the electronic equipment controls the electronic equipment to shut down.

Description

Electronic equipment and shutdown method thereof
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a shutdown method for an electronic device and an electronic device.
Background
Before shipping, an electronic device (e.g., a mobile phone, a tablet computer, etc.) needs to be tested many times, for example, an external device for testing the electronic device tests hardware performance (e.g., antenna performance, battery performance, etc.) of the electronic device. In the testing process, the electronic device is connected with an external device (for example, a personal computer or the like) through a Universal Serial Bus (USB) interface, after a tester finishes testing a certain performance of the electronic device through the external device, the tester may need to shut down the electronic device and disconnect the USB connection with the external device, put the electronic device in storage, and after a period of time, test other performances of the electronic device. For example, after the antenna performance of the electronic device is tested by the external device, the tester issues a shutdown instruction to the electronic device, and after the tester determines that the electronic device is shutdown, the tester disconnects the USB connection between the electronic device and the external device and puts the electronic device in storage.
However, when the tester issues the shutdown instruction to the electronic device through the external device, there may be a case where the instruction is delayed to issue, for example, the delay of issuing the shutdown instruction by the external device is 1 second, which results in a slow speed of disconnecting the USB connection between the electronic device and the external device by a production line worker. The electronic equipment is triggered to be started up when the electronic equipment is connected with the external equipment through the USB in a default mode during testing, and the electronic equipment is always connected with the external equipment through the USB in the testing process, so that the electronic equipment is triggered to be started up again when the speed of disconnecting the USB connection between the electronic equipment and the external equipment by testing personnel is low. After the electronic equipment is triggered to be started up again, if the display screen is not installed on the electronic equipment or the display screen is installed but the display function of the display screen is not started, the testing personnel default that the electronic equipment is shut down and put in storage. Under the condition, the electronic equipment is not shut down when being put in storage, so that the electric quantity of the battery of the electronic equipment is exhausted after the electronic equipment is put in storage, the battery needs to be disassembled and replaced when the electronic equipment is tested next time, and a large amount of manpower and financial resources are consumed.
Disclosure of Invention
The embodiment of the application provides a shutdown method of an electronic device and the electronic device, after the electronic device receives a shutdown instruction sent by an external device, when the electronic device determines that state values of a USB acquired within a first preset time period are all first preset values, it determines that the USB connection between the external device and the electronic device is in a disconnected state, then the electronic device calls the shutdown instruction or notifies a tester to control the electronic device to shutdown, it is ensured that after the USB connection between the external device and the electronic device is disconnected, the electronic device is controlled to be shut down and put in storage, the problem that the electronic device can be restarted immediately when the electronic device is shut down but the USB connection is not disconnected is solved, and further the problem that the battery electric quantity is exhausted due to the fact that the electronic device is not shut down and put in storage is solved. Or the external device is connected with the electronic device through a wireless network during testing, and the electronic device controls the electronic device to be powered off and put in storage after determining that the wireless network connection between the external device and the electronic device is disconnected, so that the electronic device is successfully powered off and put in storage after the external device finishes testing the electronic device, the labor is saved, and the efficiency of powering off the mobile phone is improved.
In order to achieve the purpose, the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a shutdown method for an electronic device, where the electronic device is connected to an external device for testing the electronic device through a USB, and the shutdown method includes: the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down; responding to a shutdown instruction, the electronic equipment acquires a state value of the USB, wherein the state value is used for reflecting the connection state of the USB; under the condition that the electronic equipment determines that the state values of the USB acquired within the first preset time are all the first preset values, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is disconnected; the electronic equipment controls the electronic equipment to be powered off.
Therefore, the electronic equipment controls the electronic equipment to be shut down and put in storage after the electronic equipment determines that the USB connecting line between the external equipment and the electronic equipment is disconnected according to the state value of the USB acquired within the first preset time, the problem that the electronic equipment is immediately restarted when the external equipment is connected with the electronic equipment through the USB and the electronic equipment is shut down but the USB is not disconnected is solved, and the problem that the battery power of the electronic equipment is exhausted due to the fact that the electronic equipment is not shut down and put in storage is solved.
In addition, after the electronic equipment acquires the state value of the USB within the first preset time, whether the USB connecting line between the external equipment and the electronic equipment is disconnected or not is judged according to the state value of the USB acquired within the first preset time, the problem of misjudgment on the connection state between the external equipment and the electronic equipment is solved, and the accuracy of determining the connection state between the external equipment and the electronic equipment is improved.
In one possible implementation manner, the receiving, by the electronic device, a shutdown instruction includes: the electronic equipment receives a shutdown instruction through a main thread; the electronic equipment acquires the state value of the USB, and comprises the following steps: the electronic equipment acquires the state value of the USB through the first sub thread, and the first sub thread and the main thread are executed in parallel.
The electronic equipment acquires the shutdown instruction and the USB state value through two parallel threads, and the processes of acquiring data through the two threads are mutually independent and interfere complementarily, so that the data acquisition efficiency is improved, and the code robustness is also improved.
In another possible implementation manner, acquiring the state value of the USB includes: calling a file opening function, and opening a storage file, wherein the storage file stores state values of the USB at different times; calling a reading function for multiple times periodically, and reading a USB state value from a storage file; calling a reading function to read one state value of the USB from the storage file each time; the shutdown method further comprises the following steps: and calling a closing function to close the storage file.
In some embodiments, the electronic device may call a file open function through the first child thread to open the storage file, and then the electronic device reads the state value of the USB from the storage file by periodically calling the read function multiple times through the first child thread. For example, the electronic device calls the read function multiple times through the first sub thread to read the state value of the USB within the first preset time length from the storage file. Then, the electronic equipment calls a closing function to close the storage file through the first sub-thread.
Therefore, the electronic device only calls the file opening function once through the first sub-thread, and then after the first sub-thread calls the reading function for multiple times to read the state values of the USB at multiple moments from the storage file, the first sub-thread calls the closing function to close the storage file. Therefore, the process that the storage file is opened only once and the state value of the USB is read for multiple times is achieved, and the problem that in the related technology, the storage file is opened once when the state value of the USB is read once, and then the storage file is closed once, so that the memory of the mobile phone is greatly consumed is solved.
In another possible implementation manner, the periodically calling the read function multiple times to obtain the state value of the USB from the storage file includes: calling a read-write position control function, and fixing a read pointer corresponding to the read function as a first position pointer; calling a reading function for multiple times based on the first position pointer, and reading one state value of the USB from the storage position indicated by the first position pointer in the storage file each time; and the storage position indicated by the first position pointer stores the state values of the USB at different times.
In some embodiments, the electronic device may call the read-write location control function through the first sub-thread, fix a read pointer corresponding to the read function as the first location pointer, and then call the read function multiple times based on the first location pointer, each time reading one status value of the USB from the storage location indicated by the first location pointer in the storage file.
It can be understood that the storage location indicated by the first location pointer stores therein the status values of the USB at different times, and the electronic device calls the read function to read the status values of the USB, so that the read function is ensured to read the status values of the USB from the storage location indicated by the first location pointer each time.
In another possible implementation manner, after the electronic device determines that the USB connection between the electronic device and the external device has been disconnected, the method further includes: the electronic equipment sends out prompt information; the prompt information is used for prompting that the USB connection between the electronic equipment and the external equipment of the user is disconnected; and controlling the electronic equipment to be powered off in response to the power-off operation of the user.
In some embodiments, after the electronic device determines that the USB connection line between the electronic device and the external device is disconnected, the electronic device may prompt the user by means of a voice prompt, and then the user may manually control the electronic device to power off. For example, the electronic device is powered off in response to a user operating a power-off key of the electronic device.
In another possible implementation manner, the shutdown method may further include:
and under the condition that the state value of the USB acquired by the electronic equipment is the second preset value, the electronic equipment continues to acquire the state value of the USB.
It can be understood that when the state value of the USB acquired by the electronic device is not the first preset value, the electronic device determines that the USB connection line between the electronic device and the external device is in a connection state, and the electronic device may continue to acquire the state value of the USB until the state values of the USB acquired by the electronic device within the first preset time period are all the first preset values, and the electronic device determines that the USB connection line between the electronic device and the external device is in a disconnection state.
In a second aspect, the present application provides another shutdown method for an electronic device, where the electronic device is connected to an external device for testing the electronic device through a USB, and the shutdown method may include: the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down; after the electronic equipment receives the shutdown instruction, if the electronic equipment does not receive the data acquisition instruction within a second preset time length, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is disconnected; the electronic equipment controls the electronic equipment to be powered off.
It can be understood that, after the electronic device receives the shutdown instruction, if the external device sends a data acquisition instruction to the electronic device, and the electronic device does not receive the data acquisition instruction sent by the external device within the second preset time period, the electronic device may determine that the USB connection state between the electronic device and the external device is the disconnection state. Under the condition, the electronic equipment is controlled to be shut down and put in storage, and the electric quantity of the electronic equipment cannot be exhausted after the electronic equipment is put in storage.
In one possible implementation manner, the shutdown method may further include:
after the electronic equipment receives the shutdown instruction, if the electronic equipment receives a data acquisition instruction sent by the external equipment within a second preset time, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is not disconnected.
In another possible implementation manner, the receiving, by the electronic device, a shutdown instruction includes: the electronic equipment receives a shutdown instruction through a main thread; the electronic equipment receives a data acquisition instruction sent by the external equipment within a second preset time period, and the method comprises the following steps: and the electronic equipment receives a data acquisition instruction sent by the external equipment through a second sub-thread, and the second sub-thread and the main thread are executed in parallel.
The electronic equipment obtains the shutdown instruction and the data obtaining instruction through two parallel threads, and the processes of obtaining the instruction through the two threads are mutually independent and interfere complementarily, so that the data obtaining efficiency is improved, and the code robustness is also improved.
In a third aspect, the present application provides a shutdown method for an electronic device, where the electronic device is connected to an external device for testing the electronic device through a wireless network, and the shutdown method may include: the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down; responding to a shutdown instruction, and acquiring a wireless network signal by the electronic equipment; under the condition that the electronic equipment determines that the wireless network signal is not monitored within the third preset time, the electronic equipment determines that the wireless network connection between the electronic equipment and the external equipment is disconnected; the electronic equipment controls the electronic equipment to be powered off.
It can be understood that after the electronic device obtains the shutdown instruction, if the electronic device does not monitor the wireless network signal for a long time, the electronic device determines that the wireless network connection between the electronic device and the external device is in a disconnected state.
In one possible implementation manner, the receiving, by the electronic device, a shutdown instruction includes: the electronic equipment receives a shutdown instruction through a main thread; the electronic equipment acquires wireless network signals, and comprises the following steps: the electronic equipment acquires the wireless network signal through a third sub-thread, and the third sub-thread and the main thread are executed in parallel.
The electronic equipment acquires the shutdown instruction and monitors the wireless network signal through two parallel threads, and the execution processes of the two threads are mutually independent and interfere complementarily, so that the data acquisition efficiency is improved, and the code robustness is also improved.
In another possible implementation manner, the shutdown method further includes:
and under the condition that the electronic equipment determines that the wireless network signal is monitored within the third preset time, the electronic equipment continues to monitor the wireless network signal.
In another possible implementation manner, the controlling, by the electronic device, the shutdown of the electronic device includes:
and the electronic equipment is controlled to be powered off according to the power-off instruction.
In another possible implementation manner, the controlling, by the electronic device, the shutdown of the electronic device further includes:
the electronic equipment sends out prompt information; the prompt information is used for prompting that the wireless network connection between the electronic equipment and the external equipment of the user is disconnected; and controlling the electronic equipment to be powered off in response to the power-off operation of the user.
In a fourth aspect, the present application provides an electronic device comprising: one or more processors; a memory; wherein one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the electronic device, cause the electronic device to perform the shutdown method according to any of the above first aspects, or to perform the shutdown method according to any of the above second aspects, or to perform the shutdown method according to any of the above third aspects.
In a fifth aspect, the present application provides a computer-readable storage medium having instructions stored therein, which when executed on an electronic device, cause the electronic device to perform the shutdown method according to any one of the first aspects, or perform the shutdown method according to any one of the second aspects, or perform the shutdown method according to any one of the third aspects.
In a sixth aspect, the present application provides a computer program product, which includes computer instructions, when the computer instructions are executed on an electronic device, to cause the electronic device to execute the shutdown method according to any one of the first aspect, or execute the shutdown method according to any one of the second aspect, or execute the shutdown method according to any one of the third aspect.
It is to be understood that the electronic device according to the fourth aspect, the computer storage medium according to the fifth aspect, and the computer program product according to the sixth aspect are all configured to execute the corresponding method provided above, and therefore, the beneficial effects achieved by the electronic device can refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Drawings
FIG. 1 is a diagram illustrating an exemplary testing system according to an embodiment of the present disclosure;
fig. 2 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application;
fig. 4 is a first exemplary diagram of a shutdown method according to an embodiment of the present application;
fig. 5 is a first flowchart illustrating a shutdown method according to an embodiment of the present disclosure;
fig. 6 is a second flowchart illustrating a shutdown method according to an embodiment of the present application;
fig. 7 is a second exemplary diagram of a shutdown method according to an embodiment of the present application;
fig. 8 is a third schematic flowchart of a shutdown method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of the present application, the meaning of "a plurality" is two or more unless otherwise specified.
In the embodiments of the present application, the words "exemplary" or "such as" are used herein to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
The embodiment of the application provides a shutdown method of electronic equipment, when the electronic equipment is connected with external equipment through a USB, after the electronic equipment receives a shutdown instruction sent by the external equipment, when the electronic equipment determines that the state values of the USB acquired within a first preset time period are all a first preset value (for example, 0), the USB connection between the external equipment and the electronic equipment is determined to be in a disconnected state, then, the electronic equipment calls a shutdown instruction or informs a tester to control the electronic equipment to shut down, so that the electronic equipment is controlled to shut down and put in storage after the USB connection between the external equipment and the electronic equipment is disconnected, and the problems that the external equipment is connected with the electronic equipment through the USB, the electronic equipment is shut down but the USB connection is not disconnected are solved, the electronic equipment can be restarted immediately, and the problem of battery power exhaustion caused by the fact that the electronic equipment is not shut down and put in storage is solved.
Or when the electronic equipment is connected with the external equipment through the USB or the wireless network, after the electronic equipment receives a shutdown instruction sent by the external equipment, if the electronic equipment does not receive the data acquisition instruction within a second preset time length, the electronic equipment determines that the USB connection or the wireless network connection between the external equipment and the electronic equipment is in a disconnected state, then the electronic equipment calls the shutdown instruction or notifies a tester to control the electronic equipment to shut down, so that the electronic equipment is controlled to be shut down and put in storage after the USB connection or the wireless network connection between the external equipment and the electronic equipment is disconnected, and the problem of battery power exhaustion caused by the fact that the electronic equipment is not shut down and put in storage is solved.
Or, when the electronic device is connected with the external device through a wireless network (for example, WiFi), the electronic device controls the electronic device to shut down and put in storage after determining that the wireless network connection between the external device and the electronic device is disconnected, so that it is ensured that the electronic device is successfully shut down and put in storage after the external device completes the test of the mobile phone, thereby saving manpower and improving the efficiency of shutting down the electronic device.
For example, the shutdown method of the electronic device provided in the embodiment of the present application may be applied to electronic devices such as a mobile phone, a tablet computer, a Personal Computer (PC), a Personal Digital Assistant (PDA), a smart watch, a netbook, a wearable electronic device, an Augmented Reality (AR) device, a Virtual Reality (VR) device, an in-vehicle device, an intelligent vehicle, and an intelligent audio device, and the embodiment of the present application does not limit this.
It should be noted that, when the electronic device is in the test stage, the electronic device may be only a motherboard and does not include a display screen, or the electronic device includes a display screen but the display function of the display screen of the electronic device does not work. Under the condition that the electronic equipment triggers the start-up again after receiving the shutdown instruction, a tester cannot determine the on/off state of the electronic equipment according to the display screen, so that the tester defaults that the electronic equipment is shut down.
The test system that this application embodiment provided, this test system includes customer end and test end, and wherein, the customer end includes electronic equipment, and this electronic equipment can be cell-phone, panel computer, PC, intelligent wrist-watch etc. and the test end includes external device, and this external device also can be cell-phone, panel computer, electronic equipment such as PC. The external equipment is connected with the electronic equipment through a USB or a wireless network. For example, the external device performs data transmission with the electronic device through the USB interface or the WiFi communication interface, so as to achieve the purpose of testing the electronic device.
Fig. 1 is an exemplary diagram of a test system according to an embodiment of the present disclosure, as shown in fig. 1, the test system includes a client 11 and a test end 12, taking an electronic device of the client 11 as a mobile phone 111 as an example, taking an external device 122 of the test end 12 as a PC as an example, and the external device 122 is connected to the mobile phone 111 through a USB. The external device 122 performs data transmission with the mobile phone 111 through the USB interface. For example, the external device 122 may send a power-on instruction, a power-off instruction, an information obtaining instruction, and the like to the mobile phone 111 through the USB interface. The mobile phone 111 may send some information (e.g., chip information, current information, etc.) of the mobile phone 111 to the external device through the USB interface.
It should be noted that, the number of the mobile phone 111 and the external device 122 in fig. 1 is only used as an exemplary description, and the embodiment of the present application does not limit this. The client 11 may include a plurality of mobile phones 111, that is, the external device 122 may test the plurality of mobile phones 111, which is not limited herein. The testing end 12 may include a plurality of external devices 122, that is, the plurality of external devices 122 may test the mobile phone 111 at the same time, which is not limited herein.
In fig. 1, the mobile phone 111 and the external device 122 are connected through a USB as an example, and the mobile phone 111 and the external device 122 may also be connected through a connection manner such as a wireless network, which is not limited herein.
It should be noted that the test system shown in fig. 1 is only one example provided in the present embodiment, and should not be construed as limiting the present application.
Fig. 2 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a Subscriber Identification Module (SIM) card interface 194, and the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), among others. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in 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 have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In this embodiment, the processor 110 may execute an instruction sent by the external device, for example, after the electronic device 100 receives a shutdown instruction sent by the external device through the USB interface, the processor 110 may execute the shutdown instruction.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
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 transmit data between the electronic device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
In the embodiment of the present application, after the electronic device is connected to the external device through the USB interface 130, the electronic device performs data transmission with the external device through the USB interface.
It should be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a 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 to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also 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 can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, among others. GNSS may include Global Positioning System (GPS), global navigation satellite system (GLONASS), beidou satellite navigation system (BDS), quasi-zenith satellite system (QZSS), and/or Satellite Based Augmentation System (SBAS).
The electronic device 100 implements a display function by a GPU, an application processor, and the like. The GPU is a microprocessor for image processing and is connected with the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The electronic device 100 may implement a photographing function through the ISP, the camera 193, the video codec, the GPU, the application processor, and the like.
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 perform fourier transform or the like on the frequency bin energy.
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: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent recognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in the external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes 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 program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a Universal Flash Storage (UFS), and the like.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headset interface 170D, and the application processor. Such as music playing, recording, etc.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
In the embodiment of the present application, after the USB connection line or the wireless network connection between the electronic device 100 and the external device is disconnected, the electronic device 100 may indicate that the USB connection line or the wireless network connection between the electronic device 100 and the external device is disconnected through the indicator 192. For example, assuming that the indicator 192 is an indicator light, the electronic device 100 may determine that the USB connection line or the wireless network connection between the electronic device 100 and the external device is disconnected through a display color of the indicator light. Indicator 192 may also prompt the user that the USB connection or wireless network connection between electronic device 100 and the external device has been disconnected by issuing an indication message.
The SIM card interface 194 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 194 or being pulled out from the SIM card interface 194. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 194 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. Multiple cards can be inserted into the same SIM card interface 194 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 194 may also be compatible with different types of SIM cards. The SIM card interface 194 may also be compatible with an external memory card. The electronic device 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
In the embodiment of the present application, the electronic device 100 may further include a display screen 195, but when the electronic device is in a production test stage, the display function of the display screen 195 may not be turned on.
The display screen 195 is used to display images, video, and the like. The display screen 195 includes a display panel. The display panel may be a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, electronic device 100 may include 1 or N display screens 195, with N being a positive integer greater than 1.
It is understood that, in order to implement the shutdown function of the electronic device, the electronic device includes hardware and/or software modules corresponding to the hardware and/or software modules for performing the respective functions. The present application can be realized in hardware or a combination of hardware and computer software in connection with the exemplary algorithm steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware 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, with the embodiment described in connection with the particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In this embodiment, the electronic device may be divided into functional modules according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module may be implemented in the form of hardware. It should be noted that the division of the modules in this embodiment is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
For example, in a division manner, referring to fig. 3, fig. 3 is a schematic diagram of a software structure of an electronic device provided in an embodiment of the present application, and as shown in fig. 3, the electronic device may include a system library and a kernel layer.
Wherein, the system library can comprise a plurality of functional modules.
In the embodiment of the present application, the system library may include a first sub-thread, a data processing module, a data monitoring module, a second sub-thread, an audio prompting module, and a shutdown module.
The electronic device can acquire the state value of the USB through the first sub thread.
The data processing module is used for judging whether a USB connecting line between the electronic equipment and the external equipment is disconnected or not according to the state value of the USB.
The data monitoring module is used for monitoring WiFi signals in the mobile phone so as to judge whether WiFi connection between the external equipment and the electronic equipment is disconnected or not according to whether the WiFi signals are monitored or not.
The electronic device may obtain a data obtaining instruction sent by the external device through the second sub-thread, where the data obtaining instruction may be an instruction for obtaining single board information of the electronic device, an instruction for obtaining a calibration parameter of a radio frequency antenna of the electronic device, a related instruction for testing a current of the electronic device, and the like, and the data obtaining instruction is not limited herein.
The audio prompting module is used for prompting a user in a voice prompting mode after the USB connecting line or the wireless network between the electronic equipment and the external equipment is determined to be disconnected.
The shutdown module is used for controlling the electronic equipment to shut down according to the shutdown instruction.
The kernel layer is a layer between hardware and software. The kernel layer at least comprises a USB driver, a data acquisition module and a data monitoring module.
The USB driver is configured to drive a USB interface of the electronic device to receive an instruction sent by the external device, for example, when the external device is connected to the electronic device through the USB interface, the external device sends a shutdown instruction to the USB interface of the electronic device, and the USB interface of the USB driver drives the USB interface of the electronic device to obtain the shutdown instruction.
The data acquisition module is used for acquiring the USB state value from the storage file. The storage file comprises a plurality of storage positions, and one storage position stores state values of the USB at different moments.
The data monitoring module is configured to monitor whether the USB interface receives an instruction sent by the external device, for example, the data monitoring module may be configured to monitor whether the USB driver receives a shutdown instruction sent by the external device.
The technical solutions involved in the following embodiments can be implemented in an electronic device having the above hardware structure and software architecture. The following takes an electronic device as an example, and the present solution is exemplarily described.
In some embodiments, as shown in fig. 4, in a scenario where the mobile phone is connected to the external device through the USB connection line, after a performance test of the mobile phone by the external device is completed, the external device sends a shutdown instruction to the USB interface of the mobile phone through the USB connection line. For example, after the performance test of the external device on the radio frequency antenna of the mobile phone is completed, the external device sends a shutdown instruction to the USB interface of the mobile phone through the USB connection line. After the USB interface of the mobile phone receives a shutdown instruction sent by the external equipment, the data acquisition module of the mobile phone acquires the shutdown instruction from the USB interface through a serial port data thread, and the data processing module controls the mobile phone to shut down after determining that the USB connecting line between the mobile phone and the external equipment is disconnected according to the acquired USB state.
The USB state is used for representing the USB connection state between the mobile phone and the external equipment. The state value of the USB is used to reflect the USB state. For example, the state value of the USB is 1, which indicates that the mobile phone is connected to the external device through the USB connection line; the state value of the USB is 0, which represents that the USB connecting line between the mobile phone and the external equipment is disconnected.
Next, referring to fig. 5, the electronic device is taken as an example to explain the above process in detail, and fig. 5 is a first flowchart of a shutdown method provided in this embodiment of the present application. As shown in fig. 5, the method may include the steps of:
step 501, the external device sends a shutdown instruction to the USB interface of the mobile phone. Correspondingly, the USB interface of the mobile phone receives a shutdown instruction.
The power-off instruction is used for controlling the mobile phone to be powered off.
Because the mobile phone is connected with the external equipment through the USB connecting wire, data are transmitted between the mobile phone and the external equipment through the USB. In the embodiment of the application, after the external device finishes testing the mobile phone, the external device can send a shutdown instruction to the USB interface of the mobile phone through the USB connection line, and after the mobile phone is shutdown, the tester puts the mobile phone in storage for storage.
Step 502, the data monitoring module monitors that the USB interface receives a shutdown instruction.
Step 503, the data monitoring module stores the state value of the USB into a storage file.
In this embodiment of the application, the data monitoring module periodically monitors the open state of the USB interface (for example, every 100 ms) through the serial port data thread, and when the USB interface of the mobile phone is in the open state, after the data monitoring module monitors that the USB interface receives a shutdown instruction sent by the external device, the data monitoring module reads the shutdown instruction from the USB interface through the serial port data thread. That is, the data acquired by the serial port data thread includes a shutdown instruction, for example, the data acquired by the serial port data thread actmdserver may include the shutdown instruction.
Here, the serial port data thread may be a main thread, and is configured to obtain data from the USB interface and store the data in a storage file. For example, after the data monitoring module monitors that the USB interface receives a shutdown instruction sent by the external device, the data monitoring module periodically reads the state value of the USB from the USB interface through the serial data thread, and stores the state value read to the USB each time in the storage file.
For example, after the data monitoring module monitors that the USB interface receives a shutdown instruction sent by the external device, the data monitoring module monitors the connection state between the external device and the mobile phone every 1 second, and stores the state value of the USB into the storage file.
In step 504, the data monitoring module sends a serial port data thread to the data acquisition module. Correspondingly, the data acquisition module receives the serial port data thread.
In the embodiment of the application, after the data monitoring module reads the shutdown instruction through the serial port data thread, the data monitoring module sends the serial port data thread to the data acquisition module.
It is understood that the serial data thread may include various types of instructions, for example, the serial data thread may include an AP side instruction, an MA instruction or a Modem instruction. Here, after the data obtaining module receives the serial port data thread, the data obtaining module may determine, according to the instruction identifier of the shutdown instruction, that the shutdown instruction in the serial port data thread is the AP-side instruction. The instruction identifier may be used to identify the type to which the instruction belongs.
That is, each type of instruction has a corresponding instruction identifier, for example, the AP-side instruction, the MA instruction, and the Modem instruction have corresponding instruction identifiers, so as to identify the types corresponding to different instructions.
In this embodiment of the application, after the data obtaining module determines that the shutdown instruction in the serial port data thread is the AP side instruction, the AP side instruction may be analyzed by using an AP side instruction analysis logic, so as to obtain the first sub-thread. Wherein the first sub-thread may be a thread that is executed in parallel with the main thread.
It will be appreciated that different types of instructions have corresponding resolution logic, and that AP-side instructions herein also have corresponding AP-side instruction resolution logic.
It should be explained that each thread has a unique identifier to distinguish primary and secondary relationships among the threads. In addition, after a sub-thread is established in the main thread, the main thread and the sub-thread do not influence each other in their respective life cycles, that is, after the life cycle of the main thread is over, the sub-thread can continue to operate, or after the life cycle of the sub-thread is over, the main thread can continue to operate.
In step 505, the data obtaining module obtains the state value of the USB from the storage file.
The storage file comprises a plurality of storage positions, wherein one storage position stores the state values of the USB at different moments.
In the embodiment of the application, the data acquisition module can acquire the state value of the USB from the storage file through the first sub thread. For example, the data obtaining module obtains the state value of the USB through a first sub-thread thdddiagnotusb in the serial data thread atcmderver.
Because the first sub-thread and the main thread are two threads which are executed in parallel, when the data monitoring module reads the shutdown instruction through the main thread, the first sub-thread executes in parallel to acquire the state value of the USB, so that the robustness of codes is improved, and the execution efficiency is also improved.
Taking the example that the data obtaining module obtains the state value of the USB from the storage file through the first sub-thread thdddiagnotusb, in the related art, when the first sub-thread thdddiagnotusb obtains the state value of the USB from the storage file, the first sub-thread thdddiagnotusb obtains the state value of the USB by calling a file opening function, reading a function, and closing the function. Here, the file open function is used to open the storage file, the read function is used to read data stored in the storage file, and the close function is used to close the storage file. For example, the first sub-thread thdddiagnotusb acquires a state value of one USB stored in the storage file at a certain time by sequentially calling an open function, a read function, and a close function, where the first sub-thread thdddiagnotusb needs to continuously and cyclically execute a code "open-read-close" to acquire the state values of the USB stored in the storage file at different times. However, the first sub-thread continuously opens the storage file and then closes the storage file, which not only causes the memory of the mobile phone to be exhausted, but also destroys the robustness of the code.
In the embodiment of the application, when the data obtaining module obtains the state value of the USB by calling the file opening function, reading the function and closing the function through the first sub-thread, the first sub-thread may call the file opening function periodically and then call the reading function to read the state values of the USB stored in the storage file at different times, and then call the closing function to close the storage file. For example, after the first child thread calls the open function to open the storage file, the first child thread may periodically call the read function to read the state value of the USB within the first preset time duration stored in the storage file, and then call the close function to close the storage file. That is, the first child thread may acquire the state value of the USB within the first preset time duration stored in the storage file by executing the code "open while (1) { read } close".
Therefore, the process of the first sub-thread acquiring the state values of the USB stored in the storage file at different moments only calls the file opening function and the file closing function once. After the first sub-thread calls the file opening function to open the storage file, the reading function is called to read the state values of the stored USB at different moments in the storage file, and then the closing function is called to close the storage file. Therefore, the first sub-thread only opens the storage file once, and the problem that in the related art, the memory of the mobile phone is greatly consumed because the storage file is opened once when the state value of the USB is read once is solved, so that the processes of opening the file once and reading the state value of the USB for multiple times are realized.
In addition, since the read function (e.g., read function) is a common interface function, the mechanism is that after each time data stored in a current storage location in a storage file is read, the data stored in a next storage location is sequentially read when the data is read from the storage file next time. Here, the next storage position is a storage position adjacent to and behind the current storage position. For example, the first child thread reads the state value of the USB from the D1 location of the storage file when calling the read function for the first time, and the first child thread reads the state value of the USB from the D2 location of the storage file when calling the read function for the second time. The position D1 is adjacent to the position D2, and the position D2 is the next storage position of the position D1.
However, after the data monitoring module reads the state values of the USB at different times through the serial port data thread, the read state values of the USB are stored in a fixed storage location in the storage file. For example, after the data monitoring module acquires the state values of the USB at different times through the serial port data thread, the acquired state values of the USB are all stored in the storage location indicated by the first location pointer of the storage file. The storage position indicated by the first position pointer stores the state values of the USB at different times. For example, the storage location indicated by the first location pointer stores the USB status values read from the USB interface by the data snooping module at times T1, T2, and T3, respectively.
It should be explained that the storage location indicated by the first location pointer may be any location in the storage file, and the location of the storage location indicated by the first location pointer in the storage file is not limited herein.
Obviously, when the first sub-thread calls the read function multiple times to read the state values of the USB at different times from the storage file, the first sub-thread cannot acquire the state values of the USB at different times, which are stored in the storage location corresponding to the first location pointer of the storage file. Therefore, in the embodiment of the application, after the first sub-thread calls the read function each time to read the state value of the USB once from the storage location corresponding to the first position pointer of the storage file, the first sub-thread calls the read-write position control function once to return the first position pointer to the read-write function, so that the first sub-thread can also read the state value of the USB from the storage location indicated by the first position pointer when the first sub-thread calls the read-write function next time. The read-write position control function is used for controlling the first sub thread to read the state values of the USB at different moments from the same storage position of the storage file each time the read function is called. For example, the read/write position control function may be an lseek interface function.
The lseek function is also referred to as a random access file and is used to locate a file pointer to a corresponding location in a specified file descriptor. For example, after calling the read function each time to read the state value of the USB from the storage location corresponding to the first location pointer of the storage file, the first child thread may call the lseek function to locate the file pointer to the first location pointer of the storage file, so that the first child thread may read the state values of the USB at different times from the same location of the storage file.
In step 506, the data acquisition module sends the state value of the USB to the data processing module. Accordingly, the data processing module receives the state value of the USB.
Step 507, the data processing module judges whether the USB connection line between the mobile phone and the external device is disconnected according to the USB state value.
In the embodiment of the application, the data processing module may obtain a state value of the USB within a first preset duration, so as to determine whether the USB connection line between the mobile phone and the external device is disconnected according to the state value of the USB within the first preset duration.
In a first situation, if the state values of the USB within the first preset time period acquired by the data processing module are all the first preset values (for example, the first preset value is 0), the data processing module determines that the USB connection line between the mobile phone and the external device is in a disconnected state.
It should be explained that the USB connection line between the mobile phone and the external device is in a disconnected state, which means that the USB connection line between the mobile phone and the external device is pulled out, and the mobile phone and the external device are not connected through the USB connection line.
For example, the data processing module may obtain the state value of the USB in real time, and if the state values of the USB obtained by the data processing module within a duration of 3 seconds are all 0, the data processing module determines that the USB connection line between the mobile phone and the external device is in a disconnected state.
The first preset time period is taken as 3 seconds as an example, and of course, the first preset time period may also be 2 seconds, 3.5 seconds, 4 seconds, and the like, which is not limited herein.
In the second situation, if the state value of the USB acquired by the data processing module is a second preset value (for example, the second preset value is 1), the data processing module determines that the USB connection line between the mobile phone and the external device is in a connection state. Namely, the USB connecting line between the mobile phone and the external equipment is not pulled out by the tester. Under the condition, the data processing module continuously reads the state value of the USB so as to judge whether the USB connecting line between the mobile phone and the external equipment is disconnected or not according to the subsequently acquired state value of the USB.
That is to say, when the state value of the USB acquired by the data processing module is 1, the data processing module may determine that the USB connection line between the mobile phone and the external device is in a connection state. The data processing module continuously reads the state value of the USB until the state values of the USB acquired within the first preset time are all 0, and the data processing module determines that the USB connecting line between the mobile phone and the external equipment is in a disconnected state.
It should be explained that, when the data obtaining module obtains the state value of the USB from the storage file, there may be a case where the obtained USB state is unstable due to a jump of the state value of the USB between 0 and 1, that is, there may be a jump of the state value of the USB obtained by the data obtaining module between 0 and 1. In this case, in order to avoid the data processing module from misjudging the USB connection state between the mobile phone and the external device, in this embodiment of the application, after the data processing module acquires the USB state value sent by the data acquisition module, the data processing module may judge that the USB connection between the mobile phone and the external device is in the disconnected state according to the USB state value within the first preset time period.
Step 508, the shutdown module controls the mobile phone to shutdown.
In some embodiments, after the data processing module determines that the USB connection line between the mobile phone and the external device is in the disconnected state, the shutdown module may control the mobile phone to shutdown according to a shutdown instruction received by the mobile phone. For example, the shutdown module may call a shutdown instruction through a shutdown interface function (e.g., call the shutdown instruction through a shutdown interface function shutdown) to control the mobile phone to be powered off.
In other embodiments, after the data processing module determines that the USB connection line between the mobile phone and the external device is in the disconnected state, the mobile phone may prompt the user in a manner of sending a prompt message. For example, the mobile phone may send a prompt sound through the audio prompt module to prompt a tester that the USB connection line between the mobile phone and the external device is in a disconnected state, so that the tester manually controls the mobile phone to shut down. For example, the mobile phone may send a voice prompt in a voice prompt manner to "the mobile phone is disconnected", or the mobile phone may send a sound such as a buzzer to prompt the tester, so that the tester manually controls the mobile phone to shut down and then puts the mobile phone in storage, thereby ensuring that the battery power of the mobile phone is sufficient during the next test.
In summary, after the USB interface of the mobile phone receives the shutdown instruction sent by the external device, the data processing module determines that the state value of the USB acquired within the first preset time period is 0, and then determines that the USB connection line between the mobile phone and the external device is in the disconnected state, and then the shutdown module calls the shutdown instruction through the shutdown interface function to control the mobile phone to shutdown, or the shutdown module notifies a tester to manually control the mobile phone to shutdown. Therefore, the mobile phone is controlled to be powered off after the USB connecting line between the mobile phone and the external equipment is disconnected, and the problem that the mobile phone can be restarted immediately when the mobile phone is powered off but the USB connection is not disconnected due to the USB connection between the mobile phone and the external equipment is solved.
In the embodiment of the application, when the mobile phone is connected with the external device through the USB or the wireless network, after the external device sends the shutdown instruction to the mobile phone, if the USB or the wireless network connection between the mobile phone and the external device is not disconnected and the mobile phone is not shutdown, the external device may also send other instructions to the mobile phone.
For example, after the external device sends a shutdown instruction to the USB interface of the mobile phone, when the USB connection line between the mobile phone and the external device is not disconnected and the mobile phone is not shutdown, the external device may also send a data acquisition instruction to the USB interface of the mobile phone through the USB connection line. The data acquisition instruction is used for acquiring certain information in the mobile phone or controlling the mobile phone to execute an operation corresponding to the instruction. For example, the data acquisition instruction may be an instruction for acquiring information of a single board of a mobile phone, an instruction for calibrating a radio frequency antenna of the mobile phone, an instruction for performing a related test on a current of the mobile phone, or the like. After the external device sends a data acquisition instruction to the USB interface of the mobile phone, the mobile phone may determine whether the USB connection line between the mobile phone and the external device is disconnected according to whether the data acquisition instruction sent by the external device can be received.
The following takes the connection between the mobile phone and the external device through the USB connection line as an example, and the above process is explained in detail with reference to fig. 6, where fig. 6 is a schematic flow diagram of a shutdown method provided in this embodiment of the present application. As shown in fig. 6, the method may include the steps of:
step 601, the external device sends a shutdown instruction to the USB interface of the mobile phone. Correspondingly, the USB interface of the mobile phone receives a shutdown instruction.
The power-off instruction is used for controlling the mobile phone to be powered off.
Step 602, the external device sends a data acquisition instruction to the USB interface of the mobile phone. Correspondingly, the USB interface of the mobile phone receives the data acquisition instruction.
In this embodiment of the application, the execution processes of step 601 and step 602 are not limited, the external device may send a shutdown instruction to the USB interface of the mobile phone first, and then send a data acquisition instruction, that is, sequentially execute step 601 and step 602, the external device may also send a data acquisition instruction to the USB interface of the mobile phone first, and then send a shutdown instruction, that is, execute step 602 first and then execute step 601, and the external device may also send a shutdown instruction and a data acquisition instruction to the USB interface of the mobile phone simultaneously, that is, execute step 601 and step 602 simultaneously, where this is not limited.
Step 603, the data monitoring module monitors that the USB interface receives a shutdown instruction.
In step 604, the data monitoring module monitors whether the USB interface receives the data acquisition instruction within a second preset time period.
In the embodiment of the application, after the external device sends the data acquisition instruction to the USB interface of the mobile phone, the mobile phone may determine whether the USB connection line between the mobile phone and the external device is disconnected according to whether the USB interface receives the data acquisition instruction sent by the external device.
In a possible situation, if the data monitoring module of the mobile phone does not monitor that the USB interface receives the data acquisition instruction sent by the external device within a second preset time period during which the external device sends the data acquisition instruction, the mobile phone determines that the USB connection line between the mobile phone and the external device is disconnected.
In another possible situation, if the data monitoring module of the mobile phone monitors that the USB interface receives the data acquisition instruction sent by the external device within a second preset time period during which the external device sends the data acquisition instruction, the mobile phone determines that the USB connection line between the mobile phone and the external device is in a connection state.
In the embodiment of the application, when the data monitoring module reads the shutdown instruction from the USB interface through the serial port data thread, the mobile phone may obtain the data acquisition instruction sent by the external device through other threads. For example, the mobile phone obtains a data obtaining instruction sent by the external device through the second sub thread. The second sub-thread may be a thread executed in parallel with the serial port data thread. That is to say, the mobile phone can acquire various instructions sent by the external device in a multi-thread manner, thereby ensuring the stability of the external device in testing the mobile phone.
It should be noted that the external device sends the shutdown instruction to the mobile phone and sends the data acquisition instruction to the mobile phone in a multi-thread manner, for example, the external device may send the shutdown instruction and the instruction for acquiring the information of the single board of the mobile phone to the mobile phone through different threads. When one thread can not normally run, the running of other threads is not influenced, so that the stability of the mobile phone in the test process is ensured, and the data transmission efficiency is improved.
Step 605, the power-off module controls the mobile phone to power off.
In the embodiment of the application, after the mobile phone determines that the USB connection line between the mobile phone and the external device is disconnected, the shutdown module of the mobile phone calls the shutdown instruction to control the mobile phone to shutdown, or the mobile phone may prompt the user by sending a prompt message, so that the tester manually controls the mobile phone to shutdown. The second preset time period is not limited, and the second preset time period may be 2 seconds, 3 seconds, and the like.
Step 606, the data monitoring module sends a data acquisition instruction to the data acquisition module. Correspondingly, the data acquisition module receives the data acquisition instruction.
In step 607, the data obtaining module obtains information corresponding to the data obtaining instruction.
In step 608, the data obtaining module sends the information corresponding to the data obtaining instruction to the external device through the USB interface. Correspondingly, the external equipment receives information corresponding to the data acquisition instruction.
For example, it is assumed that the data obtaining instruction is an instruction for obtaining board information of a mobile phone, and after the data obtaining module obtains the data obtaining instruction, the data obtaining module may obtain the board information of the mobile phone according to the data obtaining instruction. And then, the data acquisition module sends the single-board information of the mobile phone to the external equipment through the USB interface. Correspondingly, the external equipment receives the single board information of the mobile phone.
In some embodiments, it is assumed that the data acquisition instruction acquired by the data acquisition module is an instruction for testing some performances of the mobile phone, and the mobile phone may test the mobile phone according to the data acquisition instruction. For example, assuming that the data acquisition instruction acquired by the data acquisition module is an instruction for testing a radio frequency antenna of a mobile phone, the mobile phone may test a video antenna of the mobile phone according to the instruction.
It should be noted that, in the above-mentioned fig. 6, the connection between the mobile phone and the external device is taken as an example, and the method in the above-mentioned fig. 6 is also applicable to the connection between the mobile phone and the external device through other manners, for example, the connection between the mobile phone and the external device is through a wireless network, which is not limited herein.
To sum up, after the mobile phone receives the shutdown instruction sent by the external device, the external device sends a data acquisition instruction to the mobile phone, and if the mobile phone does not receive the data acquisition instruction within the second preset time period, it is determined that the connection between the mobile phone and the external device is disconnected, and then the mobile phone is controlled to be shut down. Therefore, the mobile phone is controlled to be powered off after the connection between the mobile phone and the external equipment is disconnected, and the problem that the electric quantity of the mobile phone is exhausted due to storage and storage of the mobile phone without being powered off is solved.
In other embodiments, as shown in fig. 7, in a scenario where the mobile phone is connected to the external device through the wireless network, after a performance test of the mobile phone by the external device is completed, the external device sends a shutdown instruction to the mobile phone through the wireless network, and after determining that the mobile phone is shutdown, the tester stores the mobile phone in a storage.
For example, assume that the mobile phone and the external device are connected through a Wireless-Fidelity (WiFi), that is, the external device performs data transmission with the mobile phone through WiFi. For example, after the external device finishes the performance test of the radio frequency antenna of the mobile phone, the external device sends a shutdown instruction to the mobile phone through WiFi. After the mobile phone obtains the shutdown instruction, the mobile phone continuously monitors the WiFi signal, and the mobile phone determines whether the WiFi connection between the mobile phone and the external equipment is disconnected according to whether the WiFi signal is monitored. If the mobile phone does not monitor the WiFi signal, the WiFi connection between the mobile phone and the external equipment is determined to be disconnected, and the mobile phone is controlled to be powered off.
Next, taking a wireless network connection between the mobile phone and the external device as an example, the above process is explained in detail with reference to fig. 8, and fig. 8 is a third flowchart of the shutdown method provided in this embodiment of the present application. As shown in fig. 8, the method may include the steps of:
step 801, the external device sends a shutdown instruction to a WiFi communication interface of the mobile phone through WiFi.
Because the mobile phone is connected with the external equipment through WiFi, data are transmitted between the mobile phone and the external equipment through WiFi. In the embodiment of the application, when the external device controls the mobile phone to be powered off, the external device may send a power-off instruction to the mobile phone through the WiFi.
In step 802, the data monitoring module monitors that the WiFi communication interface obtains a shutdown instruction.
In step 803, the data monitoring module sends a data monitoring instruction to the data monitoring module. Correspondingly, the data monitoring module receives the data monitoring instruction.
The data monitoring instruction is used for indicating the data monitoring module to monitor WiFi signals in the mobile phone.
And step 804, the data monitoring module judges whether the WiFi connection between the mobile phone and the external equipment is disconnected according to whether the WiFi signals can be monitored.
It will be appreciated that the WiFi signal of the handset has its corresponding signal identification used to uniquely tag the WiFi signal. The data monitoring module can monitor various signals, and the data monitoring module can identify the WiFi signals from the various signals according to the signal identifications corresponding to the WiFi signals.
In the embodiment of the application, the data monitoring module can monitor the WiFi signal in the mobile phone in real time, and if the data monitoring module can monitor the WiFi signal in the mobile phone, it is determined that the WiFi connection between the mobile phone and the external device is not disconnected. And if the data monitoring module does not monitor the WiFi signal in the mobile phone, determining that the WiFi connection between the mobile phone and the external equipment is disconnected.
In order to avoid unstable WiFi signals in the mobile phone, the data monitoring module misjudges the WiFi connection state between the mobile phone and the external equipment. In the embodiment of the application, under the condition that the data monitoring module determines that the WiFi signal in the mobile phone is monitored within the third preset time period, the data monitoring module determines that the WiFi connection between the mobile phone and the external device is not disconnected. And the data monitoring module does not monitor the WiFi signal in the mobile phone within a third preset time length, and the disconnection of the WiFi connection between the mobile phone and the external equipment is determined. For example, if the data monitoring module does not monitor a WiFi signal in the mobile phone within 3 seconds, it is determined that the WiFi connection between the mobile phone and the external device is disconnected.
The third preset time period is not limited, and the third preset time period may be 2 seconds, 3 seconds, and the like.
In the embodiment of the application, when the data monitoring module reads the shutdown instruction from the WiFi communication interface through the serial port data thread, the data monitoring module may monitor the WiFi signal in the mobile phone through other threads. For example, the data monitoring module monitors a WiFi signal in the mobile phone through the third sub thread. The third sub-thread may be a thread executed in parallel with the serial port data thread. That is to say, the mobile phone can acquire data in a multi-thread manner, so that the efficiency and stability of data acquisition are improved.
In step 804, if the data monitoring module determines that the WiFi connection between the mobile phone and the external device is in a disconnected state, step 805 is executed, otherwise, the data monitoring module monitors a WiFi signal to determine whether the WiFi connection between the mobile phone and the external device is disconnected.
Step 805, the data monitoring module sends a shutdown instruction to the shutdown module. Correspondingly, the shutdown module receives a shutdown instruction.
In step 806, the shutdown module controls the mobile phone to shutdown according to the shutdown instruction.
In some embodiments, after the data monitoring module determines that the WiFi connection between the mobile phone and the external device is in a disconnected state, the data monitoring module sends a shutdown instruction to the shutdown module, so that the shutdown module controls the mobile phone to shutdown according to the shutdown instruction.
In other embodiments, after the data monitoring module determines that the WiFi connection between the mobile phone and the external device is in a disconnected state, the mobile phone may prompt a tester that the WiFi connection between the mobile phone and the external device is in a disconnected state through the audio prompting module, so that the tester manually controls the mobile phone to turn off. For example, the mobile phone may send a voice prompt in a voice prompt manner to "the mobile phone is disconnected", or the mobile phone may send a sound such as a buzzer to prompt the tester. Therefore, after the external equipment finishes testing certain performances of the mobile phone, the mobile phone is controlled to be powered off in a code and manual combination mode, and the production line efficiency is improved.
In the embodiment of the application, the mobile phone is connected with the external device through the WiFi, after the external device sends the shutdown instruction to the mobile phone, when the data monitoring module does not monitor the WiFi signal, it is determined that the WiFi connection between the mobile phone and the external device is disconnected, and then the shutdown module or a tester controls the mobile phone to shutdown. Therefore, data transmission is carried out between the mobile phone and the external equipment through WiFi connection, and the problem that the mobile phone can be restarted immediately when the mobile phone is powered off but the USB connection is not disconnected due to USB connection between the mobile phone and the external equipment is solved fundamentally. The mobile phone executes the shutdown operation after determining that the WiFi connection between the mobile phone and the external equipment is disconnected, so that the mobile phone is successfully shut down and then put in storage after the external equipment finishes testing the mobile phone, the labor is saved, and the shutdown efficiency of the mobile phone is improved.
The above description is made by taking WiFi connection as an example of the wireless network connection between the mobile phone and the external device. The shutdown method provided by the embodiment of the application can also be applied to other wireless network connection scenes. For example, the mobile phone and the external device may communicate with each other via bluetooth or ZigBee, which is not limited herein.
In summary, in the scheme provided in the embodiment of the present application, when the mobile phone is connected to the external device through the USB, and the data processing module determines that the state values of the USB acquired within the first preset time period are all the first preset values, it is determined that the USB connection line between the mobile phone and the external device is in the disconnected state, so that the problem of misjudgment on the connection state of the USB when the state value of the USB acquired by the data processing module jumps between the first preset value and the second preset value is avoided. Subsequently, the mobile phone calls a shutdown instruction or informs a tester to control the shutdown of the mobile phone, so that the mobile phone is controlled to be shut down and put in storage after the USB connection between the external equipment and the mobile phone is disconnected.
In addition, after the data processing module calls the file opening function to open the storage file through the first sub-thread, the reading function is called to read the stored state values of the USB at different moments from the storage file, and then the closing function is called to close the storage file. Therefore, the first sub-thread only calls the file opening function once to open the storage file, the problem that in the related technology, the memory of the mobile phone is greatly consumed because the storage file is opened once when the state value of the USB is read once is solved, and therefore the purpose that the file is opened once and the state value of the USB is read for many times is achieved.
In addition, when the mobile phone is connected with the external equipment through the USB or the wireless network, after the mobile phone receives a shutdown instruction sent by the external equipment, if the mobile phone does not receive the data acquisition instruction within a second preset time period, the USB connection or the wireless network connection between the external equipment and the mobile phone is determined to be in a disconnected state, then the mobile phone calls the shutdown instruction or informs a tester to control the mobile phone to shutdown, so that the mobile phone is controlled to be shut down and put in storage after the USB connection or the wireless network connection between the external equipment and the mobile phone is disconnected, and the problem that the battery power is exhausted due to the fact that the mobile phone is not shut down and put in storage is solved.
In addition, when data are transmitted between the mobile phone and the external equipment through wireless network connection, the mobile phone does not monitor a wireless network signal within a third preset time period, the disconnection of the wireless network connection between the mobile phone and the external equipment is determined, then the mobile phone is controlled to be shut down and put in storage, the mobile phone is successfully shut down and put in storage after the external equipment finishes testing the mobile phone, manpower is saved, and the efficiency of shutting down the mobile phone is improved.
As shown in fig. 9, an embodiment of the present application discloses an electronic device, which may be the above-mentioned mobile phone. The electronic device may specifically include: one or more processors 901; a memory 902; one or more application programs (not shown); and one or more computer programs 903, which may be connected by one or more communication buses 904. Wherein the one or more computer programs 903 are stored in the memory 902 and configured to be executed by the one or more processors 901, the one or more computer programs 903 comprising instructions that can be used to perform the relevant steps in the above embodiments.
It is to be understood that the electronic devices and the like described above include hardware structures and/or software modules for performing the respective functions in order to realize the functions described above. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware 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 embodiments of the present invention.
In the embodiment of the present application, the electronic device and the like may be divided into functional modules according to the method example, for example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, the division of the modules in the embodiment of the present invention is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
In a case where the functional modules are divided according to the respective functions, a possible composition diagram of the electronic device related to the above embodiment may include: display unit, transmission unit and processing unit etc. It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
Embodiments of the present application further provide an electronic device, which includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, the one or more memories being configured to store computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the associated method steps to implement the shutdown method in the above-described embodiments.
Embodiments of the present application further provide a computer-readable storage medium, where computer instructions are stored, and when the computer instructions are run on an electronic device, the electronic device is caused to execute the above related method steps to implement the shutdown method in the above embodiments.
Embodiments of the present application further provide a computer program product, where the computer program product includes computer instructions, and when the computer instructions are run on an electronic device, the electronic device is caused to execute the above related method steps to implement the shutdown method in the above embodiments.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the device executes the shutdown method executed by the electronic equipment in the above method embodiments.
In addition, the electronic device, the computer-readable storage medium, the computer program product, or the apparatus provided in this embodiment are all configured to execute the corresponding method provided above, so that the beneficial effects achieved by the electronic device, the computer-readable storage medium, the computer program product, or the apparatus can refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or make a contribution to the prior art, or all or part of the technical solutions may be implemented in the form of a software product stored in a storage medium and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: flash memory, removable hard drive, read only memory, random access memory, magnetic or optical disk, and the like.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A shutdown method of an electronic device, wherein the electronic device is connected to an external device for testing the electronic device through a Universal Serial Bus (USB) interface, the method comprising:
the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down;
responding to the shutdown instruction, the electronic equipment acquires a state value of the USB, wherein the state value is used for reflecting the connection state of the USB;
under the condition that the electronic equipment determines that the state values of the USB acquired within a first preset time are all first preset values, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is disconnected;
the electronic equipment controls the electronic equipment to be powered off.
2. The method of claim 1, wherein the electronic device receives a shutdown instruction, comprising:
the electronic equipment receives the shutdown instruction through a main thread;
the electronic equipment acquires the state value of the USB, and the method comprises the following steps:
the electronic equipment acquires the state value of the USB through a first sub thread, and the first sub thread and the main thread are executed in parallel.
3. The method according to claim 1 or 2, wherein the obtaining the state value of the USB comprises:
calling a file opening function, and opening a storage file, wherein the storage file stores the state values of the USB at different moments;
calling a reading function for multiple times periodically, and reading the state value of the USB from the storage file; calling the reading function to read one state value of the USB from the storage file each time;
the method further comprises the following steps: and calling a closing function to close the storage file.
4. The method according to claim 3, wherein said periodically calling said read function multiple times to obtain the state value of said USB from said storage file comprises:
calling a read-write position control function, and fixing a read pointer corresponding to the read function as a first position pointer;
calling the reading function for multiple times based on the first position pointer, and reading one state value of the USB from the storage position indicated by the first position pointer in the storage file each time; and the storage position indicated by the first position pointer stores the state values of the USB at different times.
5. The method according to claim 1 or 2, wherein after the electronic device determines that the USB connection between the electronic device and the external device has been disconnected, the method further comprises:
the electronic equipment sends out prompt information; the prompt information is used for prompting a user that the USB connection between the electronic equipment and the external equipment is disconnected;
and controlling the electronic equipment to be powered off in response to the power-off operation of the user.
6. The method according to claim 1 or 2, characterized in that the method further comprises:
and under the condition that the state value of the USB acquired by the electronic equipment is a second preset value, the electronic equipment continuously acquires the state value of the USB.
7. A shutdown method of an electronic device, wherein the electronic device is connected to an external device for testing the electronic device through a Universal Serial Bus (USB) interface, the method comprising:
the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down;
after the electronic equipment receives the shutdown instruction, if the electronic equipment does not receive a data acquisition instruction within a second preset time length, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is disconnected;
the electronic equipment controls the electronic equipment to be powered off.
8. The method of claim 7, further comprising:
after the electronic equipment receives the shutdown instruction, if the electronic equipment receives the data acquisition instruction sent by the external equipment within the second preset time, the electronic equipment determines that the USB connection between the electronic equipment and the external equipment is not disconnected.
9. The method of claim 7 or 8, wherein the electronic device receiving the shutdown instruction comprises:
the electronic equipment receives the shutdown instruction through a main thread;
the step of receiving, by the electronic device, the data acquisition instruction sent by the external device within the second preset time period includes:
and the electronic equipment receives the data acquisition instruction sent by the external equipment through a second sub-thread, and the second sub-thread and the main thread are executed in parallel.
10. A shutdown method of an electronic device is characterized in that the electronic device is connected with an external device for testing the electronic device through a wireless network, and the method comprises the following steps:
the electronic equipment receives a shutdown instruction, wherein the shutdown instruction is used for indicating the electronic equipment to shut down;
responding to the shutdown instruction, and acquiring a wireless network signal by the electronic equipment;
under the condition that the electronic equipment determines that the wireless network signal is not monitored within a third preset time period, the electronic equipment determines that the wireless network connection between the electronic equipment and the external equipment is disconnected;
the electronic equipment controls the electronic equipment to be powered off.
11. The method of claim 10, wherein the electronic device receives a shutdown instruction, comprising:
the electronic equipment receives the shutdown instruction through a main thread;
the electronic equipment acquires wireless network signals, and the method comprises the following steps:
the electronic equipment acquires the wireless network signal through a third sub-thread, and the third sub-thread and the main thread are executed in parallel.
12. The method according to claim 10 or 11, characterized in that the method further comprises:
and under the condition that the electronic equipment determines that the wireless network signal is monitored within the third preset time, the electronic equipment continues to monitor the wireless network signal.
13. The method according to claim 10 or 11, wherein the electronic device controls the electronic device to power off, comprising:
and the electronic equipment controls the electronic equipment to be powered off according to the power-off instruction.
14. The method according to claim 10 or 11, wherein the electronic device controls the electronic device to power off, further comprising:
the electronic equipment sends out prompt information; the prompt information is used for prompting a user that the wireless network connection between the electronic equipment and the external equipment is disconnected;
and controlling the electronic equipment to be powered off in response to the power-off operation of the user.
15. An electronic device, comprising:
one or more processors;
a memory;
wherein the memory has stored therein one or more computer programs, the one or more computer programs comprising instructions, which when executed by the electronic device, cause the electronic device to perform the power-off method of any of claims 1-6, or perform the power-off method of any of claims 7-9, or perform the power-off method of any of claims 10-14.
16. A computer readable storage medium having instructions stored therein, which when run on an electronic device, cause the electronic device to perform a shutdown method according to any one of claims 1-6, or to perform a shutdown method according to any one of claims 7-9, or to perform a shutdown method according to any one of claims 10-14.
CN202210385581.XA 2022-04-13 2022-04-13 Electronic equipment and shutdown method thereof Active CN114489825B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210385581.XA CN114489825B (en) 2022-04-13 2022-04-13 Electronic equipment and shutdown method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210385581.XA CN114489825B (en) 2022-04-13 2022-04-13 Electronic equipment and shutdown method thereof

Publications (2)

Publication Number Publication Date
CN114489825A true CN114489825A (en) 2022-05-13
CN114489825B CN114489825B (en) 2022-09-27

Family

ID=81488166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210385581.XA Active CN114489825B (en) 2022-04-13 2022-04-13 Electronic equipment and shutdown method thereof

Country Status (1)

Country Link
CN (1) CN114489825B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115834751A (en) * 2022-11-09 2023-03-21 惠州市德赛西威智能交通技术研究院有限公司 Detection method, detection system and storage medium for mobile phone interconnection equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140258661A1 (en) * 2013-03-08 2014-09-11 Wistron Corporation Backup method and computer system thereof
CN104111719A (en) * 2014-06-25 2014-10-22 小米科技有限责任公司 Method and device for controlling battery to be disconnected from main equipment
CN108304738A (en) * 2018-01-04 2018-07-20 捷开通讯(深圳)有限公司 A kind of method, mobile terminal and the storage device of management USB debugging modes
CN108337739A (en) * 2018-01-30 2018-07-27 上海商米科技有限公司 Establish method and device, the data processing method of wireless debugging connection
CN108491285A (en) * 2018-02-23 2018-09-04 广东欧珀移动通信有限公司 Data guard method and Related product applied to testing for electrical equipment
US20190150086A1 (en) * 2017-11-13 2019-05-16 Fci Inc. Power saving method and device thereof in internet-of-things

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140258661A1 (en) * 2013-03-08 2014-09-11 Wistron Corporation Backup method and computer system thereof
CN104111719A (en) * 2014-06-25 2014-10-22 小米科技有限责任公司 Method and device for controlling battery to be disconnected from main equipment
US20190150086A1 (en) * 2017-11-13 2019-05-16 Fci Inc. Power saving method and device thereof in internet-of-things
CN108304738A (en) * 2018-01-04 2018-07-20 捷开通讯(深圳)有限公司 A kind of method, mobile terminal and the storage device of management USB debugging modes
CN108337739A (en) * 2018-01-30 2018-07-27 上海商米科技有限公司 Establish method and device, the data processing method of wireless debugging connection
CN108491285A (en) * 2018-02-23 2018-09-04 广东欧珀移动通信有限公司 Data guard method and Related product applied to testing for electrical equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115834751A (en) * 2022-11-09 2023-03-21 惠州市德赛西威智能交通技术研究院有限公司 Detection method, detection system and storage medium for mobile phone interconnection equipment

Also Published As

Publication number Publication date
CN114489825B (en) 2022-09-27

Similar Documents

Publication Publication Date Title
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
CN114996168B (en) Multi-device cooperative testing method, testing device and readable storage medium
CN115622177B (en) Charging method, mobile terminal and storage medium
CN114489825B (en) Electronic equipment and shutdown method thereof
CN114257502B (en) Log reporting method and device
CN113656089B (en) Class verification method and device in application program
CN117130541B (en) Storage space configuration method and related equipment
CN116679900B (en) Audio service processing method, firmware loading method and related devices
CN116049122B (en) Log information transmission control method, electronic device and storage medium
CN113485709B (en) Application optimization method and device and electronic equipment
CN113380240B (en) Voice interaction method and electronic equipment
CN114079642B (en) Mail processing method and electronic equipment
CN115800557A (en) Wireless charging method, electronic device, storage medium, and program
CN113467821A (en) Application program repairing method, device, equipment and readable storage medium
CN117082170B (en) On-off test method, test system and shared host
CN117130765B (en) Configuration method of computing resources and electronic equipment
CN117013660B (en) Charging icon display method and electronic equipment
CN114006969B (en) Window starting method and electronic equipment
CN115513571B (en) Control method of battery temperature and terminal equipment
CN116048544B (en) Processing method of popup advertisement, electronic equipment and readable storage medium
CN116382728B (en) Propagation name display method and terminal equipment
CN117154900B (en) Charging control method and electronic equipment
CN116775345B (en) Data transmission method and electronic equipment
CN117687814A (en) Exception handling method, system and storage medium
CN117729561A (en) System upgrading method, terminal and storage medium

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