1. 程式人生 > >[android adb shell] 怎麼解鎖圖案鎖屏(pattern lock)的手機?

[android adb shell] 怎麼解鎖圖案鎖屏(pattern lock)的手機?

所謂的防水手機由於沖洗螢幕進水而觸控失靈了,幸好adb是開啟的,還能用usb連上,然而問題來了,我加了圖案鎖屏,雖然adb shell能進,但死活操作不了啊。。。

首先,要確定觸控事件的裝置,我的手機是event2

其次,解析度肯定得搞清楚,可參考 https://blog.csdn.net/u011967006/article/details/53760678 獲取解析度。

stackoverflow上找到如下資料:

For touch events only 2 event types are used:
EV_ABS (3)
EV_SYN (0)

Touching the display (in case of Type A protocol) will result in an input report (sequence of input events) containing the following event codes:
ABS_MT_TRACKING_ID (57) - ID of the touch (important for multi-touch reports)
ABS_MT_POSITION_X (53) - x coordinate of the touch
ABS_MT_POSITION_Y (54) - y coordinate of the touch
ABS_MT_TOUCH_MAJOR (48) - basically width of your finger tip in pixels
ABS_MT_PRESSURE (58) - pressure of the touch
SYN_MT_REPORT (2) - end of separate touch data
SYN_REPORT (0) - end of report

然後就是不停嘗試了,不同手機貌似不太一致。

如下是個圖案 “Z”,最後居然一口氣畫了出來。一開始還以為中間斷線沒法完成了。

adb -s <phone sn> shell sendevent /dev/input/event2 3 57 8338
adb -s <phone sn> shell sendevent /dev/input/event2 1 330 1
adb -s <phone sn> shell sendevent /dev/input/event2 1 325 1

adb -s <phone sn> shell sendevent /dev/input/event2 3 53 300
adb -s <phone sn> shell sendevent /dev/input/event2 3 54 1680
adb -s <phone sn> shell sendevent /dev/input/event2 3 58 150
adb -s <phone sn> shell sendevent /dev/input/event2 3 48 5
adb -s <phone sn> shell sendevent /dev/input/event2 3 49 3
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0

adb -s <phone sn> shell sendevent /dev/input/event2 3 53 1150
adb -s <phone sn> shell sendevent /dev/input/event2 3 54 1630
adb -s <phone sn> shell sendevent /dev/input/event2 3 48 5
adb -s <phone sn> shell sendevent /dev/input/event2 3 58 50
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0

adb -s <phone sn> shell sendevent /dev/input/event2 3 53 300
adb -s <phone sn> shell sendevent /dev/input/event2 3 54 2280
adb -s <phone sn> shell sendevent /dev/input/event2 3 48 5
adb -s <phone sn> shell sendevent /dev/input/event2 3 58 50
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0

adb -s <phone sn> shell sendevent /dev/input/event2 3 53 1150
adb -s <phone sn> shell sendevent /dev/input/event2 3 54 2280
adb -s <phone sn> shell sendevent /dev/input/event2 3 48 5
adb -s <phone sn> shell sendevent /dev/input/event2 3 58 50
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0


adb -s <phone sn> shell sendevent /dev/input/event2 3 57 -1
adb -s <phone sn> shell sendevent /dev/input/event2 1 74 0
adb -s <phone sn> shell sendevent /dev/input/event2 1 75 0
adb -s <phone sn> shell sendevent /dev/input/event2 0 0 0