CN114968456B - Method and device for controlling terminal - Google Patents

Method and device for controlling terminal Download PDF

Info

Publication number
CN114968456B
CN114968456B CN202210490685.7A CN202210490685A CN114968456B CN 114968456 B CN114968456 B CN 114968456B CN 202210490685 A CN202210490685 A CN 202210490685A CN 114968456 B CN114968456 B CN 114968456B
Authority
CN
China
Prior art keywords
terminal
virtual host
adb
control instruction
process list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210490685.7A
Other languages
Chinese (zh)
Other versions
CN114968456A (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.)
Qilin Hesheng Network Technology Inc
Original Assignee
Qilin Hesheng Network Technology Inc
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 Qilin Hesheng Network Technology Inc filed Critical Qilin Hesheng Network Technology Inc
Priority to CN202210490685.7A priority Critical patent/CN114968456B/en
Publication of CN114968456A publication Critical patent/CN114968456A/en
Application granted granted Critical
Publication of CN114968456B publication Critical patent/CN114968456B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/451Execution arrangements for user interfaces
    • G06F9/452Remote windowing, e.g. X-Window System, desktop virtualisation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method and a device for controlling a terminal, wherein the method comprises the following steps: setting a virtual host at the local of the terminal; monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port; the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen. According to the method and the device, ADB communication is carried out on the terminal locally in the form of a virtual host with the terminal, background applications running in the terminal are screened out through a debugging mechanism of the ADB, and various background applications are terminated forcefully, so that resource release is effectively formed, the background applications are prevented from being activated by a third party, and the running speed of the terminal is improved.

Description

Method and device for controlling terminal
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a method and an apparatus for controlling a terminal.
Background
With the popularization of the mobile internet and the development of the technology of intelligent terminals, intelligent terminals such as intelligent terminals and tablet computers have become an indispensable part of life of people. However, intelligent terminals such as mobile phones and the like often have too slow running speed due to more background applications, and have great influence on the use of users.
At present, a user is often required to actively scan various installed applications to clean application programs running in the background, but a pull-alive mechanism exists in part of the applications, and the applications are often pulled alive again by a third party after cleaning, so that a large amount of system resources are still occupied.
Disclosure of Invention
The embodiment of the application aims to provide a method and a device for controlling a terminal, which can facilitate the terminal to release resources and improve the running speed of the terminal.
In order to solve the technical problems, embodiments of the present application are realized by the following aspects.
In a first aspect, an embodiment of the present application provides a method for controlling a terminal, including:
setting a virtual host at the local of the terminal; monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port; the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen.
In a second aspect, an embodiment of the present application provides an apparatus for controlling a terminal, including: the setting module is used for setting a virtual host at the local of the terminal; the monitoring module is used for monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host through the target port by ADB; the sending module is used for sending a control instruction to the terminal by the virtual host in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the display module is used for executing the control instruction by the terminal and displaying an execution result corresponding to the control instruction on a terminal screen.
In the embodiment of the application, a virtual host is set locally at a terminal; monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port; the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen. According to the method and the device, ADB communication can be carried out with the terminal in the form of a virtual host locally, background applications running in the terminal are screened out through a debugging mechanism of the ADB, and various background applications are terminated forcefully, so that resource release is effectively formed, the background applications are prevented from being activated by a third party, and the running speed of the terminal is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a schematic flow chart of a method for controlling a terminal according to an embodiment of the present application;
fig. 2 is another flow chart of a method for controlling a terminal according to an embodiment of the present application;
fig. 3 is another flow chart of a method for controlling a terminal according to an embodiment of the present application;
fig. 4 is a schematic flow chart of an apparatus for controlling a terminal according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions in the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
Fig. 1 shows a schematic flow chart of a method for controlling a terminal according to an embodiment of the present application, where the method may be performed by an electronic device, for example, a first terminal device and/or a second terminal device. In other words, the method may be performed by software or hardware installed at the terminal device. As shown, the method may include the following steps.
S10: and setting a virtual host at the local of the terminal.
In this embodiment, a virtual host is set locally in the terminal, so that the terminal considers that the terminal is connected with a part of upper computers through an ADB and accepts debugging.
The virtual host is set to firstly start the relative debugging authority corresponding to the terminal.
S101: receiving an opening instruction of the auxiliary right triggered by a user;
the terminal receives an auxiliary right opening instruction of the user, and opens auxiliary service rights, and after the auxiliary rights are opened, the terminal can simulate triggering behaviors such as clicking by the user so as to open corresponding debugging rights.
S102: according to the starting instruction, starting a developer debugging mode and a wireless debugging switch corresponding to the terminal;
simulating a clicking operation of a user on a terminal screen by using the auxiliary rights, firstly, declaring a service associated with the auxiliary rights in android management.
<application>
<service
android:name="cn.tbu.AccessibilityMonitorService"
android:description="@string/strong_acc_description"
android:exported="true"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService"/>
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/access_config"/>
</service>
</application>
When the "developer debug mode" is started, the capability of a specific application, such as whether the window content can be obtained, whether the gesture can be simulated, and the like, is defined in the content of the configuration file access_config. In this embodiment, all the capabilities of acquiring the auxiliary rights are applied for as follows.
<accessibility-service
xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagDefault|flagReportViewIds|flagIncludeNotI
mportantViews"
android:canPerformGestures="true"
android:canRetrieveWindowContent="true"
android:description="@string/strong_acc_description"
android:notificationTimeout="0"/>
After the statement is finished, a 'developer debug mode' switch is turned on, namely a 'developer option' interface in a 'system setting' interface is called, then an application package name and a window change event type operated by a foreground can be obtained through an AccessibilityEvent parameter by utilizing an AccessibilityEvent callback method of an auxiliary service, information such as types, IDs, display text contents and the like of all UI elements in a window is obtained, a UI component corresponding to the switch of the 'developer option' interface is found, a performace (accessibilityNodeInfo. ACTION_CLICK) method is executed to simulate that a user CLICKs the switch, the switch is triggered to be in an on state, and the 'developer debug mode' is triggered to be started
Similarly, when the wireless debugging switch is started, a developer option interface is started, the UI component of the interface is searched, the UI component of the wireless debugging is found, clicking triggering is simulated, and then the button of the wireless debugging is simulated to be clicked to start the switch of the wireless debugging.
S103: and a virtual host is locally established in a wireless debugging mode, and a public and private key file is generated so as to establish ADB connection with the terminal.
And after the wireless debugging function is started, acquiring a port and a pairing code which are displayed on the interface and used for prompting connection. And finding a button of 'using pairing code to pair equipment' in the current window by using an auxiliary function, and simulating a user to click so as to display the target port and pairing code information of the popup window prompt. After finding the display component according to the UI component ID, using an Access ibilityNodeInfo. GetText () method to obtain the displayed text content, and obtaining the target port and the pairing code.
And establishing a virtual host in the terminal, generating a pair of RSA public and private key files by using the 'adbygenin adby', and marking the established virtual host so as to facilitate the subsequent establishment of ADB connection through the adbd, wherein the adbykey at the end of the command is the name of the key.
S12: monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port;
a) The adb system service on the terminal initiates connection monitoring to the wireless debugging port through the target port, and waits for debugging connection establishment;
b) When the terminal monitors that the virtual host initiates a connection request through the target port, initiating authentication to the virtual host through the public and private key file; the method comprises the following steps:
the virtual host initiates a connection request through the target port, namely, sends a CNXN message for establishing connection, wherein the CNXN message comprises: version number of cnxn+maximum data length 4096+host name; after receiving the CNXN message, the terminal returns an AUTH message containing the first verification token to the virtual host through the wireless debugging port.
The virtual host performs signature verification on a first verification token sent by the terminal according to an RSA public-private key file, and sends a corresponding verification signature after verification is passed to the terminal in a form of CNXN message;
the terminal sends an AUTH message containing a second verification token to the virtual host again through the invalid debugging port according to the verification signature, and the AUTH message indicates that the public key information of the corresponding RSA needs to be verified;
the virtual host verifies the second verification token according to the public key information in the RSA public-private key file, namely, sends an AUTH message with the public key information to the terminal, and needs to further verify the public key information in the terminal so as to improve the security during debugging.
C) And the virtual host is identified by the terminal as an upper computer for debugging when the authentication is passed.
If the public key information in the terminal passes verification, a confirmation message is returned to the virtual host computer in a CNXN mode, the authentication passes, the virtual host computer is identified by the terminal as an upper computer for debugging, the virtual host computer and the terminal are successfully connected in an ADB mode, and the virtual host computer can receive a corresponding debugging instruction in the ADB mode.
S14: the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal;
in this embodiment, after the virtual host set in the terminal is connected to the terminal itself in the ADB mode, the virtual host sends a debug command with a control command to the terminal, where the control command includes a control command for stopping the application running, so as to end the application running in the background.
S16: and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen.
In this embodiment, after receiving a control instruction sent by a virtual host, a terminal screens out application programs running in the background, stops the application programs running in the background according to the control instruction, releases system resources occupied by the application programs running in the background, and loads the system resources occupied by a CPU, a memory and the like, which can be used by a foreground application in the terminal, thereby improving the running efficiency of the foreground application focused by a user. Meanwhile, the corresponding size of the released system resources is displayed in the screen of the terminal, and the use experience of the user is improved.
According to the method and the device, ADB communication can be carried out with the terminal in the form of a virtual host locally, background applications running in the terminal are screened out through a debugging mechanism of the ADB, and various background applications are terminated forcefully, so that resource release is effectively formed.
Fig. 2 is another flow chart of a method for controlling a terminal according to an embodiment of the present application, where the method may include the following steps as shown in the figure.
S210: setting a virtual host at the local of the terminal;
the same as in the previous embodiment will not be described again.
S220: monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port;
the same as in the previous embodiment will not be described again.
S230: the virtual host acquires a running user process list and a foreground process list running in a foreground in the terminal based on ADB connection;
in this embodiment, the virtual host sends an OPEN message to the terminal based on the ADB connection, and the message body is "shell: < specific command >". For example, "shell: ps-A|grep-E\" ≡u 0\ "", a control instruction of "ps-A|grep-E" ≡u 0\ "is executed, and the running process information in the terminal is queried.
Wherein, each parameter command has the following meaning:
ps: the Linux is used for listing running processes and threads, and the Android high version defaults to only output the processes of the current user, so that the process information of all users is output by adding the-A parameter representation.
grep: in the tool for text searching on Linux, because the ps command output process comprises a system service and a user service which does not belong to the system service in a terminal, and the user name of the user service starts with 'u 0_', the 'u 0_' is used as a filtering key, and the user process is respectively filtered out from the ps command output process as a running process, so that a running user process list is obtained.
Similarly, the virtual host sends a dumpsys activity top instruction to the terminal based on ADB connection, and queries information of a foreground application running in the terminal to obtain a list of the foreground application.
S240: and screening a target process list operated by a background based on the user process list and the foreground process list.
In this embodiment, the virtual host performs a difference operation on the user process list and the foreground process list, and the foreground process list records all the user processes running in the foreground because the user process list records all the user processes running in the foreground, and the difference operation is performed on the user process list and the foreground process list, so as to obtain a target process list recording the running application in the background.
S250: and respectively reading first packet names corresponding to all applications in the target process list, and sending a control instruction corresponding to the first packet names to the terminal by the virtual host in an ADB mode.
In this embodiment, the virtual host analyzes the target process list to obtain a first packet name of each background application, and sends a stop instruction for the first packet name to the terminal in ADB mode. In this embodiment, the virtual host sends control instructions "am force-stop first packet names" to the terminals respectively, and the background applications corresponding to the first packet names are respectively and forcedly stopped to stop running.
S260: and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen.
In this embodiment, the terminal executes the control instruction sent by the virtual host, stops running the background application corresponding to the first packet name, counts the resources occupied by all the background applications, such as the memory size, and displays the counted resources as the execution result on the terminal screen.
In this embodiment, a virtual host is set locally in a terminal; monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port; the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen. According to the method and the system, ADB communication can be carried out with the terminal in the form of a virtual host locally, the user process and the foreground process are counted through the debugging mechanism of the ADB, the background application running in the terminal is obtained after screening, all background applications are forcefully terminated, resource release is effectively formed, and after the background application stops running, the background application is influenced by the android system and is difficult to be pulled up again by a third party, so that the running speed of the terminal is improved.
Fig. 3 is another flow chart of a method for controlling a terminal according to an embodiment of the present application, where the method may include the following steps as shown in the figure.
S310: setting a virtual host at the local of the terminal;
the same as in the previous embodiment will not be described again.
S320: monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port;
the same as in the previous embodiment will not be described again.
S330: the virtual host acquires a running user process list and a foreground process list running in a foreground in the terminal based on ADB connection;
in this embodiment, the virtual host sends an OPEN message to the terminal based on the ADB connection, and queries the running process information in the terminal to obtain the running user process in the terminal, so as to form a user process list.
Similarly, the virtual host sends an instruction to the terminal based on the ADB connection, wherein the instruction is used for inquiring information of a foreground application running in the terminal, and a list of the foreground application is obtained.
S340: and screening a target process list operated by a background based on the user process list and the foreground process list.
In this embodiment, the virtual host performs a difference operation on the user process list and the foreground process list, and the foreground process list records all the user processes running in the foreground because the user process list records all the user processes running in the foreground, and the difference operation is performed on the user process list and the foreground process list, so as to obtain a target process list recording the running application in the background.
S350: and respectively reading the memory information corresponding to each application in the target process list, and respectively taking the application packet name corresponding to the memory occupation larger than the set threshold value as a second packet name, wherein the virtual host sends a control instruction corresponding to the second packet name to the terminal in an ADB mode.
In this embodiment, the virtual host analyzes the target process list, obtains the memory occupation value corresponding to each background running application, performs data analysis on each memory occupation value, and extracts the median of each memory occupation value as the predetermined threshold, so that the memory resources occupied by the corresponding application of the memory occupation value greater than the predetermined threshold are excessive. In this embodiment, the application packet name whose memory occupancy value is greater than the predetermined threshold is used as the second packet name, and then a control instruction is formed according to the second packet name, and the application packet name whose memory occupancy value is less than the predetermined threshold is not processed. The virtual host sends a control instruction corresponding to the second packet name to the terminal in an ADB mode, and controls a background process with excessive memory occupation in the terminal, so that the background process with memory occupation larger than a preset threshold value in the terminal is forcibly stopped.
S360: and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen.
In this embodiment, the terminal executes the control instruction sent by the virtual host, stops running the background application corresponding to the second packet name, and counts the resources occupied by the background application corresponding to the second packet name, such as the memory size, and displays the counted resources as the execution result on the terminal screen.
In this embodiment, a virtual host is set locally in a terminal; monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port; the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal; and the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen. According to the method and the system, ADB communication can be carried out with the terminal in a mode of a virtual host locally, user processes and foreground processes are counted through a debugging mechanism of the ADB, a background application running in the terminal is obtained after screening, analysis is carried out on the background application, the background application with overlarge memory occupation is selected to be terminated, resources with overlarge memory occupation are released, and the terminated background application is terminated by the terminal and is difficult to be pulled up again by a third party due to the influence of an android system, so that the running speed of the terminal is improved.
Fig. 4 is a device 400 for controlling a terminal according to an embodiment of the present application, including:
a setting module 401, configured to set a virtual host locally on a terminal;
the monitoring module 402 is configured to monitor a target port for the virtual host to communicate with the terminal, and connect the terminal to the virtual host through the target port;
a sending module 403, configured to send a control instruction to the terminal by using an ADB mode by using the virtual host; the control instruction is used for stopping an application program running in the background in the terminal;
and the display module 404 is configured to execute the control instruction by the terminal, and display an execution result corresponding to the control instruction on a terminal screen.
In one possible implementation, the setting module includes:
the receiving unit is used for receiving an opening instruction of the auxiliary right triggered by a user;
the starting unit is used for starting a developer debugging mode and a wireless debugging switch corresponding to the terminal according to the starting instruction;
and the setting unit is used for locally establishing the virtual host in the wireless debugging mode and generating a public and private key file so as to establish ADB connection with the terminal.
In one possible implementation, the monitoring module includes:
the monitoring unit is used for initiating connection monitoring to the wireless debugging port through the target port by the terminal and waiting for debugging connection establishment;
the authentication unit is used for initiating authentication to the virtual host through the public and private key file when the terminal monitors that the virtual host initiates a connection request through the target port;
and the verification unit is used for identifying the virtual host as an upper computer for debugging by the terminal if the virtual host passes the authentication.
In one possible implementation, the authentication unit specifically includes,
the first verification subunit is used for verifying the first verification token sent by the terminal by the virtual host and sending a corresponding verification signature after verification is passed to the terminal;
a sending subunit, configured to send a second authentication token to the virtual host again according to the authentication signature by the terminal;
and the second verification subunit is used for verifying the second verification token by the virtual host according to the public key in the public-private key file.
In one possible implementation, the apparatus further includes:
the acquisition module is used for acquiring a running user process list and a foreground process list running in a foreground in the terminal based on ADB connection by the virtual host;
and the screening module is used for screening a target process list operated by a background based on the user process list and the foreground process list.
In one possible implementation manner, the sending module specifically includes:
the first control unit is used for respectively reading first packet names corresponding to all applications in the target process list, and the virtual host sends a control instruction corresponding to the first packet names to the terminal in an ADB mode.
In one possible implementation, the apparatus further includes:
and the second control unit is used for respectively reading the memory information corresponding to each application in the target process list, respectively taking an application packet name corresponding to which the memory occupation is larger than a set threshold value as a second packet name, and sending a control instruction corresponding to the second packet name to the terminal by the virtual host in an ADB mode.
The electronic device of embodiments of the present application may exist in a variety of forms including, but not limited to, the following devices.
(1) A mobile communication device: such devices are characterized by mobile communication capabilities and are primarily aimed at providing voice, data communications. Such terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, etc.
(2) Ultra mobile personal computer equipment, which belongs to the category of personal computers, has the functions of calculation and processing and generally has the characteristic of mobile internet surfing. Such terminals include: PDA, MID, and UMPC devices, etc., such as iPad.
(3) Portable entertainment device: such devices may display and play multimedia content. The device comprises: audio, video players (e.g., iPod), palm game consoles, electronic books, and smart toys and portable car navigation devices.
(4) Other electronic devices with data interaction function.
Further, embodiments of the present application also provide a computer-readable storage medium for storing computer-executable instructions that, when executed by a processor, implement the following flow: establishing connection with a second terminal device; receiving a control instruction from the second terminal device, wherein the control instruction is input through an input device of the second terminal, and the control instruction comprises an instruction for acquiring screen display content; executing the control instruction, including: acquiring screen display content of a first terminal device; and sending the execution result of the control instruction to the second terminal equipment, wherein the execution result of the control instruction comprises the screen display content of the first terminal equipment.
Further, embodiments of the present application also provide a computer-readable storage medium for storing computer-executable instructions that, when executed by a processor, implement the following flow: establishing connection with a first terminal device; transmitting a control instruction to the first terminal device, wherein the control instruction is input through an input device of a second terminal, and the control instruction comprises an instruction for acquiring screen display content; receiving an execution result of the control instruction sent by the first terminal equipment, wherein the execution result of the control instruction comprises screen display content of the first terminal equipment; and displaying the screen display content of the first terminal device on the display device of the second terminal device.
Therefore, when the computer executable instructions are executed by the processor, the methods described in the foregoing method embodiments can be executed, and the functions and the beneficial effects of the methods described in the foregoing method embodiments are realized, which are not described herein again.
The computer readable storage medium includes Read-Only Memory (ROM), random access Memory (Random Access Memory RAM), magnetic disk or optical disk, etc.
Further, embodiments of the present application also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, implement the following flow: establishing connection with a second terminal device; receiving a control instruction from the second terminal device, wherein the control instruction is input through an input device of the second terminal, and the control instruction comprises an instruction for acquiring screen display content; executing the control instruction, including: acquiring screen display content of a first terminal device; and sending the execution result of the control instruction to the second terminal equipment, wherein the execution result of the control instruction comprises the screen display content of the first terminal equipment.
Further, embodiments of the present application also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, implement the following flow: establishing connection with a first terminal device; transmitting a control instruction to the first terminal device, wherein the control instruction is input through an input device of a second terminal, and the control instruction comprises an instruction for acquiring screen display content; receiving an execution result of the control instruction sent by the first terminal equipment, wherein the execution result of the control instruction comprises screen display content of the first terminal equipment; and displaying the screen display content of the first terminal device on the display device of the second terminal device.
Thus, executing the computer program product provided in the embodiment of the present application can execute each method described in the foregoing method embodiment, and implement the functions and beneficial effects of each method described in the foregoing method embodiment, which are not described herein again.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (12)

1. A method for controlling a terminal, comprising:
setting a virtual host at the local of the terminal;
monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host by the ADB through the target port;
the virtual host sends a control instruction to the terminal in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal;
the terminal executes the control instruction and displays an execution result corresponding to the control instruction on a terminal screen;
before the virtual host sends a control instruction to the terminal in the ADB mode, the method further comprises the following steps:
the virtual host machine obtains a running user process list and a foreground process list running in the terminal based on ADB connection, specifically, the virtual host machine sends an OPEN message to the terminal based on ADB connection to inquire running process information in the terminal to obtain the running user process list in the terminal, and the virtual host machine sends an instruction to the terminal based on ADB connection to inquire information of a foreground application running in the terminal to obtain the foreground process list;
and screening a target process list operated by a background based on the user process list and the foreground process list.
2. The method of claim 1, wherein the setting up the virtual host locally at the terminal comprises:
receiving an opening instruction of the auxiliary right triggered by a user;
according to the starting instruction, starting a developer debugging mode and a wireless debugging switch corresponding to the terminal;
and a virtual host is locally established in a wireless debugging mode, and a public and private key file is generated so as to establish ADB connection with the terminal.
3. The method according to claim 1 or 2, wherein the ADB connection of the terminal with the virtual host through the destination port comprises:
the terminal initiates connection monitoring to a wireless debugging port through the target port and waits for debugging connection establishment;
when the terminal monitors that the virtual host initiates a connection request through the target port, initiating authentication to the virtual host through a public and private key file;
and if the virtual host passes the authentication, the virtual host is identified by the terminal as an upper computer for debugging.
4. The method of claim 3, wherein upon initiating authentication with the virtual host via the public-private key file,
the virtual host verifies the first verification token sent by the terminal, and sends a corresponding verification signature after verification is passed to the terminal;
the terminal sends a second verification token to the virtual host again according to the verification signature;
and the virtual host verifies the second verification token according to the public key in the public-private key file.
5. The method according to claim 1, wherein the virtual host sends control instructions to the terminal in ADB mode, in particular:
and respectively reading first packet names corresponding to all applications in the target process list, and sending a control instruction corresponding to the first packet names to the terminal by the virtual host in an ADB mode.
6. The method according to claim 1, wherein the method further comprises:
and respectively reading the memory information corresponding to each application in the target process list, and respectively taking the application packet name corresponding to the memory occupation larger than the set threshold value as a second packet name, wherein the virtual host sends a control instruction corresponding to the second packet name to the terminal in an ADB mode.
7. An apparatus for controlling a terminal, comprising:
the setting module is used for setting a virtual host at the local of the terminal;
the monitoring module is used for monitoring a target port for communication between the virtual host and the terminal, and connecting the terminal with the virtual host through the target port by ADB;
the sending module is used for sending a control instruction to the terminal by the virtual host in an ADB mode; the control instruction is used for stopping an application program running in the background in the terminal;
the display module is used for executing the control instruction by the terminal and displaying an execution result corresponding to the control instruction on a terminal screen;
the apparatus further comprises:
the virtual host is used for acquiring a running user process list and a foreground process list in the terminal based on ADB connection, specifically, the virtual host is used for sending an OPEN message to the terminal based on ADB connection, inquiring running process information in the terminal to obtain the running user process list in the terminal, and sending an instruction to the terminal based on ADB connection, inquiring information of a foreground application in the terminal to obtain the foreground process list;
and the screening module is used for screening a target process list operated by a background based on the user process list and the foreground process list.
8. The apparatus of claim 7, wherein the setup module comprises:
the receiving unit is used for receiving an opening instruction of the auxiliary right triggered by a user;
the starting unit is used for starting a developer debugging mode and a wireless debugging switch corresponding to the terminal according to the starting instruction;
and the setting unit is used for locally establishing the virtual host in the wireless debugging mode and generating a public and private key file so as to establish ADB connection with the terminal.
9. The apparatus of claim 7 or 8, wherein the monitoring module comprises:
the monitoring unit is used for initiating connection monitoring to the wireless debugging port through the target port by the terminal and waiting for debugging connection establishment;
the authentication unit is used for initiating authentication to the virtual host through a public and private key file when the terminal monitors that the virtual host initiates a connection request through the target port;
and the verification unit is used for identifying the virtual host as an upper computer for debugging by the terminal if the virtual host passes the authentication.
10. The device according to claim 9, wherein the authentication unit comprises in particular,
the first verification subunit is used for verifying the first verification token sent by the terminal by the virtual host and sending a corresponding verification signature after verification is passed to the terminal;
a sending subunit, configured to send a second authentication token to the virtual host again according to the authentication signature by the terminal;
and the second verification subunit is used for verifying the second verification token by the virtual host according to the public key in the public-private key file.
11. The apparatus of claim 7, wherein the sending module specifically comprises:
the first control unit is used for respectively reading first packet names corresponding to all applications in the target process list, and the virtual host sends a control instruction corresponding to the first packet names to the terminal in an ADB mode.
12. The apparatus of claim 7, wherein the apparatus further comprises:
and the second control unit is used for respectively reading the memory information corresponding to each application in the target process list, respectively taking an application packet name corresponding to which the memory occupation is larger than a set threshold value as a second packet name, and sending a control instruction corresponding to the second packet name to the terminal by the virtual host in an ADB mode.
CN202210490685.7A 2022-05-07 2022-05-07 Method and device for controlling terminal Active CN114968456B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210490685.7A CN114968456B (en) 2022-05-07 2022-05-07 Method and device for controlling terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210490685.7A CN114968456B (en) 2022-05-07 2022-05-07 Method and device for controlling terminal

Publications (2)

Publication Number Publication Date
CN114968456A CN114968456A (en) 2022-08-30
CN114968456B true CN114968456B (en) 2024-03-08

Family

ID=82982020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210490685.7A Active CN114968456B (en) 2022-05-07 2022-05-07 Method and device for controlling terminal

Country Status (1)

Country Link
CN (1) CN114968456B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115767025B (en) * 2022-11-10 2024-01-23 合芯科技有限公司 Method, device, electronic equipment and storage medium for preventing data leakage

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105005494A (en) * 2015-08-28 2015-10-28 广东欧珀移动通信有限公司 Method and system for preventing silently installing application
CN105243016A (en) * 2015-09-30 2016-01-13 北京奇虎科技有限公司 Method, apparatus and system for monitoring terminal device on test platform
CN105357030A (en) * 2015-09-30 2016-02-24 北京奇虎科技有限公司 Offline recovery method, device and system for terminal equipment on test platform
CN106453766A (en) * 2015-08-04 2017-02-22 阿里巴巴集团控股有限公司 Data transmission method, data transmission device and data transmission system based on virtual machine
CN107256188A (en) * 2017-06-30 2017-10-17 百度在线网络技术(北京)有限公司 Control method, device, terminal and the storage medium of Android device
CN107544900A (en) * 2016-06-27 2018-01-05 北京优朋普乐科技有限公司 Android device and its open method and device, control system for debugging bridge
CN107798240A (en) * 2016-09-07 2018-03-13 武汉安天信息技术有限责任公司 A kind of method and device for being used to monitor PC ends operation mobile device
CN107943578A (en) * 2017-11-03 2018-04-20 深圳市金立通信设备有限公司 A kind of memory release method, terminal device and computer-readable medium
CN109213539A (en) * 2016-09-27 2019-01-15 华为技术有限公司 A kind of method for recovering internal storage and device
CN109491890A (en) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 The interface scans method and terminal device of application program
CN109992430A (en) * 2019-02-28 2019-07-09 维沃移动通信有限公司 A kind of data transmission method, first terminal and second terminal
CN110413503A (en) * 2019-06-14 2019-11-05 平安科技(深圳)有限公司 A kind of application program capacity monitoring method, device, equipment and storage medium
CN110674508A (en) * 2019-09-23 2020-01-10 北京智游网安科技有限公司 Android component detection processing method, detection terminal and storage medium
CN111382416A (en) * 2018-12-27 2020-07-07 北京右划网络科技有限公司 Application program operation identification method and device, terminal equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150332043A1 (en) * 2014-05-15 2015-11-19 Auckland Uniservices Limited Application analysis system for electronic devices

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106453766A (en) * 2015-08-04 2017-02-22 阿里巴巴集团控股有限公司 Data transmission method, data transmission device and data transmission system based on virtual machine
CN105005494A (en) * 2015-08-28 2015-10-28 广东欧珀移动通信有限公司 Method and system for preventing silently installing application
CN105243016A (en) * 2015-09-30 2016-01-13 北京奇虎科技有限公司 Method, apparatus and system for monitoring terminal device on test platform
CN105357030A (en) * 2015-09-30 2016-02-24 北京奇虎科技有限公司 Offline recovery method, device and system for terminal equipment on test platform
CN107544900A (en) * 2016-06-27 2018-01-05 北京优朋普乐科技有限公司 Android device and its open method and device, control system for debugging bridge
CN107798240A (en) * 2016-09-07 2018-03-13 武汉安天信息技术有限责任公司 A kind of method and device for being used to monitor PC ends operation mobile device
CN109213539A (en) * 2016-09-27 2019-01-15 华为技术有限公司 A kind of method for recovering internal storage and device
CN107256188A (en) * 2017-06-30 2017-10-17 百度在线网络技术(北京)有限公司 Control method, device, terminal and the storage medium of Android device
CN107943578A (en) * 2017-11-03 2018-04-20 深圳市金立通信设备有限公司 A kind of memory release method, terminal device and computer-readable medium
CN109491890A (en) * 2018-10-16 2019-03-19 深圳壹账通智能科技有限公司 The interface scans method and terminal device of application program
CN111382416A (en) * 2018-12-27 2020-07-07 北京右划网络科技有限公司 Application program operation identification method and device, terminal equipment and storage medium
CN109992430A (en) * 2019-02-28 2019-07-09 维沃移动通信有限公司 A kind of data transmission method, first terminal and second terminal
CN110413503A (en) * 2019-06-14 2019-11-05 平安科技(深圳)有限公司 A kind of application program capacity monitoring method, device, equipment and storage medium
CN110674508A (en) * 2019-09-23 2020-01-10 北京智游网安科技有限公司 Android component detection processing method, detection terminal and storage medium

Also Published As

Publication number Publication date
CN114968456A (en) 2022-08-30

Similar Documents

Publication Publication Date Title
US10936371B2 (en) Method for resource allocation and related products
CN113595968B (en) Login method and system based on cloud application instance and related equipment
US11252151B2 (en) Method and apparatus for data transmission between terminals
WO2017197888A1 (en) Information sharing method, intelligent terminal, and system
CN111991813A (en) Method and device for logging in game, electronic equipment and storage medium
CN112346751B (en) Application program installation method and device, electronic equipment and storage medium
WO2015176352A1 (en) Android system-based method and device for information exchange between applications
CN114968456B (en) Method and device for controlling terminal
CN106027631B (en) Data transmission method and device
CN111338971B (en) Application testing method and device, electronic equipment and storage medium
CN111142900A (en) Program updating method and device and terminal equipment
US20150128129A1 (en) Method and device for installing application
CN111641554B (en) Message processing method and device and computer readable storage medium
WO2017003885A1 (en) Brokered advanced pairing
WO2017193544A1 (en) Method, device, and electronic apparatus for downloading resource
WO2015081716A1 (en) Method, system, and related device for providing application service
CN105025482B (en) Communication information processing method and equipment thereof
CN111565382B (en) Transmission method and electronic equipment
CN109412931B (en) Method, device and terminal equipment for performing knowledge question answering by using instant messaging mode
CN115225627A (en) File transmission method and device, computer equipment and storage medium
CN111866135A (en) Message display control method and device for electronic equipment, electronic equipment and readable medium
CN111031145A (en) Remote assistance method and system based on intelligent terminal
CN113905263B (en) Set top box control method, equipment and storage medium
CN111010483B (en) Mobile terminal control method and device, computer device and storage medium
CN107181727B (en) Control method and device of external equipment

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