diff options
author | yuanjiahsu <yuanjiahsu@google.com> | 2019-02-23 02:06:03 +0800 |
---|---|---|
committer | yuanjiahsu <yuanjiahsu@google.com> | 2019-02-26 09:07:01 +0800 |
commit | c3430b155f31889036f559c1eb08c58ad572020b (patch) | |
tree | e57829cff7332988bff16ca0d84dc0840319c3c2 | |
parent | 30360747f79da192b810040df4e97119d3bf0aee (diff) | |
download | EmergencyInfo-c3430b155f31889036f559c1eb08c58ad572020b.tar.gz |
Enable searchable by config and feature flag
For searchable index feature in Settings, add config to enable or
disable it. Feature flag also applied for droidfood.
Test: Manually
Bug: 124429637
Change-Id: I1c8bbefb87f0bdfd5a65eb1c1f87cfa2cd75e5bb
-rw-r--r-- | res/values/config.xml | 2 | ||||
-rw-r--r-- | src/com/android/emergency/EmergencySearchIndexablesProvider.java | 12 |
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; } } |