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

Commit 8646252e authored by Zemiao Zhu's avatar Zemiao Zhu
Browse files

Fix SearchFragment crash in tests.

Cause of crash: FragmentManager is already executing transactions.
This is because we unnecessarily resets the current query string,
indirectly invoking onQueryTextChange, causing a fragment transaction;
later when the searchView focus changes. it causes a second fragment
transaction. Fixes by removing the query reset step (it gets reset at
next expansion of search view anyway).

Bug: 182958870
Test: atest DocumentsUIGoogleTests
Change-Id: I21de9ec3a2e8c72be1d0ce7c7ccfd98a4567e2a5
parent cd06f188
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -97,8 +97,8 @@ public class SearchFragment extends Fragment {
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        final BaseActivity activity = (BaseActivity) getActivity();
        final Injector injector = activity.getInjector();
+0 −2
Original line number Diff line number Diff line
@@ -333,8 +333,6 @@ public class SearchViewManager implements
    public boolean cancelSearch() {
        if (mSearchView != null && (isExpanded() || isSearching())) {
            cancelQueuedSearch();
            // If the query string is not empty search view won't get iconified
            mSearchView.setQuery("", false);

            if (mFullBar) {
                onClose();