本文整理匯總了Java中com.stericson.RootTools.RootTools.findBinary方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.findBinary方法的具體用法?Java RootTools.findBinary怎麽用?Java RootTools.findBinary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.stericson.RootTools.RootTools
的用法示例。
在下文中一共展示了RootTools.findBinary方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteFile_su
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private static boolean deleteFile_su(String file) {
boolean OK;
List<String> settingsPaths = RootTools.findBinary("rm", true);
if (settingsPaths.size() > 0) {
String command1 = "rm " + file;
//if (PPApplication.isSELinuxEnforcing())
// command1 = PPApplication.getSELinuxEnforceCommand(command1);
synchronized (PPApplication.startRootCommandMutex) {
Command command = new Command(0, false, command1);
try {
//RootTools.closeAllShells();
RootTools.getShell(true, Shell.ShellContext.RECOVERY).add(command);
OK = commandWait(command);
OK = OK && command.getExitCode() == 0;
} catch (Exception e) {
//e.printStackTrace();
OK = false;
}
}
}
else {
OK = RootTools.deleteFileOrDirectory(file, false);
}
return OK;
}
示例2: deleteFile_su
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
private static boolean deleteFile_su(String file) {
boolean OK;
List<String> settingsPaths = RootTools.findBinary("rm", true);
if (settingsPaths.size() > 0) {
synchronized (PPApplication.startRootCommandMutex) {
String command1 = "rm " + file;
//if (PPApplication.isSELinuxEnforcing())
// command1 = PPApplication.getSELinuxEnforceCommand(command1);
Command command = new Command(0, false, command1);
try {
//RootTools.closeAllShells();
RootTools.getShell(true, Shell.ShellContext.RECOVERY).add(command);
OK = commandWait(command);
OK = OK && command.getExitCode() == 0;
} catch (Exception e) {
//e.printStackTrace();
OK = false;
}
}
}
else {
OK = RootTools.deleteFileOrDirectory(file, false);
}
return OK;
}
示例3: checkUtil
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will check a given binary, determine if it exists and determine that
* it has either the permissions 755, 775, or 777.
*
* @param util Name of the utility to check.
* @return boolean to indicate whether the binary is installed and has
* appropriate permissions.
*/
public boolean checkUtil(String util) {
if (RootTools.findBinary(util)) {
List<String> binaryPaths = new ArrayList<String>();
binaryPaths.addAll(RootTools.lastFoundBinaryPaths);
for (String path : binaryPaths) {
Permissions permissions = RootTools
.getFilePermissionsSymlinks(path + "/" + util);
if (permissions != null) {
String permission;
if (Integer.toString(permissions.getPermissions()).length() > 3)
permission = Integer.toString(permissions.getPermissions()).substring(1);
else
permission = Integer.toString(permissions.getPermissions());
if (permission.equals("755") || permission.equals("777")
|| permission.equals("775")) {
RootTools.utilPath = path + "/" + util;
return true;
}
}
}
}
return false;
}
示例4: doInBackground
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
@Override
protected Void doInBackground(Void... voids) {
hasRoot = RootTools.isAccessGiven();
hasBusyBox = RootTools.isBusyboxAvailable() || RootTools.findBinary("toybox");
return null;
}