summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorTodd Kennedy <toddke@google.com>2015-09-10 13:58:01 -0700
committerTodd Kennedy <toddke@google.com>2015-09-22 10:16:42 -0700
commite16fb554dd49db118327ece0d9aac8eb788c7c54 (patch)
tree944bddcdb1565fe83fc3fbcea8cb0996ebe5360e /core
parent88f92ec5a76c94dcb084ffcc8a4fc36a66bb9ca2 (diff)
downloadframeworks_base-e16fb554dd49db118327ece0d9aac8eb788c7c54.zip
frameworks_base-e16fb554dd49db118327ece0d9aac8eb788c7c54.tar.gz
frameworks_base-e16fb554dd49db118327ece0d9aac8eb788c7c54.tar.bz2
save "retain loader" state
We cannot pull the "retain loader" state from the Activity; an Activity may not always be hosting a Fragment. Instead, save the "retain loader" state inside the individual fragments. Bug: 23838271 Change-Id: I8358183a7689b5a571ea7be03d769186b2812600
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/Fragment.java5
-rw-r--r--core/java/android/app/FragmentController.java1
-rw-r--r--core/java/android/app/FragmentManager.java11
3 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index 82206ea..d50483e 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -460,6 +460,9 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
// If set this fragment is being retained across the current config change.
boolean mRetaining;
+ // If set this fragment's loaders are being retained across the current config change.
+ boolean mRetainLoader;
+
// If set this fragment has menu items to contribute.
boolean mHasMenu;
@@ -2401,7 +2404,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
mLoaderManager = mHost.getLoaderManager(mWho, mLoadersStarted, false);
}
if (mLoaderManager != null) {
- if (mRetaining) {
+ if (mRetainLoader) {
mLoaderManager.doRetain();
} else {
mLoaderManager.doStop();
diff --git a/core/java/android/app/FragmentController.java b/core/java/android/app/FragmentController.java
index 28dadfa..1b45137 100644
--- a/core/java/android/app/FragmentController.java
+++ b/core/java/android/app/FragmentController.java
@@ -341,6 +341,7 @@ public class FragmentController {
*/
public void doLoaderStop(boolean retain) {
mHost.doLoaderStop(retain);
+ mHost.mFragmentManager.setRetainLoader(retain);
}
/**
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 132ffef..51d6132 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -869,6 +869,17 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
}
}
+ void setRetainLoader(boolean retain) {
+ if (mActive != null) {
+ for (int i=0; i<mActive.size(); i++) {
+ Fragment f = mActive.get(i);
+ if (f != null) {
+ f.mRetainLoader = retain;
+ }
+ }
+ }
+ }
+
void moveToState(Fragment f, int newState, int transit, int transitionStyle,
boolean keepActive) {
if (DEBUG && false) Log.v(TAG, "moveToState: " + f