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


Java RootTools.log方法代碼示例

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


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

示例1: parseSpecialPermissions

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public int parseSpecialPermissions(String permission) {
    int tmp = 0;
    if (permission.charAt(2) == 's') {
        tmp += 4;
    }

    if (permission.charAt(5) == 's') {
        tmp += 2;
    }

    if (permission.charAt(8) == 't') {
        tmp += 1;
    }

    RootTools.log("special permissions " + tmp);

    return tmp;
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:19,代碼來源:RootToolsInternalMethods.java

示例2: isNativeToolsReady

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public boolean isNativeToolsReady(int nativeToolsId, Context context) {
    RootTools.log("Preparing Native Tools");
    InternalVariables.nativeToolsReady = false;

    Installer installer;
    try {
        installer = new Installer(context);
    } catch (IOException ex) {
        if (RootTools.debugMode) {
            ex.printStackTrace();
        }
        return false;
    }

    if (installer.isBinaryInstalled("nativetools")) {
        InternalVariables.nativeToolsReady = true;
    } else {
        InternalVariables.nativeToolsReady = installer.installBinary(nativeToolsId,
                "nativetools", "700");
    }
    return InternalVariables.nativeToolsReady;
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:23,代碼來源:RootToolsInternalMethods.java

示例3: hasEnoughSpaceOnSdCard

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * Checks if there is enough Space on SDCard
 *
 * @param updateSize size to Check (long)
 * @return <code>true</code> if the Update will fit on SDCard, <code>false</code> if not enough
 * space on SDCard. Will also return <code>false</code>, if the SDCard is not mounted as
 * read/write
 */
@SuppressWarnings("deprecation")
public boolean hasEnoughSpaceOnSdCard(long updateSize) {
    RootTools.log("Checking SDcard size and that it is mounted as RW");
    String status = Environment.getExternalStorageState();
    if (!status.equals(Environment.MEDIA_MOUNTED)) {
        return false;
    }
    File path = Environment.getExternalStorageDirectory();
    StatFs stat = new StatFs(path.getPath());
    long blockSize = 0;
    long availableBlocks = 0;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        blockSize = stat.getBlockSize();
        availableBlocks = stat.getAvailableBlocks();
    } else {
        blockSize = stat.getBlockSizeLong();
        availableBlocks = stat.getAvailableBlocksLong();
    }
    return (updateSize < availableBlocks * blockSize);
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:29,代碼來源:RootToolsInternalMethods.java

示例4: waitForFinish

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public CommandResult waitForFinish()
{
    RootTools.log(String.format("Waiting for command %d...", id));
    do
    {
        try
        {
            countdown.await();
        }
        catch (InterruptedException e)
        {
            RootTools.log(String.format("...InterruptedException while waiting for command %d...", id),
                          LOG_TYPE_DEBUG, e);
        }
    }
    while (countdown.getCount() > 0);
    RootTools.log(String.format("...Done waiting for command %d", id));

    return getResult();
}
 
開發者ID:Takhion,項目名稱:android-tetheringfixer,代碼行數:21,代碼來源:WaitCommand.java

示例5: commandFinished

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
protected void commandFinished() {
    if (!terminated) {
        synchronized (this) {
            if (mHandler != null && handlerEnabled) {
                Message msg = mHandler.obtainMessage();
                Bundle bundle = new Bundle();
                bundle.putInt(CommandHandler.ACTION, CommandHandler.COMMAND_COMPLETED);
                msg.setData(bundle);
                mHandler.sendMessage(msg);
            }
            else {
                commandCompleted(id, exitCode);
            }

            RootTools.log("Command " + id + " finished.");
            finishCommand();
        }
    }
}
 
開發者ID:acomminos,項目名稱:Mountie,代碼行數:20,代碼來源:Command.java

示例6: terminated

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
protected void terminated(String reason) {
    synchronized (Command.this) {


        if (mHandler != null && handlerEnabled) {
            Message msg = mHandler.obtainMessage();
            Bundle bundle = new Bundle();
            bundle.putInt(CommandHandler.ACTION, CommandHandler.COMMAND_TERMINATED);
            bundle.putString(CommandHandler.TEXT, reason);
            msg.setData(bundle);
            mHandler.sendMessage(msg);
        }
        else {
            commandTerminated(id, reason);
        }

        RootTools.log("Command " + id + " did not finish because it was terminated. Termination reason: " + reason);
        setExitCode(-1);
        terminated = true;
        finishCommand();
    }
}
 
開發者ID:acomminos,項目名稱:Mountie,代碼行數:23,代碼來源:Command.java

示例7: isProcessRunning

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This method can be used to to check if a process is running
 *
 * @param processName name of process to check
 * @return <code>true</code> if process was found
 * @throws TimeoutException (Could not determine if the process is running)
 */
public boolean isProcessRunning(final String processName) {

    RootTools.log("Checks if process is running: " + processName);

    InternalVariables.processRunning = false;

    try {
        CommandCapture command = new CommandCapture(0, false, "ps") {
            @Override
            public void output(int id, String line) {
                if (line.contains(processName)) {
                    InternalVariables.processRunning = true;
                }
            }
        };
        RootTools.getShell(true).add(command);
        commandWait(RootTools.getShell(true), command);

    } catch (Exception e) {
        RootTools.log(e.getMessage());
    }

    return InternalVariables.processRunning;
}
 
開發者ID:acomminos,項目名稱:Mountie,代碼行數:32,代碼來源:RootToolsInternalMethods.java

示例8: switchRootShellContext

import com.stericson.RootTools.RootTools; //導入方法依賴的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;
    }
}
 
開發者ID:acomminos,項目名稱:Mountie,代碼行數:20,代碼來源:Shell.java

示例9: startRootShell

import com.stericson.RootTools.RootTools; //導入方法依賴的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;
    }
 
開發者ID:Fusion,項目名稱:BambooGarden,代碼行數:26,代碼來源:Shell.java

示例10: parsePermissions

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
public int parsePermissions(String permission) {
    permission = permission.toLowerCase(Locale.US);
    int tmp;
    if (permission.charAt(0) == 'r') {
        tmp = 4;
    } else {
        tmp = 0;
    }

    RootTools.log("permission " + tmp);
    RootTools.log("character " + permission.charAt(0));

    if (permission.charAt(1) == 'w') {
        tmp += 2;
    } else {
        tmp += 0;
    }

    RootTools.log("permission " + tmp);
    RootTools.log("character " + permission.charAt(1));

    if (permission.charAt(2) == 'x' || permission.charAt(2) == 's'
            || permission.charAt(2) == 't') {
        tmp += 1;
    } else {
        tmp += 0;
    }

    RootTools.log("permission " + tmp);
    RootTools.log("character " + permission.charAt(2));

    return tmp;
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:34,代碼來源:RootToolsInternalMethods.java

示例11: getMounts

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This will return an ArrayList of the class Mount. The class mount contains the following
 * property's: device mountPoint type flags
 * <p/>
 * These will provide you with any information you need to work with the mount points.
 *
 * @return <code>ArrayList<Mount></code> an ArrayList of the class Mount.
 * @throws Exception if we cannot return the mount points.
 */
public ArrayList<Mount> getMounts() throws Exception {

    InternalVariables.mounts = new ArrayList<>();

    if (null == InternalVariables.mounts || InternalVariables.mounts.isEmpty()) {
        Shell shell = RootTools.getShell(true);

        Command cmd = new Command(Constants.GET_MOUNTS,
                false,
                "cat /proc/mounts") {

            @Override
            public void commandOutput(int id, String line) {
                if (id == Constants.GET_MOUNTS) {
                    RootTools.log(line);

                    String[] fields = line.split(" ");
                    InternalVariables.mounts.add(new Mount(new File(fields[0]), // device
                            new File(fields[1]), // mountPoint
                            fields[2], // fstype
                            fields[3] // flags
                    ));
                }

                super.commandOutput(id, line);
            }
        };
        shell.add(cmd);
        this.commandWait(shell, cmd);
    }

    return InternalVariables.mounts;
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:43,代碼來源:RootToolsInternalMethods.java

示例12: getMountedAs

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This will tell you how the specified mount is mounted. rw, ro, etc...
 * <p/>
 *
 * @param path mount you want to check
 * @return <code>String</code> What the mount is mounted as.
 * @throws Exception if we cannot determine how the mount is mounted.
 */
public String getMountedAs(String path) throws Exception {
    InternalVariables.mounts = getMounts();
    String mp;
    if (InternalVariables.mounts != null) {
        for (Mount mount : InternalVariables.mounts) {

            mp = mount.getMountPoint().getAbsolutePath();

            if (mp.equals("/")) {
                if (path.equals("/")) {
                    return (String) mount.getFlags().toArray()[0];
                } else {
                    continue;
                }
            }

            if (path.equals(mp) || path.startsWith(mp + "/")) {
                RootTools.log((String) mount.getFlags().toArray()[0]);
                return (String) mount.getFlags().toArray()[0];
            }
        }

        throw new Exception();
    } else {
        throw new Exception();
    }
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:36,代碼來源:RootToolsInternalMethods.java

示例13: getSymlinks

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This will return an ArrayList of the class Symlink. The class Symlink contains the following
 * property's: path SymplinkPath
 * <p/>
 * These will provide you with any Symlinks in the given path.
 *
 * @param path path to search for Symlinks.
 * @return <code>ArrayList<Symlink></code> an ArrayList of the class Symlink.
 * @throws Exception if we cannot return the Symlinks.
 */
public ArrayList<Symlink> getSymlinks(String path) throws Exception {

    // this command needs find
    if (!checkUtil("find")) {
        throw new Exception();
    }

    InternalVariables.symlinks = new ArrayList<>();

    Command command = new Command(0, false, "find " + path + " -type l -exec ls -l {} \\;") {
        @Override
        public void commandOutput(int id, String line) {
            if (id == Constants.GET_SYMLINKS) {
                RootTools.log(line);

                String[] fields = line.split(" ");
                InternalVariables.symlinks.add(new Symlink(new File(fields[fields.length - 3]), // file
                        new File(fields[fields.length - 1]) // SymlinkPath
                ));

            }

            super.commandOutput(id, line);
        }
    };
    Shell.startRootShell().add(command);
    commandWait(Shell.startRootShell(), command);

    if (InternalVariables.symlinks != null) {
        return InternalVariables.symlinks;
    } else {
        throw new Exception();
    }
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:45,代碼來源:RootToolsInternalMethods.java

示例14: isAppletAvailable

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This will let you know if an applet is available from BusyBox
 * <p/>
 *
 * @param applet The applet to check for.
 * @return <code>true</code> if applet is available, false otherwise.
 */
public boolean isAppletAvailable(String applet, String binaryPath) {
    try {
        for (String aplet : getBusyBoxApplets(binaryPath)) {
            if (aplet.equals(applet)) {
                return true;
            }
        }
        return false;
    } catch (Exception e) {
        RootTools.log(e.toString());
        return false;
    }
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:21,代碼來源:RootToolsInternalMethods.java

示例15: isProcessRunning

import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
 * This method can be used to to check if a process is running
 *
 * @param processName name of process to check
 * @return <code>true</code> if process was found
 * @throws TimeoutException (Could not determine if the process is running)
 */
public boolean isProcessRunning(final String processName) {

    RootTools.log("Checks if process is running: " + processName);

    InternalVariables.processRunning = false;

    try {
        Command command = new Command(0, false, "ps") {
            @Override
            public void commandOutput(int id, String line) {
                if (line.contains(processName)) {
                    InternalVariables.processRunning = true;
                }

                super.commandOutput(id, line);
            }
        };
        RootTools.getShell(true).add(command);
        commandWait(RootTools.getShell(true), command);

    } catch (Exception e) {
        RootTools.log(e.getMessage());
    }

    return InternalVariables.processRunning;
}
 
開發者ID:AlexanderKirillov,項目名稱:Script-Executor-ROOT,代碼行數:34,代碼來源:RootToolsInternalMethods.java


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