Package android.os

Class Process


  • public class Process
    extends Object
    Tools for managing OS processes.
    • Field Detail

      • 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 to LAST_APPLICATION_UID that are reserved for assigning to applications.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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 with setThreadPriority(int) and #setThreadPriority(int, int), not with the normal Thread class.
        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
      • 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
    • Constructor Detail

      • Process

        public Process()
    • Method Detail

      • setThreadPriority

        public static final void setThreadPriority​(int priority)
                                            throws IllegalArgumentException,
                                                   SecurityException
        Sets 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.