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

Commit a2c5763f authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov
Browse files

Commit SearchFragment-dismissing transaction safely

Schedule (self-)dissmissing SearchFragment with using a variation of
FragmentTransaction.commit() method, instead of trying to execute
transaction right away using commitNow() with may cause
java.lang.IllegalStateException: "FragmentManager is already executing
transactions".

Bug: 259640896
Test: atest DocumentsUIGoogleTests
Change-Id: Ia1d29104e4ada298b4fc02b4cec98a892ecbd3f6
parent 82e4f05e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -163,9 +163,9 @@ public class SearchFragment extends Fragment {

        updateDirectoryVisibility(View.VISIBLE);

        FragmentTransaction ft = getParentFragmentManager().beginTransaction();
        ft.remove(this);
        ft.commitNow();
        getParentFragmentManager().beginTransaction()
                .remove(this)
                .commitAllowingStateLoss();
    }

    private void updateDirectoryVisibility(int visibility) {