diff options
| author | 2010-12-09 09:24:55 -0800 | |
|---|---|---|
| committer | 2010-12-09 09:24:55 -0800 | |
| commit | e2b0480f5e698b7d771b1c1348cc0bff2a72548d (patch) | |
| tree | 1b771549d34fba2353d88d005e7454cd521bcdc6 | |
| parent | d2112306330ce0c162bee4b864991962ca2b655a (diff) | |
Fix not saving state when restarting an activity.
Change-Id: I4c9e93e9523c9c62e3a15e6e4587ffad06280545
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 45500bc8852a..3dfb801611de 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -2415,8 +2415,6 @@ public final class ActivityThread { state = new Bundle(); mInstrumentation.callActivityOnSaveInstanceState(r.activity, state); r.state = state; - } else { - r.state = null; } // Now we are idle. r.activity.mCalled = false; @@ -2956,9 +2954,13 @@ public final class ActivityThread { r.activity.mChangingConfigurations = true; - Bundle savedState = null; + // Need to ensure state is saved. if (!r.paused) { - savedState = performPauseActivity(r.token, false, r.isPreHoneycomb()); + performPauseActivity(r.token, false, r.isPreHoneycomb()); + } + if (r.state == null && !r.stopped && !r.isPreHoneycomb()) { + r.state = new Bundle(); + mInstrumentation.callActivityOnSaveInstanceState(r.activity, r.state); } handleDestroyActivity(r.token, false, configChanges, true); @@ -2983,9 +2985,6 @@ public final class ActivityThread { } } r.startsNotResumed = tmp.startsNotResumed; - if (savedState != null) { - r.state = savedState; - } handleLaunchActivity(r, currentIntent); } |