Add target sdk check for behavior change.

Bug 62188967

A previous change stopped animations on fragment Views before
being removed. This change in behavior caused other problems,
so the behavior must be placed behind a target SDK check.

Test: ran fragment tests, validated on app
Change-Id: I098e9b0f1472d9838abeacba3baaa7581f7a82ad
This commit is contained in:
George Mount
2017-06-08 14:18:31 -07:00
parent 7925f817d0
commit d1cfbc506b

View File

@@ -1353,9 +1353,11 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate
f.performDestroyView();
dispatchOnFragmentViewDestroyed(f, false);
if (f.mView != null && f.mContainer != null) {
// Stop any current animations:
f.mView.clearAnimation();
f.mContainer.endViewTransition(f.mView);
if (getTargetSdk() >= Build.VERSION_CODES.O) {
// Stop any current animations:
f.mView.clearAnimation();
f.mContainer.endViewTransition(f.mView);
}
Animator anim = null;
if (mCurState > Fragment.INITIALIZING && !mDestroyed
&& f.mView.getVisibility() == View.VISIBLE