One, the Android input subsystem event encoding
The Android input time encoding format is:(timestamp:device:type code value)
Timestamp: The system is booting to the current time
Device: Devices that can generate input events
Type: Enter the event code, as defined
/ * Event types */ #define Ev_syn 0x00 #define Ev_key 0x01 #define Ev_rel 0x02 # Define Ev_abs 0x03 #define EV_MSC 0x04 #define EV_SW 0x05 #define EV_LED 0x11 #define EV_SND 0x12 #define EV_REP 0x14 #define EV_FF 0x15 #define EV_PWR 0x16 #define Ev_ff_status 0x17 #define EV_MAX 0x1f #define EV_CNT
The types corresponds to a set of codes for the same logical input structure. Each type has a set of available codes for generating input events. For more information on the codes available for each type, refer to the Codes section.
* Ev_syn:
-For the split flag between events. Events can be split on time or space, as in the case of multi-touch protocols.
* Ev_key:
-Used to describe changes in the state of the keyboard, keys, or similar keyboard devices.
* Ev_rel:
-Used to describe a change in the value on a relative axis, for example: The mouse moves 5 units to the left.
* Ev_abs:
-Used to describe a change in values on a relative axis, such as a value describing the coordinates on a touchscreen.
* Ev_msc:
-Use this type to describe when you cannot match an existing type.
* EV_SW:
-Used to describe an input switch with two states.
* Ev_led:
-Used to control the on and off of the LED lights on the device.
* EV_SND:
-Used to give the device output prompt sound.
* Ev_rep:
-for devices that can be automatically duplicated (autorepeating).
* EV_FF:
-Used to send a mandatory feedback command to the input device. Vibration )
* EV_PWR:
-especially for input of power switch.
* Ev_ff_status:
-A forced feedback state for the receiving device.
For example, Ev_abs corresponds to the following code:
/* * Absolute axes */#define ABS_X 0x00#define abs_y 0x01#define abs_z 0x02#define Abs_rx 0x03#define abs_ry 0x04#define abs_rz 0x05#define abs_throttle 0x06#define abs_rudder 0x07#define abs_wheel 0x08#define abs_gas 0x09#define abs_brake 0x0a#define abs_hat0x 0x10#defi Ne abs_hat0y 0x11#define abs_hat1x 0x12#define abs_hat1y 0x13#define abs_hat2x 0x14#define ABS_HAT 2Y 0x15#define abs_hat3x 0x16#define abs_hat3y 0x17#define abs_pressure 0x18#define abs_distance 0x19#define abs_tilt_x 0x1a#define abs_tilt_y 0x1b#define abs_tool_width 0x1c#define ABS_VOLUME 0x20#define abs_misc 0x28#define abs_mt_touch_major 0x30/* MAJOR axis of touching ellipse */#define Abs_mt_to Uch_minor 0x31/* MINOR axis (omit if circular) */#define ABS_MT_WIDTH_MAJOR 0x32/* MAJOR axis of approaching ell Ipse */#define ABS_MT_WIDth_minor 0x33/* MINOR axis (omit if circular) */#define ABS_MT_ORIENTATION 0x34/* Ellipse ORIENTATION */#define abs_mt_position_x 0x35/* Center X Ellipse POSITION */#define ABS_MT_POSITION_Y 0x36/* Center Y Ellipse Positi On */#define ABS_MT_TOOL_TYPE 0x37/* TYPE of touching device */#define ABS_MT_BLOB_ID 0x38/* Group a set O F Packets as a blob */#define ABS_MT_TRACKING_ID 0x39/* Unique ID of initiated contact */#define Abs_mt_pressure 0X3A/* Pressure on contact area */#define ABS_MAX 0x3f#define abs_cnt (abs_max+1)
Second, the SDK comes with tools
Getevent/sendevent
The source of these two commands is under system/core/toolbox/, sendevent.c getevent.c
GetEvent
Using GetEvent to get the events reported by the/DEV/INPUT/EVENTX device, this command also outputs the basic information for all event devices as follows:
Add device 1:/dev/input/event1 name: "Mxc_ts" Add Device 2:/dev/input/event0 name: "MXCKPD"
Indicates that the system has two event devices, respectively, corresponding to the input device Touchscreen,keyboard
Sendevent
Use Sendevent to simulate touch screens, keyboards, and other types of event events,
Sendevent/dev/input/eventx Type code value
/dev/input/eventx corresponds to an event device that can be getevent to obtain the available event devices
A detailed definition of type, code, value can be see kernel/include/linux/input.h
Third, Reran
Reran source in Click to open the link
(1) Installing ARM Cross-compilation tool
Tool download Link Click to open link
According to different systems to install the corresponding tool, after the completion of the configuration system environment variables, I am WIN10 system, in the system environment ;installdir
\bin
variable path add installdir
"", which is the more path of your installation tool.
(2) Compile Translate.java file as jar
(3) Compile record.c, then copy it to the phone /data/local path
Arm-none-linux-gnueabi-gcc-static-o replay replay.c adb push yourpath/replay/data/local
(4)记录事件路径,并将路径文件recordedEvents.txt
翻译成 translatedEvents.txt,然后将这个文件放入手机/data/local 路径中
adb shell Getevent-tt > Recordedevents.txtjava-jar translate.jar/path/to/recordedevents.txt/path/to/android-sdk/ PLATFORM-TOOLS/TRANSLATEDEVENTS.TXTADB Push Translatedevents.txt/data/local
(5) Return visit record
ADB shell/data/local/./replay/data/local/translatedevents.txt
Android Auto Replay tool--reran