Skip to content

Commit

Permalink
Commit bringing RootTools code up to 4.1 and bringing about the integ…
Browse files Browse the repository at this point in the history
…ration of RootShell.
  • Loading branch information
Stericson committed Jan 7, 2015
1 parent 9fbe755 commit b9330dc
Show file tree
Hide file tree
Showing 18 changed files with 546 additions and 2,754 deletions.
7 changes: 6 additions & 1 deletion RootTools/RootTools.iml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="LIBRARY_PROJECT" value="true" />
<option name="UPDATE_PROPERTY_FILES" value="true" />
<option name="ENABLE_SOURCES_AUTOGENERATION" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/out" />
<output-test url="file://$MODULE_DIR$/out/test/RootTools" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/src/com/stericson/RootToolsTests" />
</content>
<orderEntry type="jdk" jdkName="Android API 20, L preview Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="RootShell" level="project" />
</component>
</module>

9 changes: 9 additions & 0 deletions RootTools/RootTools.ipr
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,14 @@
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
<component name="libraryTable">
<library name="RootShell">
<CLASSES>
<root url="jar://$PROJECT_DIR$/RootShell.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
</project>

642 changes: 399 additions & 243 deletions RootTools/RootTools.iws

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions RootTools/src/com/stericson/RootTools/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

public class Constants
{
public static final String TAG = "RootTools v3.6";
public static final String TAG = "RootTools v4.1";
public static final int FPS = 1;
public static final int IAG = 2;
public static final int BBA = 3;
public static final int BBV = 4;
public static final int GI = 5;
Expand Down
62 changes: 23 additions & 39 deletions RootTools/src/com/stericson/RootTools/RootTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
import android.content.Intent;
import android.util.Log;

import com.stericson.RootShell.RootShell;
import com.stericson.RootShell.exceptions.RootDeniedException;
import com.stericson.RootShell.execution.Command;
import com.stericson.RootShell.execution.Shell;
import com.stericson.RootTools.containers.Mount;
import com.stericson.RootTools.containers.Permissions;
import com.stericson.RootTools.containers.Symlink;
import com.stericson.RootTools.exceptions.RootDeniedException;
import com.stericson.RootTools.execution.Command;
import com.stericson.RootTools.execution.Shell;
import com.stericson.RootTools.internal.Remounter;
import com.stericson.RootTools.internal.RootToolsInternalMethods;
import com.stericson.RootTools.internal.Runner;
Expand Down Expand Up @@ -84,7 +85,6 @@ private static final RootToolsInternalMethods getInternals()
// --------------------

public static boolean debugMode = false;
public static List<String> lastFoundBinaryPaths = new ArrayList<String>();
public static String utilPath;

/**
Expand Down Expand Up @@ -133,7 +133,7 @@ public static boolean checkUtil(String util)
*/
public static void closeAllShells() throws IOException
{
Shell.closeAll();
RootShell.closeAllShells();
}

/**
Expand All @@ -143,7 +143,7 @@ public static void closeAllShells() throws IOException
*/
public static void closeCustomShell() throws IOException
{
Shell.closeCustomShell();
RootShell.closeCustomShell();
}

/**
Expand All @@ -154,14 +154,7 @@ public static void closeCustomShell() throws IOException
*/
public static void closeShell(boolean root) throws IOException
{
if (root)
{
Shell.closeRootShell();
}
else
{
Shell.closeShell();
}
RootShell.closeShell(root);
}

/**
Expand Down Expand Up @@ -215,7 +208,7 @@ public static boolean exists(final String file)
*/
public static boolean exists(final String file, boolean isDir)
{
return getInternals().exists(file, isDir);
return RootShell.exists(file, isDir);
}

/**
Expand Down Expand Up @@ -251,13 +244,11 @@ public static boolean fixUtils(String[] utils) throws Exception

/**
* @param binaryName String that represent the binary to find.
* @return <code>true</code> if the specified binary was found. Also, the path the binary was
* found at can be retrieved via the variable lastFoundBinaryPath, if the binary was
* found in more than one location this will contain all of these locations.
* @return <code>List<String></code> containing the paths the binary was found at.
*/
public static boolean findBinary(String binaryName)
public static List<String> findBinary(String binaryName)
{
return getInternals().findBinary(binaryName);
return RootShell.findBinary(binaryName);
}

/**
Expand Down Expand Up @@ -307,12 +298,12 @@ public static List<String> getBusyBoxApplets(String path) throws Exception
* @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.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getCustomShell(String shellPath, int timeout) throws IOException, TimeoutException, RootDeniedException
{
return Shell.startCustomShell(shellPath, timeout);
return RootShell.getCustomShell(shellPath, timeout);
}

/**
Expand All @@ -321,7 +312,7 @@ public static Shell getCustomShell(String shellPath, int timeout) throws IOExcep
*
* @param shellPath a <code>String</code> to Indicate the path to the shell that you want to open.
* @throws TimeoutException
* @throws com.stericson.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getCustomShell(String shellPath) throws IOException, TimeoutException, RootDeniedException
Expand Down Expand Up @@ -398,19 +389,12 @@ public static List<String> getPath()
* @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.RootTools.exceptions.RootDeniedException
* @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
{
if (root)
{
return Shell.startRootShell(timeout, shellContext, retry);
}
else
{
return Shell.startShell(timeout);
}
return RootShell.getShell(root, timeout, shellContext, retry);
}

/**
Expand All @@ -421,7 +405,7 @@ public static Shell getShell(boolean root, int timeout, Shell.ShellContext 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
* @throws TimeoutException
* @throws com.stericson.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getShell(boolean root, int timeout, Shell.ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException
Expand All @@ -436,7 +420,7 @@ public static Shell getShell(boolean root, int timeout, Shell.ShellContext shell
* @param root a <code>boolean</code> to Indicate whether or not you want to open a root shell or a standard shell
* @param shellContext the context to execute the shell with
* @throws TimeoutException
* @throws com.stericson.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getShell(boolean root, Shell.ShellContext shellContext) throws IOException, TimeoutException, RootDeniedException
Expand All @@ -451,7 +435,7 @@ public static Shell getShell(boolean root, Shell.ShellContext shellContext) thro
* @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.
* @throws TimeoutException
* @throws com.stericson.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getShell(boolean root, int timeout) throws IOException, TimeoutException, RootDeniedException
Expand All @@ -465,7 +449,7 @@ public static Shell getShell(boolean root, int timeout) throws IOException, Time
*
* @param root a <code>boolean</code> to Indicate whether or not you want to open a root shell or a standard shell
* @throws TimeoutException
* @throws com.stericson.RootTools.exceptions.RootDeniedException
* @throws com.stericson.RootShell.exceptions.RootDeniedException
* @throws IOException
*/
public static Shell getShell(boolean root) throws IOException, TimeoutException, RootDeniedException
Expand Down Expand Up @@ -629,15 +613,15 @@ public static boolean isAppletAvailable(String applet)
*/
public static boolean isAccessGiven()
{
return getInternals().isAccessGiven();
return RootShell.isAccessGiven();
}

/**
* @return <code>true</code> if BusyBox was found.
*/
public static boolean isBusyboxAvailable()
{
return findBinary("busybox");
return RootShell.isBusyboxAvailable();
}

public static boolean isNativeToolsReady(int nativeToolsId, Context context)
Expand All @@ -663,7 +647,7 @@ public static boolean isProcessRunning(final String processName)
*/
public static boolean isRootAvailable()
{
return findBinary("su");
return RootShell.isRootAvailable();
}

/**
Expand Down
Loading

0 comments on commit b9330dc

Please sign in to comment.