本文整理汇总了Java中eu.chainfire.libsuperuser.Shell.OnCommandResultListener方法的典型用法代码示例。如果您正苦于以下问题:Java Shell.OnCommandResultListener方法的具体用法?Java Shell.OnCommandResultListener怎么用?Java Shell.OnCommandResultListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.chainfire.libsuperuser.Shell
的用法示例。
在下文中一共展示了Shell.OnCommandResultListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callBinary
import eu.chainfire.libsuperuser.Shell; //导入方法依赖的package包/类
private void callBinary(final String params, final int flag,
final Shell.OnCommandResultListener listener) {
String command = binaryFile.getAbsolutePath() + " " + params;
if (BuildConfig.DEBUG)
Log.d(TAG, "command = " + command);
rootSession.addCommand(command, flag, listener);
}
示例2: runShellCommand
import eu.chainfire.libsuperuser.Shell; //导入方法依赖的package包/类
/**
* Runs the command on an interactive shell. Provides a listener for the caller to interact.
* The caller is executed on a worker background thread, hence any calls from the callback
* should be thread safe.
* Command is run from superuser context (u:r:SuperSU0)
*
* @param cmd the command
* @param callback
* @return a list of results. Null only if the command passed is a blocking call or no output is
* there for the command passed
*/
public static void runShellCommand(String cmd, Shell.OnCommandResultListener callback)
throws ShellNotRunningException {
if (MainActivity.shellInteractive == null || !MainActivity.shellInteractive.isRunning())
throw new ShellNotRunningException();
MainActivity.shellInteractive.addCommand(cmd, 0, callback);
MainActivity.shellInteractive.waitForIdle();
}