Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
il...@google.com <il...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c7782e3df384027df9484f615880a22d26975f18
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 10 10:53:39 2019
Fall back to commitAllowingStateLoss() on ISE
When FragmentPagerAdapter or FragmentStatePagerAdapter
runs finishUpdate() in response to a measure/layout
pass, it runs commitNowAllowingStateLoss() as all
normal devices don't do measure/layout while processing
pending FragmentTransactions.
However, with b/135945162 , FragmentManager does call
requestApplyInsets() as part of processing Fragments.
This gets posted on real devices, but Robolectric will
run it inline, causing this to throw an
IllegalStateException. To ensure that Robolectric
continues to work, we can call commitAllowingStateLoss()
in this particular case to ensure that it runs even
while pending FragmentTransactions are being processed.
Test: manual testing
Fixes: 137201343
Change-Id: I62b6312ffbd754af6c6bedf0f1adc30c40641575
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentPagerAdapter.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStatePagerAdapter.java
https://android-review.googlesource.com/1013911
https://goto.google.com/android-sha1/c7782e3df384027df9484f615880a22d26975f18
Branch: androidx-master-dev
commit c7782e3df384027df9484f615880a22d26975f18
Author: Ian Lake <ilake@google.com>
Date: Wed Jul 10 10:53:39 2019
Fall back to commitAllowingStateLoss() on ISE
When FragmentPagerAdapter or FragmentStatePagerAdapter
runs finishUpdate() in response to a measure/layout
pass, it runs commitNowAllowingStateLoss() as all
normal devices don't do measure/layout while processing
pending FragmentTransactions.
However, with
requestApplyInsets() as part of processing Fragments.
This gets posted on real devices, but Robolectric will
run it inline, causing this to throw an
IllegalStateException. To ensure that Robolectric
continues to work, we can call commitAllowingStateLoss()
in this particular case to ensure that it runs even
while pending FragmentTransactions are being processed.
Test: manual testing
Fixes: 137201343
Change-Id: I62b6312ffbd754af6c6bedf0f1adc30c40641575
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentPagerAdapter.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStatePagerAdapter.java
Description
Version used: 1.1.0-beta01
When a new Fragment is added, developers need to manually call ViewCompat.requestApplyInsets() (or the equivalent framework APIs) in order for the new View to get the correct insets set on the container.
FragmentManager should do that for you.