android RootTooles 分享

来源:互联网 发布:linux账号密码忘记了 编辑:程序博客网 时间:2024/06/11 16:19
RootTools 共享的root代码lib.jar 分析


下载地址:
文件


使用jar-lib-java.exe 打开jar文件,可以看到java源码
RootTools 类里面接口:

Set<String> getPath() 获取系统环境变量PATH值
ArrayList<Mount> getMounts() 获取所有挂载点
offerBusyBox(Activity activity) 应用市场搜索busybox
Intent offerBusyBox(Activity activity, int requestCode) 带返回值
offerSuperUser 搜索SuperUser应用
rootAvailable 判断是否有su,可执行root操作
busyboxAvailable 判断是否存在busybox
accessGiven 判断是否允许了应用root权限
EnoughSpaceOnSdCard(long updateSize) 是否有足够的空间
remount(String file, String mountType) 重新挂载某文件
installBinary(Context context, int sourceId, String destName, String mode) 安装文件,路径还需要查询确认
sendShell(String[] commands, int sleepTime, Result result)执行命令,返回结果
sendShell(String[] commands, int sleepTime) 不需要结果
sendShell(String command, Result result) 命令之间不需要sleep
sendShell(String command) 直接执行
getSpace(String path)获取路径使用空间

Remounter 类:
remount(String file, String mountType) 重新挂载
findMountPointRecursive先查找挂载点
Mount类:
拼出参数列表
InternalMethods类:
InternalMethods instance() 获取实例
doExec(String[] commands) 执行命令
returnPath 返回系统路径PATH值
getMounts 获取所有挂载点
Installer 
installBinary(int sourceId, String destName, String mode)
将资源sourceId 复制到context.getFilesDir().getCanonicalPath(); 下的destname,改变mode为mode
Executer类:
sendShell(String[] commands, int sleepTime, IResult result) 执行命令,返回执行结果
0 0
原创粉丝点击