Package android.os
Class Process
- java.lang.Object
-
- android.os.Process
-
public class Process extends Object
Tools for managing OS processes.
-
-
Field Summary
Fields Modifier and Type Field Description static intBLUETOOTH_UIDDefines the UID/GID for the Bluetooth service process.static intDRM_UIDDefines the UID/GID for the DRM process.static intFIRST_APPLICATION_UIDDefines the start of a range of UIDs (and GIDs), going from this number toLAST_APPLICATION_UIDthat are reserved for assigning to applications.static intFIRST_ISOLATED_UIDFirst uid used for fully isolated sandboxed processes (with no permissions of their own)static intFIRST_SHARED_APPLICATION_GIDFirst gid for applications to share resources.static intLAST_APPLICATION_UIDLast of application-specific UIDs starting atFIRST_APPLICATION_UID.static intLAST_ISOLATED_UIDLast uid used for fully isolated sandboxed processes (with no permissions of their own)static intLAST_SHARED_APPLICATION_GIDLast gid for applications to share resources.static intLOG_UIDDefines the UID/GID for the log group.static intMEDIA_RW_GIDDefines the GID for the group that allows write access to the internal media storage.static intMEDIA_UIDDefines the UID/GID for the mediaserver process.static intNFC_UIDDefines the UID/GID for the NFC service process.static intPACKAGE_INFO_GIDAccess to installed package detailsstatic intPHONE_UIDDefines the UID/GID under which the telephony code runs.static intROOT_UIDDefines the root UID.static intSCHED_BATCHBatch scheduling policystatic intSCHED_FIFOFirst-In First-Out scheduling policystatic intSCHED_IDLEIdle scheduling policystatic intSCHED_OTHERDefault scheduling policystatic intSCHED_RRRound-Robin scheduling policystatic StringSECONDARY_ZYGOTE_SOCKETstatic intSHARED_RELRO_UIDDefines the UID/GID for the shared RELRO file updater process.static intSHARED_USER_GIDDefines the gid shared by all applications running under the same profile.static intSHELL_UIDDefines the UID/GID for the user shell.static intSIGNAL_KILLstatic intSIGNAL_QUITstatic intSIGNAL_USR1static intSYSTEM_UIDDefines the UID/GID under which system code runs.static intTHREAD_GROUP_AUDIO_APPApplication audio thread group.static intTHREAD_GROUP_AUDIO_SYSSystem audio thread group.static intTHREAD_GROUP_BG_NONINTERACTIVEBackground thread group - All threads in this group are scheduled with a reduced share of the CPU.static intTHREAD_GROUP_DEFAULTDefault thread group - has meaning with setProcessGroup() only, cannot be used with setThreadGroup().static intTHREAD_GROUP_SYSTEMSystem thread group.static intTHREAD_PRIORITY_AUDIOStandard priority of audio threads.static intTHREAD_PRIORITY_BACKGROUNDStandard priority background threads.static intTHREAD_PRIORITY_DEFAULTStandard priority of application threads.static intTHREAD_PRIORITY_DISPLAYStandard priority of system display threads, involved in updating the user interface.static intTHREAD_PRIORITY_FOREGROUNDStandard priority of threads that are currently running a user interface that the user is interacting with.static intTHREAD_PRIORITY_LESS_FAVORABLEMinimum increment to make a priority less favorable.static intTHREAD_PRIORITY_LOWESTLowest available thread priority.static intTHREAD_PRIORITY_MORE_FAVORABLEMinimum increment to make a priority more favorable.static intTHREAD_PRIORITY_URGENT_AUDIOStandard priority of the most important audio threads.static intTHREAD_PRIORITY_URGENT_DISPLAYStandard priority of the most important display threads, for compositing the screen and retrieving input events.static intVPN_UIDDefines the UID/GID for the group that controls VPN services.static intWIFI_UIDDefines the UID/GID for the WIFI supplicant process.static StringZYGOTE_SOCKET
-
Constructor Summary
Constructors Constructor Description Process()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsetThreadPriority(int priority)Sets the scheduling group for a thread.
-
-
-
Field Detail
-
ZYGOTE_SOCKET
public static final String ZYGOTE_SOCKET
- See Also:
- Constant Field Values
-
SECONDARY_ZYGOTE_SOCKET
public static final String SECONDARY_ZYGOTE_SOCKET
- See Also:
- Constant Field Values
-
ROOT_UID
public static final int ROOT_UID
Defines the root UID.- See Also:
- Constant Field Values
-
SYSTEM_UID
public static final int SYSTEM_UID
Defines the UID/GID under which system code runs.- See Also:
- Constant Field Values
-
PHONE_UID
public static final int PHONE_UID
Defines the UID/GID under which the telephony code runs.- See Also:
- Constant Field Values
-
SHELL_UID
public static final int SHELL_UID
Defines the UID/GID for the user shell.- See Also:
- Constant Field Values
-
LOG_UID
public static final int LOG_UID
Defines the UID/GID for the log group.- See Also:
- Constant Field Values
-
WIFI_UID
public static final int WIFI_UID
Defines the UID/GID for the WIFI supplicant process.- See Also:
- Constant Field Values
-
MEDIA_UID
public static final int MEDIA_UID
Defines the UID/GID for the mediaserver process.- See Also:
- Constant Field Values
-
DRM_UID
public static final int DRM_UID
Defines the UID/GID for the DRM process.- See Also:
- Constant Field Values
-
VPN_UID
public static final int VPN_UID
Defines the UID/GID for the group that controls VPN services.- See Also:
- Constant Field Values
-
NFC_UID
public static final int NFC_UID
Defines the UID/GID for the NFC service process.- See Also:
- Constant Field Values
-
BLUETOOTH_UID
public static final int BLUETOOTH_UID
Defines the UID/GID for the Bluetooth service process.- See Also:
- Constant Field Values
-
MEDIA_RW_GID
public static final int MEDIA_RW_GID
Defines the GID for the group that allows write access to the internal media storage.- See Also:
- Constant Field Values
-
PACKAGE_INFO_GID
public static final int PACKAGE_INFO_GID
Access to installed package details- See Also:
- Constant Field Values
-
SHARED_RELRO_UID
public static final int SHARED_RELRO_UID
Defines the UID/GID for the shared RELRO file updater process.- See Also:
- Constant Field Values
-
FIRST_APPLICATION_UID
public static final int FIRST_APPLICATION_UID
Defines the start of a range of UIDs (and GIDs), going from this number toLAST_APPLICATION_UIDthat are reserved for assigning to applications.- See Also:
- Constant Field Values
-
LAST_APPLICATION_UID
public static final int LAST_APPLICATION_UID
Last of application-specific UIDs starting atFIRST_APPLICATION_UID.- See Also:
- Constant Field Values
-
FIRST_ISOLATED_UID
public static final int FIRST_ISOLATED_UID
First uid used for fully isolated sandboxed processes (with no permissions of their own)- See Also:
- Constant Field Values
-
LAST_ISOLATED_UID
public static final int LAST_ISOLATED_UID
Last uid used for fully isolated sandboxed processes (with no permissions of their own)- See Also:
- Constant Field Values
-
SHARED_USER_GID
public static final int SHARED_USER_GID
Defines the gid shared by all applications running under the same profile.- See Also:
- Constant Field Values
-
FIRST_SHARED_APPLICATION_GID
public static final int FIRST_SHARED_APPLICATION_GID
First gid for applications to share resources. Used when forward-locking is enabled but all UserHandles need to be able to read the resources.- See Also:
- Constant Field Values
-
LAST_SHARED_APPLICATION_GID
public static final int LAST_SHARED_APPLICATION_GID
Last gid for applications to share resources. Used when forward-locking is enabled but all UserHandles need to be able to read the resources.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_DEFAULT
public static final int THREAD_PRIORITY_DEFAULT
Standard priority of application threads. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_LOWEST
public static final int THREAD_PRIORITY_LOWEST
Lowest available thread priority. Only for those who really, really don't want to run if anything else is happening. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_BACKGROUND
public static final int THREAD_PRIORITY_BACKGROUND
Standard priority background threads. This gives your thread a slightly lower than normal priority, so that it will have less chance of impacting the responsiveness of the user interface. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_FOREGROUND
public static final int THREAD_PRIORITY_FOREGROUND
Standard priority of threads that are currently running a user interface that the user is interacting with. Applications can not normally change to this priority; the system will automatically adjust your application threads as the user moves through the UI. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_DISPLAY
public static final int THREAD_PRIORITY_DISPLAY
Standard priority of system display threads, involved in updating the user interface. Applications can not normally change to this priority. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_URGENT_DISPLAY
public static final int THREAD_PRIORITY_URGENT_DISPLAY
Standard priority of the most important display threads, for compositing the screen and retrieving input events. Applications can not normally change to this priority. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_AUDIO
public static final int THREAD_PRIORITY_AUDIO
Standard priority of audio threads. Applications can not normally change to this priority. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_URGENT_AUDIO
public static final int THREAD_PRIORITY_URGENT_AUDIO
Standard priority of the most important audio threads. Applications can not normally change to this priority. Use withsetThreadPriority(int)and#setThreadPriority(int, int), not with the normalThreadclass.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_MORE_FAVORABLE
public static final int THREAD_PRIORITY_MORE_FAVORABLE
Minimum increment to make a priority more favorable.- See Also:
- Constant Field Values
-
THREAD_PRIORITY_LESS_FAVORABLE
public static final int THREAD_PRIORITY_LESS_FAVORABLE
Minimum increment to make a priority less favorable.- See Also:
- Constant Field Values
-
SCHED_OTHER
public static final int SCHED_OTHER
Default scheduling policy- See Also:
- Constant Field Values
-
SCHED_FIFO
public static final int SCHED_FIFO
First-In First-Out scheduling policy- See Also:
- Constant Field Values
-
SCHED_RR
public static final int SCHED_RR
Round-Robin scheduling policy- See Also:
- Constant Field Values
-
SCHED_BATCH
public static final int SCHED_BATCH
Batch scheduling policy- See Also:
- Constant Field Values
-
SCHED_IDLE
public static final int SCHED_IDLE
Idle scheduling policy- See Also:
- Constant Field Values
-
THREAD_GROUP_DEFAULT
public static final int THREAD_GROUP_DEFAULT
Default thread group - has meaning with setProcessGroup() only, cannot be used with setThreadGroup(). When used with setProcessGroup(), the group of each thread in the process is conditionally changed based on that thread's current priority, as follows: threads with priority numerically less than THREAD_PRIORITY_BACKGROUND are moved to foreground thread group. All other threads are left unchanged.- See Also:
- Constant Field Values
-
THREAD_GROUP_BG_NONINTERACTIVE
public static final int THREAD_GROUP_BG_NONINTERACTIVE
Background thread group - All threads in this group are scheduled with a reduced share of the CPU. Value is same as constant SP_BACKGROUND of enum SchedPolicy. FIXME rename to THREAD_GROUP_BACKGROUND.- See Also:
- Constant Field Values
-
THREAD_GROUP_SYSTEM
public static final int THREAD_GROUP_SYSTEM
System thread group.- See Also:
- Constant Field Values
-
THREAD_GROUP_AUDIO_APP
public static final int THREAD_GROUP_AUDIO_APP
Application audio thread group.- See Also:
- Constant Field Values
-
THREAD_GROUP_AUDIO_SYS
public static final int THREAD_GROUP_AUDIO_SYS
System audio thread group.- See Also:
- Constant Field Values
-
SIGNAL_QUIT
public static final int SIGNAL_QUIT
- See Also:
- Constant Field Values
-
SIGNAL_KILL
public static final int SIGNAL_KILL
- See Also:
- Constant Field Values
-
SIGNAL_USR1
public static final int SIGNAL_USR1
- See Also:
- Constant Field Values
-
-
Method Detail
-
setThreadPriority
public static final void setThreadPriority(int priority) throws IllegalArgumentException, SecurityExceptionSets the scheduling group for a thread.- Parameters:
tid- The identifier of the thread to change.group- The target group for this thread from THREAD_GROUP_*.- Throws:
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. If the thread is a thread group leader, that is it's gettid() == getpid(), then the other threads in the same thread group are _not_ affected.
-
-