проверка android_id
adb shell
settings get secure android_id
проверка состояния экрана (заблокирован или нет)
#!/bin/bash
if [ "$(adb shell dumpsys power | grep mScreenOn= | grep -oE '(true|false)')" == false ] ; then
echo "Screen is off. Turning on."
adb shell input keyevent 26 # wakeup
adb shell input touchscreen swipe 930 380 1080 380 # unlock
echo "OK, should be on now."
else
echo "Screen is already on."
echo "Turning off."
adb shell input keyevent 26 # sleep
fi
Ввод текста, здвиг , событие
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID
Аппаратне события
для посылки события касания вы должны: 1 установить координаты: adb shell sendevent /dev/input/event2 3 0 x adb shell sendevent /dev/input/event2 3 1 y 2 Посталь событие нажатия (обязательно в 2 команды последняя 0 0 0 ): adb shell sendevent /dev/input/event2 1 330 1 adb shell sendevent /dev/input/event2 0 0 0 3 Посталь событие "отпустить палец" (обязательно в 2 команды последняя 0 0 0 ):
adb shell sendevent /dev/input/event2 1 330 0 adb shell sendevent /dev/input/event2 0 0 0 Просмотр событий adb shell getevent
результат работы команды примерно такой
p.s. Не забываем переводить значения из hex в decimal. В командах adb должно быть decimal/dev/input/event2: 0003 0035 0000022e /dev/input/event2: 0003 0036 00000039 /dev/input/event2: 0000 0002 00000000 /dev/input/event2: 0003 0012 00000020 /dev/input/event2: 0003 0014 00000000 /dev/input/event2: 0000 0000 00000000
dev/input/event2: 0003 0035 0000022e
/dev/input/event2: 0003 0036 00000039
/dev/input/event2: 0000 0002 00000000
/dev/input/event2: 0003 0012 00000020
/dev/input/event2: 0003 0014 00000000
/dev/input/event2: 0000 0000 00000000 - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
o send touch event you need to do:
1 Set coordinates:
1 You can record events:
1 Set coordinates:
adb shell sendevent /dev/input/event2 3 0 x
adb shell sendevent /dev/input/event2 3 1 y
2 Send touch event (must have 0 0 0 pair):
adb shell sendevent /dev/input/event2 1 330 1
adb shell sendevent /dev/input/event2 0 0 0
3 Send release finger event (must have 0 0 0 pair):
adb shell sendevent /dev/input/event2 1 330 0
adb shell sendevent /dev/input/event2 0 0 0
Please note:1 You can record events:
adb shell getevent
- See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input tap x y
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
adb shell input swipe x1 y1 x2 y2
adb shell input text Hello!
adb shell input keyevent ID - See more at: http://www.softteco.com/blog/android-low-level-shell-click-on-screen/#sthash.IktmE1su.dpuf
Комментариев нет:
Отправить комментарий