对低概率问题,需要多次测试以复现问题,使用脚本更容易实现,避免频繁人工操作

首先要了解手机的众多输入设备:

命令:adb shell cat /proc/bus/input/devices/

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="qpnp_pon"
P: Phys=qpnp_pon/input0
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=event0 
B: PROP=40
B: EV=3
B: KEY=14000000000000 0

I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="qcom-tpd"
P: Phys=
S: Sysfs=/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input1
U: Uniq=
H: Handlers=mdss_fb kgsl event1 
B: PROP=2
B: EV=b
B: KEY=ff000000000000 0 0 0 0 0 400 0 0 0 160000000000 4004001400000
B: ABS=261800000000000

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="gf5216"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=event2 
B: PROP=0
B: EV=3
B: KEY=2000000040000800 1016c000000008 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="qwerty"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=event3 
B: PROP=0
B: EV=3
B: KEY=2000000040000800 1016c000000008 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/soc/soc:gpio_keys/input/input4
U: Uniq=
H: Handlers=event4 
B: PROP=0
B: EV=3
B: KEY=4000000000000000 0 0 10000 0 0 0 0 0 0 8000000000000 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="msm8952-snd-card-mtp Headset Jack"
P: Phys=ALSA
S: Sysfs=/devices/soc/c051000.sound/sound/card0/input5
U: Uniq=
H: Handlers=event5 
B: PROP=0
B: EV=21
B: SW=3c0d4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="msm8952-snd-card-mtp Button Jack"
P: Phys=ALSA
S: Sysfs=/devices/soc/c051000.sound/sound/card0/input6
U: Uniq=
H: Handlers=event6 
B: PROP=40
B: EV=3
B: KEY=e0 400000000 0 c000000000000 0

对应输入设备的Name匹配我们需要使用的设备信息,

I: Bus=0018 Vendor=0000 Product=0000 Version=0000
N: Name="qcom-tpd"
P: Phys=
S: Sysfs=/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input1
U: Uniq=
H: Handlers=mdss_fb kgsl event1 
B: PROP=2
B: EV=b
B: KEY=ff000000000000 0 0 0 0 0 400 0 0 0 160000000000 4004001400000
B: ABS=261800000000000

发现给设备对应tp。

命令:adb shell getevent /dev/input/event1

输入该命令后,做点击屏幕操作,这里我们以点击拍照为例:

终端输出:

0003 0039 00000000
0003 0030 00000003
0003 0035 00000163
0003 0036 00000476
0001 014a 00000001
0000 0000 00000000
0003 0030 00000004
0000 0000 00000000
0001 014a 00000000
0000 0000 00000000

注意:点击不同的点会输出不同的信息,这里的输出对应这点击事件的具体信息,我们之需要在脚本中做写下相同的命令既可以实现同样的操作

下面开始写脚本使用sendevent命令(这里需要注意的是,上买你的输出为十六进制,需要自行转换成十进制):

sendevent /dev/input/event1 0003 57 00000000
sendevent /dev/input/event1 0003 48 00000003
sendevent /dev/input/event1 0003 53 355
sendevent /dev/input/event1 0003 54 1142
sendevent /dev/input/event1 0001 330 00000001
sendevent /dev/input/event1 0000 0000 00000000
sendevent /dev/input/event1 0003 48 00000004
sendevent /dev/input/event1 0000 0000 00000000
sendevent /dev/input/event1 0001 330 00000000
sendevent /dev/input/event1 0000 0000 00000000

写完脚本touch.sh文件

使用命令afb push touch.sh /sdcard/把脚本导入手机

然后执行adb shell sh /sdcard/touch.sh

确认手机是否会出现同样操作

根据这个步骤也可以尝试写一些相关其他设备的输入,当我们需要重复点击时,之需要在脚本写个循环就可以实现自动压力测试了

 

 

更多相关文章

  1. [android]android自动化过程遇到的问题
  2. aapt dump badging 找不到'android:versionCode' Bug解决
  3. 50个安卓开发者应该熟悉的Android(安卓)Studio技巧和资源
  4. 【Android】Gradle自动化构建工具的用法
  5. android adb与sdcard
  6. STF本地集成-for-Mac
  7. Android培训班(15)
  8. Android(安卓)Wear 报错:cannot connect to localhost:4444: 由于
  9. android中usb设备驱动不能自动创建设备节点

随机推荐

  1. 已解决:Error: Static interface methods
  2. Android(安卓)Sqlite数据库详解
  3. android-搭建本地maven仓库
  4. android 6.0 healthd vold接收uevent
  5. Android顶部弹出提示语的三种实现方式:Win
  6. AndroidAOP之路一 注解Annotation
  7. Android(安卓)Camera 二 JNI JAVA和C/CPP
  8. android自定义Adapter
  9. Android(安卓)读取拍照或相册uri 转换成
  10. Android获取View的宽高与View.measure详