本文整理汇总了Java中com.stericson.RootTools.exceptions.RootDeniedException类的典型用法代码示例。如果您正苦于以下问题:Java RootDeniedException类的具体用法?Java RootDeniedException怎么用?Java RootDeniedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RootDeniedException类属于com.stericson.RootTools.exceptions包,在下文中一共展示了RootDeniedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePattern
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public void changePattern(View view) throws IOException, TimeoutException, RootDeniedException
{
isCorrect =false;
forceChange();
//forceChange();
if(isCorrect) {
FileOutputStream fos;
try {
fos = openFileOutput("pat", Context.MODE_PRIVATE);
fos.write(Newpin.getBytes());
fos.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例2: switchRootShellContext
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public Shell switchRootShellContext(ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException {
if(this.shellType == ShellType.ROOT)
{
try {
Shell.closeRootShell();
} catch(Exception e) {
RootTools.log("Problem closing shell while trying to switch context...");
}
//create new root shell with new context...
return Shell.startRootShell(this.shellTimeout, shellContext, 3);
}
else
{
//can only switch context on a root shell...
RootTools.log("Can only switch context on a root shell!");
return this;
}
}
示例3: startRootShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startRootShell(int timeout, int retry) throws IOException, TimeoutException, RootDeniedException {
Shell.shellTimeout = timeout;
if (rootShell == null) {
RootTools.log("Starting Root Shell!");
String cmd = "su";
// keep prompting the user until they accept for x amount of times...
int retries = 0;
while (rootShell == null) {
try {
rootShell = new Shell(cmd);
} catch (IOException e) {
if (retries++ >= retry) {
RootTools.log("IOException, could not start shell");
throw e;
}
}
}
} else {
RootTools.log("Using Existing Root Shell!");
}
return rootShell;
}
示例4: useCWD
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public void useCWD(Context context) throws IOException, TimeoutException, RootDeniedException {
add(
new CommandCapture(
-1,
false,
"cd " + context.getApplicationInfo().dataDir)
);
}
示例5: startCustomShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException {
if (Shell.customShell == null) {
RootTools.log("Starting Custom Shell!");
Shell.customShell = new Shell(shellPath, ShellType.CUSTOM, ShellContext.NORMAL, timeout);
} else
RootTools.log("Using Existing Custom Shell!");
return Shell.customShell;
}
示例6: startShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startShell(int timeout) throws IOException, TimeoutException {
try {
if (Shell.shell == null) {
RootTools.log("Starting Shell!");
Shell.shell = new Shell("/system/bin/sh", ShellType.NORMAL, ShellContext.NORMAL, timeout);
} else
RootTools.log("Using Existing Shell!");
return Shell.shell;
} catch (RootDeniedException e) {
//Root Denied should never be thrown.
throw new IOException();
}
}
示例7: run
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
@Override
public void run()
{
log("Step 2: get root...");
Fixer.startRootShellAsync(new Async.SimpleMainThreadCallback<Void>()
{
@Override
public void mainThreadCallback(Void result, boolean success, Throwable error)
{
logCallback(result, success, error, false);
if (success) advanceStep();
else
{
// error
Integer errorText = null;
if (error != null)
{
if (error instanceof RootDeniedException)
errorText = R.string.error_root_denied;
else if (error instanceof TimeoutException)
errorText = R.string.error_timeout;
else if (error instanceof IOException)
errorText = R.string.error_io;
}
error(errorText);
}
}
});
}
示例8: logCallback
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
private static void logCallback(Object result, boolean success, Throwable error, boolean resultExpected)
{
reportState("callback_result", result == null ? "NULL" : result.toString());
reportState("callback_result_expected", Boolean.toString(resultExpected));
reportState("callback_success", Boolean.toString(success));
log(String.format("Callback! success: %b\nresult: %s",
success, result == null ? null : result.toString()), error);
if (error != null && !(error instanceof Exception)) throw new Async.CallbackException(result, success, error);
if ((success && resultExpected && result == null) || (!success && (error == null ||
!(error instanceof RootDeniedException || error instanceof TimeoutException))))
reportException(error);
}
示例9: getRootShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
@Nullable
static Pair<Boolean, Shell> getRootShell() {
try {
return new Pair<>(true, RootTools.getShell(true));
} catch (IOException | RootDeniedException | TimeoutException e) {
return null;
}
}
示例10: startCustomShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException {
Shell.shellTimeout = timeout;
if (customShell == null) {
RootTools.log("Starting Custom Shell!");
customShell = new Shell(shellPath);
} else
RootTools.log("Using Existing Custom Shell!");
return customShell;
}
示例11: startShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startShell(int timeout) throws IOException, TimeoutException {
Shell.shellTimeout = timeout;
try {
if (shell == null) {
RootTools.log("Starting Shell!");
shell = new Shell("/system/bin/sh");
} else
RootTools.log("Using Existing Shell!");
return shell;
} catch (RootDeniedException e) {
//Root Denied should never be thrown.
throw new IOException();
}
}
示例12: useCWD
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public void useCWD(Context context) throws IOException, TimeoutException, RootDeniedException {
add(
new CommandCapture(
-1,
false,
"cd " + context.getApplicationInfo().dataDir));
}
示例13: runRootCommand
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static void runRootCommand(Command command) throws IOException, TimeoutException, RootDeniedException {
Shell.startRootShell().add(command);
}
示例14: startRootShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startRootShell() throws IOException, TimeoutException, RootDeniedException {
return Shell.startRootShell(0, 3);
}
示例15: startRootShell
import com.stericson.RootTools.exceptions.RootDeniedException; //导入依赖的package包/类
public static void startRootShell() throws TimeoutException, RootDeniedException, IOException
{
Shell.startRootShell(60000, 3);
}