summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorTodd Kennedy <toddke@google.com>2015-10-20 14:36:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-20 14:36:00 +0000
commitad968cf4e55afdd897ea84a44b7450442aea1e1d (patch)
tree1016ab43a4dae546c69a674dae1cc3c97c0325a4 /core
parent4ecfbcfdeaed67c3a08002069a530fa58582a48b (diff)
parent2ee19c7f46ab488f19380f4c70904a1ac00fee9a (diff)
downloadframeworks_base-ad968cf4e55afdd897ea84a44b7450442aea1e1d.zip
frameworks_base-ad968cf4e55afdd897ea84a44b7450442aea1e1d.tar.gz
frameworks_base-ad968cf4e55afdd897ea84a44b7450442aea1e1d.tar.bz2
Merge "Retain fragment loaders" into mnc-dr-dev
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/FragmentHostCallback.java11
-rw-r--r--core/java/android/app/FragmentManager.java11
4 files changed, 12 insertions, 16 deletions
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index d50483e..29e8dd4 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -460,9 +460,6 @@ 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;
@@ -2404,7 +2401,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
mLoaderManager = mHost.getLoaderManager(mWho, mLoadersStarted, false);
}
if (mLoaderManager != null) {
- if (mRetainLoader) {
+ if (mHost.getRetainLoaders()) {
mLoaderManager.doRetain();
} else {
mLoaderManager.doStop();
diff --git a/core/java/android/app/FragmentController.java b/core/java/android/app/FragmentController.java
index 1b45137..28dadfa 100644
--- a/core/java/android/app/FragmentController.java
+++ b/core/java/android/app/FragmentController.java
@@ -341,7 +341,6 @@ public class FragmentController {
*/
public void doLoaderStop(boolean retain) {
mHost.doLoaderStop(retain);
- mHost.mFragmentManager.setRetainLoader(retain);
}
/**
diff --git a/core/java/android/app/FragmentHostCallback.java b/core/java/android/app/FragmentHostCallback.java
index 7b01307..13517e6 100644
--- a/core/java/android/app/FragmentHostCallback.java
+++ b/core/java/android/app/FragmentHostCallback.java
@@ -42,9 +42,14 @@ public abstract class FragmentHostCallback<E> extends FragmentContainer {
private final Handler mHandler;
final int mWindowAnimations;
final FragmentManagerImpl mFragmentManager = new FragmentManagerImpl();
+ /** The loader managers for individual fragments [i.e. Fragment#getLoaderManager()] */
private ArrayMap<String, LoaderManager> mAllLoaderManagers;
+ /** Whether or not fragment loaders should retain their state */
+ private boolean mRetainLoaders;
+ /** The loader manger for the fragment host [i.e. Activity#getLoaderManager()] */
private LoaderManagerImpl mLoaderManager;
private boolean mCheckedForLoaderManager;
+ /** Whether or not the fragment host loader manager was started */
private boolean mLoadersStarted;
public FragmentHostCallback(Context context, Handler handler, int windowAnimations) {
@@ -166,6 +171,10 @@ public abstract class FragmentHostCallback<E> extends FragmentContainer {
return true;
}
+ boolean getRetainLoaders() {
+ return mRetainLoaders;
+ }
+
Activity getActivity() {
return mActivity;
}
@@ -217,6 +226,8 @@ public abstract class FragmentHostCallback<E> extends FragmentContainer {
}
void doLoaderStop(boolean retain) {
+ mRetainLoaders = retain;
+
if (mLoaderManager == null) {
return;
}
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 046c87a..696ccdb 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -869,17 +869,6 @@ 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