Add keywords to Slices

Attach the keywords used for Settings search to Slices.
Their primary use is helping match synonyms for presenters
which display slices without explicit Uri requests, like a launcher.

This changes:
- Updates database scheme
- Adds to SliceData object
- Grab keywords in the SliceDataConverter
- Set keywords on all slices

Test: robotests
Change-Id: I16c40d2380ffddaf0a87fb1b9cd58e95573b308f
Fixes: 78306195
This commit is contained in:
Matthew Fritze
2018-04-19 14:50:55 -07:00
parent 3bdd65e255
commit 47a44e8fa4
17 changed files with 130 additions and 18 deletions

View File

@@ -22,6 +22,7 @@ import android.text.TextUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
* Data class representing a slice stored by {@link SlicesIndexer}.
@@ -59,6 +60,8 @@ public class SliceData {
private final CharSequence mScreenTitle;
private final String mKeywords;
private final int mIconResource;
private final String mFragmentClassName;
@@ -88,6 +91,10 @@ public class SliceData {
return mScreenTitle;
}
public String getKeywords() {
return mKeywords;
}
public int getIconResource() {
return mIconResource;
}
@@ -117,6 +124,7 @@ public class SliceData {
mTitle = builder.mTitle;
mSummary = builder.mSummary;
mScreenTitle = builder.mScreenTitle;
mKeywords = builder.mKeywords;
mIconResource = builder.mIconResource;
mFragmentClassName = builder.mFragmentClassName;
mUri = builder.mUri;
@@ -148,6 +156,8 @@ public class SliceData {
private CharSequence mScreenTitle;
private String mKeywords;
private int mIconResource;
private String mFragmentClassName;
@@ -180,6 +190,11 @@ public class SliceData {
return this;
}
public Builder setKeywords(String keywords) {
mKeywords = keywords;
return this;
}
public Builder setIcon(int iconResource) {
mIconResource = iconResource;
return this;