OSDN Git Service

Fix when managed cursors are required.
authorDianne Hackborn <hackbod@google.com>
Fri, 3 Jun 2011 22:26:01 +0000 (15:26 -0700)
committerDianne Hackborn <hackbod@google.com>
Fri, 3 Jun 2011 22:26:40 +0000 (15:26 -0700)
Only do this when we are actually restarting, not when we
are just resuming after a pause.

Change-Id: I32fd263917b03776efca8e096d0343107721398d

core/java/android/app/Activity.java

index e3fb358..b739e10 100644 (file)
@@ -4421,27 +4421,29 @@ public class Activity extends ContextThemeWrapper
     final void performRestart() {
         mFragments.noteStateNotSaved();
 
-        synchronized (mManagedCursors) {
-            final int N = mManagedCursors.size();
-            for (int i=0; i<N; i++) {
-                ManagedCursor mc = mManagedCursors.get(i);
-                if (mc.mReleased || mc.mUpdated) {
-                    if (!mc.mCursor.requery()) {
-                        throw new IllegalStateException(
-                                "trying to requery an already closed cursor");
-                    }
-                    mc.mReleased = false;
-                    mc.mUpdated = false;
-                }
-            }
-        }
-
         if (mStopped) {
             mStopped = false;
-            mCalled = false;
             if (mToken != null && mParent == null) {
                 WindowManagerImpl.getDefault().setStoppedState(mToken, false);
             }
+
+            synchronized (mManagedCursors) {
+                final int N = mManagedCursors.size();
+                for (int i=0; i<N; i++) {
+                    ManagedCursor mc = mManagedCursors.get(i);
+                    if (mc.mReleased || mc.mUpdated) {
+                        if (!mc.mCursor.requery()) {
+                            throw new IllegalStateException(
+                                    "trying to requery an already closed cursor  "
+                                    + mc.mCursor);
+                        }
+                        mc.mReleased = false;
+                        mc.mUpdated = false;
+                    }
+                }
+            }
+
+            mCalled = false;
             mInstrumentation.callActivityOnRestart(this);
             if (!mCalled) {
                 throw new SuperNotCalledException(