|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.os.Process
public class Process
Tools for managing OS processes.
| Field Summary | |
|---|---|
static String |
ANDROID_SHARED_MEDIA
Name of a process for running the platform's media services. |
static int |
BLUETOOTH_GID
Defines a secondary group id for access to the bluetooth hardware. |
static int |
FIRST_APPLICATION_UID
Defines the start of a range of UIDs (and GIDs), going from this number to LAST_APPLICATION_UID that are reserved for assigning
to applications. |
static String |
GOOGLE_SHARED_APP_CONTENT
Name of the process that Google content providers can share. |
static int |
LAST_APPLICATION_UID
Last of application-specific UIDs starting at FIRST_APPLICATION_UID. |
static int |
PHONE_UID
Defines the UID/GID under which the telephony code runs. |
static int |
PROC_COMBINE
|
static int |
PROC_OUT_FLOAT
|
static int |
PROC_OUT_LONG
|
static int |
PROC_OUT_STRING
|
static int |
PROC_PARENS
|
static int |
PROC_SPACE_TERM
|
static int |
PROC_TERM_MASK
|
static int |
PROC_ZERO_TERM
|
static int |
SIGNAL_KILL
|
static int |
SIGNAL_QUIT
|
static int |
SIGNAL_USR1
|
(package private) static boolean |
sPreviousZygoteOpenFailed
true if previous zygote open failed |
static int |
SYSTEM_UID
Defines the UID/GID under which system code runs. |
(package private) static DataInputStream |
sZygoteInputStream
|
(package private) static LocalSocket |
sZygoteSocket
|
(package private) static BufferedWriter |
sZygoteWriter
|
static int |
THREAD_PRIORITY_AUDIO
Standard priority of audio threads. |
static int |
THREAD_PRIORITY_BACKGROUND
Standard priority background threads. |
static int |
THREAD_PRIORITY_DEFAULT
Standard priority of application threads. |
static int |
THREAD_PRIORITY_DISPLAY
Standard priority of system display threads, involved in updating the user interface. |
static int |
THREAD_PRIORITY_FOREGROUND
Standard priority of threads that are currently running a user interface that the user is interacting with. |
static int |
THREAD_PRIORITY_LESS_FAVORABLE
Minimum increment to make a priority less favorable. |
static int |
THREAD_PRIORITY_LOWEST
Lowest available thread priority. |
static int |
THREAD_PRIORITY_MORE_FAVORABLE
Minimum increment to make a priority more favorable. |
static int |
THREAD_PRIORITY_URGENT_AUDIO
Standard priority of the most important audio threads. |
static int |
THREAD_PRIORITY_URGENT_DISPLAY
Standard priority of the most important display threads, for compositing the screen and retrieving input events. |
(package private) static int |
ZYGOTE_RETRY_MILLIS
retry interval for opening a zygote socket |
| Constructor Summary | |
|---|---|
Process()
|
|
| Method Summary | |
|---|---|
static long |
getElapsedCpuTime()
Returns elapsed milliseconds of the time this process has run. |
static int |
getFreeMemory()
|
static int |
getGidForName(String name)
Returns the GID assigned to a particular user name, or -1 if there is none. |
static int[] |
getPids(String path,
int[] lastArray)
|
static long |
getPss(int pid)
Gets the total Pss value for a given process, in bytes. |
static int |
getThreadPriority(int tid)
Return the current priority of a thread, based on Linux priorities. |
static int |
getUidForName(String name)
Returns the UID assigned to a partlicular user name, or -1 if there is none. |
static void |
killProcess(int pid)
Kill the process with the given PID. |
static int |
myPid()
Returns the identifier of this process, which can be used with killProcess(int) and sendSignal(int, int). |
static int |
myTid()
Returns the identifier of the calling thread, which be used with setThreadPriority(int, int). |
static boolean |
readProcFile(String file,
int[] format,
String[] outStrings,
long[] outLongs,
float[] outFloats)
|
static void |
readProcLines(String path,
String[] reqFields,
long[] outSizes)
|
static void |
sendSignal(int pid,
int signal)
Send a signal to the given process. |
static void |
setArgV0(String text)
Change this process's argv[0] parameter. |
static int |
setGid(int uid)
|
static boolean |
setOomAdj(int pid,
int amt)
Set the out-of-memory badness adjustment for a process. |
static void |
setThreadPriority(int priority)
Set the priority of the calling thread, based on Linux priorities. |
static void |
setThreadPriority(int tid,
int priority)
Set the priority of a thread, based on Linux priorities. |
static int |
setUid(int uid)
|
static int |
start(String processClass,
int uid,
int gid,
int[] gids,
boolean enableDebugger,
String[] zygoteArgs)
Start a new process. |
static int |
start(String processClass,
String niceName,
int uid,
int gid,
int[] gids,
boolean enableDebugger,
String[] zygoteArgs)
Start a new process. |
static boolean |
supportsProcesses()
Determine whether the current environment supports multiple processes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ANDROID_SHARED_MEDIA
public static final String GOOGLE_SHARED_APP_CONTENT
public static final int SYSTEM_UID
public static final int PHONE_UID
public static final int FIRST_APPLICATION_UID
LAST_APPLICATION_UID that are reserved for assigning
to applications.
public static final int LAST_APPLICATION_UID
FIRST_APPLICATION_UID.
public static final int BLUETOOTH_GID
public static final int THREAD_PRIORITY_DEFAULT
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_LOWEST
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_BACKGROUND
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_FOREGROUND
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_DISPLAY
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_URGENT_DISPLAY
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_AUDIO
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_URGENT_AUDIO
setThreadPriority(int) and
setThreadPriority(int, int), not with the normal
Thread class.
public static final int THREAD_PRIORITY_MORE_FAVORABLE
public static final int THREAD_PRIORITY_LESS_FAVORABLE
public static final int SIGNAL_QUIT
public static final int SIGNAL_KILL
public static final int SIGNAL_USR1
static LocalSocket sZygoteSocket
static DataInputStream sZygoteInputStream
static BufferedWriter sZygoteWriter
static boolean sPreviousZygoteOpenFailed
static final int ZYGOTE_RETRY_MILLIS
public static final int PROC_TERM_MASK
public static final int PROC_ZERO_TERM
public static final int PROC_SPACE_TERM
public static final int PROC_COMBINE
public static final int PROC_PARENS
public static final int PROC_OUT_STRING
public static final int PROC_OUT_LONG
public static final int PROC_OUT_FLOAT
| Constructor Detail |
|---|
public Process()
| Method Detail |
|---|
public static final int start(String processClass,
String niceName,
int uid,
int gid,
int[] gids,
boolean enableDebugger,
String[] zygoteArgs)
If processes are enabled, a new process is created and the static main() function of a processClass is executed there. The process will continue running after this function returns.
If processes are not enabled, a new thread in the caller's process is created and main() of processClass called there.
The niceName parameter, if not an empty string, is a custom name to give to the process instead of using processClass. This allows you to make easily identifyable processes even if you are using the same base processClass to start them.
processClass - The class to use as the process's main entry
point.niceName - A more readable name to use for the process.uid - The user-id under which the process will run.gid - The group-id under which the process will run.gids - Additional group-ids associated with the process.enableDebugger - True if debugging should be enabled for this process.zygoteArgs - Additional arguments to supply to the zygote process.
RuntimeException - on fatal start failure
public static final int start(String processClass,
int uid,
int gid,
int[] gids,
boolean enableDebugger,
String[] zygoteArgs)
public static final long getElapsedCpuTime()
public static final int myPid()
killProcess(int) and sendSignal(int, int).
public static final int myTid()
setThreadPriority(int, int).
public static final int getUidForName(String name)
public static final int getGidForName(String name)
public static final void setThreadPriority(int tid,
int priority)
throws IllegalArgumentException,
SecurityException
tid - The identifier of the thread/process to change.priority - A Linux priority level, from -20 for highest scheduling
priority to 19 for lowest scheduling priority.
IllegalArgumentException - Throws IllegalArgumentException if
tid does not exist.
SecurityException - Throws SecurityException if your process does
not have permission to modify the given thread, or to use the given
priority.
public static final void setThreadPriority(int priority)
throws IllegalArgumentException,
SecurityException
setThreadPriority(int, int) for more information.
priority - A Linux priority level, from -20 for highest scheduling
priority to 19 for lowest scheduling priority.
IllegalArgumentException - Throws IllegalArgumentException if
tid does not exist.
SecurityException - Throws SecurityException if your process does
not have permission to modify the given thread, or to use the given
priority.setThreadPriority(int, int)
public static final int getThreadPriority(int tid)
throws IllegalArgumentException
tid - The identifier of the thread/process to change.
IllegalArgumentException - Throws IllegalArgumentException if
tid does not exist.public static final boolean supportsProcesses()
public static final boolean setOomAdj(int pid,
int amt)
pid - The process identifier to set.amt - Adjustment value -- linux allows -16 to +15.
public static final void setArgV0(String text)
text - The new name of this process.
public static final void killProcess(int pid)
public static final int setUid(int uid)
public static final int setGid(int uid)
public static final void sendSignal(int pid,
int signal)
pid - The pid of the target process.signal - The signal to send.public static final int getFreeMemory()
public static final void readProcLines(String path,
String[] reqFields,
long[] outSizes)
public static final int[] getPids(String path,
int[] lastArray)
public static final boolean readProcFile(String file,
int[] format,
String[] outStrings,
long[] outLongs,
float[] outFloats)
public static final long getPss(int pid)
pid - the process to the Pss for
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||