IT. Expert System.

Android Reference

Process


android.os

Class Process



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

      • ANDROID_SHARED_MEDIA

        public static final String ANDROID_SHARED_MEDIA
        Name of a process for running the platform's media services.
        See Also:
        Constant Field Values
      • GOOGLE_SHARED_APP_CONTENT

        public static final String GOOGLE_SHARED_APP_CONTENT
        Name of the process that Google content providers can share.
        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
      • SDCARD_RW_GID

        public static final int SDCARD_RW_GID
        Defines the GID for the group that allows write access to the SD card.
        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
      • 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
      • 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
      • BLUETOOTH_GID

        public static final int BLUETOOTH_GID
        Defines a secondary group id for access to the bluetooth hardware.
        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_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_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
      • 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

      • start

        public static final Process.ProcessStartResult start(String processClass,
                                       String niceName,
                                       int uid,
                                       int gid,
                                       int[] gids,
                                       int debugFlags,
                                       int mountExternal,
                                       int targetSdkVersion,
                                       String seInfo,
                                       String[] zygoteArgs)
        Start a new process.

        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.

        Parameters:
        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.
        debugFlags - Additional flags.
        targetSdkVersion - The target SDK version for the app.
        seInfo - null-ok SE Android information for the new process.
        zygoteArgs - Additional arguments to supply to the zygote process.
        Returns:
        An object that describes the result of the attempt to start the process.
        Throws:
        RuntimeException - on fatal start failure
      • getElapsedCpuTime

        public static final long getElapsedCpuTime()
        Returns elapsed milliseconds of the time this process has run.
        Returns:
        Returns the number of milliseconds this process has return.
      • myUid

        public static final int myUid()
        Returns the identifier of this process's uid. This is the kernel uid that the process is running under, which is the identity of its app-specific sandbox. It is different from myUserHandle() in that a uid identifies a specific app sandbox in a specific user.
      • myUserHandle

        public static final UserHandle myUserHandle()
        Returns this process's user handle. This is the user the process is running under. It is distinct from myUid() in that a particular user will have multiple distinct apps running under it each with their own uid.
      • isIsolated

        public static final boolean isIsolated()
        Returns whether the current process is in an isolated sandbox.
      • getUidForName

        public static final int getUidForName(String name)
        Returns the UID assigned to a particular user name, or -1 if there is none. If the given string consists of only numbers, it is converted directly to a uid.
      • getGidForName

        public static final int getGidForName(String name)
        Returns the GID assigned to a particular user name, or -1 if there is none. If the given string consists of only numbers, it is converted directly to a gid.
      • getUidForPid

        public static final int getUidForPid(int pid)
        Returns a uid for a currently running process.
        Parameters:
        pid - the process id
        Returns:
        the uid of the process, or -1 if the process is not running.
      • getParentPid

        public static final int getParentPid(int pid)
        Returns the parent process id for a currently running process.
        Parameters:
        pid - the process id
        Returns:
        the parent process id of the process, or -1 if the process is not running.
      • getThreadGroupLeader

        public static final int getThreadGroupLeader(int tid)
        Returns the thread group leader id for a currently running thread.
        Parameters:
        tid - the thread id
        Returns:
        the thread group leader id of the thread, or -1 if the thread is not running. This is same as what getpid(2) would return if called by tid.
      • setThreadPriority

        public static final void setThreadPriority(int tid,
                             int priority)
                                            throws IllegalArgumentException,
                                                   SecurityException
        Set the priority of a thread, based on Linux priorities.
        Parameters:
        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.
        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.
      • setCanSelfBackground

        public static final void setCanSelfBackground(boolean backgroundOk)
        Call with 'false' to cause future calls to setThreadPriority(int) to throw an exception if passed a background-level thread priority. This is only effective if the JNI layer is built with GUARD_THREAD_PRIORITY defined to 1.
      • setThreadGroup

        public static final void setThreadGroup(int tid,
                          int group)
                                         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.
      • setProcessGroup

        public static final void setProcessGroup(int pid,
                           int group)
                                          throws IllegalArgumentException,
                                                 SecurityException
        Sets the scheduling group for a process and all child threads
        Parameters:
        pid - The identifier of the process to change.
        group - The target group for this process 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. group == THREAD_GROUP_DEFAULT means to move all non-background priority threads to the foreground scheduling group, but to leave background priority threads alone. group == THREAD_GROUP_BG_NONINTERACTIVE moves all threads, regardless of priority, to the background scheduling group. group == THREAD_GROUP_FOREGROUND is not allowed.
      • getThreadPriority

        public static final int getThreadPriority(int tid)
                                           throws IllegalArgumentException
        Return the current priority of a thread, based on Linux priorities.
        Parameters:
        tid - The identifier of the thread/process to change.
        Returns:
        Returns the current priority, as a Linux priority level, from -20 for highest scheduling priority to 19 for lowest scheduling priority.
        Throws:
        IllegalArgumentException - Throws IllegalArgumentException if tid does not exist.
      • setThreadScheduler

        public static final void setThreadScheduler(int tid,
                              int policy,
                              int priority)
                                             throws IllegalArgumentException
        Set the scheduling policy and priority of a thread, based on Linux.
        Parameters:
        tid - The identifier of the thread/process to change.
        policy - A Linux scheduling policy such as SCHED_OTHER etc.
        priority - A Linux priority level in a range appropriate for the given policy.
        Throws:
        IllegalArgumentException - Throws IllegalArgumentException if tid does not exist, or if priority is out of range for the policy.
        SecurityException - Throws SecurityException if your process does not have permission to modify the given thread, or to use the given scheduling policy or priority.
      • supportsProcesses

        @Deprecated
        public static final boolean supportsProcesses()
        Deprecated. This method always returns true. Do not use.
        Determine whether the current environment supports multiple processes.
        Returns:
        Returns true if the system can run in multiple processes, else false if everything is running in a single process.
      • setOomAdj

        public static final boolean setOomAdj(int pid,
                        int amt)
        Set the out-of-memory badness adjustment for a process.
        Parameters:
        pid - The process identifier to set.
        amt - Adjustment value -- linux allows -16 to +15.
        Returns:
        Returns true if the underlying system supports this feature, else false.
      • setArgV0

        public static final void setArgV0(String text)
        Change this process's argv[0] parameter. This can be useful to show more descriptive information in things like the 'ps' command.
        Parameters:
        text - The new name of this process.
      • killProcess

        public static final void killProcess(int pid)
        Kill the process with the given PID. Note that, though this API allows us to request to kill any process based on its PID, the kernel will still impose standard restrictions on which PIDs you are actually able to kill. Typically this means only the process running the caller's packages/application and any additional processes created by that app; packages sharing a common UID will also be able to kill each other's processes.
      • setUid

        public static final int setUid(int uid)
      • setGid

        public static final int setGid(int uid)
      • sendSignal

        public static final void sendSignal(int pid,
                      int signal)
        Send a signal to the given process.
        Parameters:
        pid - The pid of the target process.
        signal - The signal to send.
      • killProcessQuiet

        public static final void killProcessQuiet(int pid)
      • sendSignalQuiet

        public static final void sendSignalQuiet(int pid,
                           int signal)
      • getFreeMemory

        public static final long getFreeMemory()
      • getTotalMemory

        public static final long getTotalMemory()
      • readProcLines

        public static final void readProcLines(String path,
                         String[] reqFields,
                         long[] outSizes)
      • getPids

        public static final int[] getPids(String path,
                    int[] lastArray)
      • readProcFile

        public static final boolean readProcFile(String file,
                           int[] format,
                           String[] outStrings,
                           long[] outLongs,
                           float[] outFloats)
      • parseProcLine

        public static final boolean parseProcLine(byte[] buffer,
                            int startIndex,
                            int endIndex,
                            int[] format,
                            String[] outStrings,
                            long[] outLongs,
                            float[] outFloats)
      • getPidsForCommands

        public static final int[] getPidsForCommands(String[] cmds)
      • getPss

        public static final long getPss(int pid)
        Gets the total Pss value for a given process, in bytes.
        Parameters:
        pid - the process to the Pss for
        Returns:
        the total Pss value for the given process in bytes, or -1 if the value cannot be determined


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 409 / . Delta: 0.03148 с