From 06de2ea752171f52a4e6e6872cb3a0689e591dcb Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Thu, 21 May 2009 12:56:43 -0700 Subject: 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. --- core/java/android/app/ApplicationThreadNative.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/java/android/app/ApplicationThreadNative.java') diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index bcc930208206..f24318585cb4 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -331,6 +331,14 @@ public abstract class ApplicationThreadNative extends Binder profilerControl(start, path); return true; } + + case SET_SCHEDULING_GROUP_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + int group = data.readInt(); + setSchedulingGroup(group); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -672,5 +680,14 @@ class ApplicationThreadProxy implements IApplicationThread { IBinder.FLAG_ONEWAY); data.recycle(); } + + public void setSchedulingGroup(int group) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeInt(group); + mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } } -- cgit v1.2.3