diff options
Diffstat (limited to 'src/com/android/settings/search/Index.java')
-rw-r--r-- | src/com/android/settings/search/Index.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index b1d21af91..f4aebb214 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -284,15 +284,17 @@ public class Index { private boolean addIndexablesFromRemoteProvider(String packageName, String authority) { try { + final int baseRank = Ranking.getBaseRankForAuthority(authority); + final Context packageContext = mContext.createPackageContext(packageName, 0); final Uri uriForResources = buildUriForXmlResources(authority); addIndexablesForXmlResourceUri(packageContext, packageName, uriForResources, - SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS); + SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS, baseRank); final Uri uriForRawData = buildUriForRawData(authority); addIndexablesForRawDataUri(packageContext, packageName, uriForRawData, - SearchIndexablesContract.INDEXABLES_RAW_COLUMNS); + SearchIndexablesContract.INDEXABLES_RAW_COLUMNS, baseRank); return true; } catch (PackageManager.NameNotFoundException e) { Log.w(LOG_TAG, "Could not create context for " + packageName + ": " @@ -501,7 +503,7 @@ public class Index { } private void addIndexablesForXmlResourceUri(Context packageContext, String packageName, - Uri uri, String[] projection) { + Uri uri, String[] projection, int baseRank) { final ContentResolver resolver = packageContext.getContentResolver(); final Cursor cursor = resolver.query(uri, projection, null, null, null); @@ -515,7 +517,9 @@ public class Index { final int count = cursor.getCount(); if (count > 0) { while (cursor.moveToNext()) { - final int rank = cursor.getInt(COLUMN_INDEX_XML_RES_RANK); + final int providerRank = cursor.getInt(COLUMN_INDEX_XML_RES_RANK); + final int rank = (providerRank > 0) ? baseRank + providerRank : baseRank; + final int xmlResId = cursor.getInt(COLUMN_INDEX_XML_RES_RESID); final String className = cursor.getString(COLUMN_INDEX_XML_RES_CLASS_NAME); @@ -546,7 +550,7 @@ public class Index { } private void addIndexablesForRawDataUri(Context packageContext, String packageName, - Uri uri, String[] projection) { + Uri uri, String[] projection, int baseRank) { final ContentResolver resolver = packageContext.getContentResolver(); final Cursor cursor = resolver.query(uri, projection, null, null, null); @@ -560,7 +564,9 @@ public class Index { final int count = cursor.getCount(); if (count > 0) { while (cursor.moveToNext()) { - final int rank = cursor.getInt(COLUMN_INDEX_RAW_RANK); + final int providerRank = cursor.getInt(COLUMN_INDEX_RAW_RANK); + final int rank = (providerRank > 0) ? baseRank + providerRank : baseRank; + final String title = cursor.getString(COLUMN_INDEX_RAW_TITLE); final String summaryOn = cursor.getString(COLUMN_INDEX_RAW_SUMMARY_ON); final String summaryOff = cursor.getString(COLUMN_INDEX_RAW_SUMMARY_OFF); |