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

Commit f3448693 authored by Ivan Chiang's avatar Ivan Chiang
Browse files

Use the query bundle to search

Add search string into bundle to do search.

Change-Id: I264e16165fef1214938e2b8ccea2c73674789a65
Fix: 119798037
Test: atest DocumentsUITests
parent 7910925c
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.OperationCanceledException;
import android.os.RemoteException;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Document;
import android.util.Log;

@@ -121,19 +122,23 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
            result.client = client;

            Resources resources = getContext().getResources();
            if (mFeatures.isContentPagingEnabled()) {
                Bundle queryArgs = new Bundle();

            final Bundle queryArgs = new Bundle();
            mModel.addQuerySortArgs(queryArgs);

            if (mSearchMode) {
                // add the search string into the query bundle.
                queryArgs.putString(DocumentsContract.QUERY_ARG_DISPLAY_NAME,
                        DocumentsContract.getSearchDocumentsQuery(mUri));
            }

            if (mFeatures.isContentPagingEnabled()) {
                // TODO: At some point we don't want forced flags to override real paging...
                // and that point is when we have real paging.
                DebugFlags.addForcedPagingArgs(queryArgs);
            }

            cursor = client.query(mUri, null, queryArgs, mSignal);
            } else {
                cursor = client.query(
                        mUri, null, null, null, mModel.getDocumentSortQuery(), mSignal);
            }

            if (cursor == null) {
                throw new RemoteException("Provider returned null");