ShellCommands

提供常用的 ADB Shell 控制指令封装接口,用于远程控制 Android 设备。

包括应用管理、输入模拟等操作,所有方法返回对应 shell 执行的命令字符串。

Author

M8Test

See also

Functions

Link copied to clipboard
abstract fun forceStopApp(packageName: String): String

强行停止指定包名的应用。

Link copied to clipboard
abstract fun getGlobalName(): String

获取作为全局变量时的名称.

Link copied to clipboard
abstract fun getPublicType(): Type

获取 Variable 注入到脚本时需要显示的类型.

Link copied to clipboard
abstract fun inputBase64Text(base64: String): String

模拟文本输入。

Link copied to clipboard
abstract fun inputKeyEvent(code: Int): String

模拟按键事件。

Link copied to clipboard
abstract fun inputSwipe(x1: Int, y1: Int, x2: Int, y2: Int, duration: Long): String

模拟滑动操作。

Link copied to clipboard
abstract fun inputTap(x: Int, y: Int): String

模拟点击指定坐标。

Link copied to clipboard
abstract fun inputText(text: String): String

模拟文本输入。

Link copied to clipboard
abstract fun installApp(path: String): String

安装指定路径的 APK 文件。

Link copied to clipboard
abstract fun isPrefixRequired(): Boolean

是否需要添加前缀, 每种编程语言添加的前缀不一样, 前缀可以通过 Language.getVariablePrefix 获取.

Link copied to clipboard
abstract fun isSuffixRequired(): Boolean

是否需要添加后缀, 每种编程语言添加的后缀不一样, 后缀可以通过 Language.getVariableSuffix 获取.

Link copied to clipboard
abstract fun killApp(packageName: String): String

杀死指定包名的应用进程(使用 killpkill)。

Link copied to clipboard
abstract fun launchApp(packageName: String, user: String, displayId: String?): String?

构建一个 shell 命令,用于在指定的显示器上以特定用户身份启动应用。

Link copied to clipboard
abstract fun uninstallApp(packageName: String): String

卸载指定包名的应用。