Fix issue #3274841: Orientation change problem with a paused activity
Plus a bunch of debug output improvements.
And some new Intent helpers for dealing with restarting an app.
Change-Id: I50ec56bca6a86c562156b13fe8a6fdf68038a12e
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 1b2d4df..196e7b2 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -248,7 +248,7 @@
* @param prefix Text to print at the front of each line.
* @param fd The raw file descriptor that the dump is being sent to.
* @param writer A PrintWriter to which the dump is to be set.
- * @param args additional arguments to the dump request.
+ * @param args Additional arguments to the dump request.
*/
public abstract void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args);
}
@@ -456,7 +456,9 @@
return;
}
- writer.print(prefix); writer.println("Active Fragments:");
+ writer.print(prefix); writer.print("Active Fragments in ");
+ writer.print(Integer.toHexString(System.identityHashCode(this)));
+ writer.println(":");
String innerPrefix = prefix + " ";
@@ -490,6 +492,7 @@
BackStackRecord bs = mBackStack.get(i);
writer.print(prefix); writer.print(" #"); writer.print(i);
writer.print(": "); writer.println(bs.toString());
+ bs.dump(innerPrefix, fd, writer, args);
}
}
}
@@ -1312,6 +1315,10 @@
Fragment f = fs.instantiate(mActivity);
if (DEBUG) Log.v(TAG, "restoreAllState: adding #" + i + ": " + f);
mActive.add(f);
+ // Now that the fragment is instantiated (or came from being
+ // retained above), clear mInstance in case we end up re-restoring
+ // from this FragmentState again.
+ fs.mInstance = null;
} else {
if (DEBUG) Log.v(TAG, "restoreAllState: adding #" + i + ": (null)");
mActive.add(null);