有没有一种应用程序可以检测到它是通过连接计算机的 ADB 命令行代码启动(或终止),还是通过物理点击屏幕上的实际应用程序图标来检测?
和/或它能否判断应用中的点击输入是通过物理点击还是通过 ADB 输入完成的?
启动命令:adb shell monkey -p -c android.intent.category.LAUNCHER 1
终止命令:adb shell am force-stop
tap命令:adb shell输入tap
最佳答案
adb 命令运行在system/bin/sh
的全新进程中。这很难实现,即使设备已经被 root。
您可能需要通过 getevent
命令处理触摸事件。 adb shell input
将跳过输入设备以模拟用户操作,但如果有人使用 adb shell sendevent
命令,您将无法检测到它。
关于android - Android 应用程序可以检测 ADB 命令吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44753229/