summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-04-21 14:06:36 -0700
committerSan Mehat <san@google.com>2009-04-27 09:17:06 -0700
commite9d376b801b7890b1ef5006ed55de4208e64bb63 (patch)
tree9c4840944aeaccfe4c9eaf6a72a164af38f17ed1 /core/java
parent03a54faa454381e8d67fe11b1be2b2d54f3894c6 (diff)
downloadframeworks_base-e9d376b801b7890b1ef5006ed55de4208e64bb63.zip
frameworks_base-e9d376b801b7890b1ef5006ed55de4208e64bb63.tar.gz
frameworks_base-e9d376b801b7890b1ef5006ed55de4208e64bb63.tar.bz2
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
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/Process.java35
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