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

Commit b20ed181 authored by Ivan Chiang's avatar Ivan Chiang Committed by Android (Google) Code Review
Browse files

Merge "Use the query bundle to search"

parents f12a1078 f3448693
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");