Method and device for restarting mobile terminal, electronic equipment, system and storage medium
By adding a system daemon on the mobile terminal, monitoring and automatically handling debug bridge connection exceptions, the cost and efficiency of manual restart in mobile terminal automation tests are solved, and the automated exception handling and restart process is realized.
Patent Information
- Application Number
- CN202311246381.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-25
- Publication Date
- 2025-03-28
AI Technical Summary
In the mobile terminal automation test scenario, the debug bridge connection between the mobile terminal and the host terminal is abnormal, resulting in disconnection of communication and requires manual restart of the mobile terminal, which is costly and inefficient.
The system daemon is added to the mobile terminal to monitor the debug bridge connection status between the mobile terminal and the host terminal, obtain the system administrator's permissions when abnormal, switch the user to the system user, and execute the restart command to automatically restart the mobile terminal.
It realizes automatic discovery of exceptions and automatically restarts the mobile terminal, reducing labor costs, improving exception handling efficiency, and providing an unattended exception solution.
Smart Images

Figure CN119718893A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of testing technology, and in particular to a method, device, electronic device, system and storage medium for restarting a mobile terminal. Background Art
[0002] In the mobile terminal automation test scenario, a debug bridge connection will be established between the mobile terminal and the host terminal, and the host terminal will test or debug the mobile terminal through the debug bridge connection. Due to the customization of the mobile terminal system, process modification and other reasons, during the testing or debugging process, the debug bridge connection established between the mobile terminal and the host terminal will be abnormal, resulting in the disconnection of communication between the two. Once the communication is disconnected, the host terminal will lose control of the mobile terminal. In this case, only manual intervention can be made to manually operate the mobile terminal (such as long pressing the power button of the mobile terminal) to restart the mobile terminal, so as to reconnect the mobile terminal to the host terminal.
[0003] In the process of implementing the present invention, the inventors found that manually restarting the mobile terminal to restore the debug bridge connection between the mobile terminal and the host terminal requires human monitoring and operation, which has high labor costs and low exception handling efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, electronic device, system and storage medium for restarting a mobile terminal, which can reduce labor costs and improve exception handling efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a method for restarting a mobile terminal, comprising:
[0006] Using the system daemon process of the mobile terminal to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal;
[0007] When the connection state is abnormal, obtaining the system administrator authority of the mobile terminal;
[0008] The current user of the mobile terminal is switched to a system user using the system administrator authority, and a restart instruction is executed using the identity of the system user to restart the mobile terminal.
[0009] In a second aspect, an embodiment of the present invention provides a device for restarting a mobile terminal, including:
[0010] A monitoring module, used for monitoring the connection status of the debugging bridge connection between the mobile terminal and the host terminal by using the system daemon process of the mobile terminal;
[0011] An acquisition module, used for acquiring the system administrator authority of the mobile terminal when the connection state is abnormal;
[0012] The restart module is used to switch the current user of the mobile terminal to a system user by using the system administrator authority, and execute a restart instruction by using the identity of the system user to restart the mobile terminal.
[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for restarting a mobile terminal as described in any embodiment of the present invention is implemented.
[0014] In a fourth aspect, an embodiment of the present invention provides a system for restarting a mobile terminal, including a host terminal and an electronic device for executing a method for restarting a mobile terminal as described in any embodiment of the present invention.
[0015] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for restarting a mobile terminal as described in any embodiment of the present invention.
[0016] The solution of the embodiment of the present invention can use the system daemon process of the mobile terminal to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal; when the connection status is abnormal, obtain the system administrator authority of the mobile terminal; use the system administrator authority to switch the current user of the mobile terminal to the system user, and use the identity of the system user to execute a restart instruction to restart the mobile terminal. The embodiment of the present invention adds a system daemon process to the mobile terminal, and uses the system daemon process to monitor and solve the abnormality, that is, when it is detected that the debug bridge connection between the mobile terminal and the host terminal is abnormal, the system administrator authority of the mobile terminal will be obtained. Having the system administrator authority means having the user switching authority, so the system administrator authority can be used to switch the current user of the mobile terminal to the system user. The system user has the operation authority to restart the mobile terminal, so the system user can be used to execute the restart instruction to automatically restart the mobile terminal. The whole process realizes automatic discovery of abnormalities and restarts the mobile terminal to solve the abnormalities, providing an unattended abnormality solution, without the need for manual intervention, saving labor costs, and improving the efficiency of abnormality handling. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 is a flowchart of a method for restarting a mobile terminal provided by an embodiment of the present invention;
[0019] Figure 2 This is an example diagram of a mobile terminal automated testing scenario provided by an embodiment of the present invention;
[0020] Figure 3 is a structural diagram of a mobile terminal provided by an embodiment of the present invention;
[0021] Figure 4 is another flowchart of a method for restarting a mobile terminal provided by an embodiment of the present invention;
[0022] Figure 5 is a structural diagram of a device for restarting a mobile terminal provided by an embodiment of the present invention;
[0023] Figure 6 is a structural diagram of a system for restarting a mobile terminal provided by an embodiment of the present invention;
[0024] Figure 7 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Figure 1It is a flow chart of a method for restarting a mobile terminal provided by an embodiment of the present invention. The method for restarting a mobile terminal provided by an embodiment of the present invention can be used to automatically restart a mobile terminal when performing automated testing of a mobile terminal. The method for restarting a mobile terminal can be executed by a device for restarting a mobile terminal provided by an embodiment of the present invention, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated in an electronic device, and the electronic device can be, for example, a mobile terminal, and the mobile terminal can be, for example, a mobile phone, a tablet computer, etc. An operating system is installed in the mobile terminal, and the installed operating system is, for example, an Android system.
[0028] Before introducing the method for restarting a mobile terminal according to an embodiment of the present invention, the following is an introduction to the automatic testing of the mobile terminal. Figure 2 As shown, Figure 2 The figure shows an example of a mobile terminal automation test scenario, which includes a mobile terminal and a host terminal. The mobile terminal can be, for example, a mobile phone, and the host terminal can be, for example, a personal computer (PC). Taking the Android system (in actual applications, other intelligent operating systems can also be used) as an example, the mobile terminal and the host terminal can establish an Android Debug Bridge (ADB) connection, thereby providing ADB services through the ADB connection. The ADB service is part of the Android Development Kit (SDK), which provides a set of command line tools and services for the host terminal to communicate with the Android device (i.e., the mobile terminal), install applications, debug, and transmit data.
[0029] ADB adopts the client-server model, which includes three parts, such as Figure 2 As shown in the figure, it includes the ADB client and ADB server running on the mobile terminal, as well as the ADB daemon running on the mobile terminal. The ADB client can be called through ADB commands, and the ADB client can send commands to the ADB server; the ADB server is a process running in the background of the host, which is used to manage the communication between the ADB client and the ADB daemon running on the mobile terminal. The function of the ADB daemon is to connect to the ADB server, process the ADB commands from the ADB server, and provide some services for the ADB client running on the host.
[0030] The method for establishing an ADB connection is as follows: the mobile terminal can be connected to the host terminal through the Universal Serial Bus (USB), and then respond to the debug mode (located under the developer options of the mobile terminal) startup command to start the debug mode. After the debug mode is started, the ADB daemon process of the mobile terminal will be started, and the ADB server can establish an ADB connection with the mobile terminal.
[0031] The working principle of ADB is as follows: When the ADB client is started, the ADB client will first check whether the ADB server is started. If not, the ADB server will be started first. After the ADB server is started, it will bind to port 5037 on the host and listen for commands issued by the ADB client. The ADB server will then establish a connection with the running mobile terminal. After that, the ADB server will manage the established connection and process ADB commands from the ADB client. Common ADB commands include querying devices, installing or uninstalling applications, transferring files, printing logs, taking screenshots, and recording screens.
[0032] The reason for the disconnection of ADB connection is generally that the ADB daemon process running on the mobile terminal cannot work normally or is accidentally killed. Restarting the mobile terminal can revive or restore the ADB daemon process to normal, thereby restoring the ADB connection. Currently, restarting the mobile terminal is generally achieved through manual operation, which has high labor costs and low exception handling efficiency.
[0033] Continue reading Figure 1 This embodiment will be specifically described from the following steps.
[0034] Step 101: Use the system daemon process of the mobile terminal to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal.
[0035] In this embodiment, in order to promptly detect and handle abnormalities in the debug bridge connection, a daemon process, namely, a system daemon process, may be added to the mobile terminal, for example Figure 3 As shown, the mobile terminal of this embodiment may include an original ADB daemon and a newly added system daemon. The original ADB daemon may be used to establish and maintain ADB services, and the newly added system daemon may be used to identify and process debug bridge connection anomalies.
[0036] The newly added system daemon is a special process that runs in the background on the mobile terminal. It is usually started when the operating system starts and continues to run while the operating system is running. It is independent of the user session and runs in the background unattended without the need to interact with the user.
[0037] After the mobile terminal and the host terminal establish a debugging bridge connection, the mobile terminal can use the system daemon to monitor the connection status of the debugging bridge connection between the mobile terminal and the host terminal, and the connection status includes normal or abnormal. The system daemon can use itself to monitor the connection status of the debugging bridge connection between the mobile terminal and the host terminal to obtain the connection status; or the system daemon can also obtain the connection status of the debugging bridge connection between the mobile terminal and the host terminal monitored by other devices from other devices.
[0038] Step 102: when the connection status is abnormal, obtain the system administrator authority of the mobile terminal.
[0039] System administrator privileges, also known as root privileges, are the highest level of administrator privileges in an operating system. When a device has system administrator privileges, it has full control and access to the entire operating system and can perform system-wide operations, including modifying system files, installing or uninstalling system applications, changing system settings, accessing restricted resources, etc. After obtaining system administrator privileges, many advanced tasks can be performed, such as deleting system applications, changing or disabling system services, modifying system files or configurations, using privileged commands, installing custom storage, creating system users, switching users, etc. With system administrator privileges, you can bypass the limitations of general user privileges and have deeper control and customization of the device as a system administrator.
[0040] Since the mobile terminal is currently processing the debugging mode, you can directly use the ADB command line tool (for example: adb root) to obtain temporary system administrator privileges. Alternatively, you can also use a third-party root privilege management tool to obtain system administrator privileges. Some third-party applications such as SuperSU and Magisk provide one-click root privilege functions. You can pre-download these third-party applications and then use them to obtain temporary system administrator privileges. Alternatively, you can also use a flashing tool to obtain system administrator privileges. Some Android device manufacturers provide official flashing tools, such as ADB / Fastboot tools, Odin, Flash Tool, etc. These tools can be used to flash specific firmware or write root privileges.
[0041] Step 103: Use the system administrator's authority to switch the current user of the mobile terminal to a system user, and use the identity of the system user to execute a restart instruction to restart the mobile terminal.
[0042] The current user of the mobile terminal defaults to an ordinary user or a general user. An ordinary user or a general user can usually only access and operate his own files and limited system resources. A system user is also called a shell user or a super user. A system user usually has higher permissions and privileges and can perform system-level operations. A system administrator has the right to create, delete and manage system users, while an ordinary user or a general user is usually created and configured by a system administrator or a system user. Thus, in this embodiment, after obtaining the system administrator authority of the mobile terminal, the system administrator authority can be used to create a system user, and the current user of the mobile terminal can be temporarily switched to a system user, thereby using the privileged identity of the system user to execute a restart instruction (i.e., reboot) to restart the system of the mobile terminal. Since the restart operation is performed in the Android system, the whole process does not require the help of an external call. For example, the current user of the mobile terminal can be temporarily switched to a system user using the Switch User (SU) command.
[0043] As mentioned above, the debug bridge connection is abnormal. This is usually caused by the ADB daemon running on the mobile terminal not working properly or being accidentally killed. After the mobile terminal automatically restarts, the ADB daemon will be revived or restored to normal, so the debug bridge connection can be restored to normal.
[0044] In addition, since system users have higher permissions and privileges, they may pose risks to the stability, data integrity and security of the system, and need to be operated with caution. Therefore, after the debug bridge connection is restored to normal, the user on the mobile end can be switched from a system user back to an ordinary user or general user through the SU command to reduce the risk of misoperation. Generally speaking, when an ordinary user or general user switches to a system user, the user's permissions are increased, and the switch requires a password; when a system user switches to an ordinary user or general user, the user's permissions are reduced, so the reverse switch does not require a password.
[0045] The solution of this embodiment can add a system daemon process to the mobile terminal, and use the system daemon process to monitor and resolve exceptions, that is, use the system daemon process to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal. When it is detected that the debug bridge connection between the mobile terminal and the host terminal has an abnormality, the system administrator privileges of the mobile terminal will be obtained. Having the system administrator privileges means having the user switching privileges, so the system administrator privileges can be used to switch the current user of the mobile terminal to the system user. The system user has the operation privileges to restart the mobile terminal, so the restart command can be executed using the identity of the system user to automatically restart the mobile terminal. The whole process realizes automatic detection of exceptions and restarts the mobile terminal to resolve the exceptions, without the need for human intervention, providing an unattended exception solution, saving labor costs, and improving exception handling efficiency.
[0046] The method for restarting a mobile terminal provided by an embodiment of the present invention is further described below. Figure 4 As shown, the method of this embodiment may include:
[0047] Step 401, establishing a physical connection with a host terminal via a universal serial bus.
[0048] That is, a physical connection (i.e., wired connection) is established with the host side using USB. USB is a commonly used host side interface with four wires, two power wires and two signal wires. In addition, if the mobile terminal also supports establishing a debug bridge connection via a wireless method, a wireless connection can also be established with the host side using a wireless method, such as Bluetooth (i.e., Bluetooth), Wireless Fidelity (Wireless Fidelity, Wi-Fi), etc. This embodiment will be described by taking the use of USB to establish a debug bridge connection as an example.
[0049] Step 402: Use the debug bridge daemon process of the mobile terminal to process the debug mode start instruction to establish a debug bridge connection with the host terminal through the universal serial bus.
[0050] The mobile terminal of this embodiment can be a mobile terminal with an Android system installed. The mobile terminal has an Android debug bridge daemon, that is, an ADB daemon, installed in it. After the mobile terminal establishes a USB connection with the host terminal, the mobile terminal can display a selection page. The user can choose to start the debug mode on the selection page. Choosing to start the debug mode triggers the generation of a debug mode start instruction. The debug bridge daemon will respond to the debug mode start instruction and establish a debug bridge connection with the host terminal through the universal serial bus.
[0051] Step 403: Receive the system daemon process pushed by the host and start the system daemon process.
[0052] The host side can establish a debug bridge connection with one or more mobile terminals, so as to debug or test one or more mobile terminals. Since the debug bridge client and server of each mobile terminal are on the same host side, and the default listening port is 5037, the host side can maintain a list of mobile terminals that have established a debug bridge connection with itself, and the list includes the identification information of the mobile terminals that have established a debug bridge connection with the host side, and the identification information can be the device serial number, number, etc. of the mobile terminal for distinguishing the mobile terminal.
[0053] The host side can set up a health check program. After the host side establishes a debug bridge connection with each mobile terminal, the health check program can be used to detect the connection status of the debug bridge connection established with each mobile terminal according to the mobile terminal list. Specifically, the health check program on the host side can first detect whether each mobile terminal has installed the system daemon. For mobile terminals that do not have the system daemon installed, the system daemon installation package can be pushed to these mobile terminals, and these mobile terminals can be instructed to install the system daemon according to the pushed installation package and start the installed system daemon; for mobile terminals that have already installed the system daemon, the health check program on the host side can detect whether the system daemon is started. If not, the mobile terminal is instructed to start the system daemon. If it is already started, the debug bridge connection status detection continues.
[0054] When executing the debug bridge connection status detection, the host-side health check program can establish a long connection communication with the ADB daemon of each mobile terminal according to the device serial number, so as to detect the connection status of the debug bridge connection between the host and each mobile terminal through the established long connection communication. The communication method can use any adb command, such as using getpropro.product.model to obtain the command return.
[0055] Step 404: Utilize the debug bridge daemon process to receive the connection status detection message sent by the host.
[0056] When the debug bridge daemon is normal, it can receive the connection status detection message sent by the host and feedback the connection status response message to the host; when the debug bridge daemon is abnormal, it may not be able to receive the connection status detection message, or it may be able to receive the connection status detection message sent by the host but cannot feedback the connection status response message to the host.
[0057] Step 405, in response to the connection status detection message, a connection status response message is fed back to the host end, so that the host end determines the connection status of the debug bridge connection between the mobile end and the host end according to the connection status response message.
[0058] That is, the health check program of the host side can send a connection status detection message to the mobile side according to a preset period or frequency. If the ADB daemon process of the mobile side is normal, the ADB daemon process will feedback a connection status response message to the host side. Under normal circumstances, one connection status detection message will feedback a connection status response message. If the ADB daemon process of the mobile side is abnormal, no connection status response message will be fed back for the connection status detection message. The host side can judge the connection status of the debugging bridge connection between the mobile side and the host side according to the reception of the connection status response message. For example, if after multiple or multiple rounds of attempts, it is found that no connection status response message is received within the preset time length or the number of connection status response messages received within the preset time length is lower than the preset number, the host side can consider that the debugging bridge connection between the mobile side and the host side is abnormal, and the host side can report abnormal information to the server. The abnormal information may include the identification information of the abnormal mobile side, the abnormal detection time, etc. The server can maintain an abnormal device list, and the abnormal device list may include the identification information of each mobile side whose debugging bridge connection status is abnormal.
[0059] Step 406: Use the system daemon process of the mobile terminal to send a connection status query request to the server, where the connection status query request includes identification information of the mobile terminal.
[0060] The mobile terminal can use its own system daemon to send a connection status query request to the server in real time or periodically. The connection status query request includes the identification information of the mobile terminal to query the connection status of the debug bridge connection between the mobile terminal and the host terminal identified by the identification information from the server.
[0061] Step 407: using the system daemon process of the mobile terminal to receive a connection status query response fed back by the server, the connection status query response includes the connection status of the debug bridge connection between the host terminal and the mobile terminal corresponding to the identification information.
[0062] The connection status may include normal or abnormal. The server may query the abnormal device list according to the identification information in the connection status query response. If the abnormal device list includes the identification information, it indicates that the debugging bridge connection of the mobile terminal identified by the identification information is abnormal. If the abnormal device list does not include the identification information, it indicates that the debugging bridge connection of the mobile terminal identified by the identification information is normal. When it is found that the debugging bridge connection of the mobile terminal is normal, it may continue to wait for the next query.
[0063] In this embodiment, the connection status of the debug bridge connection between the mobile terminal and the host terminal is queried from the server through the system daemon process, which is equivalent to querying the connection status of the debug bridge with the help of an external device. It can realize automatic monitoring, centralized monitoring and management, and can detect anomalies in time to ensure the stability and reliability of the debug bridge connection.
[0064] Step 408: when the connection status is abnormal, obtain the system administrator authority of the mobile terminal.
[0065] The device has system administrator privileges and will have full control and access to the entire operating system, and can perform system-wide operations. When the connection status is found to be abnormal, the device status recorded in the mobile backend can be set as abnormal to facilitate timely handling of the abnormality.
[0066] Step 409: Use the system administrator's authority to switch the current user of the mobile terminal to a system user, and use the identity of the system user to execute a restart instruction to restart the mobile terminal.
[0067] When the current user of the mobile terminal is switched to the system user by using the system administrator's authority to solve the exception, the device status recorded in the background of the mobile terminal can also be reset from abnormal to normal to facilitate the next query control.
[0068] The current user of the mobile terminal defaults to an ordinary user or a general user. An ordinary user or a general user can usually only access and operate his own files and limited system resources. A system user usually has higher permissions and privileges and can perform system-level operations. In this embodiment, after obtaining the system administrator privileges of the mobile terminal, the system administrator privileges can be used to create a system user, and the current user of the mobile terminal can be temporarily switched to a system user, so as to use the privileged identity of the system user to execute a restart instruction to restart the system of the mobile terminal. After the mobile terminal is restarted, the ADB daemon process of the mobile terminal will be revived or restored to normal, so that the debug bridge connection can be restored to normal. After the debug bridge connection between the mobile terminal and the host terminal is restored to normal, the host terminal can instruct the mobile terminal to restart the system daemon process to continue monitoring and resolve possible debug bridge connection anomalies.
[0069] The solution of this embodiment can add a system daemon process to the mobile terminal, and use the system daemon process to monitor and resolve exceptions, that is, use the system daemon process to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal. When it is detected that the debug bridge connection between the mobile terminal and the host terminal has an abnormality, the system administrator privileges of the mobile terminal will be obtained. Having the system administrator privileges means having the user switching privileges, so the system administrator privileges can be used to switch the current user of the mobile terminal to the system user. The system user has the operation privileges to restart the mobile terminal, so the restart command can be executed using the identity of the system user to automatically restart the mobile terminal. The whole process realizes automatic detection of exceptions and restarts the mobile terminal to resolve the exceptions, without the need for human intervention, providing an unattended exception solution, saving labor costs, and improving exception handling efficiency.
[0070] Figure 5is a structural diagram of a device for restarting a mobile terminal provided in an embodiment of the present invention, and the device is suitable for executing a method for restarting a mobile terminal provided in an embodiment of the present invention, such as Figure 5 As shown, the device may specifically include:
[0071] A monitoring module 501, used for monitoring the connection status of the debug bridge connection between the mobile terminal and the host terminal by using the system daemon process of the mobile terminal;
[0072] An acquisition module 502 is used to acquire the system administrator authority of the mobile terminal when the connection state is abnormal;
[0073] The restart module 503 is used to switch the current user of the mobile terminal to a system user by using the system administrator authority, and execute a restart instruction by using the identity of the system user to restart the mobile terminal.
[0074] In one embodiment, the monitoring module 501 is specifically used for:
[0075] Using the system daemon process to send a connection status query request to a server, wherein the connection status query request includes identification information of the mobile terminal;
[0076] The system daemon process is used to receive a connection status query response fed back by the server, wherein the connection status query response includes a connection status of a debug bridge connection between the host end and the mobile end corresponding to the identification information.
[0077] In one embodiment, the device further comprises a connection module, and the connection module is used to:
[0078] Before the monitoring module 501 monitors the connection status of the debug bridge connection between the mobile terminal and the host terminal, a physical connection is established with the host terminal through a universal serial bus;
[0079] In response to a debug mode start instruction, the debug bridge connection is established with the host end via the universal serial bus.
[0080] In one embodiment, the connection module establishes the debug bridge connection with the host end through the universal serial bus in response to the debug mode start instruction, including:
[0081] The debug bridge daemon process of the mobile terminal is used to process the debug mode startup instruction to establish the debug bridge connection with the host terminal through the universal serial bus.
[0082] In one embodiment, the connection status of the debug bridge connection between the host end and the mobile end corresponding to the identification information is provided by the host end to the server, and the device further includes a status interaction module, which is used to:
[0083] After the connection module processes the debug mode startup instruction using the debug bridge daemon process of the mobile terminal to establish the debug bridge connection with the host terminal through the universal serial bus, the debug bridge daemon process is used to receive the connection status detection message sent by the host terminal;
[0084] In response to the connection status detection message, a connection status response message is fed back to the host end, so that the host end determines the connection status of the debug bridge connection between the mobile end and the host end according to the connection status response message.
[0085] In one embodiment, the device further includes a system guard module, and the system guard module is used to:
[0086] Before the monitoring module 501 monitors the connection status of the debug bridge connection between the mobile terminal and the host terminal, the system daemon process pushed by the host terminal is received and the system daemon process is started.
[0087] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0088] The device of the embodiment of the present invention can add a system daemon process to the mobile terminal, and use the system daemon process to monitor and solve exceptions, that is, use the system daemon process to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal. When it is detected that the debug bridge connection between the mobile terminal and the host terminal has an abnormality, the system administrator privileges of the mobile terminal will be obtained. The person who has the system administrator privileges has the user switching privileges, so the system administrator privileges can be used to switch the current user of the mobile terminal to a system user. The system user has the operation privileges to restart the mobile terminal, so the restart command can be executed using the identity of the system user to automatically restart the mobile terminal. The whole process realizes automatic detection of exceptions and restarts the mobile terminal to solve the exceptions, provides an unattended exception solution, does not require manual intervention, saves labor costs, and improves exception handling efficiency.
[0089] The embodiment of the present invention also provides a system for restarting a mobile terminal, such as Figure 6As shown, the system includes a mobile terminal 601, a host terminal 602 and a server 603, wherein there can be one or more mobile terminals 601, that is, the host terminal 602 can debug or test one or more mobile terminals 601, wherein the mobile terminal 601 can use the system daemon process of the mobile terminal 601 to monitor the connection status of the debugging bridge connection between the mobile terminal 601 and the host terminal 602; when the connection status is abnormal, obtain the system administrator authority of the mobile terminal 601; use the system administrator authority to switch the current user of the mobile terminal 601 to the system user, and use the identity of the system user to execute the restart instruction to restart the mobile terminal 601.
[0090] For the specific interaction process between the devices in the system, please refer to the description of the previous embodiment, which will not be repeated here.
[0091] An embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for restarting a mobile terminal provided in any of the above embodiments is implemented.
[0092] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for restarting a mobile terminal provided in any of the above embodiments is implemented.
[0093] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 7 The electronic device shown is only an example and should not bring any limitation to the function and scope of use of the present invention.
[0094] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0095] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0096] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0097] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0098] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0099] The modules and / or units involved in the description of the present invention may be implemented by software or hardware. The modules and / or units described may also be arranged in a processor, for example, it may be described as follows: a processor includes a monitoring module, an acquisition module and a restart module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.
[0100] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0101] The system daemon process of the mobile terminal is used to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal; when the connection status is abnormal, the system administrator authority of the mobile terminal is obtained; the current user of the mobile terminal is switched to a system user by using the system administrator authority, and a restart instruction is executed by using the identity of the system user to restart the mobile terminal.
[0102] According to the technical solution of the present invention, a system daemon can be added to the mobile terminal, and the system daemon can be used to monitor and solve abnormalities, that is, the system daemon of the mobile terminal is used to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal; when the connection status is abnormal, the system administrator authority of the mobile terminal is obtained; the current user of the mobile terminal is switched to the system user by using the system administrator authority, and the restart command is executed by using the identity of the system user to restart the mobile terminal. That is, when the embodiment of the present invention detects that the debug bridge connection between the mobile terminal and the host terminal is abnormal, the system administrator authority of the mobile terminal will be obtained. The user with the system administrator authority has the user switching authority, so the current user of the mobile terminal can be switched to the system user by using the system administrator authority. The system user has the operation authority to restart the mobile terminal, so the restart command can be executed by using the identity of the system user to automatically restart the mobile terminal. The whole process realizes automatic discovery of abnormalities and restarting the mobile terminal to solve the abnormalities, providing an unattended abnormal solution, without the need for manual intervention, saving labor costs, and improving the efficiency of abnormal handling.
[0103] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0104] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0105] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for restarting a mobile terminal, characterized in that: include: Using the system daemon process of the mobile terminal to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal; When the connection state is abnormal, obtaining the system administrator authority of the mobile terminal; The current user of the mobile terminal is switched to a system user using the system administrator authority, and a restart instruction is executed using the identity of the system user to restart the mobile terminal.
2. The method for restarting a mobile terminal according to claim 1, characterized in that: The method of using the system daemon process of the mobile terminal to monitor the connection status of the debug bridge connection between the mobile terminal and the host terminal includes: Using the system daemon process to send a connection status query request to a server, wherein the connection status query request includes identification information of the mobile terminal; The system daemon process is used to receive a connection status query response fed back by the server, wherein the connection status query response includes a connection status of a debug bridge connection between the host end and the mobile end corresponding to the identification information.
3. The method for restarting a mobile terminal according to claim 2, characterized in that: Before monitoring the connection status of the debugging bridge connection between the mobile terminal and the host terminal, the method further includes: Establishing a physical connection with the host terminal via a universal serial bus; In response to a debug mode start instruction, the debug bridge connection is established with the host end via the universal serial bus.
4. The method for restarting a mobile terminal according to claim 3, characterized in that: The step of responding to the debug mode startup instruction and establishing the debug bridge connection with the host end through the universal serial bus includes: The debug bridge daemon process of the mobile terminal is used to process the debug mode startup instruction to establish the debug bridge connection with the host terminal through the universal serial bus.
5. The method for restarting a mobile terminal according to claim 4, characterized in that: The connection state of the debug bridge connection between the host end and the mobile end corresponding to the identification information is provided by the host end to the server, and after the debug bridge daemon process of the mobile end processes the debug mode start instruction to establish the debug bridge connection with the host end through the universal serial bus, the further comprising: Utilizing the debug bridge daemon process to receive the connection status detection message sent by the host end; In response to the connection status detection message, a connection status response message is fed back to the host end, so that the host end determines the connection status of the debug bridge connection between the mobile end and the host end according to the connection status response message.
6. The method for restarting a mobile terminal according to any one of claims 1 to 5, characterized in that: Before monitoring the connection status of the debugging bridge connection between the mobile terminal and the host terminal, the method further includes: Receive the system daemon process pushed by the host end and start the system daemon process.
7. A device for restarting a mobile terminal, characterized in that: include: A monitoring module, used for monitoring the connection status of the debugging bridge connection between the mobile terminal and the host terminal by using the system daemon process of the mobile terminal; An acquisition module, used for acquiring the system administrator authority of the mobile terminal when the connection state is abnormal; The restart module is used to switch the current user of the mobile terminal to a system user by using the system administrator authority, and execute a restart instruction by using the identity of the system user to restart the mobile terminal.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for restarting a mobile terminal according to any one of claims 1 to 6 is implemented.
9. A system for restarting a mobile terminal, characterized in that: The invention comprises a host end and an electronic device for executing the method for restarting a mobile end as claimed in any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for restarting a mobile terminal as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Offline recovery method, device and system for terminal equipment on test platform
CN105357030A
Equipment connection method and device
CN111726413A
Application program multi-level protection method
CN112612635A
Program restarting method and device, storage medium and electronic device
CN114791835A
Monitoring method and device of terminal test equipment and electronic equipment
CN116260747A