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

Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ import android.os.Handler; ...@@ -31,6 +31,7 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.OperationCanceledException; import android.os.OperationCanceledException;
import android.os.RemoteException; import android.os.RemoteException;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Document; import android.provider.DocumentsContract.Document;
import android.util.Log; import android.util.Log;
...@@ -121,20 +122,24 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> { ...@@ -121,20 +122,24 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
result.client = client; result.client = client;
Resources resources = getContext().getResources(); Resources resources = getContext().getResources();
if (mFeatures.isContentPagingEnabled()) {
Bundle queryArgs = new Bundle();
mModel.addQuerySortArgs(queryArgs);
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... // TODO: At some point we don't want forced flags to override real paging...
// and that point is when we have real paging. // and that point is when we have real paging.
DebugFlags.addForcedPagingArgs(queryArgs); DebugFlags.addForcedPagingArgs(queryArgs);
cursor = client.query(mUri, null, queryArgs, mSignal);
} else {
cursor = client.query(
mUri, null, null, null, mModel.getDocumentSortQuery(), mSignal);
} }
cursor = client.query(mUri, null, queryArgs, mSignal);
if (cursor == null) { if (cursor == null) {
throw new RemoteException("Provider returned null"); throw new RemoteException("Provider returned null");
} }
...@@ -151,7 +156,7 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> { ...@@ -151,7 +156,7 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
// TODO: When API tweaks have landed, use ContentResolver.EXTRA_HONORED_ARGS // TODO: When API tweaks have landed, use ContentResolver.EXTRA_HONORED_ARGS
// instead of checking directly for ContentResolver.QUERY_ARG_SORT_COLUMNS (won't work) // instead of checking directly for ContentResolver.QUERY_ARG_SORT_COLUMNS (won't work)
if (mFeatures.isContentPagingEnabled() if (mFeatures.isContentPagingEnabled()
&& cursor.getExtras().containsKey(ContentResolver.QUERY_ARG_SORT_COLUMNS)) { && cursor.getExtras().containsKey(ContentResolver.QUERY_ARG_SORT_COLUMNS)) {
if (VERBOSE) Log.d(TAG, "Skipping sort of pre-sorted cursor. Booya!"); if (VERBOSE) Log.d(TAG, "Skipping sort of pre-sorted cursor. Booya!");
} else { } else {
cursor = mModel.sortCursor(cursor, mFileTypeLookup); cursor = mModel.sortCursor(cursor, mFileTypeLookup);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment