diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-27 09:18:14 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-27 09:18:14 -0700 |
commit | 3eab744d018924189b1b8f5530accd52e91213de (patch) | |
tree | f9002bced44ef10597b196f8c09b3f0f6843d9b3 /core/java/android/os | |
parent | 1fb758e94b5b9e342b6dc6452cb5bd7cf0cc4ed6 (diff) | |
parent | e9d376b801b7890b1ef5006ed55de4208e64bb63 (diff) | |
download | frameworks_base-3eab744d018924189b1b8f5530accd52e91213de.zip frameworks_base-3eab744d018924189b1b8f5530accd52e91213de.tar.gz frameworks_base-3eab744d018924189b1b8f5530accd52e91213de.tar.bz2 |
Merge change 376 into donut
* changes:
Add support for changing a threads scheduler group. Three groups are available (default, background non interactive, foreground boost). Setting a thread priority to PRIORITY_BACKGROUND will transparently change groups to background
Diffstat (limited to 'core/java/android/os')
-rw-r--r-- | core/java/android/os/Process.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index e4412a3..30acef9 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -176,6 +176,26 @@ public class Process { */ public static final int THREAD_PRIORITY_LESS_FAVORABLE = +1; + /** + * Default thread group - gets a 'normal' share of the CPU + * @hide + */ + public static final int THREAD_GROUP_DEFAULT = 0; + + /** + * Background non-interactive thread group - All threads in + * this group are scheduled with a reduced share of the CPU. + * @hide + */ + public static final int THREAD_GROUP_BG_NONINTERACTIVE = 1; + + /** + * Foreground 'boost' thread group - All threads in + * this group are scheduled with an increased share of the CPU + * @hide + **/ + public static final int THREAD_GROUP_FG_BOOST = 2; + public static final int SIGNAL_QUIT = 3; public static final int SIGNAL_KILL = 9; public static final int SIGNAL_USR1 = 10; @@ -569,6 +589,21 @@ public class Process { */ public static final native void setThreadPriority(int tid, int priority) throws IllegalArgumentException, SecurityException; + + /** + * Sets the scheduling group for a thread. + * @hide + * @param tid The indentifier of the thread/process to change. + * @param group The target group for this thread/process. + * + * @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. + */ + public static final native void setThreadGroup(int tid, int group) + throws IllegalArgumentException, SecurityException; /** * Set the priority of the calling thread, based on Linux priorities. See |