CN114968456A - Method and device for controlling terminal - Google Patents

Method and device for controlling terminal Download PDF

Info

Publication number
CN114968456A
CN114968456A CN202210490685.7A CN202210490685A CN114968456A CN 114968456 A CN114968456 A CN 114968456A CN 202210490685 A CN202210490685 A CN 202210490685A CN 114968456 A CN114968456 A CN 114968456A
Authority
CN
China
Prior art keywords
terminal
virtual host
control instruction
adb
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.)
Granted
Application number
CN202210490685.7A
Other languages
Chinese (zh)
Other versions
CN114968456B (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

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/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 locally at a terminal; monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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 embodiment of the application, the terminal carries out ADB communication with the terminal in a local virtual host mode, background applications running in the terminal are screened out through an ADB debugging mechanism, and all background applications are terminated forcibly, so that resource release is effectively formed, the background applications are prevented from being pulled alive 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 intelligent terminal technology, intelligent terminals such as intelligent terminals and tablet computers have become an essential part of the life of people. However, the background applications of intelligent terminals such as mobile phones are more, so that the operation speed is too slow, and the use of the intelligent terminals by users is greatly influenced.
According to the existing scheme, a user is required to actively scan various installed applications to clean application programs running in a background, but a pull-alive mechanism exists in part of the applications, the applications are frequently pulled alive again by a third party after being cleaned, and 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.
To solve the above technical problem, embodiments of the present application are achieved 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 locally at a terminal; monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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 locally at the terminal; the monitoring module is used for monitoring a target port of the virtual host for communicating with the terminal and connecting the terminal with the virtual host through the target port; a sending module, configured to send a control instruction to the terminal in an ADB mode by the virtual host; the control instruction is used for stopping the application program running in the background in the terminal; and the display module is used for the terminal to execute the control instruction and display an execution result corresponding to the control instruction on a terminal screen.
In the embodiment of the application, a virtual host is locally arranged on a terminal; monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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, the ADB communication can be carried out with the terminal in a virtual host mode locally at the terminal, the background application running in the terminal is screened out through an ADB debugging mechanism, and all background applications are terminated forcibly, so that resource release is effectively formed, the background application is prevented from being pulled alive 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 needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
Fig. 1 is a schematic flowchart of a method for controlling a terminal according to an embodiment of the present disclosure;
fig. 2 is another schematic flowchart of a method for controlling a terminal according to an embodiment of the present disclosure;
fig. 3 is another schematic flowchart of a method for controlling a terminal according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating an apparatus for controlling a terminal according to an embodiment of the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 shows a flowchart of a method for controlling a terminal, which may be performed by an electronic device, for example, a first terminal device and/or a second terminal device according to an embodiment of the present application. In other words, the method may be performed by software or hardware installed in the terminal device. As shown, the method may include the following steps.
S10: and setting a virtual host locally at the terminal.
In this embodiment, a virtual host is locally installed in the terminal, and the terminal is considered to be connected to one upper computer through an ADB and is debugged.
And setting a relevant debugging permission corresponding to the terminal to be started by the virtual host.
S101: receiving an opening instruction of an auxiliary authority triggered by a user;
the terminal receives an auxiliary authority opening instruction of a user, the auxiliary service authority is opened, and after the auxiliary authority is opened, the terminal can simulate the triggering behaviors of clicking and the like of the user so as to open the corresponding debugging authority.
S102: according to the starting instruction, a developer debugging mode and a wireless debugging switch corresponding to the terminal are started;
simulating the click operation of the user on the terminal screen by using the auxiliary authority, firstly declaring the service associated with the auxiliary authority in android manifest.
<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 debugging mode' is started, the specific application capability is defined in the content of the setting configuration file access _ config.xml, such as whether window content can be obtained or not, whether gestures can be simulated or not. In this embodiment, all the capabilities of acquiring the auxiliary right are applied 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, opening a 'developer debugging mode' switch, namely calling a 'developer option' interface in a 'system setting' interface, then utilizing an onaccessibirityevent callback method of auxiliary service, obtaining the name of an application packet and the type of a window change event which are operated in the foreground through an accessisibirityevent parameter, obtaining the types, IDs (identities), display text contents and other information of all UI elements in the window, searching a UI component corresponding to the switch of the 'developer option' interface, executing a performAction (accessingnodeon. ACTION _ CLICK) method to simulate a user to CLICK the switch, triggering the switch to be in an open state, and enabling the 'developer debugging mode' to be opened due to triggering
Similarly, when the wireless debugging switch is turned on, the developer option interface is turned on, the user interface module is searched for the wireless debugging UI module, clicking triggering is carried out in a simulation mode, and then the turning-on button is clicked in a simulation mode to turn on the wireless debugging switch.
S103: and in a wireless debugging mode, a virtual host is locally established, 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, a port and a pairing code for prompting connection displayed on an interface are acquired. And finding a button for using the pairing code to pair equipment in the current window by using an auxiliary function, and simulating a user to click, thereby displaying the target port and the pairing code information prompted by the popup window. And after finding the display component according to the UI component ID, obtaining the displayed text content by using an Access information NodeInfo.
The method comprises the steps of establishing a virtual host in a terminal, generating a pair of RSA public and private key files by using an adbkeyGenadkey, and marking the established virtual host so as to establish ADB connection through an adbd later, wherein the adbkey at the end of a command is the name of a key.
S12: monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host through the target port;
A) initiating connection monitoring to a wireless debugging port by an adb system service on the terminal through a target port, and waiting for the establishment of debugging connection;
B) when the terminal monitors that the virtual host initiates a connection request through the target port, the terminal initiates authentication to the virtual host through the public and private key file; the method specifically comprises the following steps:
the virtual host initiates a connection request through the target port, that is, sends a CNXN message for establishing a connection, where the CNXN message includes: version number of CNXN + maximum data length 4096+ Host name; and 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 carries out signature verification on a first verification token sent by the terminal according to the RSA public and private key file, and sends a corresponding verification signature after verification is passed to the terminal in a CNXN message form;
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 represents that public key information of corresponding RSA needs to be verified;
the virtual host verifies the second verification token according to the public key information in the RSA public and private key file, namely, an AUTH message with the public key information is sent to the terminal, and the public key information needs to be further verified in the terminal so as to improve the security during debugging.
C) And the virtual host is identified as an upper computer for debugging by the terminal when the authentication is passed.
If the public key information in the terminal passes verification, the terminal returns confirmation information to the virtual host in a CNXN mode, the authentication is passed, the virtual host is identified as an upper computer for debugging by the terminal, the virtual host and the terminal are successfully connected in an ADB mode, and the virtual host 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 the 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 instruction to the terminal, where the control instruction includes a control command for stopping application running, so as to end an application program 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 the control instruction sent by the virtual host, the terminal screens out the application programs running in the background, and stops the application programs running in the background according to the control instruction, so that system resources occupied by the application programs running in the background are released, and the occupied system resources, such as the CPU and the memory, can be loaded by foreground applications in the terminal, thereby improving the running efficiency of foreground applications concerned by users. Meanwhile, the corresponding size of the released system resource is displayed in the screen of the terminal, and the use experience of the user is also improved.
According to the method and the device, ADB communication can be carried out with the terminal in a virtual host mode locally at the terminal, background applications running in the terminal are screened out through an ADB debugging mechanism, and all background applications are terminated forcibly, so that resource release is effectively formed.
Fig. 2 shows another flowchart of a method for controlling a terminal according to an embodiment of the present application, where as shown in the figure, the method may include the following steps.
S210: setting a virtual host locally at a terminal;
the same as the previous embodiment will not be described again.
S220: monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host through the target port;
the same as the previous embodiment will not be described again.
S230: the virtual host acquires a user process list running in the terminal and a foreground process list running in a foreground based on ADB connection;
in this embodiment, the virtual host sends an OPEN message to the terminal based on ADB connection, and the message body is "shell: < specific command >". For example, "shell: ps-A | grep-E \ ^ u0 \", execute "ps-A | grep-E" ^ u0 \ "control command, and query the information of the running process in the terminal.
Wherein, the meaning of each parameter command is as follows:
ps: and a tool used for listing information of running processes and threads on Linux, and only the process of the current user is output by default on the Android high-version, so that the process information of all users is output by adding a-A parameter.
grep: in the tool for text search on Linux, because the processes for outputting the ps commands comprise system services in the terminal and user services which do not belong to the system services, and the user names of the user services begin with "u 0_", the "u 0_" is used as a filtering key, and the user processes are respectively filtered out as running processes from the processes for outputting the ps commands, so that a running user process list is obtained.
Similarly, the virtual host sends a "dumpsys activity top" instruction to the terminal based on the ADB connection, and queries information of foreground applications running in the terminal to obtain a list of the foreground applications.
S240: and screening out a target process list running in 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 because the user process list records all running user processes, the foreground process list records all foreground running user processes, and the difference between the two is obtained, the target process list recording the background running application is obtained.
S250: and respectively reading the first packet names corresponding to the 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 parses the target process list, obtains the first packet name of each background application, and sends a stop instruction for the first packet name to the terminal in the ADB mode. In this embodiment, the virtual host sends a control instruction "am force-stop first packet name" to the terminal, and forcibly stops the background application corresponding to the first packet name from 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 instructions sent by the virtual host, respectively stops running the background applications corresponding to the first package name, and counts resources, such as memory size, occupied by all the background applications, and displays the counted resources on the terminal screen as an execution result.
In this embodiment, a virtual host is locally set in a terminal; monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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, the terminal can be locally communicated with the terminal in an ADB mode, the user process and the foreground process are respectively counted through an ADB debugging mechanism, the background application running in the terminal is obtained after screening, and each background application is terminated by force, so that resource release is effectively formed, the background application is influenced by the android system after stopping running, and the terminal is difficult to be reactivated by a third party, so that the running speed of the terminal is increased.
Fig. 3 shows another flowchart of a method for controlling a terminal according to an embodiment of the present disclosure, where as shown in the figure, the method may include the following steps.
S310: setting a virtual host locally at a terminal;
the same as the previous embodiment will not be described again.
S320: monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host through the target port;
the same as the previous embodiment will not be described again.
S330: the virtual host acquires a user process list running in the terminal and a foreground process list running in a foreground based on ADB connection;
in this embodiment, the virtual host sends an OPEN message to the terminal based on the ADB connection, and queries information of a process running in the terminal to obtain a user process running 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, where the instruction is used to query information of foreground applications running in the terminal to obtain a list of the foreground applications.
S340: and screening out a target process list running in 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 because the user process list records all running user processes, the foreground process list records all foreground running user processes, and the difference between the two is obtained, the target process list recording the background running application is obtained.
S350: and respectively reading the memory information corresponding to each application in the target process list, respectively taking the application packet name corresponding to the memory occupation larger than a set threshold 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.
In this embodiment, the virtual host parses the target process list, obtains a memory occupancy value corresponding to each background running application, performs data analysis on each memory occupancy value, extracts a median of each memory occupancy value as a predetermined threshold, and determines that the memory occupancy value greater than the predetermined threshold occupies too much memory resources for the corresponding application. In this embodiment, the application package name whose memory usage value is greater than the predetermined threshold is used as the second package name, and then a control instruction is formed according to the second package name, and the application package name whose memory usage value is less than the predetermined threshold is not processed. And the virtual host sends a control instruction corresponding to the second packet name to the terminal in an ADB mode, controls the background process with overlarge memory occupation in the terminal and forcibly stops the background process with the memory occupation larger than a set threshold value in the terminal.
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, respectively stops running the background applications corresponding to the second packet names, and counts resources occupied by the background applications corresponding to the second packet names, such as memory size, and displays the statistics on the terminal screen as an execution result.
In this embodiment, a virtual host is locally set in a terminal; monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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 a virtual host mode locally at the terminal, user processes and foreground processes are counted respectively through an ADB debugging mechanism, background applications running in the terminal are obtained after screening, the background applications are analyzed, the background applications with the excessively large memory occupation are selected to be terminated, resources with the excessively large memory occupation are released, the background applications with the terminated memory are terminated by the terminal, the background applications are influenced by the android system, the background applications are difficult to be revived by a third party, and therefore 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 at a terminal;
a monitoring module 402, configured to monitor a target port of the virtual host in communication with the terminal, and perform ADB connection between the terminal and the virtual host through the target port;
a sending module 403, configured to send a control instruction to the terminal in an ADB mode by the virtual host; the control instruction is used for stopping the application program running in the background in the terminal;
and a display module 404, 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 manner, the setting module includes:
the receiving unit is used for receiving an opening instruction of the auxiliary authority triggered by the 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 a 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 a wireless debugging port by the terminal through the target port and waiting for the establishment of debugging connection;
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 being identified as an upper computer for debugging by the terminal if the virtual host passes the authentication.
In a possible implementation, 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 the verification is passed to the terminal;
a sending subunit, configured to send, by the terminal, a second verification token to the virtual host again according to the verification signature;
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 and private key file.
In one possible implementation, the apparatus further includes:
an obtaining module, configured to obtain, by the virtual host, a user process list running in the terminal and a foreground process list running in a foreground based on ADB connection;
and the screening module is used for screening out a target process list running in a background on the basis of the user process list and the foreground process list.
In a possible implementation manner, the sending module specifically includes:
and the first control unit is used for respectively reading the first packet names corresponding to the 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 the application packet names corresponding to the memory occupation larger than a set threshold value as second packet names, and the virtual host sends a control instruction corresponding to the second packet names to the terminal in an ADB mode.
The electronic device of the embodiments of the present application exists in various forms, including but not limited to the following devices.
(1) A mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice and data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) The ultra-mobile personal computer equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This kind of equipment includes: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) And other electronic devices with data interaction functions.
Further, an embodiment of the present application also provides a computer-readable storage medium for storing computer-executable instructions, which when executed by a processor implement the following process: 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 device and comprises an instruction for acquiring screen display content; executing the control instruction, including: acquiring screen display content of first terminal equipment; and sending an execution result of the control instruction to the second terminal equipment, wherein the execution result of the control instruction comprises screen display content of the first terminal equipment.
Further, an embodiment of the present application also provides a computer-readable storage medium for storing computer-executable instructions, which when executed by a processor implement the following process: establishing connection with first terminal equipment; sending a control instruction to the first terminal device, wherein the control instruction is input through an input device of a second terminal and 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 equipment on the display equipment of the second terminal equipment.
Thus, when executed by a processor, the computer-executable instructions can perform the methods described in the foregoing method embodiments, and implement the functions and advantages of the methods described in the foregoing method embodiments, which are not described herein again.
The computer-readable storage medium includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Further, embodiments of the present application also provide a computer program product, the 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 process: 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 device and comprises an instruction for acquiring screen display content; executing the control instruction, including: acquiring screen display content of first terminal equipment; and sending an execution result of the control instruction to the second terminal equipment, wherein the execution result of the control instruction comprises screen display content of the first terminal equipment.
Further, embodiments of the present application also provide a computer program product, the 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 process: establishing connection with a first terminal device; sending a control instruction to the first terminal device, wherein the control instruction is input through an input device of a second terminal and 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 equipment on the display equipment of the second terminal equipment.
Therefore, the computer program product provided in the embodiment of the present application can execute the methods described in the foregoing method embodiments, and implement the functions and advantages of the methods described in the foregoing method embodiments, which are not described herein again.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (14)

1. A method of controlling a terminal, comprising:
setting a virtual host locally at a terminal;
monitoring a target port of the virtual host for communicating with the terminal, and carrying out ADB connection on the terminal and the virtual host 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 the 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.
2. The method of claim 1, wherein setting up the virtual host locally at the terminal comprises:
receiving an opening instruction of an auxiliary authority triggered by a user;
according to the starting instruction, a developer debugging mode and a wireless debugging switch corresponding to the terminal are started;
and in a wireless debugging mode, a virtual host is locally established, 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 connecting the terminal and the virtual host through the target port comprises:
the terminal initiates connection monitoring to a wireless debugging port through the target port and waits for the establishment of debugging connection;
when the terminal monitors that the virtual host initiates a connection request through the target port, the terminal initiates authentication to the virtual host through the public and private key file;
and if the virtual host passes the authentication, the virtual host is identified as an upper computer for debugging by the terminal.
4. The method of claim 3, wherein when the authentication is initiated to the virtual host via the public-private key file,
the virtual host verifies a first verification token sent by the terminal and sends a corresponding verification signature after the 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 and private key file.
5. The method of claim 1, wherein before the virtual host sends the control command to the terminal in the ADB mode, the method further comprises:
the virtual host acquires a user process list running in the terminal and a foreground process list running in a foreground based on ADB connection;
and screening out a target process list running in the background based on the user process list and the foreground process list.
6. The method according to claim 5, wherein the virtual host sends a control command to the terminal in an ADB mode, specifically:
and respectively reading the first packet names corresponding to the 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.
7. The method of claim 5, further comprising:
and respectively reading the memory information corresponding to each application in the target process list, respectively taking the application packet name corresponding to the memory occupation larger than a set threshold 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.
8. An apparatus for controlling a terminal, comprising:
the setting module is used for setting a virtual host locally at 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 and the virtual host through the target port;
a sending module, configured to send a control instruction to the terminal in an ADB mode by the virtual host; the control instruction is used for stopping the application program running in the background in the terminal;
and the display module is used for the terminal to execute the control instruction and display an execution result corresponding to the control instruction on a terminal screen.
9. The apparatus of claim 8, wherein the setup module comprises:
the receiving unit is used for receiving an opening instruction of the auxiliary authority 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 a wireless debugging mode and generating a public and private key file so as to establish ADB connection with the terminal.
10. The apparatus of claim 8 or 9, wherein the monitoring module comprises:
the monitoring unit is used for initiating connection monitoring to a wireless debugging port by the terminal through the target port and waiting for the establishment of debugging connection;
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 being identified as an upper computer for debugging by the terminal if the virtual host passes the authentication.
11. The device according to claim 10, characterized in that 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 the verification is passed to the terminal;
a sending subunit, configured to send, by the terminal, a second verification token to the virtual host again according to the verification signature;
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 and private key file.
12. The apparatus of claim 8, further comprising:
an obtaining module, configured to obtain, by the virtual host, a user process list running in the terminal and a foreground process list running in a foreground based on ADB connection;
and the screening module is used for screening out a target process list running in a background on the basis of the user process list and the foreground process list.
13. The apparatus according to claim 12, wherein the sending module specifically includes:
and the first control unit is used for respectively reading the first packet names corresponding to the 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.
14. The apparatus of claim 12, further comprising:
and the second control unit is used for respectively reading the memory information corresponding to each application in the target process list, respectively taking the application packet names corresponding to the memory occupation larger than a set threshold value as second packet names, and the virtual host sends a control instruction corresponding to the second packet names to the terminal 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 true CN114968456A (en) 2022-08-30
CN114968456B 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)

Cited By (1)

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

Citations (15)

* 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
US20150332043A1 (en) * 2014-05-15 2015-11-19 Auckland Uniservices Limited Application analysis system for electronic devices
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

Patent Citations (15)

* 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
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WEIXIN_34137799: "使用adb命令停止APP后台进程的方法", pages 1 - 2, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_34137799/article/details/90589031?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-9-90589031-blog-83069028.235^v38^pc_relevant_default_base&spm=1001.2101.3001.4242.6&utm_relevant_index=10> *

Cited By (2)

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

Also Published As

Publication number Publication date
CN114968456B (en) 2024-03-08

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
CN109165157B (en) Method for testing application program and test platform
CN107329750A (en) The recognition methods of advertisement page, jump method and mobile terminal in application program
CN105573778B (en) Application program starting method and terminal
CN105718171B (en) A kind of data processing method and terminal
WO2014015732A1 (en) Method and system for generating terminal capability description information
CN107402792B (en) Integration method, device, equipment and storage medium of application software installation package
CN105786839A (en) Application data acquisition method and apparatus
CN102736954A (en) Addressing system degradation by application disabling
US20170033980A1 (en) Agent manager for distributed transaction monitoring system
CN112316417B (en) Control equipment connection method, device, equipment and computer readable storage medium
CN108090345B (en) Linux system external command execution method and device
CN114968456B (en) Method and device for controlling terminal
CN106101836A (en) The player method of intelligent television and device
CN111142900A (en) Program updating method and device and terminal equipment
WO2024109786A1 (en) Instant messaging session information processing method and apparatus, and electronic device
CN111641554B (en) Message processing method and device and computer readable storage medium
CN114042310A (en) Game operation data collection method and device, computer equipment and storage medium
CN114356867A (en) Method and device for opening compressed package file, electronic equipment and storage medium
CN107678737B (en) Service processing method and device and self-service terminal equipment
CN113687925A (en) Equipment operation processing method and device, storage medium and computer equipment
CN113867831A (en) Intelligent device control method, intelligent device, storage medium and electronic device
CN113448585A (en) Optimization method and device for thread pool, electronic equipment and storage medium
CN111031145A (en) Remote assistance method and system based on intelligent terminal

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