diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-26 18:59:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-26 18:59:36 -0700 |
commit | 2a4daf06fb36ff932f9d52962284ba369cee1ce0 (patch) | |
tree | 1dd74436298dc417d5ee84c8435376b09e98d973 /core | |
parent | 0c0ad39cd8eaa6de6b7f99cec3971bcc953461e0 (diff) | |
parent | 06de2ea752171f52a4e6e6872cb3a0689e591dcb (diff) | |
download | frameworks_base-2a4daf06fb36ff932f9d52962284ba369cee1ce0.zip frameworks_base-2a4daf06fb36ff932f9d52962284ba369cee1ce0.tar.gz frameworks_base-2a4daf06fb36ff932f9d52962284ba369cee1ce0.tar.bz2 |
Merge change 2508 into donut
* changes:
Activity Manager changes the scheduling group of processes.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 12 | ||||
-rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 17 | ||||
-rw-r--r-- | core/java/android/app/IApplicationThread.java | 4 |
3 files changed, 32 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 1e15d14..06e0a45 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; diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index bcc9302..f243185 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(); + } } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 9f3534b..ec03d3a 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -87,7 +87,8 @@ public interface IApplicationThread extends IInterface { void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; void requestPss() throws RemoteException; void profilerControl(boolean start, String path) throws RemoteException; - + void setSchedulingGroup(int group) throws RemoteException; + String descriptor = "android.app.IApplicationThread"; int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; @@ -117,4 +118,5 @@ public interface IApplicationThread extends IInterface { int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25; int REQUEST_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26; int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; + int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; } |