设置:
adb
。问题: 手机只需滑动即可解锁。 我设法打开屏幕:
adb -s XXXXX shell svc power stayon true
但是,当尝试滑动时:
adb -s XXXXX shell "input touchscreen swipe 126 459 913 472"
Exception occurred while executing 'touchscreen':
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
at com.android.server.input.InputManagerService.injectInputEventInternal(InputManagerService.java:914)
at com.android.server.input.InputManagerService.injectInputEvent(InputManagerService.java:866)
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1091)
at com.android.server.input.InputShellCommand.injectMotionEvent(InputShellCommand.java:138)
at com.android.server.input.InputShellCommand.sendSwipe(InputShellCommand.java:370)
at com.android.server.input.InputShellCommand.runSwipe(InputShellCommand.java:354)
at com.android.server.input.InputShellCommand.onCommand(InputShellCommand.java:194)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.input.InputManagerService.onShellCommand(InputManagerService.java:3551)
at android.os.Binder.shellCommand(Binder.java:956)
at android.os.Binder.onTransact(Binder.java:840)
at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:1144)
at android.os.Binder.execTransactInternal(Binder.java:1190)
at android.os.Binder.execTransact(Binder.java:1149)
有什么想法吗?
您可以尝试类似 AndroidViewClient/culebra 中的滑动示例
#! /usr/bin/env python3
from com.dtmilano.android.viewclient import ViewClient
helper = ViewClient.view_client_helper()
helper.ui_device.swipe(segments=[(300, 300), (600, 1200), (600, 300), (300, 300)], segment_steps=50)
当然你需要调整坐标。
这是当 Keep 是顶部 Activity 时上一个命令的结果(因此我们实际上可以看到它在绘制)