Merge "Allow committing allowing state loss on detached FragmentManager." into oc-dev

am: e9679db5e2

Change-Id: I4192bc42bdc35ff29ac6e3c4ce2bb67f5a412c4b
This commit is contained in:
George Mount
2017-04-03 17:57:27 +00:00
committed by android-build-merger

View File

@@ -1844,6 +1844,10 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
}
synchronized (this) {
if (mDestroyed || mHost == null) {
if (allowStateLoss) {
// This FragmentManager isn't attached, so drop the entire transaction.
return;
}
throw new IllegalStateException("Activity has been destroyed");
}
if (mPendingActions == null) {
@@ -1960,6 +1964,10 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
}
public void execSingleAction(OpGenerator action, boolean allowStateLoss) {
if (allowStateLoss && (mHost == null || mDestroyed)) {
// This FragmentManager isn't attached, so drop the entire transaction.
return;
}
ensureExecReady(allowStateLoss);
if (action.generateOps(mTmpRecords, mTmpIsPop)) {
mExecutingActions = true;