|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stericson.RootTools.internal.RootToolsInternalMethods
public final class RootToolsInternalMethods
Constructor Summary | |
---|---|
protected |
RootToolsInternalMethods()
|
Method Summary | |
---|---|
boolean |
checkUtil(java.lang.String util)
This will check a given binary, determine if it exists and determine that it has either the permissions 755, 775, or 777. |
boolean |
copyFile(java.lang.String source,
java.lang.String destination,
boolean remountAsRw,
boolean preserveFileAttributes)
Copys a file to a destination. |
boolean |
deleteFileOrDirectory(java.lang.String target,
boolean remountAsRw)
Deletes a file or directory |
boolean |
exists(java.lang.String file)
Use this to check whether or not a file exists on the filesystem. |
boolean |
findBinary(java.lang.String binaryName)
|
void |
fixUtil(java.lang.String util,
java.lang.String utilPath)
This will try and fix a given binary. |
boolean |
fixUtils(java.lang.String[] utils)
This will check an array of binaries, determine if they exist and determine that it has either the permissions 755, 775, or 777. |
java.util.List<java.lang.String> |
getBusyBoxApplets(java.lang.String path)
This will return an List of Strings. |
java.lang.String |
getBusyBoxVersion(java.lang.String path)
|
long |
getConvertedSpace(java.lang.String spaceStr)
|
Permissions |
getFilePermissionsSymlinks(java.lang.String file)
|
java.lang.String |
getInode(java.lang.String file)
This method will return the inode number of a file. |
static void |
getInstance()
|
java.lang.String |
getMountedAs(java.lang.String path)
This will tell you how the specified mount is mounted. |
java.util.ArrayList<Mount> |
getMounts()
This will return an ArrayList of the class Mount. |
java.util.Set<java.lang.String> |
getPath()
This will return the environment variable $PATH |
Permissions |
getPermissions(java.lang.String line)
|
long |
getSpace(java.lang.String path)
Get the space for a desired partition. |
java.lang.String |
getSymlink(java.lang.String file)
This will return a String that represent the symlink for a specified file. |
java.util.ArrayList<Symlink> |
getSymLinks()
|
java.util.ArrayList<Symlink> |
getSymlinks(java.lang.String path)
This will return an ArrayList of the class Symlink. |
java.lang.String |
getWorkingToolbox()
This will return to you a string to be used in your shell commands which will represent the valid working toolbox with correct permissions. |
boolean |
hasEnoughSpaceOnSdCard(long updateSize)
Checks if there is enough Space on SDCard |
boolean |
hasUtil(java.lang.String util,
java.lang.String box)
Checks whether the toolbox or busybox binary contains a specific util |
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. |
boolean |
isAccessGiven()
|
boolean |
isAppletAvailable(java.lang.String applet,
java.lang.String binaryPath)
This will let you know if an applet is available from BusyBox |
boolean |
isBinaryAvailable(android.content.Context context,
java.lang.String binaryName)
This method checks whether a binary is installed. |
boolean |
isNativeToolsReady(int nativeToolsId,
android.content.Context context)
|
boolean |
isProcessRunning(java.lang.String processName)
This method can be used to to check if a process is running |
boolean |
killProcess(java.lang.String processName)
This method can be used to kill a running process |
void |
offerBusyBox(android.app.Activity activity)
This will launch the Android market looking for BusyBox |
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 |
void |
offerSuperUser(android.app.Activity activity)
This will launch the Android market looking for SuperUser |
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 |
int |
parsePermissions(java.lang.String permission)
|
int |
parseSpecialPermissions(java.lang.String permission)
|
boolean |
returnPath()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RootToolsInternalMethods()
Method Detail |
---|
public static void getInstance()
public boolean returnPath() throws java.util.concurrent.TimeoutException
java.util.concurrent.TimeoutException
public java.util.ArrayList<Symlink> getSymLinks() throws java.io.IOException
java.io.IOException
public Permissions getPermissions(java.lang.String line)
public int parsePermissions(java.lang.String permission)
public int parseSpecialPermissions(java.lang.String permission)
public boolean copyFile(java.lang.String source, java.lang.String destination, boolean remountAsRw, boolean preserveFileAttributes)
source
- example: /data/data/org.adaway/files/hostsdestination
- example: /system/etc/hostsremountAsRw
- remounts the destination as read/write before writing to itpreserveFileAttributes
- tries to copy file attributes from source to destination, if only cat is available
only permissions are preserved
public boolean checkUtil(java.lang.String util)
util
- Name of the utility to check.
public boolean deleteFileOrDirectory(java.lang.String target, boolean remountAsRw)
target
- example: /data/data/org.adaway/files/hostsremountAsRw
- remounts the destination as read/write before writing to it
public boolean exists(java.lang.String file)
file
- String that represent the file, including the full path to the
file and its name.
public void fixUtil(java.lang.String util, java.lang.String utilPath)
util
- Name of the utility to fix.utilPath
- path to the toolbox that provides ln, rm, and chmod. This can be a blank string, a
path to a binary that will provide these, or you can use
RootTools.getWorkingToolbox()public boolean fixUtils(java.lang.String[] utils) throws java.lang.Exception
utils
- Name of the utility to check.
java.lang.Exception
- if the operation cannot be completed.public boolean findBinary(java.lang.String binaryName)
binaryName
- String that represent the binary to find.
true
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.public java.util.List<java.lang.String> getBusyBoxApplets(java.lang.String path) throws java.lang.Exception
path
- Path to the busybox binary that you want the list of applets from.
null
If we cannot return the list of applets.
java.lang.Exception
public java.lang.String getBusyBoxVersion(java.lang.String path)
public long getConvertedSpace(java.lang.String spaceStr)
public java.lang.String getInode(java.lang.String file)
file
- path to the file that you wish to return the inode number
public boolean isAccessGiven()
true
if your app has been given root access.
java.util.concurrent.TimeoutException
- if this operation times out. (cannot determine if access is given)public boolean isNativeToolsReady(int nativeToolsId, android.content.Context context)
public Permissions getFilePermissionsSymlinks(java.lang.String file)
file
- String that represent the file, including the full path to the
file and its name.
public java.util.ArrayList<Mount> getMounts() throws java.lang.Exception
ArrayList
an ArrayList of the class Mount.
java.lang.Exception
- if we cannot return the mount points.public java.lang.String getMountedAs(java.lang.String path) throws java.lang.Exception
path
- mount you want to check
String
What the mount is mounted as.
java.lang.Exception
- if we cannot determine how the mount is mounted.public 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 long getSpace(java.lang.String path)
path
- The partition to find the space for.
java.util.concurrent.TimeoutException
public java.lang.String getSymlink(java.lang.String file)
file
- file to get the Symlink for. (must have absolute path)
String
a String that represent the symlink for a specified file or an
empty string if no symlink exists.public java.util.ArrayList<Symlink> getSymlinks(java.lang.String path) throws java.lang.Exception
path
- path to search for Symlinks.
ArrayList
an ArrayList of the class Symlink.
java.lang.Exception
- if we cannot return the Symlinks.public java.lang.String getWorkingToolbox()
public 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 boolean hasUtil(java.lang.String util, java.lang.String box)
util
- box
- Should contain "toolbox" or "busybox"
public 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 boolean isBinaryAvailable(android.content.Context context, java.lang.String binaryName)
context
- the current activity's Context
binaryName
- binary file name; appended to /data/data/app.package/files/
boolean
which indicates whether or not
the binary already exists.public boolean isAppletAvailable(java.lang.String applet, java.lang.String binaryPath)
applet
- The applet to check for.
true
if applet is available, false otherwise.public boolean isProcessRunning(java.lang.String processName)
processName
- name of process to check
true
if process was found
java.util.concurrent.TimeoutException
- (Could not determine if the process is running)public boolean killProcess(java.lang.String processName)
processName
- name of process to kill
true
if process was found and killed successfullypublic void offerBusyBox(android.app.Activity activity)
activity
- pass in your Activitypublic android.content.Intent offerBusyBox(android.app.Activity activity, int requestCode)
activity
- pass in your ActivityrequestCode
- pass in the request code
public void offerSuperUser(android.app.Activity activity)
activity
- pass in your Activitypublic android.content.Intent offerSuperUser(android.app.Activity activity, int requestCode)
activity
- pass in your ActivityrequestCode
- pass in the request code
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |