dalvik: thread: Set the control group of a thread to the background group
if the priority is logically-lower than ANDROID_PRIORITY_BACKGROUND

Signed-off-by: San Mehat <san@google.com>
diff --git a/vm/Thread.c b/vm/Thread.c
index acfc7a9..0adde38 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -2819,9 +2819,9 @@
     }
     newNice = kNiceValues[newPriority-1];
 
-    if (newPriority == ANDROID_PRIORITY_BACKGROUND) {
+    if (newPriority >= ANDROID_PRIORITY_BACKGROUND) {
         dvmChangeThreadSchedulerGroup("bg_non_interactive");
-    } else if (getpriority(PRIO_PROCESS, pid) == ANDROID_PRIORITY_BACKGROUND) {
+    } else if (getpriority(PRIO_PROCESS, pid) >= ANDROID_PRIORITY_BACKGROUND) {
         dvmChangeThreadSchedulerGroup(NULL);
     }
 
diff --git a/vm/alloc/Heap.c b/vm/alloc/Heap.c
index 09954ea..e58a8a8 100644
--- a/vm/alloc/Heap.c
+++ b/vm/alloc/Heap.c
@@ -775,7 +775,7 @@
          * in backward UNIX terms means lower priority.
          */
 
-        if (priorityResult == ANDROID_PRIORITY_BACKGROUND) {
+        if (priorityResult >= ANDROID_PRIORITY_BACKGROUND) {
             dvmChangeThreadSchedulerGroup(NULL);
         }
 
@@ -1025,7 +1025,7 @@
             LOGD_HEAP("Reset priority to %d\n", oldThreadPriority);
         }
 
-        if (oldThreadPriority == ANDROID_PRIORITY_BACKGROUND) {
+        if (oldThreadPriority >= ANDROID_PRIORITY_BACKGROUND) {
             dvmChangeThreadSchedulerGroup("bg_non_interactive");
         }
     }