/**@class android.os.Process @extends java.lang.Object Tools for managing OS processes. */ var Process = { /** @hide for internal use only. */ ZYGOTE_SOCKET : "zygote", /** @hide for internal use only. */ SECONDARY_ZYGOTE_SOCKET : "zygote_secondary", /** Defines the root UID. @hide */ ROOT_UID : "0", /** Defines the UID/GID under which system code runs. */ SYSTEM_UID : "1000", /** Defines the UID/GID under which the telephony code runs. */ PHONE_UID : "1001", /** Defines the UID/GID for the user shell. @hide */ SHELL_UID : "2000", /** Defines the UID/GID for the log group. @hide */ LOG_UID : "1007", /** Defines the UID/GID for the WIFI supplicant process. @hide */ WIFI_UID : "1010", /** Defines the UID/GID for the mediaserver process. @hide */ MEDIA_UID : "1013", /** Defines the UID/GID for the DRM process. @hide */ DRM_UID : "1019", /** Defines the UID/GID for the group that controls VPN services. @hide */ VPN_UID : "1016", /** Defines the UID/GID for the NFC service process. @hide */ NFC_UID : "1027", /** Defines the UID/GID for the Bluetooth service process. @hide */ BLUETOOTH_UID : "1002", /** Defines the GID for the group that allows write access to the internal media storage. @hide */ MEDIA_RW_GID : "1023", /** Access to installed package details @hide */ PACKAGE_INFO_GID : "1032", /** Defines the UID/GID for the shared RELRO file updater process. @hide */ SHARED_RELRO_UID : "1037", /** Defines the start of a range of UIDs (and GIDs), going from this number to {@link #LAST_APPLICATION_UID} that are reserved for assigning to applications. */ FIRST_APPLICATION_UID : "10000", /** Last of application-specific UIDs starting at {@link #FIRST_APPLICATION_UID}. */ LAST_APPLICATION_UID : "19999", /** First uid used for fully isolated sandboxed processes (with no permissions of their own) @hide */ FIRST_ISOLATED_UID : "99000", /** Last uid used for fully isolated sandboxed processes (with no permissions of their own) @hide */ LAST_ISOLATED_UID : "99999", /** Defines the gid shared by all applications running under the same profile. @hide */ SHARED_USER_GID : "9997", /** First gid for applications to share resources. Used when forward-locking is enabled but all UserHandles need to be able to read the resources. @hide */ FIRST_SHARED_APPLICATION_GID : "50000", /** Last gid for applications to share resources. Used when forward-locking is enabled but all UserHandles need to be able to read the resources. @hide */ LAST_SHARED_APPLICATION_GID : "59999", /** Standard priority of application threads. Use with {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_DEFAULT : "0", /** Lowest available thread priority. Only for those who really, really don't want to run if anything else is happening. Use with {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_LOWEST : "19", /** 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 {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_BACKGROUND : "10", /** 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 {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_FOREGROUND : "-2", /** Standard priority of system display threads, involved in updating the user interface. Applications can not normally change to this priority. Use with {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_DISPLAY : "-4", /** 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 {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_URGENT_DISPLAY : "-8", /** Standard priority of audio threads. Applications can not normally change to this priority. Use with {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_AUDIO : "-16", /** Standard priority of the most important audio threads. Applications can not normally change to this priority. Use with {@link #setThreadPriority}(int) and {@link #setThreadPriority(int, int)}, <b>not</b> with the normal {@link java.lang.Thread} class. */ THREAD_PRIORITY_URGENT_AUDIO : "-19", /** Minimum increment to make a priority more favorable. */ THREAD_PRIORITY_MORE_FAVORABLE : "-1", /** Minimum increment to make a priority less favorable. */ THREAD_PRIORITY_LESS_FAVORABLE : "1", /** Default scheduling policy @hide */ SCHED_OTHER : "0", /** First-In First-Out scheduling policy @hide */ SCHED_FIFO : "1", /** Round-Robin scheduling policy @hide */ SCHED_RR : "2", /** Batch scheduling policy @hide */ SCHED_BATCH : "3", /** Idle scheduling policy @hide */ SCHED_IDLE : "5", /** 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. @hide */ THREAD_GROUP_DEFAULT : "-1", /** 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. @hide */ THREAD_GROUP_BG_NONINTERACTIVE : "0", /** System thread group. @hide */ THREAD_GROUP_SYSTEM : "2", /** Application audio thread group. @hide */ THREAD_GROUP_AUDIO_APP : "3", /** System audio thread group. @hide */ THREAD_GROUP_AUDIO_SYS : "4", /***/ SIGNAL_QUIT : "3", /***/ SIGNAL_KILL : "9", /***/ SIGNAL_USR1 : "10", /**@hide */ PROC_TERM_MASK : "255", /**@hide */ PROC_ZERO_TERM : "0", /**@hide */ PROC_SPACE_TERM : "32", /**@hide */ PROC_TAB_TERM : "9", /**@hide */ PROC_COMBINE : "256", /**@hide */ PROC_PARENS : "512", /**@hide */ PROC_QUOTES : "1024", /**@hide */ PROC_OUT_STRING : "4096", /**@hide */ PROC_OUT_LONG : "8192", /**@hide */ PROC_OUT_FLOAT : "16384", /**Start a new process. <p>If processes are enabled, a new process is created and the static main() function of a <var>processClass</var> is executed there. The process will continue running after this function returns. <p>If processes are not enabled, a new thread in the caller's process is created and main() of <var>processClass</var> called there. <p>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 <var>processClass</var> to start them. @param {String} processClass The class to use as the process's main entry point. @param {String} niceName A more readable name to use for the process. @param {Number} uid The user-id under which the process will run. @param {Number} gid The group-id under which the process will run. @param {Object {int[]}} gids Additional group-ids associated with the process. @param {Number} debugFlags Additional flags. @param {Number} targetSdkVersion The target SDK version for the app. @param {Number} seInfo null-ok SELinux information for the new process. @param {String} abi non-null the ABI this app should be started with. @param {String} instructionSet null-ok the instruction set to use. @param {String} appDataDir null-ok the data directory of the app. @param {String} zygoteArgs Additional arguments to supply to the zygote process. @return {Object {android.os.Process.ProcessStartResult}} An object that describes the result of the attempt to start the process. @throws RuntimeException on fatal start failure {@hide} */ start : function( ) {}, /**Tries to establish a connection to the zygote that handles a given {@code abi}. Might block and retry if the zygote is unresponsive. This method is a no-op if a connection is already open. @hide */ establishZygoteConnectionForAbi : function( ) {}, /**Returns elapsed milliseconds of the time this process has run. @return {Number} Returns the number of milliseconds this process has return. */ getElapsedCpuTime : function( ) {}, /**Returns true if the current process is a 64-bit runtime. */ is64Bit : function( ) {}, /**Returns the identifier of this process, which can be used with {@link #killProcess} and {@link #sendSignal}. */ myPid : function( ) {}, /**Returns the identifier of this process' parent. @hide */ myPpid : function( ) {}, /**Returns the identifier of the calling thread, which be used with {@link #setThreadPriority(int, int)}. */ myTid : function( ) {}, /**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 {@link #myUserHandle} in that a uid identifies a specific app sandbox in a specific user. */ myUid : function( ) {}, /**Returns this process's user handle. This is the user the process is running under. It is distinct from {@link #myUid}() in that a particular user will have multiple distinct apps running under it each with their own uid. */ myUserHandle : function( ) {}, /**Returns whether the current process is in an isolated sandbox. @hide */ isIsolated : function( ) {}, /**{@hide} */ isIsolated : function( ) {}, /**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. */ getUidForName : function( ) {}, /**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. */ getGidForName : function( ) {}, /**Returns a uid for a currently running process. @param {Number} pid the process id @return {Number} the uid of the process, or -1 if the process is not running. @hide pending API council review */ getUidForPid : function( ) {}, /**Returns the parent process id for a currently running process. @param {Number} pid the process id @return {Number} the parent process id of the process, or -1 if the process is not running. @hide */ getParentPid : function( ) {}, /**Returns the thread group leader id for a currently running thread. @param {Number} tid the thread id @return {Number} 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. @hide */ getThreadGroupLeader : function( ) {}, /**Set the priority of a thread, based on Linux priorities. @param {Number} tid The identifier of the thread/process to change. @param {Number} priority A Linux priority level, from -20 for highest scheduling priority to 19 for lowest scheduling priority. @throws IllegalArgumentException Throws IllegalArgumentException if <var>tid</var> does not exist. @throws SecurityException Throws SecurityException if your process does not have permission to modify the given thread, or to use the given priority. */ setThreadPriority : function( ) {}, /**Call with 'false' to cause future calls to {@link #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. @hide */ setCanSelfBackground : function( ) {}, /**Sets the scheduling group for a thread. @param {Number} tid The identifier of the thread to change. @param {Number} group The target group for this thread from THREAD_GROUP_*. @param group The target group for this thread from THREAD_GROUP_*. @throws IllegalArgumentException Throws IllegalArgumentException if <var>tid</var> does not exist. @throws 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. */ setThreadGroup : function( ) {}, /**Sets the scheduling group for a process and all child threads @param {Number} pid The identifier of the process to change. @param {Number} group The target group for this process from THREAD_GROUP_*. @param group The target group for this process from THREAD_GROUP_*. @throws IllegalArgumentException Throws IllegalArgumentException if <var>tid</var> does not exist. @throws 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. */ setProcessGroup : function( ) {}, /**Return the scheduling group of requested process. @hide */ getProcessGroup : function( ) {}, /**Set the priority of the calling thread, based on Linux priorities. See {@link #setThreadPriority(int, int)} for more information. @param {Number} priority A Linux priority level, from -20 for highest scheduling priority to 19 for lowest scheduling priority. @throws IllegalArgumentException Throws IllegalArgumentException if <var>tid</var> does not exist. @throws SecurityException Throws SecurityException if your process does not have permission to modify the given thread, or to use the given priority. @see #setThreadPriority(int, int) */ setThreadPriority : function( ) {}, /**Return the current priority of a thread, based on Linux priorities. @param {Number} tid The identifier of the thread/process to change. @return {Number} 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 <var>tid</var> does not exist. */ getThreadPriority : function( ) {}, /**Set the scheduling policy and priority of a thread, based on Linux. @param {Number} tid The identifier of the thread/process to change. @param {Number} policy A Linux scheduling policy such as SCHED_OTHER etc. @param {Number} priority A Linux priority level in a range appropriate for the given policy. @throws IllegalArgumentException Throws IllegalArgumentException if <var>tid</var> does not exist, or if <var>priority</var> is out of range for the policy. @throws SecurityException Throws SecurityException if your process does not have permission to modify the given thread, or to use the given scheduling policy or priority. {@hide} */ setThreadScheduler : function( ) {}, /**Determine whether the current environment supports multiple processes. @return {Boolean} Returns true if the system can run in multiple processes, else false if everything is running in a single process. @deprecated This method always returns true. Do not use. */ supportsProcesses : function( ) {}, /**Adjust the swappiness level for a process. @param {Number} pid The process identifier to set. @param {Boolean} is_increased Whether swappiness should be increased or default. @return {Boolean} Returns true if the underlying system supports this feature, else false. {@hide} */ setSwappiness : function( ) {}, /**Change this process's argv[0] parameter. This can be useful to show more descriptive information in things like the 'ps' command. @param {String} text The new name of this process. {@hide} */ setArgV0 : function( ) {}, /**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. */ killProcess : function( ) {}, /** @hide */ setUid : function( ) {}, /** @hide */ setGid : function( ) {}, /**Send a signal to the given process. @param {Number} pid The pid of the target process. @param {Number} signal The signal to send. */ sendSignal : function( ) {}, /** @hide Private impl for avoiding a log message... DO NOT USE without doing your own log, or the Android Illuminati will find you some night and beat you up. */ killProcessQuiet : function( ) {}, /** @hide Private impl for avoiding a log message... DO NOT USE without doing your own log, or the Android Illuminati will find you some night and beat you up. */ sendSignalQuiet : function( ) {}, /** @hide */ getFreeMemory : function( ) {}, /** @hide */ getTotalMemory : function( ) {}, /** @hide */ readProcLines : function( ) {}, /** @hide */ getPids : function( ) {}, /** @hide */ readProcFile : function( ) {}, /** @hide */ parseProcLine : function( ) {}, /** @hide */ getPidsForCommands : function( ) {}, /**Gets the total Pss value for a given process, in bytes. @param {Number} pid the process to the Pss for @return {Number} the total Pss value for the given process in bytes, or -1 if the value cannot be determined @hide */ getPss : function( ) {}, /**Kill all processes in a process group started for the given pid. @hide */ killProcessGroup : function( ) {}, /**Remove all process groups. Expected to be called when ActivityManager is restarted. @hide */ removeAllProcessGroups : function( ) {}, };