Home > other >  Written in python simulation android long press key combination (the volume reduction and mute) scri
Written in python simulation android long press key combination (the volume reduction and mute) scri

Time:10-07

The import OS
The import time
Def factory (count) :

I=1
While count> 0:
OS. Popen (" adb shell adds/dev/input/event1 1 185 1 ")
OS. Popen (" adb shell adds/dev/input/event1 0 0 0 ")
Time. Sleep (6)
OS. Popen (" adb shell adds/dev/input/event1 1 185 0 ")
OS. Popen (" adb shell adds/dev/input/event1 0 0 0 ")
Print (" this is the first hard % d times reduction "% I)
I +=1
The count -=1
Time. Sleep (80)
Factory (100)

# here are a few places need to pay special attention to, the first is to get key combination event occurs, the need to press key combination, at the same time get key events, through the getevent ()
The second point, is a key event is the hexadecimal, again send event, need to be converted to decimal,
  • Related