$root - ROOT与Shell命令
- 更新时间:2026-02-08 19:43:41
ROOT与Shell工具
hasPermit()
是否获得ROOT权限
- 返回 : {boolean} 是否获得ROOT权限
- 版本 : 1.0.0
getPermit()
获得root权限
- 返回 : {boolean} 是否获得root权限
- 版本 : 1.0.0
enablePointer(enable)
启用指针
打开或者关闭开发者调试的指针位置选项
- 参数 : enable {boolean} 是否启用
- 版本 : 1.4.1
click(x, y)
点击
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
- 版本 : 1.0.0
click(x, y, dur)
点击
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
- 参数 : dur {int} 点击时长
- 版本 : 1.0.0
click(x, y, dur, delay)
点击
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
- 参数 : dur {int} 点击时长
- 参数 : delay {int} 点击前延迟
- 版本 : 1.0.0
click(index)
点击
- 参数 : index {int[]} 点击位置
- 版本 : 1.0.0
click(index, dur)
点击
- 参数 : index {int[]} 点击位置
- 参数 : dur {int} 点击时间
- 版本 : 1.0.0
click(index, dur, delay)
点击
- 参数 : index {int[]} 点击位置
- 参数 : dur {int} 点击时间
- 参数 : delay {int} 延迟
- 版本 : 1.0.0
click(index)
点击
- 参数 : index {Point} 点击位置
- 版本 : 1.0.0
click(index, dur)
点击
- 参数 : index {Point} 点击位置
- 参数 : dur {int} 点击时长
- 版本 : 1.0.0
click(index, dur, delay)
点击
- 参数 : index {Point} 点击位置
- 参数 : dur {int} 点击时长
- 参数 : delay {int} 点击前延迟
- 版本 : 1.0.0
press(x, y)
长按
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
- 版本 : 1.0.0
press(x, y, dur)
长按
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
- 参数 : dur {int} 长按后延迟
- 版本 : 1.0.0
press(x, y, dur, delay)
长按
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
- 参数 : dur {int} 长按后延迟
- 参数 : delay {int} 长按前延迟
- 版本 : 1.0.0
move(x1, y1, x2, y2)
滑动
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
- 版本 : 1.0.0
move(x1, y1, x2, y2, dur)
滑动
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
- 参数 : dur {int} 滑动时间
- 版本 : 1.0.0
move(x1, y1, x2, y2, dur, delay)
滑动
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
- 参数 : dur {int} 滑动时间
- 参数 : delay {int} 滑动延迟
- 版本 : 1.0.0
lock()
锁屏
- 版本 : 1.0.0
unlock()
解锁屏幕
- 版本 : 1.0.0
power()
电源按键
- 版本 : 1.0.9
exec(cmd)
执行ROOT命令
- 参数 : cmd {string} 命令
- 版本 : 1.5.9
exeRootShell(cmd)
执行ROOT命令
- 参数 : cmd {string} 命令
- 版本 : 1.0.0
exeRootShell(cmd, output)
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 版本 : 1.0.0
exeRootShell(cmd, output, terminate)
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 版本 : 1.0.0
exeRootShell(cmd, output, terminate, complete)
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
- 版本 : 1.0.0
exeRootShellSync(cmd)
同步执行ROOT命令
- 参数 : cmd {string} 命令 $"命令"$
- 返回 : {string} 命令输出的结果
- 版本 : 1.9.1
exeShell(cmd)
执行免ROOT命令
- 参数 : cmd {string} 命令
- 版本 : 1.0.0
exeShell(cmd, output)
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 版本 : 1.0.0
exeShell(cmd, output, terminate)
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 版本 : 1.0.0
exeShell(cmd, output, terminate, complete)
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
- 版本 : 1.0.0
closeRootShell()
关闭rootShell
- 版本 : 1.0.0
closeShell()
关闭shell
- 版本 : 1.0.0
closeAll()
关闭所有
- 版本 : 1.0.0
input(text)
输入文本
- 参数 : text {string} 内容
- 版本 : 1.0.0
killApp(pkgName)
杀死应用
需要root权限才能执行
- 参数 : pkgName {string} 包名
- 版本 : 1.0.4
lsRunningApps(callback)
列出所有运行的应用
- 参数 : callback {(pkg)=>{}} 回调(回调:应用包名)
- 版本 : 1.0.4
home()
回到主页
- 版本 : 1.0.9
back()
返回按键
- 版本 : 1.0.9
menu()
菜单按键
- 版本 : 1.0.9
recent()
最近任务
- 版本 : 1.0.9
setWmSize(width, height)
设置手机分辨率
- 参数 : width {int} 宽度
- 参数 : height {int} 高度
setDpi(density)
设置手机分辨率
- 参数 : density {int} 分辨率
- 版本 : 1.5.4
resetWm()
重置手机分辨率与DPI
- 版本 : 1.5.4
key(keyName)
模拟按键
- 参数 : keyName 按键名称
- 版本 : 1.5.9