Fixed
Status Update
Comments
al...@google.com <al...@google.com> #2
Could be related to the changes you've made in FixedFragmentStateAdapter. Could you share the code, I can have a quick look.
al...@google.com <al...@google.com> #3
> Could be related to the changes you've made in FixedFragmentStateAdapter. Could you share the code, I can have a quick look.
Sorry, but I believe that is not a culprit. I just added a single line of code to avoid BadParcelableException.
https://issuetracker.google.com/issues/132840199
```
@Override
public final void restoreState(@NonNull Parcelable savedState) {
if (!mSavedStates.isEmpty() || !mFragments.isEmpty()) {
throw new IllegalStateException(
"Expected the adapter to be 'fresh' while restoring state.");
}
Bundle bundle = (Bundle) savedState;
bundle.setClassLoader(getClass().getClassLoader()); // <-- ADDED THIS LINE
for (String key : bundle.keySet()) {
...
}
```
Sorry, but I believe that is not a culprit. I just added a single line of code to avoid BadParcelableException.
```
@Override
public final void restoreState(@NonNull Parcelable savedState) {
if (!mSavedStates.isEmpty() || !mFragments.isEmpty()) {
throw new IllegalStateException(
"Expected the adapter to be 'fresh' while restoring state.");
}
Bundle bundle = (Bundle) savedState;
bundle.setClassLoader(getClass().getClassLoader()); // <-- ADDED THIS LINE
for (String key : bundle.keySet()) {
...
}
```
ch...@google.com <ch...@google.com>
di...@google.com <di...@google.com>
ap...@google.com <ap...@google.com> #4
I investigated the issue and turned out the part of the scenario which causes the problem;
1. RecyclerView.recycleViewHolderInternal()
2. hodler.doesTransientStatePreventRecycling() retuns true
3. FragmentStateAdapter.onFailedToRecycleView() -> onViewRecycled() -> removeFragment()
4. onFailedToRecycleView() retuns false, it means the ViewHolder is not recycled yet.
5. Soon after, FragmentStateAdapter.onViewAttachedToWindow() -> placeFragmentInViewHolder() -> IllegalStateException("Design assumption violated.")
1. RecyclerView.recycleViewHolderInternal()
2. hodler.doesTransientStatePreventRecycling() retuns true
3. FragmentStateAdapter.onFailedToRecycleView() -> onViewRecycled() -> removeFragment()
4. onFailedToRecycleView() retuns false, it means the ViewHolder is not recycled yet.
5. Soon after, FragmentStateAdapter.onViewAttachedToWindow() -> placeFragmentInViewHolder() -> IllegalStateException("Design assumption violated.")
pr...@google.com <pr...@google.com> #5
Hi! I have successfully created a demo project which can reproduce this issue. Please check the following repo and I hope it helps to resolve the issue.
https://github.com/h6ah4i/FragmentStateAdapterOnFailedToRecyclerViewFailure
pa...@gmail.com <pa...@gmail.com> #6
[UPDATE]
This issue still exists on ViewPager2 v1.0.0-alpha06 with RecyclerView v1.1.0-beta01.
This issue still exists on ViewPager2 v1.0.0-alpha06 with RecyclerView v1.1.0-beta01.
pr...@google.com <pr...@google.com> #7
I can confirm I can repro this and will try to provide a workaround / fix soon.
Big thanks for the sample app, repro steps and research info. Super appreciated!
Big thanks for the sample app, repro steps and research info. Super appreciated!
Description
The following lint check is baseline suppressed in your project. Please remove all instances of this suppression from
window/window/lint-baseline.xml
and address the associated issues before your next stable release.5 instance(s) of
RestrictedApiAndroidX
ActivityStack.getToken can only be called from within the same library group (referenced groupId=
androidx.window.extensions
from groupId=androidx.window
)Found in
src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
at line 0:ActivityStack.getToken can only be called from within the same library group (referenced groupId=
androidx.window.extensions
from groupId=androidx.window
)Found in
src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
at line 0:ActivityStack.getToken can only be called from within the same library group (referenced groupId=
androidx.window.extensions
from groupId=androidx.window
)Found in
src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
at line 0:ActivityStack.getToken can only be called from within the same library group (referenced groupId=
androidx.window.extensions
from groupId=androidx.window
)Found in
src/main/java/androidx/window/embedding/EmbeddingAdapter.kt
at line 0:WindowExtensions.VENDOR_API_LEVEL_2 can only be accessed from within the same library group (referenced groupId=
androidx.window.extensions
from groupId=androidx.window
)Found in
src/main/java/androidx/window/embedding/EmbeddingCompat.kt
at line 0: