Merge "Update search indexable interface for dynamic indexing."
This commit is contained in:
@@ -84,9 +84,9 @@ public class SearchIndexablesContract {
|
||||
/**
|
||||
* Last path segment for Preference Key, Slice Uri pair.
|
||||
* <p>
|
||||
* The (Key, Slice Uri) pairs are a mapping between the primary key of the search result and
|
||||
* a Uri for a Slice that represents the same data. Thus, an app can specify a list of Uris
|
||||
* for Slices that replace regular intent-based search results with inline content.
|
||||
* The (Key, Slice Uri) pairs are a mapping between the primary key of the search result and
|
||||
* a Uri for a Slice that represents the same data. Thus, an app can specify a list of Uris
|
||||
* for Slices that replace regular intent-based search results with inline content.
|
||||
* </p>
|
||||
*/
|
||||
public static final String SLICE_URI_PAIRS = "slice_uri_pairs";
|
||||
@@ -96,6 +96,22 @@ public class SearchIndexablesContract {
|
||||
*/
|
||||
public static final String SLICE_URI_PAIRS_PATH = SETTINGS + "/" + SLICE_URI_PAIRS;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamic indexable raw data names.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String DYNAMIC_INDEXABLES_RAW = "dynamic_indexables_raw";
|
||||
|
||||
/**
|
||||
* ContentProvider path for dynamic indexable raw data.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String DYNAMIC_INDEXABLES_RAW_PATH =
|
||||
SETTINGS + "/" + DYNAMIC_INDEXABLES_RAW;
|
||||
|
||||
/**
|
||||
* Indexable xml resources columns.
|
||||
*/
|
||||
@@ -212,7 +228,7 @@ public class SearchIndexablesContract {
|
||||
* Cursor schema for SliceUriPairs.
|
||||
*/
|
||||
@NonNull
|
||||
public static final String[] SLICE_URI_PAIRS_COLUMNS = new String[]{
|
||||
public static final String[] SLICE_URI_PAIRS_COLUMNS = new String[] {
|
||||
SliceUriPairColumns.KEY,
|
||||
SliceUriPairColumns.SLICE_URI
|
||||
};
|
||||
|
||||
@@ -77,6 +77,7 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
|
||||
private static final int MATCH_NON_INDEXABLE_KEYS_CODE = 3;
|
||||
private static final int MATCH_SITE_MAP_PAIRS_CODE = 4;
|
||||
private static final int MATCH_SLICE_URI_PAIRS_CODE = 5;
|
||||
private static final int MATCH_DYNAMIC_RAW_CODE = 6;
|
||||
|
||||
/**
|
||||
* Implementation is provided by the parent class.
|
||||
@@ -96,6 +97,8 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
|
||||
MATCH_SITE_MAP_PAIRS_CODE);
|
||||
mMatcher.addURI(mAuthority, SearchIndexablesContract.SLICE_URI_PAIRS_PATH,
|
||||
MATCH_SLICE_URI_PAIRS_CODE);
|
||||
mMatcher.addURI(mAuthority, SearchIndexablesContract.DYNAMIC_INDEXABLES_RAW_PATH,
|
||||
MATCH_DYNAMIC_RAW_CODE);
|
||||
|
||||
// Sanity check our setup
|
||||
if (!info.exported) {
|
||||
@@ -126,6 +129,8 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
|
||||
return querySiteMapPairs();
|
||||
case MATCH_SLICE_URI_PAIRS_CODE:
|
||||
return querySliceUriPairs();
|
||||
case MATCH_DYNAMIC_RAW_CODE:
|
||||
return queryDynamicRawData(null);
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unknown Uri " + uri);
|
||||
}
|
||||
@@ -191,12 +196,30 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all {@link android.provider.SearchIndexablesContract.RawData}.
|
||||
*
|
||||
* Those are the dynamic raw indexable data.
|
||||
*
|
||||
* @param projection list of {@link android.provider.SearchIndexablesContract.RawData} columns
|
||||
* to put into the cursor. If {@code null} all supported columns should be
|
||||
* included.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@Nullable
|
||||
public Cursor queryDynamicRawData(String[] projection) {
|
||||
// By default no-op;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(Uri uri) {
|
||||
switch (mMatcher.match(uri)) {
|
||||
case MATCH_RES_CODE:
|
||||
return SearchIndexablesContract.XmlResource.MIME_TYPE;
|
||||
case MATCH_RAW_CODE:
|
||||
case MATCH_DYNAMIC_RAW_CODE:
|
||||
return SearchIndexablesContract.RawData.MIME_TYPE;
|
||||
case MATCH_NON_INDEXABLE_KEYS_CODE:
|
||||
return SearchIndexablesContract.NonIndexableKey.MIME_TYPE;
|
||||
|
||||
Reference in New Issue
Block a user