|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stericson.RootTools.RootTools
public class RootTools
Nested Class Summary | |
---|---|
static class |
RootTools.Result
|
Field Summary | |
---|---|
static boolean |
debugMode
|
Constructor Summary | |
---|---|
RootTools()
|
Method Summary | |
---|---|
static boolean |
accessGiven()
Deprecated. As of release 0.7, replaced by isAccessGiven() |
static boolean |
busyboxAvailable()
Deprecated. As of release 0.7, replaced by isBusyboxAvailable() |
static boolean |
EnoughSpaceOnSdCard(long updateSize)
Deprecated. As of release 0.7, replaced by hasEnoughSpaceOnSdCard(long) |
static boolean |
findBinary(java.lang.String binaryName)
|
static java.lang.String |
getBusyBoxVersion()
|
static int |
getFilePermissions(java.lang.String file)
|
static java.util.ArrayList<com.stericson.RootTools.Mount> |
getMounts()
This will return an ArrayList of the class Mount. |
static java.util.Set<java.lang.String> |
getPath()
This will return the environment variable $PATH |
static long |
getSpace(java.lang.String path)
Get the space for a desired partition. |
static boolean |
hasEnoughSpaceOnSdCard(long updateSize)
Checks if there is enough Space on SDCard |
static boolean |
installBinary(android.content.Context context,
int sourceId,
java.lang.String destName)
This method can be used to unpack a binary from the raw resources folder and store it in /data/data/app.package/files/ This is typically useful if you provide your own C- or C++-based binary. |
static boolean |
installBinary(android.content.Context context,
int sourceId,
java.lang.String destName,
java.lang.String mode)
This method can be used to unpack a binary from the raw resources folder and store it in /data/data/app.package/files/ This is typically useful if you provide your own C- or C++-based binary. |
static boolean |
isAccessGiven()
|
static boolean |
isBusyboxAvailable()
|
static boolean |
isRootAvailable()
|
static void |
log(java.lang.String msg)
This method allows you to output debug messages only when debugging is on. |
static void |
log(java.lang.String TAG,
java.lang.String msg)
This method allows you to output debug messages only when debugging is on. |
static void |
offerBusyBox(android.app.Activity activity)
This will launch the Android market looking for BusyBox |
static android.content.Intent |
offerBusyBox(android.app.Activity activity,
int requestCode)
This will launch the Android market looking for BusyBox, but will return the intent fired and starts the activity with startActivityForResult |
static void |
offerSuperUser(android.app.Activity activity)
This will launch the Android market looking for SuperUser |
static android.content.Intent |
offerSuperUser(android.app.Activity activity,
int requestCode)
This will launch the Android market looking for SuperUser, but will return the intent fired and starts the activity with startActivityForResult |
static boolean |
remount(java.lang.String file,
java.lang.String mountType)
This will take a path, which can contain the file name as well, and attempt to remount the underlying partition. |
static boolean |
rootAvailable()
Deprecated. As of release 0.7, replaced by isRootAvailable() |
static java.util.List<java.lang.String> |
sendShell(java.lang.String command)
Sends one shell command as su (attempts to) |
static java.util.List<java.lang.String> |
sendShell(java.lang.String[] commands,
int sleepTime)
Sends several shell command as su (attempts to) |
static java.util.List<java.lang.String> |
sendShell(java.lang.String[] commands,
int sleepTime,
RootTools.Result result)
Sends several shell command as su (attempts to) |
static java.util.List<java.lang.String> |
sendShell(java.lang.String command,
RootTools.Result result)
Sends one shell command as su (attempts to) |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean debugMode
Constructor Detail |
---|
public RootTools()
Method Detail |
---|
public static java.util.Set<java.lang.String> getPath() throws java.lang.Exception
Set
A Set of Strings representing the environment variable $PATH
java.lang.Exception
- if we cannot return the $PATH variablepublic static java.util.ArrayList<com.stericson.RootTools.Mount> getMounts() throws java.lang.Exception
ArrayList
an ArrayList of the class Mount.
java.lang.Exception
- if we cannot return the mount points.public static void offerBusyBox(android.app.Activity activity)
activity
- pass in your Activitypublic static android.content.Intent offerBusyBox(android.app.Activity activity, int requestCode)
activity
- pass in your ActivityrequestCode
- pass in the request code
public static void offerSuperUser(android.app.Activity activity)
activity
- pass in your Activitypublic static android.content.Intent offerSuperUser(android.app.Activity activity, int requestCode)
activity
- pass in your ActivityrequestCode
- pass in the request code
@Deprecated public static boolean rootAvailable()
isRootAvailable()
true
if su was foundpublic static boolean isRootAvailable()
true
if su was found.@Deprecated public static boolean busyboxAvailable()
isBusyboxAvailable()
true
if BusyBox was foundpublic static boolean isBusyboxAvailable()
true
if BusyBox was found.public static boolean findBinary(java.lang.String binaryName)
binaryName
- String that represent the binary to find.
true
if the specified binary was found.public static int getFilePermissions(java.lang.String file)
file
- String that represent the file, including the full
path to the file and its name.
int
detailing the permissions of the file
or -1 if the file could not be found or permissions couldn't be determined.public static java.lang.String getBusyBoxVersion()
@Deprecated public static boolean accessGiven()
isAccessGiven()
true
if your app has been given root access.public static boolean isAccessGiven()
true
if your app has been given root access.@Deprecated public static boolean EnoughSpaceOnSdCard(long updateSize)
hasEnoughSpaceOnSdCard(long)
updateSize
- size to Check (long)
true
if the Update will fit on SDCard,
false
if not enough space on SDCard.
Will also return false
,
if the SDCard is not mounted as read/writepublic static boolean hasEnoughSpaceOnSdCard(long updateSize)
updateSize
- size to Check (long)
true
if the Update will fit on SDCard,
false
if not enough space on SDCard.
Will also return false
,
if the SDCard is not mounted as read/writepublic static boolean remount(java.lang.String file, java.lang.String mountType)
file
- file pathmountType
- mount type: pass in RO (Read only) or RW (Read Write)
boolean
which indicates whether or not the partition
has been remounted as specified.public static boolean installBinary(android.content.Context context, int sourceId, java.lang.String destName, java.lang.String mode)
context
- the current activity's Context
sourceId
- resource id; typically R.raw.id
destName
- destination file name; appended to /data/data/app.package/files/mode
- chmod value for this file
boolean
which indicates whether or not we were
able to create the new file.public static boolean installBinary(android.content.Context context, int sourceId, java.lang.String destName)
context
- the current activity's Context
sourceId
- resource id; typically R.raw.id
destName
- destination file name; appended to /data/data/app.package/files/
boolean
which indicates whether or not we were
able to create the new file.public static java.util.List<java.lang.String> sendShell(java.lang.String[] commands, int sleepTime, RootTools.Result result) throws java.io.IOException, java.lang.InterruptedException, com.stericson.RootTools.RootToolsException
commands
- array of commands to send to the shellsleepTime
- time to sleep between each command, delay.result
- injected result object that implements the Result class
LinkedList
containing each line that was returned
by the shell after executing or while trying to execute the given commands.
You must iterate over this list, it does not allow random access,
so no specifying an index of an item you want,
not like you're going to know that anyways.
java.lang.InterruptedException
java.io.IOException
com.stericson.RootTools.RootToolsException
public static java.util.List<java.lang.String> sendShell(java.lang.String[] commands, int sleepTime) throws java.io.IOException, java.lang.InterruptedException, com.stericson.RootTools.RootToolsException
commands
- array of commands to send to the shellsleepTime
- time to sleep between each command, delay.
java.lang.InterruptedException
java.io.IOException
com.stericson.RootTools.RootToolsException
public static java.util.List<java.lang.String> sendShell(java.lang.String command, RootTools.Result result) throws java.io.IOException, java.lang.InterruptedException, com.stericson.RootTools.RootToolsException
command
- command to send to the shellresult
- injected result object that implements the Result class
LinkedList
containing each line that was returned
by the shell after executing or while trying to execute the given commands.
You must iterate over this list, it does not allow random access,
so no specifying an index of an item you want,
not like you're going to know that anyways.
java.lang.InterruptedException
java.io.IOException
com.stericson.RootTools.RootToolsException
public static java.util.List<java.lang.String> sendShell(java.lang.String command) throws java.io.IOException, java.lang.InterruptedException, com.stericson.RootTools.RootToolsException
command
- command to send to the shell
java.lang.InterruptedException
java.io.IOException
com.stericson.RootTools.RootToolsException
public static long getSpace(java.lang.String path)
path
- The partition to find the space for.
public static void log(java.lang.String msg)
msg
- The message to output.public static void log(java.lang.String TAG, java.lang.String msg)
msg
- The message to output.TAG
- Optional parameter to define the tag that the Log will use.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |