From 4eba96bb314d8ff773ea33d6cb3179f25751ecce Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 21 Jan 2011 13:34:36 -0800 Subject: Fix issue #3377999: Activities need to be stopped when sleeping This is a band-aid over the existing kludgy stopping mechanism where the semantics of stop are different in the activity manager than in the clients. This change is intended to be as unobtrusive as possible, only impacting the sleep case. I have a different change that completely reworks how we stop activities to simply this all a lot by unifying the semantics between the server and client. However, it is too late in HC for such an extensive change. Later I'll revert this one and put in the better solution. Change-Id: Id77f2db1ec83469cdd888acb8fbc4679daa7766e --- core/java/android/app/ApplicationThreadNative.java | 20 ++++++++++++++++++++ 1 file changed, 20 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 d28e8533ce6a..ef929333823c 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -97,6 +97,15 @@ public abstract class ApplicationThreadNative extends Binder return true; } + case SCHEDULE_SLEEPING_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + IBinder b = data.readStrongBinder(); + boolean sleeping = data.readInt() != 0; + scheduleSleeping(b, sleeping); + return true; + } + case SCHEDULE_RESUME_ACTIVITY_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); @@ -503,6 +512,17 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } + public final void scheduleSleeping(IBinder token, + boolean sleeping) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeStrongBinder(token); + data.writeInt(sleeping ? 1 : 0); + mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } + public final void scheduleResumeActivity(IBinder token, boolean isForward) throws RemoteException { Parcel data = Parcel.obtain(); -- cgit v1.2.3