diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-05-30 16:38:30 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-05-30 16:38:30 -0700 |
commit | 61af8a8ef77fd0e1a760d01a5c7784ae1d0efc37 (patch) | |
tree | 9e66b35a153dca499caac988e98a67ab1fb83568 /core | |
parent | 3c144c3e69405000f5c7542f20890437a4fb4987 (diff) | |
download | frameworks_base-61af8a8ef77fd0e1a760d01a5c7784ae1d0efc37.zip frameworks_base-61af8a8ef77fd0e1a760d01a5c7784ae1d0efc37.tar.gz frameworks_base-61af8a8ef77fd0e1a760d01a5c7784ae1d0efc37.tar.bz2 |
Working on issue #6561352: java.lang.RuntimeException: Unable to start...
...activity ComponentInfo{com.google.android.googlequicksearchbox
/com.google.android.googlequicksearchbox.SearchActivity}
Add check for a situation where we are saving the state of a
fragment with a -1 index, and fail early in that case with more
debug information.
Change-Id: I03a928dde521fa06664d0036dd9f90eef3247afc
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/FragmentManager.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 6058bdc..03ee419 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -1568,8 +1568,17 @@ final class FragmentManagerImpl extends FragmentManager { for (int i=0; i<N; i++) { Fragment f = mActive.get(i); if (f != null) { + if (f.mIndex < 0) { + String msg = "Failure saving state: active " + f + + " has cleared index: " + f.mIndex; + Slog.e(TAG, msg); + dump(" ", null, new PrintWriter(new LogWriter( + Log.ERROR, TAG, Log.LOG_ID_SYSTEM)), new String[] { }); + throw new IllegalStateException(msg); + } + haveFragments = true; - + FragmentState fs = new FragmentState(f); active[i] = fs; @@ -1621,6 +1630,14 @@ final class FragmentManagerImpl extends FragmentManager { added = new int[N]; for (int i=0; i<N; i++) { added[i] = mAdded.get(i).mIndex; + if (added[i] < 0) { + String msg = "Failure saving state: active " + mAdded.get(i) + + " has cleared index: " + added[i]; + Slog.e(TAG, msg); + dump(" ", null, new PrintWriter(new LogWriter( + Log.ERROR, TAG, Log.LOG_ID_SYSTEM)), new String[] { }); + throw new IllegalStateException(msg); + } if (DEBUG) Log.v(TAG, "saveAllState: adding fragment #" + i + ": " + mAdded.get(i)); } |