Android commands analog touch swipe to unlock

Source: Internet
Author: User
<span id="Label3"></p>  <p align="left"><p align="left">There are a lot of input devices on the phone, Power key, volume plus minus key, touch screen and so On. The numbers of these devices will vary from one phone to another, so we need to first understand what input devices are on the phone, and then use the script to manipulate the input devices to achieve some of the desired operations and then automate the testing through LOOPS.</p></p><p align="left"><p align="left"></p></p><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_1_7516209" class="plain" name="code"><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_1_7516209" class="plain" name="code">$ adb Shell cat/proc/bus/input/devices</pre></pre><p><p></p></p><p align="left"><p align="left">This command is to display the System's input device list, you need to understand the meaning of these devices, and then to operate these devices! What we need to do here is touch, from which we can see that the touch event is event1.</p></p><p align="left"><p align="left"></p></p><p align="left"><p align="left">Let's take the screen touch input as an example. will use two corresponding commands: getevent and sendevent, as the name implies, one is to get the event, the other is to send the simulation event.</p></p><p align="left"><p align="left"><br></p></p><p align="left"><p align="left">First we use GetEvent to understand the operation of the device, casually execute a getevent to monitor handler event1 (event1 for screen events):</p></p><p align="left"><p align="left"></p></p><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_2_6753624" class="plain" name="code"><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_2_6753624" class="plain" name="code">$ adb Shell Getevent/dev/input/event1</pre></pre><p><p></p></p><p align="left"><p align="left">The above instructions will only listen to the event1, and will not listen to other, such as the Power key, volume plus minus keys. Of course we can also listen to all the Events:</p></p><p align="left"><p align="left"></p></p><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_3_6862308" class="plain" name="code"><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_3_6862308" class="plain" name="code"></pre></pre><p><p></p></p><p align="left"><p align="left">Swipe to unlock to output these event messages</p></p><p align="left"><p align="left"></p></p><p align="left"><p align="left"><br></p></p><p align="left"><p align="left">The system will sample the touch event at a certain time, and the slower the sliding speed of the sampled information, the more we don't need to spend too much time on the numeric conversion, we can quickly slide, as long as the unlock can be achieved. Next we will convert the hexadecimal number into a decimal number to write to the shell script execution, you can achieve automatic unlocking.</p></p><p align="left"><p align="left"></p></p><p align="left"><p align="left">If you are currently in a dark screen, you will need to do the following:</p></p><p align="left"><p align="left"></p></p><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_4_3623706" class="plain" name="code"><pre code_snippet_id="1677749" snippet_file_name="blog_20160510_4_3623706" class="plain" name="code">$ adb shell Input KeyEvent 26</pre></pre>Simulates the Send power key event, and the screen is lit before the shell script can be executed.<br><p><p></p></p><p align="left"><p align="left"><br></p></p><p><p>Android commands analog touch swipe to unlock</p></p></span>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.