diff options
| author | Dianne Hackborn <hackbod@google.com> | 2010-12-07 23:51:29 -0800 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2010-12-08 00:35:27 -0800 |
| commit | 0aae2d4e0075fd699cf40b26dca0eb2c3b3e37d2 (patch) | |
| tree | 04686805aa8c15025416aac0da1efc95149385a0 /core/java/android/app/ActivityManagerNative.java | |
| parent | 0b38aa0f971f58ac96ebb331463ba2087af7b724 (diff) | |
Rework activity lifecycle so onSaveInstanceState() is after onPause().
The goal is to fix a bunch of fragment-related bugs caused by various
things trying to do fragment transactions after onPause()... which
currently throws an exception, since this is after the activity's state
has been saved so the new fragment state can be lost.
The basic change is relatively simple -- we now consider processes
hosting paused or stopping activities to be unkillable, and the client
code now does the onSaveInstanceState() as part of stopping the
activity.
For compatibility, if an app's targetSdkVersion is < HONEYCOMB, the
client side will still call onSaveInstanceState() prior to onPause()
and just hold on to that state until it needs to report it in once
being stopped.
Also included here is a change to generate thumbnails by taking
screenshots. The code for generating thumbnails by re-rendering
the view hierarchy is thus removed.
Change-Id: Iac1191646bd3cadbfe65779297795f22edf7e74a
Diffstat (limited to 'core/java/android/app/ActivityManagerNative.java')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index f3cc4ee88d71..34788a5df4ca 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -359,8 +359,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case ACTIVITY_PAUSED_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); - Bundle map = data.readBundle(); - activityPaused(token, map); + activityPaused(token); reply.writeNoException(); return true; } @@ -368,10 +367,11 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case ACTIVITY_STOPPED_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); + Bundle map = data.readBundle(); Bitmap thumbnail = data.readInt() != 0 ? Bitmap.CREATOR.createFromParcel(data) : null; CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); - activityStopped(token, thumbnail, description); + activityStopped(token, map, thumbnail, description); reply.writeNoException(); return true; } @@ -1688,25 +1688,25 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - public void activityPaused(IBinder token, Bundle state) throws RemoteException + public void activityPaused(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); - data.writeBundle(state); mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } - public void activityStopped(IBinder token, - Bitmap thumbnail, CharSequence description) throws RemoteException + public void activityStopped(IBinder token, Bundle state, + Bitmap thumbnail, CharSequence description) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); + data.writeBundle(state); if (thumbnail != null) { data.writeInt(1); thumbnail.writeToParcel(data, 0); |
