A method for using a handle to operate based on Android system shell permissions

By obtaining shell permissions on the Android system and using client programs to convert the handle operation signal into a touch signal, the problem of smartphone games not supporting handle operation is solved, achieving a better game control experience.

CN113805970BActive Publication Date: 2024-11-22HUNAN XIAOSUAN TECH INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111110923.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-18
Publication Date
2024-11-22
Estimated Expiration
2041-09-18

AI Technical Summary

Technical Problem

Existing smartphone games do not support the operation of external game controllers, which makes it impossible for users to obtain a better gaming operating experience through the controller.

Method used

By using client programs on the Android system to obtain shell permissions, convert the operating signal of the external controller into the touch input signal of the mobile phone touch screen, and use sys_api_service to call the system internal function to make the touch signal effective on the Android terminal device, thereby realizing that the controller is used to play mobile games control.

Benefits of technology

This enables Android terminal devices that cannot support game controller control to be controlled using game controllers, improving the game operating experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113805970B_ABST
    Figure CN113805970B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for using a handle to operate based on the Android system shell authority, comprising the following steps: S1, connecting an Android terminal device with a client program installed to a PC and opening a debugging mode; S2, running a preset script program on the PC; S3, the script program executes and starts a predetermined process, the process having a service that can call a system function with high authority, referred to as sys_api_service; S4, the client program establishes a connection with the sys_api_service; S5, pairing and connecting the handle with the Android terminal device; S6, configuring a binding relationship between a mapping control and a handle button on the client program; S7, operating a game handle; S8, the client program receives an operation signal of the handle and converts it into a corresponding touch signal, and calls a system internal function through sys_api_service to make the touch signal effective on the Android terminal device. The present invention can enable games that originally cannot support the use of a handle to be controlled using a handle, facilitates the user's game operation, and improves the game control experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Android system applications, and in particular relates to a method for using a handle to operate based on Android system shell permissions. Background Art

[0002] Smartphones are now so popular that they have become an essential electronic product in our lives. At the same time, a large number of electronic games developed based on smartphone operating systems have also appeared. In the past, most people played electronic games on personal computers and home game consoles, but now, due to the portability and ease of operation of smartphones, people are more inclined to play games on smartphones, thus forming a huge mobile game user group.

[0003] As we all know, the input operation of smartphones is through capacitive touch screen. For general game players, using touch screen to play games can meet their needs. However, there are also some users who want to use external game controllers to play games. They want to get a better game operation experience through such devices. However, most mobile games currently do not support these external controllers.

[0004] In summary, there is an urgent need to provide a method for using a handle to operate based on the Android system shell authority, which can convert the operation signal of an external handle into a touch input signal of a mobile phone touch screen, so as to achieve the control of terminal device related operations of the Android system. Summary of the invention

[0005] The purpose of the present invention is to provide a method for using a handle to operate based on the shell authority of the Android system, which can convert the operation signal of an external handle into a touch input signal of a mobile phone touch screen, thereby achieving the control of terminal device related operations of the Android system.

[0006] The above object is achieved through the following technical solution: A method for using a handle to operate based on the Android system shell permission, comprising the following steps:

[0007] S1, connect the Android terminal device with the client program installed to the PC and turn on the debugging mode;

[0008] S2, runs a preset script program on the PC;

[0009] S3, the script program executes and starts a predetermined process, the process has a high-authority service that can call system functions, the service that can call system functions is referred to as sys_api_service, and sys_api_service can call system internal functions and send touch signals to the screen of the Android terminal device;

[0010] S4, the client program establishes a connection with sys_api_service;

[0011] S5, pair the controller with the Android terminal device;

[0012] S6, the client program provides a mapping control, and the binding relationship between the mapping control and the handle button is configured on the client program;

[0013] S7, operate the game controller;

[0014] S8, the client program receives the operation signal of the handle and converts it into a corresponding touch signal, and calls the system internal function through sys_api_service to make the touch signal effective on the Android terminal device.

[0015] This technical solution is to use an intermediate layer software (client program) on the Android operating system to obtain the Android system shell authority to convert the input operation signal of the external handle into the touch input signal of the mobile phone touch screen, so as to achieve the purpose of controlling the mobile phone game. The method of obtaining the Android system shell authority is not limited, and it can be the traditional USB connection to the computer or other methods. It should be noted that those skilled in the art should be aware that such a program can be compiled according to the functions and steps to be implemented by the client program to realize the binding relationship between the configuration mapping control and the handle button and the function of converting the received handle operation signal into the corresponding touch signal.

[0016] A further technical solution is that the debugging mode in step S1 is a USB debugging mode, and the specific steps of step S1 are as follows:

[0017] S1.1, use a USB cable to connect the Android terminal device to the computer;

[0018] S1.2, enter the setting interface of the Android terminal device;

[0019] S1.3, turn on developer mode;

[0020] S1.4, enter the developer options and check USB debugging.

[0021] A further technical solution is that after the script program in steps S2 and S3 is run, a predetermined instruction is executed through adb shell, and after the execution, sys_api_service will be started.

[0022] A further technical solution is that the specific steps of step S5 are as follows:

[0023] S5.1, open the Bluetooth settings interface of the Android terminal device and enable Bluetooth search.

[0024] S5.2, turn on the Bluetooth pairing mode of the controller.

[0025] S5.3, find the controller in the Bluetooth search list of the Android terminal device and click it to connect and pair.

[0026] A further technical solution is that the specific steps of step S6 are as follows:

[0027] S6.1, enter the main interface of the client program, and add the target game operated by the target handle to the game list of the client program;

[0028] S6.2, display the configuration menu, which contains options corresponding to the buttons and joysticks of the target controller. Click the required options one by one, and mapping controls that form a binding relationship with the buttons or joysticks of the controller are added one by one on the interface of the Android terminal device.

[0029] A further technical solution is that the specific steps in step S6.2 are as follows: enter the target game, and the floating button created by the client program is displayed on the upper layer of the target game interface. The floating button creates a system-level window by calling the addView function of WindowManager. Click the floating button to display a configuration menu. The configuration menu includes options of buttons, left joystick and right joystick. Click one of the three options of buttons, left joystick and right joystick. When the option is clicked, a corresponding mapping control will be added to the interface of the Android terminal device.

[0030] A further technical solution is that in step S6.2, when the left joystick option is clicked, a mapping control that forms a binding relationship with the left joystick of the handle will be added to the Android terminal device interface; when the right joystick option is clicked, a mapping control that forms a binding relationship with the right joystick of the handle will be added to the Android terminal device interface; when the button option is clicked, a mapping control that has not yet been bound will appear on the Android terminal device interface. At this time, when one of the buttons on the handle is pressed, the mapping control that has not yet been bound will form a binding relationship with the corresponding button pressed on the handle, and in this way, the configuration of the mapping controls that form binding relationships with other buttons of the handle is completed in turn.

[0031] A further technical solution is that the specific steps of step S8 are as follows:

[0032] S8.1, the client program receives the operation signal of the handle;

[0033] S8.2, the client program converts the operation signal input by the handle into a touch signal of the mobile phone touch screen and sends it to sys_api_service;

[0034] S8.3, sys_api_service calls the system internal function to make the touch signal effective on the mobile phone.

[0035] A further technical solution is that when the button of the operating handle is operated in step S7, two response values ​​of "press" and "lift" will be generated. In step S8.2, the two response values ​​of "press" or "lift" become the corresponding touch signal input of the Android terminal device screen, and the input position of the touch signal on the screen is the position of the mapping control bound to the corresponding button on the Android terminal device screen.

[0036] A further technical solution is that when the joystick of the operating handle is operated in step S7, in step S8.2, the corresponding coordinate point value is proportionally projected to the area of ​​the joystick mapping control in the screen of the Android terminal device, and then a screen touch signal is generated at the projected position. When the joystick is reset to the origin from the pushed state, a "lifted" screen touch event will be generated.

[0037] A further technical solution is that when the joystick of the operating handle is operated in step S7, in step S8.2, the client program first determines the direction of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called direction A, and then determines the distance of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called distance A, and then generates a continuous sliding touch signal. The direction of the sliding touch signal is direction A, and the sliding speed is positively correlated with distance A. When distance A is 0, it is determined that the joystick is reset and the sliding signal is canceled.

[0038] The implementation of the technical solution of the present invention can enable Android terminal device games that originally cannot support control using a game controller to be controlled using a game controller, thereby facilitating the user's game operation and improving the game control experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0040] Figure 1 A flowchart of a method for using a handle to operate based on Android system shell permissions according to an embodiment of the present invention;

[0041] Figures 2 to 4 A schematic diagram of an operation interface of a configuration mapping control involved in an embodiment of the present invention;

[0042] Figure 5 A schematic diagram of a handle;

[0043] Figure 6This is a schematic diagram of the operating status of a handle joystick involved in an embodiment of the present invention, wherein: Figure ① is the state when the joystick is not operated (reset state, the coordinate point is at the origin of the coordinate axis), Figure ② is the state when the joystick is pushed to the uppermost position; Figure ③ is the state when the joystick is pushed to the lowermost position; Figure ④ is the state when the joystick is pushed to the leftmost position; Figure ⑤ is the state when the joystick is pushed to the rightmost position. DETAILED DESCRIPTION

[0044] The present invention is described in detail below in conjunction with the accompanying drawings. The description in this part is only exemplary and explanatory and should not have any limiting effect on the scope of protection of the present invention. In addition, those skilled in the art can make corresponding combinations of the features in the embodiments and in different embodiments in this document based on the description of this document.

[0045] The embodiments of the present invention are as follows, referring to Figure 1 , a method for using a handle to operate based on the Android system shell permission, comprising the following steps:

[0046] S1, connect the Android terminal device with the client program installed to the PC and turn on the debugging mode;

[0047] S2, runs a preset script program on the PC;

[0048] S3, the script program executes and starts a predetermined process, the process has a high-authority service that can call system functions, the service that can call system functions is referred to as sys_api_service, and sys_api_service can call system internal functions and send touch signals to the screen of the Android terminal device;

[0049] S4, the client program establishes a connection with sys_api_service;

[0050] S5, pair the controller with the Android terminal device;

[0051] S6, the client program provides a mapping control, and the binding relationship between the mapping control and the handle button is configured on the client program;

[0052] S7, operate the game controller;

[0053] S8, the client program receives the operation signal of the handle and converts it into a corresponding touch signal, and calls the system internal function through sys_api_service to make the touch signal effective on the Android terminal device.

[0054] This technical solution is to use an intermediate layer software (client program) on the Android operating system to obtain the Android system shell authority to convert the input operation signal of the external handle into the touch input signal of the mobile phone touch screen, so as to achieve the purpose of controlling the mobile phone game. The method of obtaining the Android system shell authority is not limited, and it can be the traditional USB connection to the computer or other methods. It should be noted that those skilled in the art should be aware that such a program can be compiled according to the functions and steps to be implemented by the client program to realize the binding relationship between the configuration mapping control and the handle button and the function of converting the received handle operation signal into the corresponding touch signal.

[0055] Based on the above embodiment, in another embodiment of the present invention, the debugging mode in step S1 is a USB debugging mode, and the specific steps of step S1 are as follows:

[0056] S1.1, use a USB cable to connect the Android terminal device to the computer;

[0057] S1.2, enter the setting interface of the Android terminal device;

[0058] S1.3, turn on developer mode;

[0059] S1.4, enter the developer options and check USB debugging.

[0060] On the basis of the above embodiment, in another embodiment of the present invention, the script program in steps S2 and S3 executes a predetermined instruction through adb shell after running, and after execution, sys_api_service will be started. The script program will start to execute after double-clicking the mouse. The code logic written in this script program is to execute the "nohup app_process-Djava.class.path= / data / local / tmp / system-api.apk / data / local / tmpcom.sbx.systemapi.Main> / dev / null 2>&1&" command through adb shell. The " / data / local / tmp / system-api.apk" part in this command indicates the storage path of the sys_api_service program package, and the " / data / local / tmpcom.sbx.systemapi.Main" part indicates the path of the class where the sys_api_service program entry Main method is located. The path given here is only an example, and the actual situation can be placed in a suitable position as needed. After this command is executed, sys_api_service will be started.

[0061] sys_api_service is started by adb shell and has higher permissions than ordinary application processes, so it can call the system's internal functions to send a touch signal to the phone screen. The client program does not have the permission to send touch signals to the system, but it communicates with sys_api_service after establishing a connection, and can generate a touch signal by forwarding the touch signal to the operating system. sys_api_service plays a bridge role here.

[0062] Based on the above embodiment, in another embodiment of the present invention, the specific steps of step S5 are as follows:

[0063] S5.1, open the Bluetooth settings interface of the Android terminal device and enable Bluetooth search.

[0064] S5.2, turn on the Bluetooth pairing mode of the controller.

[0065] S5.3, find the controller in the Bluetooth search list of the Android terminal device and click it to connect and pair.

[0066] Based on the above embodiment, in another embodiment of the present invention, the specific steps of step S6 are as follows:

[0067] S6.1, enter the main interface of the client program, and add the target game operated by the target handle to the game list of the client program;

[0068] S6.2, display the configuration menu, which contains options corresponding to the buttons and joysticks of the target controller. Click the required options one by one, and mapping controls that form a binding relationship with the buttons or joysticks of the controller are added one by one on the interface of the Android terminal device.

[0069] Based on the above embodiment, in another embodiment of the present invention, the specific steps in step S6.2 are as follows: Enter the target game, such as Figure 2 , the floating button created by the client program is displayed on the upper layer of the target game interface. The floating button is a system-level window created by calling the addView function of WindowManager, so it can be covered on the upper layer of the game interface; click the floating button to display the configuration menu, such as Figure 3 There are options for buttons, left joystick and right joystick in the configuration menu. Click one of the three options. When the option is clicked, the corresponding mapping control will be added to the interface of the Android terminal device.

[0070] Based on the above embodiment, in another embodiment of the present invention, Figure 2In step S6.2, when the left joystick option is clicked, a mapping control that forms a binding relationship with the left joystick of the handle is added to the Android terminal device interface; when the right joystick option is clicked, a mapping control that forms a binding relationship with the right joystick of the handle is added to the Android terminal device interface, and a mapping control is a View; when the button option is clicked, such as Figure 3 , a mapping control that has not yet been bound will appear on the Android terminal device interface. At this time, press one of the buttons on the controller, and the mapping control that has not yet been bound will form a binding relationship with the corresponding button pressed on the controller. In this way, the configuration of the mapping controls that have formed binding relationships with other buttons of the controller will be completed in turn.

[0071] For example: There is currently a mapping control in the waiting-to-bind state on the screen. At this time, press button A on the controller, and A will be displayed on the mapping control, and a binding relationship is formed with button A on the controller. Figure 4 The following figure shows the situation when the left joystick, right joystick, A button, B button, X button, and Y button have been configured.

[0072] Based on the above embodiment, in another embodiment of the present invention, Figure 2 The specific steps of step S8 are as follows:

[0073] S8.1, the client program receives the operation signal of the handle;

[0074] S8.2, the client program converts the operation signal input by the handle into a touch signal of the mobile phone touch screen and sends it to sys_api_service;

[0075] S8.3, sys_api_service calls the system internal function to make the touch signal effective on the mobile phone.

[0076] The game controller operation signal value and the screen touch signal value are two different modes, so the client needs to perform a conversion after receiving the controller operation signal.

[0077] There are two types of operating devices on the game controller, one is an ordinary button and the other is a joystick. For ordinary buttons: the operation is relatively simple, and only two response values ​​​​are generated, "press" and "lift". When the ordinary buttons of the operating handle are used, these two response values ​​​​will become touch signal inputs on the mobile phone screen, and the input position of the touch signal on the screen is the position of the mapping control bound to the corresponding button on the mobile phone screen. Therefore, based on the above embodiment, in another embodiment of the present invention, when the buttons of the operating handle are operated in step S7, two response values ​​​​of "press" and "lift" will be generated. In the step S8.2, the two response values ​​​​of "press" or "lift" become the corresponding touch signal inputs on the Android terminal device screen, and the input position of the touch signal on the screen is the position of the mapping control bound to the corresponding button on the Android terminal device screen.

[0078] For example, when the X button on the game controller is pressed, a pressed touch signal will be input to the position of the X mapping control on the mobile phone screen. Similarly, when the X button on the controller is lifted, a lifted touch signal will be input to the position of the X mapping control.

[0079] For joysticks, the operation of joysticks is more complicated than that of ordinary buttons, such as Figure 6 When operating the joystick, the response value is the coordinate point (x, y) of a point in the horizontal (x-axis) and vertical (y-axis) coordinate axes, as shown in the joystick operation status diagram. The response value coordinate point is the black dot in the circle, and the moving range of the coordinate point is only within the large circle.

[0080] According to different operation requirements, the input signal of the joystick is converted into a touch signal to form multiple modes: point-to-point touch mode: when the joystick of the handle is operated in step S7, in step S8.2, the corresponding coordinate point value is projected proportionally to the area of ​​the joystick mapping control in the screen of the Android terminal device, and then a screen touch signal is generated at the projected position. When the joystick is reset to the origin from the pushed state, a "lifted" screen touch event will be generated.

[0081] Continuous sliding mode: When operating the joystick of the handle in step S7, in step S8.2, the client program first determines the direction of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called direction A, and then determines the distance of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called distance A, and then generates a continuous sliding touch signal. The direction of the sliding touch signal is direction A, and the sliding speed is positively correlated with distance A. When distance A is 0, it is determined that the joystick is reset and the sliding signal is canceled.

[0082] The implementation of the technical solution of the present invention can enable Android terminal device games that originally cannot support control using a game controller to be controlled using a game controller, thereby facilitating the user's game operation and improving the game control experience.

[0083] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for using a handle to operate based on the Android system shell authority, characterized in that: The steps include: S1, connect the Android terminal device with the client program installed to the PC and turn on the debugging mode; S2, runs a preset script program on the PC; S3, the script program executes and starts a predetermined process, the process has a high-authority service that can call system functions, the service that can call system functions is referred to as sys_api_service, and sys_api_service can call system internal functions and send touch signals to the screen of the Android terminal device; S4, the client program establishes a connection with sys_api_service; S5, pair the controller with the Android terminal device; S6, the client program provides a mapping control, and the binding relationship between the mapping control and the handle button is configured on the client program; S7, operate the game controller; S8, the client program receives the operation signal of the handle and converts it into a corresponding touch signal, and calls the system internal function through sys_api_service to make the touch signal effective on the Android terminal device; S8.1, the client program receives the operation signal of the handle; S8.2, the client program converts the operation signal input by the handle into a touch signal of the mobile phone touch screen and sends it to sys_api_service; S8.3, sys_api_service calls the system internal function to make the touch signal effective on the mobile phone.

2. The method for using a handle to operate based on the Android system shell authority according to claim 1, characterized in that: The debugging mode in step S1 is the USB debugging mode, and the specific steps of step S1 are as follows: S1.1, use a USB cable to connect the Android terminal device to the computer; S1.2, enter the setting interface of the Android terminal device; S1.3, turn on developer mode; S1.4, enter the developer options and check USB debugging.

3. The method for using a handle to operate based on the Android system shell authority according to claim 1, characterized in that: The specific steps of step S5 are as follows: S5.1, open the Bluetooth settings interface of the Android terminal device and enable Bluetooth search; S5.2, turn on the Bluetooth pairing mode of the controller; S5.3, find the controller in the Bluetooth search list of the Android terminal device and click it to connect and pair.

4. The method for using a handle to operate based on the Android system shell authority according to any one of claims 1 to 3, characterized in that: The specific steps of step S6 are as follows: S6.1, enter the main interface of the client program, and add the target game operated by the target handle to the game list of the client program; S6.2, display the configuration menu, which contains options corresponding to the buttons and joysticks of the target controller. Click the required options one by one, and mapping controls that form a binding relationship with the buttons or joysticks of the controller are added one by one on the interface of the Android terminal device.

5. The method for using a handle to operate based on the Android system shell authority according to claim 4, characterized in that: The specific steps in step S6.2 are as follows: enter the target game, the floating button created by the client program is displayed on the upper layer of the target game interface, the floating button creates a system-level window by calling the addView function of WindowManager, click the floating button to display the configuration menu, the configuration menu has options of buttons, left joystick and right joystick, click one of the three options of buttons, left joystick and right joystick, when the option is clicked, the corresponding mapping control will be added to the interface of the Android terminal device.

6. The method for using a handle to operate based on the Android system shell authority according to claim 5, characterized in that: In step S6.2, when the left joystick option is clicked, a mapping control that forms a binding relationship with the left joystick of the handle will be added to the Android terminal device interface; when the right joystick option is clicked, a mapping control that forms a binding relationship with the right joystick of the handle will be added to the Android terminal device interface; when the button option is clicked, a mapping control that has not yet been bound will appear on the Android terminal device interface. At this time, when one of the buttons on the handle is pressed, the mapping control that has not yet been bound will form a binding relationship with the corresponding button pressed on the handle, and in this way, the configuration of the mapping controls that have formed binding relationships with other buttons of the handle is completed in turn.

7. The method for using a handle to operate based on the Android system shell authority according to claim 6, characterized in that: When operating the button of the handle in step S7, two response values ​​of "press" and "lift" are generated. In step S8.2, the two response values ​​of "press" or "lift" become the input of the corresponding touch signal on the screen of the Android terminal device. The input position of the touch signal on the screen is the position of the mapping control bound to the corresponding button on the screen of the Android terminal device.

8. The method for using a handle to operate based on the Android system shell authority according to claim 7, characterized in that: When the joystick of the handle is operated in step S7, in step S8.2, the corresponding coordinate point value is projected proportionally to the area of ​​the joystick mapping control in the screen of the Android terminal device, and then a screen touch signal is generated at the projected position. When the joystick is reset to the origin from the pushed state, a "lifted" screen touch event will be generated.

9. The method for using a handle to operate based on Android system shell permissions according to claim 7, characterized in that: When operating the joystick of the handle in step S7, in step S8.2, the client program first determines the direction of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called direction A, and then determines the distance of the joystick response value coordinate point relative to the origin of the coordinate axis, which is called distance A, and then generates a continuous sliding touch signal. The direction of the sliding touch signal is direction A, and the sliding speed is positively correlated with distance A. When distance A is 0, it is determined that the joystick is reset and the sliding signal is canceled.