當前位置: 首頁>>代碼示例>>Java>>正文


Java Shell.run方法代碼示例

本文整理匯總了Java中eu.chainfire.libsuperuser.Shell.run方法的典型用法代碼示例。如果您正苦於以下問題:Java Shell.run方法的具體用法?Java Shell.run怎麽用?Java Shell.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eu.chainfire.libsuperuser.Shell的用法示例。


在下文中一共展示了Shell.run方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
public boolean execute() {
	MyLog.entry();

	logs = Shell.run("su", commands, null, true);

	boolean result;
	if (logs == null) {
		result = false;
	} else {
		for (final String line : logs) {
			MyLog.debug(" - " + line);
		}

		result = true;
	}

	MyLog.exit();
	return result;
}
 
開發者ID:Neraud,項目名稱:PADListener,代碼行數:20,代碼來源:SuCommandExecutor.java

示例2: runCommand

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
/**
 * Run a given command with the classpath from a given context
 * @param su should it be run with su?
 * @param uid the uid to run under
 * @param codePath path to dex file
 * @param command command string {@see #getCommandLineForMainClass}
 * @return command output
 */
public static List<String> runCommand(boolean su, int uid, String codePath, String command) {
    String shell = "sh";
    if (su) {
        if (!Shell.SU.available()) {
            throw new RuntimeException("su not available!");
        }
        shell = "su";
    }
    if (uid > 0) {
        command = String.format("%d %s", uid, command);
    }
    return Shell.run(shell, new String[]{command}, new String[]{String.format("CLASSPATH=%s", codePath)}, true);
}
 
開發者ID:kevinross,項目名稱:android_debuggable_tool,代碼行數:22,代碼來源:DebuggableToolHelpers.java

示例3: runSuCommand

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
public static void runSuCommand(String[] cmds, String selinuxContext) {
    if (!TextUtils.isEmpty(selinuxContext) && isSELinuxEnforced()) {
        String shell = Shell.SU.shell(0, selinuxContext);
        Shell.run(shell, cmds, null, false, false);
    } else {
        Shell.run("su", cmds, null, false, false);
    }
}
 
開發者ID:yongce,項目名稱:SysServiceProxyLib,代碼行數:9,代碼來源:RootPermUtils.java

示例4: runSuCommand

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
public static void runSuCommand(String[] cmds, String selinuxContext) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            || TextUtils.isEmpty(selinuxContext)) {
        Shell.SU.run(cmds);
    } else {
        String shell = Shell.SU.shell(0, selinuxContext);
        Shell.run(shell, cmds, null, false);
    }
}
 
開發者ID:ycdev-demo,項目名稱:RootAppDemo,代碼行數:10,代碼來源:MainActivity.java

示例5: runSuCommand

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
public static void runSuCommand(String[] cmds, String selinuxContext) {
    if (!TextUtils.isEmpty(selinuxContext) && isSELinuxEnforced()) {
        String shell = Shell.SU.shell(0, selinuxContext);
        Shell.run(shell, cmds, null, false, true);
    } else {
        Shell.SU.run(cmds);
    }
}
 
開發者ID:yongce,項目名稱:DevTools,代碼行數:9,代碼來源:RootCmdBase.java

示例6: doInBackground

import eu.chainfire.libsuperuser.Shell; //導入方法依賴的package包/類
@Override
protected String doInBackground(String... cmdArgs) {
    checkFilesystem();
    String command[] = mCommandList.toArray(new String[mCommandList.size()]);
    String shell = enableSU ? "su" : "sh";
    List<String> res = Shell.run(shell, command, null, true);
    for (String queryRes : res)
        publishProgress(queryRes);
    publishProgress(COMMAND_EXECUTED);
    return null;
}
 
開發者ID:DroidPHP,項目名稱:DroidPHP,代碼行數:12,代碼來源:CommandTask.java


注:本文中的eu.chainfire.libsuperuser.Shell.run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。