Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb7b7ecd authored by Clara Bayarri's avatar Clara Bayarri
Browse files

Improve Exception message for adding private fragments

State which fragment is the culprit

Bug: 29565251
Change-Id: If571488882e495c09344bb06376346b3ae8dff16
parent 71ea683b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -473,8 +473,9 @@ final class BackStackRecord extends FragmentTransaction implements
            if (targetSdkVersion > Build.VERSION_CODES.N && (fragmentClass.isAnonymousClass()
                    || !Modifier.isPublic(modifiers)
                    || (fragmentClass.isMemberClass() && !Modifier.isStatic(modifiers)))) {
                throw new IllegalStateException("Fragment must be a public static class to be "
                        + "properly recreated on configuration change.");
                throw new IllegalStateException("Fragment " + fragmentClass.getCanonicalName()
                        + " must be a public static class to be  properly recreated from"
                        + " instance state.");
            }
        }
        fragment.mFragmentManager = mManager;