Merge "Less lazy child FragmentManager creation" into nyc-dev am: 6437dac3d9

am: 3b981d026c

* commit '3b981d026c87caa9ac0958a9c30b6d1566e12543':
  Less lazy child FragmentManager creation

Change-Id: I7e6adf142e707027e41346c0d3f847a8a4d599d3
This commit is contained in:
Adam Powell
2016-05-11 22:00:59 +00:00
committed by android-build-merger
2 changed files with 8 additions and 0 deletions

View File

@@ -1486,6 +1486,10 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
final int version = context != null ? context.getApplicationInfo().targetSdkVersion : 0;
if (version >= Build.VERSION_CODES.N) {
restoreChildFragmentState(savedInstanceState, true);
if (mChildFragmentManager != null
&& !mChildFragmentManager.isStateAtLeast(Fragment.CREATED)) {
mChildFragmentManager.dispatchCreate();
}
}
}

View File

@@ -870,6 +870,10 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
}
}
boolean isStateAtLeast(int state) {
return mCurState >= state;
}
void moveToState(Fragment f, int newState, int transit, int transitionStyle,
boolean keepActive) {
if (DEBUG && false) Log.v(TAG, "moveToState: " + f