Method for realizing remote control of mobile phone based on non-root permission
Technical Field
The invention relates to the technical field of remote control of mobile phones, in particular to a method for realizing remote control of a mobile phone based on non-root authority.
Background
The mobile phone is one of the essential and portable electronic products of modern people, and has been deeply integrated into the work and life of people. However, many people encounter various problems that cannot be solved by themselves in the process of using the mobile phone, which is particularly obvious for mobile phone users with higher ages. Remote control is a convenient mode, and the problem can be solved by installing the app in the mobile phones of the two parties in a mode that one mobile phone remotely controls the other mobile phone, which is similar to a remote assistance function of a pc end.
The remote control of the mobile phone end can help people to solve problems anytime and anywhere, reduces the cost for people to learn to use the mobile phone and solve problems when using the mobile phone, and brings convenience and benefits to life of people.
When the remote control function is used at present, the mobile phone of the controlled party is required to acquire root authority to achieve the control function, so that the problems brought about are as follows:
(1) remotely controlling the mobile phone by using the mobile phone, wherein a root authority of the mobile phone needs to be acquired;
(2) the data and system security of the mobile phone of the controlled party are reduced;
(3) the difficulty and the cost of using the remote control function by the user are improved.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method for realizing remote control of a mobile phone based on non-root authority. The problems in the prior art are solved by transmitting the screen gesture operation data through a protocol and calling through barrier-free service.
In order to achieve the purpose, the invention adopts the following specific scheme:
the invention provides a method for realizing remote control of a mobile phone based on non-root authority, which comprises the following steps:
s1, the control party packages the gesture operation content of the screen into an event and sends the event to the controlled party; the control and controlled party is in a communication connection state, and data such as WeChat, qq and the like are transmitted through communication software;
s2, the controlled party receives the event information, analyzes and converts the event information and then sends the event information to the screen of the controlled party;
and S3, finishing the gesture operation instruction contained in the event information by the screen of the controlled party.
Further, step S1 specifically includes: the method comprises the steps that a control party creates a self-defined event, a processor collects a touch event of a screen, packages the type, the duration (duration) of the event, the number (id) of the event, the coordinates (x and y) of the last event and the coordinates (x 'and y') of the current event according to a control protocol, and then transmits the packaged data to a controlled party.
Further, the type of the event includes any one or more of the following actions: click, double click, long press, slide, lift.
The control protocol defines each data in the event, and then the packaged data is sent through a protocol such as TCP/IP.
Further, step S2 specifically includes:
the controlled party self-defines the Android barrier-free service, analyzes the event data transmitted by the controlled party and re-encapsulates the event data into the event type required by the self-defined barrier-free service, and sends the event to the screen of the controlled party through the self-defined barrier-free service DispatcGesture function, so that the purpose of control is achieved.
Further, step S2 further includes the following steps:
s21, analyzing the event data transmitted by the controlled party;
s22, encapsulating the analyzed data into GesturreDescription.
S23, storing the GesturDescription.Stroke Description data into a Queue;
s24, creating a self-defined service component inherited from the Android accessitiveService;
s25, acquiring GesturDescription.Stroke Description event data from the Queue in the self-defined service;
s26, calling DispatchGesture (GesturgeDescription. Stroke Description, GesturgeResultCallback) in the customized service and sending GesturgeDescription. Stroke Description data to the Android system to trigger an event on the mobile phone screen of the controlled party;
s27, get the next event from Queue in the onCompleted function of GestureResultCallback and execute the operation of S26.
Through the steps, the operation gesture data of the control party is continuously sent to the mobile phone screen of the controlled party and executed, and therefore remote control of the mobile phone is achieved.
By adopting the technical scheme of the invention, the invention has the following beneficial effects:
the invention provides a method for realizing remote control of a mobile phone based on non-root authority, which comprises the following steps: the control party collects the pressing, sliding and lifting events of a user on a screen, packages the events according to a protocol and then transmits the events to the controlled party; the controlled party self-defines the Android barrier-free service, analyzes the event data transmitted by the control party and re-encapsulates the event data into the event type required by the self-defined barrier-free service, and sends the event to the screen through the self-defined dispatch Gesture function of the barrier-free service to achieve the purpose of control; by the method, the other mobile phone can be remotely controlled by the mobile phone conveniently under the condition that the root authority of the mobile phone is not required to be acquired, so that the remote assistance threshold of the mobile terminal is reduced, and the safety and the stability of the data of the mobile phone are not influenced.
Drawings
FIG. 1 is a flow chart of an embodiment of the present invention;
FIG. 2 is a flowchart of event information execution at a controlled party in accordance with an embodiment of the present invention;
fig. 3 is a basic flowchart for implementing remote control.
Detailed Description
The invention is further described below with reference to the following figures and specific examples.
The present invention will be described in detail with reference to FIGS. 1 to 3
The invention provides a method for realizing remote control of a mobile phone based on non-root authority, which comprises the following specific implementation scheme:
the method comprises the steps that a controller collects events of pressing, sliding and lifting of a screen of a user and packages the events according to a protocol and then transmits the events to a controlled party, the controlled party self-defines Android barrier-free service, analyzes event data transmitted by the controller and packages the event data into event types required by the self-defined barrier-free service again, and the events are transmitted to the screen through a self-defined dispatch Gesture function of the barrier-free service, so that the purpose of control is achieved. The method comprises the following steps:
the control method comprises the following steps:
1. and creating a self-defined touch event of the screen acquired by the event processor, packaging the type (clicking, double clicking, long pressing, sliding and lifting) of the event, the event duration, the event id, the coordinates x and y of the last event and the coordinates x 'and y' of the event according to a control protocol, and transmitting the packaged data to the controlled party.
The controlled party:
1. analyzing the event data transmitted by the controlled party;
2. encapsulating the analyzed data into GesturreDescription.
3. Storing GestureDescription, Stroke Description data in a Queue;
4. creating a self-defined service component inheriting from the Android, of the accessitivetService;
5. acquiring GesturDescription.Stroke Description event data from a Queue in the self-defined service;
6. calling in a custom service
dispatchGesture(GestureDescription.StrokeDescription,GestureResultCallback)
The method sends GesturDescription.Stroke Description data to an Android system trigger event;
7. the next event is fetched from the Queue in the onCompleted function of getureresultcallback and the operation of step 6 is performed.
Through the steps, the operation gesture data of the control party is continuously sent to the mobile phone screen of the controlled party and executed, and therefore remote control of the mobile phone is achieved.
The technical scheme realizes the control flow of fig. 3 through event information:
the control party sends information to the controlled party, the controlled party receives the information and confirms that the controlled party agrees to be controlled, and the control party obtains control authority to carry out remote operation.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.