OSDN Git Service

Fix issue #3138926: App's preferences can be lost after onPause()
authorDianne Hackborn <hackbod@google.com>
Wed, 27 Oct 2010 20:57:00 +0000 (13:57 -0700)
committerDianne Hackborn <hackbod@google.com>
Wed, 27 Oct 2010 20:57:00 +0000 (13:57 -0700)
Change-Id: Icea3d37fab5e47c89c5cbc0adff7bbec898fa93e

core/java/android/app/Activity.java
core/java/android/app/ActivityThread.java

index 78a77eb..f25c4c3 100644 (file)
@@ -1162,7 +1162,6 @@ public class Activity extends ContextThemeWrapper
      */
     protected void onPause() {
         mCalled = true;
-        QueuedWork.waitToFinish();
     }
 
     /**
index 63a5ff6..78df780 100644 (file)
@@ -2265,6 +2265,9 @@ public final class ActivityThread {
             r.activity.mConfigChangeFlags |= configChanges;
             Bundle state = performPauseActivity(token, finished, true);
 
+            // Make sure any pending writes are now committed.
+            QueuedWork.waitToFinish();
+            
             // Tell the activity manager we have paused.
             try {
                 ActivityManagerNative.getDefault().activityPaused(token, state);