summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanjia Hsu <yuanjiahsu@google.com>2019-02-26 10:30:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-02-26 10:30:35 +0000
commita8d19611953850a576e360e52a136a11e6fcfa63 (patch)
tree872fce39f540b1f879659117c789e5566dfc1609
parenta9b5091576f8d0e97bf807a52f2f32d10a770a1e (diff)
parentc3430b155f31889036f559c1eb08c58ad572020b (diff)
downloadEmergencyInfo-a8d19611953850a576e360e52a136a11e6fcfa63.tar.gz
Merge "Enable searchable by config and feature flag"
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/emergency/EmergencySearchIndexablesProvider.java12
2 files changed, 10 insertions, 4 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index 54792d2b..6a4cde6b 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -18,4 +18,6 @@
<!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. -->
<string name="config_featureFactory" translatable="false">com.android.emergency.overlay.FeatureFactoryImpl</string>
+ <!-- Flag to enable search index feature in Settings. -->
+ <bool name="config_search_index_disabled">false</bool>
</resources>
diff --git a/src/com/android/emergency/EmergencySearchIndexablesProvider.java b/src/com/android/emergency/EmergencySearchIndexablesProvider.java
index 28ce01b4..92dfb8dd 100644
--- a/src/com/android/emergency/EmergencySearchIndexablesProvider.java
+++ b/src/com/android/emergency/EmergencySearchIndexablesProvider.java
@@ -21,6 +21,7 @@ import android.database.MatrixCursor;
import android.provider.SearchIndexablesContract.XmlResource;
import android.provider.SearchIndexableResource;
import android.provider.SearchIndexablesProvider;
+import android.util.FeatureFlagUtils;
import com.android.emergency.edit.EditInfoActivity;
import com.android.emergency.edit.EditMedicalInfoActivity;
@@ -50,6 +51,11 @@ public class EmergencySearchIndexablesProvider extends SearchIndexablesProvider
@Override
public Cursor queryXmlResources(String[] projection) {
+ if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlagUtils.SAFETY_HUB)
+ && getContext().getResources().getBoolean(R.bool.config_search_index_disabled)) {
+ return null;
+ }
+
MatrixCursor cursor = new MatrixCursor(INDEXABLES_XML_RES_COLUMNS);
for (int i = 0, length = INDEXABLE_RES.length; i < length; i++) {
cursor.newRow()
@@ -66,13 +72,11 @@ public class EmergencySearchIndexablesProvider extends SearchIndexablesProvider
@Override
public Cursor queryRawData(String[] projection) {
- MatrixCursor cursor = new MatrixCursor(INDEXABLES_RAW_COLUMNS);
- return cursor;
+ return null;
}
@Override
public Cursor queryNonIndexableKeys(String[] projection) {
- MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
- return cursor;
+ return null;
}
}