当前位置: 首页>>代码示例>>Java>>正文


Java RootDeniedException类代码示例

本文整理汇总了Java中com.stericson.RootShell.exceptions.RootDeniedException的典型用法代码示例。如果您正苦于以下问题:Java RootDeniedException类的具体用法?Java RootDeniedException怎么用?Java RootDeniedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RootDeniedException类属于com.stericson.RootShell.exceptions包,在下文中一共展示了RootDeniedException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchRootShellContext

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public Shell switchRootShellContext(ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException {
    if (this.shellType == ShellType.ROOT) {
        try {
            Shell.closeRootShell();
        } catch (Exception e) {
            RootShell.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...
        RootShell.log("Can only switch context on a root shell!");
        return this;
    }
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:18,代码来源:Shell.java

示例2: startCustomShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException {

        if (Shell.customShell == null) {
            RootShell.log("Starting Custom Shell!");
            Shell.customShell = new Shell(shellPath, ShellType.CUSTOM, ShellContext.NORMAL, timeout);
        } else {
            RootShell.log("Using Existing Custom Shell!");
        }

        return Shell.customShell;
    }
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:12,代码来源:Shell.java

示例3: startShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startShell(int timeout) throws IOException, TimeoutException {

        try {
            if (Shell.shell == null) {
                RootShell.log("Starting Shell!");
                Shell.shell = new Shell("/system/bin/sh", ShellType.NORMAL, ShellContext.NORMAL, timeout);
            } else {
                RootShell.log("Using Existing Shell!");
            }
            return Shell.shell;
        } catch (RootDeniedException e) {
            //Root Denied should never be thrown.
            throw new IOException();
        }
    }
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:16,代码来源:Shell.java

示例4: useCWD

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public final void useCWD(Context context) throws IOException, TimeoutException, RootDeniedException {
    add(
            new Command(
                    -1,
                    false,
                    "cd " + context.getApplicationInfo().dataDir)
    );
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:9,代码来源:Shell.java

示例5: runAndWait

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static String runAndWait(String cmd) throws IOException
{
	try
	{
		return runAndWait(cmd, RootTools.getShell(true)).getOutput();
	}
	catch (RootDeniedException | TimeoutException e)
	{
		throw new IOException(e);
	}
}
 
开发者ID:JohnNPhillips,项目名称:HistoryCleanerPro,代码行数:12,代码来源:RootHelper.java

示例6: getRootShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell getRootShell()
{
	if (rootShell == null || rootShell.isClosed)
	{
		try
		{
			rootShell = RootShell.getShell(true);
		}
		catch (TimeoutException | IOException | RootDeniedException e)
		{
			Logger.errorST("Could not get root access", e);
		}
	}
	return rootShell;
}
 
开发者ID:JohnNPhillips,项目名称:HistoryCleanerPro,代码行数:16,代码来源:Globals.java

示例7: runRootCommand

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static Command runRootCommand(Command command) throws IOException, TimeoutException, RootDeniedException {
    return Shell.startRootShell().add(command);
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:4,代码来源:Shell.java

示例8: startRootShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
public static Shell startRootShell() throws IOException, TimeoutException, RootDeniedException {
    return Shell.startRootShell(0, 3);
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:4,代码来源:Shell.java

示例9: getShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
/**
 * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output
 * and for closing the shell when you are done using it.
 *
 * @param root         a <code>boolean</code> to Indicate whether or not you want to open a root shell or a standard shell
 * @param timeout      an <code>int</code> to Indicate the length of time to wait before giving up on opening a shell.
 * @param shellContext the context to execute the shell with
 * @param retry        a <code>int</code> to indicate how many times the ROOT shell should try to open with root priviliges...
 */
public static Shell getShell(boolean root, int timeout, Shell.ShellContext shellContext, int retry) throws IOException, TimeoutException, RootDeniedException {
    if (root) {
        return Shell.startRootShell(timeout, shellContext, retry);
    } else {
        return Shell.startShell(timeout);
    }
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:17,代码来源:RootShell.java

示例10: getCustomShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
/**
 * This will open or return, if one is already open, a custom shell, you are responsible for managing the shell, reading the output
 * and for closing the shell when you are done using it.
 *
 * @param shellPath a <code>String</code> to Indicate the path to the shell that you want to open.
 * @param timeout   an <code>int</code> to Indicate the length of time before giving up on opening a shell.
 * @throws TimeoutException
 * @throws com.stericson.RootShell.exceptions.RootDeniedException
 * @throws IOException
 */
public static Shell getCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException {
    return RootShell.getCustomShell(shellPath, timeout);
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:14,代码来源:RootTools.java

示例11: getShell

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
/**
 * This will open or return, if one is already open, a shell, you are responsible for managing the shell, reading the output
 * and for closing the shell when you are done using it.
 *
 * @param root         a <code>boolean</code> to Indicate whether or not you want to open a root shell or a standard shell
 * @param timeout      an <code>int</code> to Indicate the length of time to wait before giving up on opening a shell.
 * @param shellContext the context to execute the shell with
 * @param retry        a <code>int</code> to indicate how many times the ROOT shell should try to open with root priviliges...
 * @throws TimeoutException
 * @throws com.stericson.RootShell.exceptions.RootDeniedException
 * @throws IOException
 */
public static Shell getShell(boolean root, int timeout, Shell.ShellContext shellContext, int retry) throws IOException, TimeoutException, RootDeniedException {
    return RootShell.getShell(root, timeout, shellContext, retry);
}
 
开发者ID:AlexanderKirillov,项目名称:Script-Executor-ROOT,代码行数:16,代码来源:RootTools.java

示例12: runRootCommand

import com.stericson.RootShell.exceptions.RootDeniedException; //导入依赖的package包/类
/**
 * Executes a single argument root command.
 * <p><b>Must be in an async call.</b></p>
 *
 * @param command   a command, ie {@code "rm -f"}, {@code "chmod 644"}...
 * @param uniqueArg the unique argument for the command, usually the file name
 */
private void runRootCommand(String command, String uniqueArg) throws IOException, TimeoutException, RootDeniedException {
    Command cmd = new Command(0, false, String.format(Locale.US, "%s %s", command, uniqueArg));
    RootShell.getShell(true).add(cmd);
}
 
开发者ID:Nilhcem,项目名称:hosts-editor-android,代码行数:12,代码来源:HostsManager.java


注:本文中的com.stericson.RootShell.exceptions.RootDeniedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。