Remove result ordering for global search.
Change-Id: I7efab03f5a4ecb529be53bf12e2f8764f0fe8ef9
diff --git a/src/com/android/providers/applications/ApplicationsProvider.java b/src/com/android/providers/applications/ApplicationsProvider.java
index c292efd..a7fa1b9 100644
--- a/src/com/android/providers/applications/ApplicationsProvider.java
+++ b/src/com/android/providers/applications/ApplicationsProvider.java
@@ -396,6 +396,7 @@
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(APPLICATIONS_LOOKUP_JOIN);
qb.setProjectionMap(columnMap);
+ String orderBy = null;
if (!zeroQuery) {
qb.appendWhere(buildTokenFilter(query));
} else {
@@ -403,9 +404,11 @@
qb.appendWhere(LAST_RESUME_TIME + " > 0");
}
}
+ if (!hasGlobalSearchPermission()) {
+ orderBy = getOrderBy(zeroQuery);
+ }
// don't return duplicates when there are two matching tokens for an app
String groupBy = APPLICATIONS_TABLE + "." + _ID;
- String orderBy = getOrderBy(zeroQuery);
Cursor cursor = qb.query(mDb, projectionIn, null, null, groupBy, null, orderBy);
if (DBG) Log.d(TAG, "Returning " + cursor.getCount() + " results for " + query);
return cursor;