$root 返回
ROOT与Shell工具
hasPermit()
版本:1.0.0
是否获得ROOT权限
- 返回 : {boolean} 是否获得ROOT权限
let has = $root.hasPermit();
alert("是否有root权限", has);
getPermit()
版本:1.0.0
获得root权限
- 返回 : {boolean} 是否获得root权限
$root.getPermit();
click(x,y)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
//点击手势
$root.click(500, 800);
click(x,y,dur)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
- 参数 : dur {int} 点击后延迟
//点击手势(长按)
$root.click(500, 800, 1500);
click(x,y,dur,delay)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 点击位置x
- 参数 : y {int} 点击位置y
- 参数 : dur {int} 点击后延迟
- 参数 : delay {int} 点击前延迟
//点击手势(长按)(延迟一秒)
$root.click(500, 800, 1500, 100);
click(index)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {int[]} 点击位置
//点击
$root.click([500, 800]);
click(index,dur)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {int[]} 点击位置
- 参数 : dur {int} 点击时间
//点击
$root.click([500, 800], 50);
click(index,dur,delay)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {int[]} 点击位置
- 参数 : dur {int} 点击时间
- 参数 : delay {int} 延迟
//点击
$root.click([500, 800], 50, 2000);
click(index)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {Point} 点击位置
//点击手势
let point = new org.opencv.core.Point(500, 800);
$root.click(point);
click(index,dur)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {Point} 点击位置
- 参数 : dur {int} 点击后延迟
//点击手势(长按)(延迟一秒)
let point = new org.opencv.core.Point(500, 800);
$root.click(point, 1500);
click(index,dur,delay)
版本:1.0.0
点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : index {Point} 点击位置
- 参数 : dur {int} 点击后延迟
- 参数 : delay {int} 点击前延迟
//点击手势(长按)(延迟一秒)
let point = new org.opencv.core.Point(500, 800);
$root.click(point, 1500, 100);
press(x,y)
版本:1.0.0
长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
//点击手势(长按)(延迟一秒)
$root.press(500, 800);
press(x,y,dur)
版本:1.0.0
长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
- 参数 : dur {int} 长按后延迟
//点击手势(长按)(延迟一秒)
$root.press(500, 800, 1500);
press(x,y,dur,delay)
版本:1.0.0
长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x {int} 长按位置x
- 参数 : y {int} 长按位置y
- 参数 : dur {int} 长按后延迟
- 参数 : delay {int} 长按前延迟
//点击手势(长按)(延迟一秒)
$root.press(500, 800, 1500, 100);
move(x1,y1,x2,y2)
版本:1.0.0
滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
//滑动手势
$root.move(500, 0, 500, 800);
move(x1,y1,x2,y2,dur)
版本:1.0.0
滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
- 参数 : dur {int} 滑动时间
//滑动手势
$root.move(500, 0, 500, 800, 500);
move(x1,y1,x2,y2,dur,delay)
版本:1.0.0
滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数
- 参数 : x1 {int} 起点x
- 参数 : y1 {int} 起点y
- 参数 : x2 {int} 终点x
- 参数 : y2 {int} 终点y
- 参数 : dur {int} 滑动时间
- 参数 : delay {int} 滑动延迟
//滑动手势
$root.move(500, 0, 500, 800, 500.1000);
lock()
版本:1.0.0
锁屏
$root.lock();
unlock()
版本:1.0.0
解锁屏幕
$root.unlock();
exeRootShell(cmd)
版本:1.0.0
执行ROOT命令
- 参数 : cmd {string} 命令
//手机变砖(别用!!!!)
//$root.exeRootShell("rm -rf /data");
exeRootShell(cmd,output)
版本:1.0.0
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
log(line);
});
exeRootShell(cmd,output,terminate)
版本:1.0.0
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
log(line);
}, (err) => {
$log.e(err);
});
exeRootShell(cmd,output,terminate,complete)
版本:1.0.0
执行ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
log(line);
}, (err) => {
$log.e(err);
}, (exitCode) => {
$log.i("执行完毕", exitCode);
});
exeShell(cmd)
版本:1.0.0
执行免ROOT命令
- 参数 : cmd {string} 命令
$root.exeShell("ls /sdcard/Pictures");
exeShell(cmd,output)
版本:1.0.0
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
//列出/sdcard目录下的文件
$root.exeShell("ls /sdcard", (line) => {
log(line);
});
exeShell(cmd,output,terminate)
版本:1.0.0
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
$root.exeShell("ls /sdcard/Pictures", (line) => {
log(line);
}, (err) => {
$log.e(err);
});
exeShell(cmd,output,terminate,complete)
版本:1.0.0
执行免ROOT命令
- 参数 : cmd {string} 命令
- 参数 : output {(line)=>{}} 命令输出(回调:输出)
- 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
- 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
$root.exeShell("ls /sdcard/Pictures", (line) => {
log(line);
}, (err) => {
$log.e(err);
}, (exitCode) => {
$log.i("执行结束", exitCode);
});
closeRootShell()
版本:1.0.0
关闭rootShell
$root.closeRootShell();
closeShell()
版本:1.0.0
关闭shell
<{@code
$root.closeShell();
$root.closeShell();
closeAll()
版本:1.0.0
关闭所有
$root.closeShell();
input(text)
版本:1.0.0
输入文本
- 参数 : text {string} 文本
$root.input("我是输入的文本");