diff options
| author | Dianne Hackborn <hackbod@google.com> | 2009-05-21 12:56:43 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2009-05-26 18:50:46 -0700 |
| commit | 06de2ea752171f52a4e6e6872cb3a0689e591dcb (patch) | |
| tree | 5b970c93b8f49b81502d6ceb26a2e8fcfc240028 /core/java/android/app/ActivityThread.java | |
| parent | c29df57e5abb09c7e1ceed153e8f2b906f522d7b (diff) | |
Activity Manager changes the scheduling group of processes.
The algorithm for this is currently very simple: all persistent processes are
always in the normal scheduling group, all other processes are normal if their
oom_adj is as good or better than VISIBLE, otherwise they are in the background
group.
Note that this currently results in a fair number of log messages about not
being able to change the group, since the system process does not have
permission to do so. Once a kernel fix is in, these will go away and the code
will start working.
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 1e15d14271d3..06e0a453b232 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1513,6 +1513,18 @@ public final class ActivityThread { queueOrSendMessage(H.PROFILER_CONTROL, path, start ? 1 : 0); } + public void setSchedulingGroup(int group) { + // Note: do this immediately, since going into the foreground + // should happen regardless of what pending work we have to do + // and the activity manager will wait for us to report back that + // we are done before sending us to the background. + try { + Process.setProcessGroup(Process.myPid(), group); + } catch (Exception e) { + Log.w(TAG, "Failed setting process group to " + group, e); + } + } + @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { long nativeMax = Debug.getNativeHeapSize() / 1024; |
